X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fcounting.qh;h=f464cdc32c5b8dce7efa1c7de08ce2ad78deaf79;hb=ad415a3b4e5ec559b143c81080dd705875533449;hp=1413a80902d1fb338abed1881ea942c2929bf608;hpb=a6a3b0cebd6928e3678ee4e97de4093f1b61c58b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/counting.qh b/qcsrc/common/counting.qh index 1413a8090..f464cdc32 100644 --- a/qcsrc/common/counting.qh +++ b/qcsrc/common/counting.qh @@ -1,3 +1,8 @@ +#ifndef COUNTING_H +#define COUNTING_H + +#include "util.qh" + // =============================================== // Time processing and counting functions/macros // =============================================== @@ -51,7 +56,7 @@ ZCTX(_("CI_THI^%d seconds")), /* third */ \ ZCTX(_("CI_MUL^%d seconds"))) /* multi */ -string count_ordinal(float interval) +string count_ordinal(int interval) { // This function is designed primarily for the English language, it's impossible // to accomodate all languages unless we do a specific function for each one... @@ -60,10 +65,10 @@ string count_ordinal(float interval) // Basically, it just allows you to represent a number or count in different ways // depending on the number... like, with count_ordinal you can provide integers // and retrieve 1st, 2nd, 3rd, nth ordinal numbers in a clean and simple way. - if(floor((mod(interval, 100))/10) * 10 != 10) // examples: 12th, 111th, 213th will not execute this block + if(floor((interval % 100)/10) * 10 != 10) // examples: 12th, 111th, 213th will not execute this block { // otherwise, check normally for 1st,2nd,3rd insertions - switch(mod(interval, 10)) + switch(interval % 10) { case 1: return sprintf(_("%dst"), interval); case 2: return sprintf(_("%dnd"), interval); @@ -215,3 +220,4 @@ string process_time(float outputtype, float seconds) } return ""; } +#endif