]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/counting.qh
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / counting.qh
index b38ba9d05a9313f670f8fa8bdeede09c565ebf2c..9c92aeb2210bce07913803a514d3c5961b1bbf95 100644 (file)
@@ -71,18 +71,15 @@ string count_ordinal(int 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((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 (interval % 10)
-               {
+               switch (interval % 10) {
                        case 1: return sprintf(_("%dst"), interval);
                        case 2: return sprintf(_("%dnd"), interval);
                        case 3: return sprintf(_("%drd"), interval);
                        default: return sprintf(_("%dth"), interval);
                }
-       }
-       else { return sprintf(_("%dth"), interval); }
+       } else { return sprintf(_("%dth"), interval); }
 
        return "";
 }
@@ -102,14 +99,13 @@ string count_fill(float interval, string zeroth, string first, string second, st
        //   3 seconds
        //   etc... minutes, hours, days, etc.
 
-       switch (floor(interval))
-       {
+       switch (floor(interval)) {
                case 0: return sprintf(CTX(zeroth), interval);
                case 1:
                {
-                       if (interval == 1)  // EXACTLY value of 1
+                       if (interval == 1) { // EXACTLY value of 1
                                return sprintf(CTX(first), interval);
-                       else return sprintf(CTX(multi), interval);
+                       } else { return sprintf(CTX(multi), interval); }
                }
                case 2: return sprintf(CTX(second), interval);
                case 3: return sprintf(CTX(third), interval);
@@ -126,27 +122,22 @@ string process_time(float outputtype, float seconds)
 
        tmp_seconds = floor(seconds);
 
-       if (tmp_seconds)
-       {
+       if (tmp_seconds) {
                tmp_minutes = floor(tmp_seconds / 60);
 
-               if (tmp_minutes)
-               {
+               if (tmp_minutes) {
                        tmp_seconds -= (tmp_minutes * 60);
                        tmp_hours = floor(tmp_minutes / 60);
 
-                       if (tmp_hours)
-                       {
+                       if (tmp_hours) {
                                tmp_minutes -= (tmp_hours * 60);
                                tmp_days = floor(tmp_hours / 24);
 
-                               if (tmp_days)
-                               {
+                               if (tmp_days) {
                                        tmp_hours -= (tmp_days * 24);
                                        tmp_weeks = floor(tmp_days / 7);
 
-                                       if (tmp_weeks)
-                                       {
+                                       if (tmp_weeks) {
                                                tmp_days -= (tmp_weeks * 7);
                                                tmp_years = floor(tmp_weeks / 52);
                                        }
@@ -155,8 +146,7 @@ string process_time(float outputtype, float seconds)
                }
        }
 
-       switch (outputtype)
-       {
+       switch (outputtype) {
                case 1: return sprintf("%02d:%02d:%02d", tmp_hours, tmp_minutes, tmp_seconds);
                case 2:
                {
@@ -164,36 +154,31 @@ string process_time(float outputtype, float seconds)
 
                        output = count_seconds(tmp_seconds);
 
-                       if (tmp_minutes)
-                       {
+                       if (tmp_minutes) {
                                output = strcat(
                                        count_minutes(tmp_minutes),
                                        ((output != "") ? strcat(", ", output) : ""));
                        }
 
-                       if (tmp_hours)
-                       {
+                       if (tmp_hours) {
                                output = strcat(
                                        count_hours(tmp_hours),
                                        ((output != "") ? strcat(", ", output) : ""));
                        }
 
-                       if (tmp_days)
-                       {
+                       if (tmp_days) {
                                output = strcat(
                                        count_days(tmp_days),
                                        ((output != "") ? strcat(", ", output) : ""));
                        }
 
-                       if (tmp_weeks)
-                       {
+                       if (tmp_weeks) {
                                output = strcat(
                                        count_weeks(tmp_weeks),
                                        ((output != "") ? strcat(", ", output) : ""));
                        }
 
-                       if (tmp_years)
-                       {
+                       if (tmp_years) {
                                output = strcat(
                                        count_years(tmp_years),
                                        ((output != "") ? strcat(", ", output) : ""));
@@ -207,10 +192,9 @@ string process_time(float outputtype, float seconds)
 
                        output = count_hours(tmp_hours);
 
-                       if (tmp_weeks) tmp_days += (tmp_weeks * 7);
-                       if (tmp_years) tmp_days += (tmp_years * 365);
-                       if (tmp_days)
-                       {
+                       if (tmp_weeks) { tmp_days += (tmp_weeks * 7); }
+                       if (tmp_years) { tmp_days += (tmp_years * 365); }
+                       if (tmp_days) {
                                output = sprintf(
                                        count_days(tmp_days),
                                        ((output != "") ? strcat(", ", output) : ""));