]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up map vote mask writing to use the BIT macro instead of multiplying a local...
authorMario <mario@smbclan.net>
Sat, 24 Dec 2016 06:59:20 +0000 (16:59 +1000)
committerMario <mario@smbclan.net>
Sat, 24 Dec 2016 06:59:20 +0000 (16:59 +1000)
qcsrc/server/mapvoting.qc

index 2ea425692c1d5ead09c22889c91237190e8f1321..b5a6014462ea141adf7379172adf8fb9a853cd2c 100644 (file)
@@ -270,14 +270,14 @@ void MapVote_SendPicture(entity to, int id)
 
 void MapVote_WriteMask()
 {
-       float i;
        if ( mapvote_count < 24 )
        {
-               float mask,power;
-               mask = 0;
-               for(i = 0, power = 1; i < mapvote_count; ++i, power *= 2)
-                       if(mapvote_maps_flags[i] & GTV_AVAILABLE )
-                               mask |= power;
+               int mask = 0;
+               for(int j = 0; j < mapvote_count; ++j)
+               {
+                       if(mapvote_maps_flags[j] & GTV_AVAILABLE)
+                               mask |= BIT(j);
+               }
 
                if(mapvote_count < 8)
                        WriteByte(MSG_ENTITY, mask);
@@ -288,8 +288,8 @@ void MapVote_WriteMask()
        }
        else
        {
-               for ( i = 0; i < mapvote_count; ++i )
-                       WriteByte(MSG_ENTITY, mapvote_maps_flags[i]);
+               for (int j = 0; j < mapvote_count; ++j)
+                       WriteByte(MSG_ENTITY, mapvote_maps_flags[j]);
        }
 }