]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove for-loop workaround
authorTimePath <andrew.hardaker1995@gmail.com>
Fri, 30 Jan 2015 05:09:41 +0000 (16:09 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Fri, 30 Jan 2015 05:09:41 +0000 (16:09 +1100)
25 files changed:
qcsrc/client/bgmscript.qc
qcsrc/client/hud.qc
qcsrc/client/sortlist.qc
qcsrc/client/view.qc
qcsrc/common/mapinfo.qc
qcsrc/common/notifications.qc
qcsrc/common/util.qc
qcsrc/menu/item/listbox.qc
qcsrc/menu/xonotic/colorpicker.qc
qcsrc/server/bot/havocbot/role_onslaught.qc
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/scripting.qc
qcsrc/server/bot/waypoints.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_subs.qc
qcsrc/server/g_tetris.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_assault.qc
qcsrc/server/mutators/sandbox.qc
qcsrc/server/scores.qc
qcsrc/server/weapons/tracing.qc
qcsrc/warpzonelib/common.qc
qcsrc/warpzonelib/server.qc

index fe6a1c14aa06f31426eceaec642f351bc058d69f..b567190caa666f165cfe49bea7a09ea6fd8b0d73 100644 (file)
@@ -206,7 +206,7 @@ float BGMScript(entity e)
        }
 
        // find the CURRENT line
