From 4bd54b865109cbd11eed5186aefaccaddf0ffbab Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 1 Dec 2018 20:25:47 +0100 Subject: [PATCH] Reduce code of 2 macros --- qcsrc/common/mapobjects/teleporters.qh | 16 +++++----------- qcsrc/server/cheats.qc | 3 +-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/qcsrc/common/mapobjects/teleporters.qh b/qcsrc/common/mapobjects/teleporters.qh index 68c5114f4..f72f943d3 100644 --- a/qcsrc/common/mapobjects/teleporters.qh +++ b/qcsrc/common/mapobjects/teleporters.qh @@ -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; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 5ca5270d6..c22737ed0 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -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) \ -- 2.39.2