]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/counting.qh
Replace usages of mod() with the operator %
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / counting.qh
index 2559bf3acd9ff8e822163d961f61c3e8fbd81d3b..0aeabc85e7b092e9800199fd2672c9b475a0a088 100644 (file)
@@ -60,10 +60,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);
@@ -192,6 +192,24 @@ string process_time(float outputtype, float seconds)
                                        ((output != "") ? sprintf(", %s", output) : ""));
                        }
 
+                       return output;
+               }
+               case 3:
+               {
+                       string output = "";
+
+                       output = count_hours(tmp_hours);
+
+                       if(tmp_weeks) { tmp_days += (tmp_weeks * 7); }
+                       if(tmp_years) { tmp_days += (tmp_years * 365); }
+                       if(tmp_days)
+                       {
+                               output = sprintf(
+                                       "%s%s",
+                                       count_days(tmp_days),
+                                       ((output != "") ? sprintf(", %s", output) : ""));
+                       }
+
                        return output;
                }
        }