]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reduce code of 2 macros
authorterencehill <piuntn@gmail.com>
Sat, 1 Dec 2018 19:25:47 +0000 (20:25 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 1 Dec 2018 19:25:47 +0000 (20:25 +0100)
qcsrc/common/mapobjects/teleporters.qh
qcsrc/server/cheats.qc

index 68c5114f4d5bbf06d398f27b32584551737e42a8..f72f943d3612012c9c6bde5c9ecdc1507ee73c48 100644 (file)
@@ -34,12 +34,8 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
 void trigger_teleport_use(entity this, entity actor, entity trigger);
 
 #define TDEATHLOOP(o) \
-       entity head; \
-       vector deathmin; \
-       vector deathmax; \
-       float deathradius; \
-       deathmin = (o) + player.mins; \
-       deathmax = (o) + player.maxs; \
+       vector deathmin = (o) + player.mins; \
+       vector deathmax = (o) + player.maxs; \
        if(telefragmin != telefragmax) \
        { \
                if(deathmin.x > telefragmin.x) deathmin.x = telefragmin.x; \
@@ -49,11 +45,9 @@ void trigger_teleport_use(entity this, entity actor, entity trigger);
                if(deathmax.y < telefragmax.y) deathmax.y = telefragmax.y; \
                if(deathmax.z < telefragmax.z) deathmax.z = telefragmax.z; \
        } \
-       deathradius = max(vlen(deathmin), vlen(deathmax)); \
-       for(head = findradius(o, deathradius); head; head = head.chain) \
-               if(head != player) \
-                       if(head.takedamage) \
-                               if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
+       float deathradius = max(vlen(deathmin), vlen(deathmax)); \
+       for (entity head = findradius(o, deathradius); head; head = head.chain) \
+               if (head != player && head.takedamage && boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
 
 float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax);
 float tdeath_hit;
index 5ca5270d614dda0b5212a827c5fa5922162e8f51..c22737ed0d2d2b5d02bd9595740dca3b322cab80 100644 (file)
@@ -95,8 +95,7 @@ float CheatsAllowed(entity this, float i, int argc, float fr) // the cheat gets
 }
 
 #define BEGIN_CHEAT_FUNCTION() \
-       float cheating, attempting; \
-       cheating = 0; attempting = 0
+       float cheating = 0, attempting = 0
 #define DID_CHEAT() \
        ++cheating
 #define ADD_CHEATS(e,n) \