-       for(0;;)
+       for (;;)
        {
                tokenize_console(bufstr_get(bgmscriptbuf, e.bgmscriptline));
                if(stof(argv(1)) >= bgmtime || argv(0) != e.bgmscript)
index 492b0d43505b1be1b4eae9cbc7a68eaf613486f6..e33b9b0203705e87c0895d687e609dec265492ba 100644 (file)
@@ -3779,7 +3779,7 @@ void HUD_InfoMessages(void)
                        tm = teams.sort_next;
                        if (tm)
                        {
-                               for(0; tm.sort_next; tm = tm.sort_next)
+                               for (; tm.sort_next; tm = tm.sort_next)
                                {
                                        if(!tm.team_size || tm.team == NUM_SPECTATOR)
                                                continue;
index 7093ee07dacb206e860cb7848b13e8fffecdc71f..4d05d2c5ff21ace01c3beefc42e70e45287a6c05 100644 (file)
@@ -91,7 +91,7 @@ void Sort_Finish(entity sort)
 
 entity Sort_Get(entity sort, float i)
 {
-       for(0; sort.sort_next && i > 0; --i)
+       for (; sort.sort_next && i > 0; --i)
                sort = sort.sort_next;
        return sort;
 }
index da621ebff8a15d99fe1a08a9dad40d24ba8f9dc2..bc84c6e666b2f7a5acb67057428933ef13f9c3e1 100644 (file)
@@ -54,7 +54,7 @@ void Porto_Draw()
        portal_number = 0;
        nextdir = dir;
 
-       for(0;;)
+       for (;;)
        {
                dir = nextdir;
                traceline(p, p + 65536 * dir, true, porto);
index 43e81cbf9cc57698d9a893d1d6f2f1916485829b..366f35ed6eddde8c36e5fb5d23b009d5a5897c0f 100644 (file)
@@ -272,7 +272,7 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp
        mapMins = '0 0 0';
        mapMaxs = '0 0 0';
 
-       for(0;;)
+       for (;;)
        {
                if (!((s = fgets(fh))))
                        break;
@@ -806,7 +806,7 @@ void _MapInfo_Parse_Settemp(string pFilename, string acl, float type, string s,
                                print("Map ", pFilename, " references not existing config file ", s, "\n");
                        else
                        {
-                               for(0;;)
+                               for (;;)
                                {
                                        if (!((s = fgets(fh))))
                                                break;
@@ -949,7 +949,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                        {
                                n = tokenize_console(cvar_string("g_cdtracks_remaplist"));
                                s = strcat(" ", cvar_string("g_cdtracks_dontusebydefault"), " ");
-                               for(0;;)
+                               for (;;)
                                {
                                        i = floor(random() * n);
                                        if(strstrofs(s, strcat(" ", argv(i), " "), 0) < 0)
@@ -997,7 +997,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
        }
 
        _MapInfo_Map_Reset();
-       for(0;;)
+       for (;;)
        {
                if (!((s = fgets(fh))))
                        break;
index 356039bb642f383df08514304bfaec2827cebc84..9e98c61d53fda48288b7556d0d5419b9ecd17160 100644 (file)
@@ -322,7 +322,7 @@ string Process_Notif_Args(
        string selected, remaining = args;
        float sel_num = 0;
 
-       for(0;(remaining != "");)
+       for (;(remaining != "");)
        {
                selected = car(remaining); remaining = cdr(remaining);
 
index 1bbf648a6424b1375606a5afd18fe6f53fe2a294..64813f2f4506063f3e188aa315dd31f0b26b5db3 100644 (file)
@@ -2556,7 +2556,7 @@ void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t
        queue_end.FindConnectedComponent_processing = 1;
 
        // for each queued item:
-       for(0; queue_start; queue_start = queue_start.fld)
+       for (; queue_start; queue_start = queue_start.fld)
        {
                // find all neighbors of queue_start
                entity t;
index 5eb945e39e7bc53d864a16bb659665ea4b5df353..2f2979509e37d6df91b3d4129bb24da44f9ba767 100644 (file)
@@ -131,7 +131,7 @@ float ListBox_keyDown(entity me, float key, float ascii, float shift)
        {
                float i = me.selectedItem;
                float a = me.getItemHeight(me, i);
-               for(0;;)
+               for (;;)
                {
                        --i;
                        if (i < 0)
@@ -146,7 +146,7 @@ float ListBox_keyDown(entity me, float key, float ascii, float shift)
        {
                float i = me.selectedItem;
                float a = me.getItemHeight(me, i);
-               for(0;;)
+               for (;;)
                {
                        ++i;
                        if (i >= me.nItems)
@@ -369,7 +369,7 @@ void ListBox_draw(entity me)
        float y;
        i = me.getItemAtPos(me, me.scrollPos);
        y = me.getItemStart(me, i) - me.scrollPos;
-       for(0; i < me.nItems && y < 1; ++i)
+       for (; i < me.nItems && y < 1; ++i)
        {
                draw_shift = boxToGlobal(eY * y, oldshift, oldscale);
                vector relSize = eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, i);
index 36d779744853bff1bc68c3bdd9ba18808386cfe3..6634728f30103573984c3f44ae7c36af3126fec1 100644 (file)
@@ -73,7 +73,7 @@ vector color_hslimage(vector v, vector margin)
 float XonoticColorpicker_mouseDrag(entity me, vector coords)
 {
        float i, carets;
-       for(0;;)
+       for (;;)
        {
                i = me.controlledTextbox.cursorPos;
                if(i >= 2)
index 55da31783be7fa342b89976d337343fd8acd1682..119ea83c81b77c90b659518bf03a601d49f2f360 100644 (file)
@@ -118,7 +118,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
        cp1 = cp2 = findchain(classname, "onslaught_controlpoint");
 
        // Filter control points
-       for(0; cp2; cp2 = cp2.chain)
+       for (; cp2; cp2 = cp2.chain)
        {
                cp2.wpcost = c = 0;
                cp2.wpconsidered = false;
@@ -154,7 +154,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
        // We'll consider only the best case
        bestvalue = 99999999999;
        cp = world;
-       for(0; cp1; cp1 = cp1.chain)
+       for (; cp1; cp1 = cp1.chain)
        {
                if (!cp1.wpconsidered)
                        continue;
index e1c66797269fa0b2cda0dc65b570173903de9a36..d80f8336c8ba179bd52e862bc2807181d92efebc 100644 (file)
@@ -64,7 +64,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
        // Movement loop
        yaw = vectoyaw(move);
        move = end - org;
-       for(0;;)
+       for (;;)
        {
                if (boxesoverlap(end, end, org + m1 + '-1 -1 -1', org + m2 + '1 1 1'))
                {
@@ -108,7 +108,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                        {
                                swimming = true;
                                org = trace_endpos - normalize(org - trace_endpos) * stepdist;
-                               for(0; org.z < end.z + self.maxs.z; org.z += stepdist)
+                               for (; org.z < end.z + self.maxs.z; org.z += stepdist)
                                {
                                                if(autocvar_bot_debug_tracewalk)
                                                        debugnode(org);
@@ -880,7 +880,7 @@ float navigation_routetogoal(entity e, vector startposition)
        if(e == world)
                return false;
 
-       for(0;;)
+       for (;;)
        {
                // add the spawnfunc_waypoint to the path
                navigation_pushroute(e);
index 16a015c8df25c7b45436418579631a62aaa06a62..ead8ceac9ec5c3adba637e35df67207f6abc6391 100644 (file)
@@ -39,7 +39,7 @@ void bot_queuecommand(entity bot, string cmdstring)
                        if(cmdstr == "sound")
                        {
                                // find the LAST word
-                               for(0;;)
+                               for (;;)
                                {
                                        sp = strstrofs(parm, " ", 0);
                                        if(sp < 0)
index 3ce236c220b02f3e739ee45c88f352bb6251aaf1..23e7af3f9242061e5ffeadd5a0d0d924c569052d 100644 (file)
@@ -985,7 +985,7 @@ float botframe_autowaypoints_fix_from(entity p, float walkfromwp, entity wp, .en
 
        tmin = 0;
        tmax = 1;
-       for(0;;)
+       for (;;)
        {
                if(tmax - tmin < 0.001)
                {
index 3825e655352ff70b3f56b323b642316f14ada2e7..7166ab7cfd1156b9377724ac6f2586e591f24872 100644 (file)
@@ -108,7 +108,7 @@ void GameCommand_adminmsg(float request, float argc)
 
                        if((targets) && (admin_message))
                        {
-                               for(0;targets;)
+                               for (;targets;)
                                {
                                        t = car(targets); targets = cdr(targets);
 
@@ -1047,7 +1047,7 @@ void GameCommand_moveplayer(float request, float argc)
                        // lets see if the target(s) even actually exist.
                        if((targets) && (destination))
                        {
-                               for(0;targets;)
+                               for (;targets;)
                                {
                                        t = car(targets); targets = cdr(targets);
 
@@ -1400,7 +1400,7 @@ void GameCommand_shuffleteams(float request)
                                // build a list of the players in a random order
                                FOR_EACH_PLAYER(tmp_player)
                                {
-                                       for(0;;)
+                                       for (;;)
                                        {
                                                i = bound(1, floor(random() * maxclients) + 1, maxclients);
 
@@ -1542,7 +1542,7 @@ void GameCommand_trace(float request, float argc)
                                        float hitcount = 0;
                                        print("TEST CASE. If this returns the runaway loop counter error, possibly everything is oaky.\n");
                                        float worst_endpos_bug = 0;
-                                       for(0;;)
+                                       for (;;)
                                        {
                                                org = world.mins;
                                                delta = world.maxs - world.mins;
@@ -1571,7 +1571,7 @@ void GameCommand_trace(float request, float argc)
                                                                // how much do we need to back off?
                                                                safe = 1;
                                                                unsafe = 0;
-                                                               for(0;;)
+                                                               for (;;)
                                                                {
                                                                        pos = p * (1 - (safe + unsafe) * 0.5) + start * ((safe + unsafe) * 0.5);
                                                                        tracebox(pos, PL_MIN, PL_MAX, pos, MOVE_NOMONSTERS, world);
@@ -1605,7 +1605,7 @@ void GameCommand_trace(float request, float argc)
                                                                q0 = p;
                                                                dq = 0;
                                                                dqf = 1;
-                                                               for(0;;)
+                                                               for (;;)
                                                                {
                                                                        q = p + normalize(end - p) * (dq + dqf);
                                                                        if(q == q0)
index a0b3fec6eee05328edec934346d6a961516f76be..4238f2828e267ca9614f2f46754196735dab6eb5 100644 (file)
@@ -637,7 +637,7 @@ float VoteCommand_checkargs(float startpos, float argc)
 
        p = strstrofs(cmdrestriction, ";", 0); // find first semicolon
 
-       for(0;;)
+       for (;;)
        {
                // we know that at any time, startpos <= argc - minargs
                // so this means: argc-minargs >= startpos >= argc, thus
index a7cedc80710fe6710955647e3bd486dff2ffd944..74a8cf7f96126135f1ec45074a86d9d0036e3201 100644 (file)
@@ -543,7 +543,7 @@ float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomon
        float c;
        c = 0;
 
-       for(0;;)
+       for (;;)
        {
                if(pos * dir >= v2 * dir)
                {
index bbfd2fbc6a3305f1a5f47a00259f2bc76eda9afa..63e498bfc36075512a8d0f0581e44d8d0f9dd3c4 100644 (file)
@@ -901,7 +901,7 @@ void CompletedLines()
 
        cleared = 0;
        y = TET_LINES;
-       for(0;;)
+       for (;;)
        {
                ln = GetLine(y);
                if(strstrofs(ln, "0", 0) < 0)
index 65d43baa2ac32d86d0571ad04581a95cd0d90e8a..0a2708340dd007993e0e4f409615a3748c14276a 100644 (file)
@@ -476,7 +476,7 @@ void detect_maptype()
        vector o, v;
        float i;
 
-       for(0;;)
+       for (;;)
        {
                o = world.mins;
                o.x += random() * (world.maxs.x - world.mins.x);
index 7196b94f0a9184cc38093d7799e83aaf33411809..bcbae77ea28c12118856361e1d002abed85d8140 100644 (file)
@@ -522,7 +522,7 @@ vector randompos(vector m1, vector m2)
 float sound_allowed(float _dest, entity e)
 {
     // sounds from world may always pass
-    for(0;;)
+    for (;;)
     {
         if (e.classname == "body")
             e = e.enemy;
@@ -944,7 +944,7 @@ void InitializeEntity(entity e, void(void) func, float order)
 
     cur = initialize_entity_first;
     prev = world;
-    for(0;;)
+    for (;;)
     {
         if (!cur || cur.initialize_entity_order > order)
         {
index b64219ddf3261958c0f8b6f5b9f9eb3361c5ea6a..49deac0e8f350c1f73cfea58694a21ac7927af5b 100644 (file)
@@ -338,7 +338,7 @@ void havocbot_goalrating_ast_targets(float ratingscale)
 
        ad = findchain(classname, "func_assault_destructible");
 
-       for(0; ad; ad = ad.chain)
+       for (; ad; ad = ad.chain)
        {
                if (ad.target == "")
                        continue;
index 776ba42e7c120eaa8ae25fb8ddfa7241299bfc03..f66b5019a603b06402290bd58adaf82d12d87563 100644 (file)
@@ -393,7 +393,7 @@ void sandbox_Database_Load()
        }
        else
        {
-               for(0;;)
+               for (;;)
                {
                        file_read = fgets(file_get);
                        if(file_read == "")
index 0b5d0ee8c7b4d14429b8bffae9526dc2f9dfef25..8f9da8b061d581bf609d34c3cf4c9ae84f877ede 100644 (file)
@@ -835,7 +835,7 @@ void Score_NicePrint_Player(entity to, entity p, float w)
        sk = p.scorekeeper;
 
        s = strcat(s, p.netname);
-       for(0;;)
+       for (;;)
        {
                i = strlennocol(s) - NAMEWIDTH;
                if(i > 0)
index 3085af1205e389b7d2cf98073e99388745b69bcb..c3532d3d67a4cf29bde6541827acb005189ca8f0 100644 (file)
@@ -378,7 +378,7 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
 
        WarpZone_trace_forent = self;
 
-       for(0;;)
+       for (;;)
        {
                // TODO also show effect while tracing
                WarpZone_TraceBox_ThroughZone(start, '0 0 0', '0 0 0', end, false, WarpZone_trace_forent, world, fireBullet_trace_callback);
index c36ca5c62de709f5950e1ebb3d2839453fac7d5f..aa0de911963a9bc700e6aa3167b2181633d7b7b6 100644 (file)
@@ -272,7 +272,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
        sol = -1;
        frac = 0;
        i = 16;
-       for(0;;)
+       for (;;)
        {
                if(--i < 1)
                {
@@ -395,7 +395,7 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
        }
        WarpZone_MakeAllSolid();
        i = 16;
-       for(0;;)
+       for (;;)
        {
                if(--i < 1)
                {
index 090db021b317fae3bd9938665c453322761872f6..5d529c12e215ab78c66f85c48d7c79a8f3800147 100644 (file)
@@ -847,7 +847,7 @@ void WarpZone_StartFrame()
                if(IS_NOT_A_CLIENT(e))
                {
                        if(warpzone_warpzones_exist)
-                               for(0; (e = nextent(e)); )
+                               for (; (e = nextent(e)); )
                                        WarpZone_StoreProjectileData(e);
                        break;
                }