]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Create separate file for deathtype declarations, move common macros to
authorSamual Lenks <samual@xonotic.org>
Thu, 27 Sep 2012 22:01:14 +0000 (18:01 -0400)
committerSamual Lenks <samual@xonotic.org>
Thu, 27 Sep 2012 22:01:14 +0000 (18:01 -0400)
util.qh

qcsrc/client/progs.src
qcsrc/common/constants.qh
qcsrc/common/deathtypes.qh [new file with mode: 0644]
qcsrc/common/notifications.qc
qcsrc/common/util.qh
qcsrc/menu/progs.src
qcsrc/server/progs.src

index 8fc2b9b73d82df18f37024d4a63edd7207e5ace6..4e7aca7f63f8ca417d88dd931fc0f75e8eb0ecd9 100644 (file)
@@ -16,6 +16,7 @@ Defs.qc
 
 ../common/util.qh
 ../common/items.qh
+../common/deathtypes.qh
 ../common/explosion_equation.qh
 ../common/mapinfo.qh
 ../common/command/markup.qh
index 6359d622275ff747006c9517bd297d15da76b1c8..265b992b1e639334d43b2bc05fc33aa70760e8c9 100644 (file)
@@ -363,111 +363,6 @@ float SPECIES_ROBOT_RUSTY  =  4;
 float SPECIES_ROBOT_SHINY  =  5;
 float SPECIES_RESERVED     = 15;
 
-// Deathtypes (weapon deathtypes are the IT_* constants below)
-// NOTE: when adding death types, please add an explanation to Docs/spamlog.txt too.
-#define VAR_TO_TEXT2(var) #var
-#define CHECK_FIRST_OR_LAST(input,first,count) if(input) { input = (first + count); }
-#define CHECK_FIELD_COUNT(field,first,count) if(!field) { field = (first + count); ++count; }
-#define CHECK_MAX_DEATHTYPES(name,count) if(count == DT_MAX) { error(strcat("Maximum deathtypes hit: ", VAR_TO_TEXT2(name), ": ", ftos(count), ".\n")); }
-
-#define DT_FIRST 10000
-#define DT_MAX 1024 // limit of recursive functions with ACCUMULATE_FUNCTION
-float DT_COUNT;
-
-float DEATH_VHFIRST = DT_FIRST;
-float DEATH_VHLAST = DT_FIRST;
-
-#define DEATHTYPE(name,type,notification,first,last) \
-       float name; \
-       float first; \
-       float last; \
-       void DecDeathtype_##name() \
-       { \
-               CHECK_FIRST_OR_LAST(first, DT_FIRST, DT_COUNT) \
-               CHECK_FIRST_OR_LAST(last, DT_FIRST, DT_COUNT) \
-               CHECK_FIELD_COUNT(name, DT_FIRST, DT_COUNT) \
-               CHECK_MAX_DEATHTYPES(name, DT_COUNT) \
-       }
-       //ACCUMULATE_FUNCTION(DecDeathtypes, DecDeathtype_##name)
-
-#define DEATHTYPES \
-       DEATHTYPE(DEATH_FALL, FALSE, FALSE, DEATH_SPECIAL_START, FALSE) \
-       DEATHTYPE(DEATH_TELEFRAG, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_DROWN, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_HURTTRIGGER, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_LAVA, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_SLIME, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_KILL, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_NOAMMO, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_SWAMP, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_TEAMCHANGE, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_AUTOTEAMCHANGE, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_CAMP, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_SHOOTING_STAR, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_ROT, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_MIRRORDAMAGE, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_TOUCHEXPLODE, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_CHEAT, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_FIRE, FALSE, FALSE, FALSE, FALSE) \
-       DEATHTYPE(DEATH_QUIET, FALSE, FALSE, FALSE, FALSE) \
-       #undef DEATHTYPE
-
-DEATHTYPES
-
-float  DEATH_VHCRUSH       = 10030;
-float  DEATH_SBMINIGUN     = 10031;
-float  DEATH_SBROCKET      = 10032;
-float  DEATH_SBBLOWUP      = 10033;
-float  DEATH_WAKIGUN       = 10034;
-float  DEATH_WAKIROCKET    = 10035;
-float  DEATH_WAKIBLOWUP    = 10036;
-float  DEATH_RAPTOR_CANNON = 10037;
-float  DEATH_RAPTOR_BOMB   = 10038;
-float  DEATH_RAPTOR_BOMB_SPLIT = 10039;
-float  DEATH_RAPTOR_DEATH   = 10040;
-float  DEATH_BUMB_GUN       = 10041;
-float  DEATH_BUMB_RAY       = 10042;
-float  DEATH_BUMB_RAY_HEAL  = 10043;
-float  DEATH_BUMB_DEATH     = 10044;
-#define DEATH_ISVEHICLE(t)  ((t) >= DEATH_VHFIRST && (t) <= DEATH_VHLAST)
-
-float DEATH_GENERIC = 10050;
-
-float DEATH_WEAPON = 10100;
-
-float DEATH_CUSTOM = 10300;
-
-float DEATH_TURRET                  = 10500;
-float DEATH_TURRET_EWHEEL           = 10501;
-float DEATH_TURRET_FLAC             = 10502;
-float DEATH_TURRET_MACHINEGUN       = 10503;
-float DEATH_TURRET_WALKER_GUN       = 10504;
-float DEATH_TURRET_WALKER_MEELE     = 10505;
-float DEATH_TURRET_WALKER_ROCKET    = 10506;
-float DEATH_TURRET_HELLION          = 10507;
-float DEATH_TURRET_HK               = 10508;
-float DEATH_TURRET_MLRS             = 10509;
-float DEATH_TURRET_PLASMA           = 10510;
-float DEATH_TURRET_PHASER           = 10511;
-float DEATH_TURRET_TESLA            = 10512;
-float DEATH_TURRET_LAST            = 10512;
-
-float DEATH_WEAPONMASK = 0xFF;
-float DEATH_HITTYPEMASK = 0x1F00; // which is WAY below 10000 used for normal deaths
-float HITTYPE_SECONDARY = 0x100;
-float HITTYPE_SPLASH = 0x200; // automatically set by RadiusDamage
-float HITTYPE_BOUNCE = 0x400;
-float HITTYPE_HEADSHOT = 0x800; // automatically set by Damage (if headshotbonus is set)
-float HITTYPE_RESERVED = 0x1000; // unused yet
-
-// macros to access these
-#define DEATH_ISTURRET(t)            ((t) >= DEATH_TURRET && (t) <= DEATH_TURRET_LAST)
-#define DEATH_ISSPECIAL(t)            ((t) >= DEATH_SPECIAL_START)
-#define DEATH_WEAPONOFWEAPONDEATH(t)  ((t) & DEATH_WEAPONMASK)
-#define DEATH_ISWEAPON(t,w)           (!DEATH_ISSPECIAL(t) && DEATH_WEAPONOFWEAPONDEATH(t) == (w))
-#define DEATH_WEAPONOF(t)             (DEATH_ISSPECIAL(t) ? 0 : DEATH_WEAPONOFWEAPONDEATH(t))
-#define WEP_VALID(w)                  ((w) >= WEP_FIRST && (w) <= WEP_LAST)
-
 #define FRAGS_PLAYER 0
 #define FRAGS_SPECTATOR -666
 #define FRAGS_LMS_LOSER -616
@@ -495,49 +390,6 @@ float CPID_MOTD = 9;
 float CPID_KH_MSG = 10;
 float CPID_PREVENT_JOIN = 11;
 
-// CSQC centerprint/notify message types
-float MSG_SUICIDE = 0;
-float MSG_KILL = 1;
-float MSG_SPREE = 2;
-float MSG_KILL_ACTION = 3;
-float MSG_KILL_ACTION_SPREE = 4;
-float MSG_INFO = 5;
-float MSG_KA = 6;
-float MSG_RACE = 10;
-
-float KILL_TEAM_RED = 12001;
-float KILL_TEAM_BLUE = 12002;
-float KILL_TEAM_SPREE = 12003;
-float KILL_FIRST_BLOOD = 12004;
-float KILL_FIRST_VICTIM = 12005;
-float KILL_TYPEFRAG = 12006;
-float KILL_TYPEFRAGGED = 12007;
-float KILL_FRAG = 12008;
-float KILL_FRAGGED = 12009;
-float KILL_SPREE = 12010;
-float KILL_END_SPREE = 12011;
-float KILL_SPREE_3 = 12012;
-float KILL_SPREE_5 = 12013;
-float KILL_SPREE_10 = 12014;
-float KILL_SPREE_15 = 12015;
-float KILL_SPREE_20 = 12016;
-float KILL_SPREE_25 = 12017;
-float KILL_SPREE_30 = 12018;
-
-float INFO_GOTFLAG = 13001;
-float INFO_PICKUPFLAG = 13002;
-float INFO_LOSTFLAG = 13003;
-float INFO_RETURNFLAG = 13004;
-float INFO_CAPTUREFLAG = 13005;
-
-float KA_PICKUPBALL = 14001;
-float KA_DROPBALL = 14002;
-
-float RACE_SERVER_RECORD = 15001;
-float RACE_NEW_TIME = 15002;
-float RACE_NEW_RANK = 15003;
-float RACE_FAIL = 15004;
-
 // weapon requests
 float WR_SETUP         = 1; // (SVQC) setup weapon data
 float WR_THINK         = 2; // (SVQC) logic to run every frame
diff --git a/qcsrc/common/deathtypes.qh b/qcsrc/common/deathtypes.qh
new file mode 100644 (file)
index 0000000..dc3f42f
--- /dev/null
@@ -0,0 +1,178 @@
+// Deathtypes (weapon deathtypes are the IT_* constants below)
+// NOTE: when adding death types, please add an explanation to Docs/spamlog.txt too.
+#define DT_FIRST 10000
+#define DT_MAX 1024 // limit of recursive functions with ACCUMULATE_FUNCTION
+float DT_COUNT;
+
+float DEATH_VHFIRST = DT_FIRST;
+float DEATH_VHLAST = DT_FIRST;
+
+#define DEATHTYPE(name,type,notification,first,last) \
+       float name; \
+       float first; \
+       float last; \
+       void DecDeathtype_##name() \
+       { \
+               SET_FIRST_OR_LAST(first, DT_FIRST, DT_COUNT) \
+               SET_FIRST_OR_LAST(last, DT_FIRST, DT_COUNT) \
+               SET_FIELD_COUNT(name, DT_FIRST, DT_COUNT) \
+               CHECK_MAX_COUNT(name, DT_MAX, DT_COUNT, "deathtypes") \
+       }
+       ACCUMULATE_FUNCTION(DecDeathtypes, DecDeathtype_##name)
+
+#define DEATHTYPES \
+       DEATHTYPE(DEATH_FALL, FALSE, FALSE, DEATH_SPECIAL_START, FALSE) \
+       DEATHTYPE(DEATH_TELEFRAG, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_DROWN, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_HURTTRIGGER, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_LAVA, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_SLIME, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_KILL, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_NOAMMO, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_SWAMP, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_TEAMCHANGE, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_AUTOTEAMCHANGE, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_CAMP, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_SHOOTING_STAR, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_ROT, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_MIRRORDAMAGE, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_TOUCHEXPLODE, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_CHEAT, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_FIRE, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_QUIET, FALSE, FALSE, FALSE, FALSE) \
+       #undef DEATHTYPE
+
+DEATHTYPES
+
+float  DEATH_VHCRUSH       = 10030;
+float  DEATH_SBMINIGUN     = 10031;
+float  DEATH_SBROCKET      = 10032;
+float  DEATH_SBBLOWUP      = 10033;
+float  DEATH_WAKIGUN       = 10034;
+float  DEATH_WAKIROCKET    = 10035;
+float  DEATH_WAKIBLOWUP    = 10036;
+float  DEATH_RAPTOR_CANNON = 10037;
+float  DEATH_RAPTOR_BOMB   = 10038;
+float  DEATH_RAPTOR_BOMB_SPLIT = 10039;
+float  DEATH_RAPTOR_DEATH   = 10040;
+float  DEATH_BUMB_GUN       = 10041;
+float  DEATH_BUMB_RAY       = 10042;
+float  DEATH_BUMB_RAY_HEAL  = 10043;
+float  DEATH_BUMB_DEATH     = 10044;
+#define DEATH_ISVEHICLE(t)  ((t) >= DEATH_VHFIRST && (t) <= DEATH_VHLAST)
+
+float DEATH_GENERIC = 10050;
+
+float DEATH_WEAPON = 10100;
+
+float DEATH_CUSTOM = 10300;
+
+float DEATH_TURRET                  = 10500;
+float DEATH_TURRET_EWHEEL           = 10501;
+float DEATH_TURRET_FLAC             = 10502;
+float DEATH_TURRET_MACHINEGUN       = 10503;
+float DEATH_TURRET_WALKER_GUN       = 10504;
+float DEATH_TURRET_WALKER_MEELE     = 10505;
+float DEATH_TURRET_WALKER_ROCKET    = 10506;
+float DEATH_TURRET_HELLION          = 10507;
+float DEATH_TURRET_HK               = 10508;
+float DEATH_TURRET_MLRS             = 10509;
+float DEATH_TURRET_PLASMA           = 10510;
+float DEATH_TURRET_PHASER           = 10511;
+float DEATH_TURRET_TESLA            = 10512;
+float DEATH_TURRET_LAST            = 10512;
+
+float DEATH_WEAPONMASK = 0xFF;
+float DEATH_HITTYPEMASK = 0x1F00; // which is WAY below 10000 used for normal deaths
+float HITTYPE_SECONDARY = 0x100;
+float HITTYPE_SPLASH = 0x200; // automatically set by RadiusDamage
+float HITTYPE_BOUNCE = 0x400;
+float HITTYPE_HEADSHOT = 0x800; // automatically set by Damage (if headshotbonus is set)
+float HITTYPE_RESERVED = 0x1000; // unused yet
+
+// macros to access these
+#define DEATH_ISTURRET(t)            ((t) >= DEATH_TURRET && (t) <= DEATH_TURRET_LAST)
+#define DEATH_ISSPECIAL(t)            ((t) >= DEATH_SPECIAL_START)
+#define DEATH_WEAPONOFWEAPONDEATH(t)  ((t) & DEATH_WEAPONMASK)
+#define DEATH_ISWEAPON(t,w)           (!DEATH_ISSPECIAL(t) && DEATH_WEAPONOFWEAPONDEATH(t) == (w))
+#define DEATH_WEAPONOF(t)             (DEATH_ISSPECIAL(t) ? 0 : DEATH_WEAPONOFWEAPONDEATH(t))
+#define WEP_VALID(w)                  ((w) >= WEP_FIRST && (w) <= WEP_LAST)
+
+// CSQC centerprint/notify message types
+float MSG_SUICIDE = 0;
+float MSG_KILL = 1;
+float MSG_SPREE = 2;
+float MSG_KILL_ACTION = 3;
+float MSG_KILL_ACTION_SPREE = 4;
+float MSG_INFO = 5;
+float MSG_KA = 6;
+float MSG_RACE = 10;
+
+float KILL_TEAM_RED = 12001;
+float KILL_TEAM_BLUE = 12002;
+float KILL_TEAM_SPREE = 12003;
+float KILL_FIRST_BLOOD = 12004;
+float KILL_FIRST_VICTIM = 12005;
+float KILL_TYPEFRAG = 12006;
+float KILL_TYPEFRAGGED = 12007;
+float KILL_FRAG = 12008;
+float KILL_FRAGGED = 12009;
+float KILL_SPREE = 12010;
+float KILL_END_SPREE = 12011;
+float KILL_SPREE_3 = 12012;
+float KILL_SPREE_5 = 12013;
+float KILL_SPREE_10 = 12014;
+float KILL_SPREE_15 = 12015;
+float KILL_SPREE_20 = 12016;
+float KILL_SPREE_25 = 12017;
+float KILL_SPREE_30 = 12018;
+
+float INFO_GOTFLAG = 13001;
+float INFO_PICKUPFLAG = 13002;
+float INFO_LOSTFLAG = 13003;
+float INFO_RETURNFLAG = 13004;
+float INFO_CAPTUREFLAG = 13005;
+
+float KA_PICKUPBALL = 14001;
+float KA_DROPBALL = 14002;
+
+float RACE_SERVER_RECORD = 15001;
+float RACE_NEW_TIME = 15002;
+float RACE_NEW_RANK = 15003;
+float RACE_FAIL = 15004;
+
+       /*print("Obituary_Notification(): ", ftos(deathtype), ".\n");
+       switch(deathtype)
+       {
+               // suicide
+               case DEATH_AUTOTEAMCHANGE:
+               case DEATH_CAMP:
+               case DEATH_NOAMMO:
+               case DEATH_ROT:
+               case DEATH_TEAMCHANGE:
+               
+               case KILL_TEAM_SUICIDE_RED:
+               case KILL_TEAM_SUICIDE_BLUE:
+
+               // murder
+               case KILL_TEAM_FRAG_RED:
+               case KILL_TEAM_FRAG_BLUE:
+
+               case KILL_FIRST_BLOOD:
+               case KILL_FIRST_VICTIM:
+               
+               case KILL_FRAG:
+               case KILL_TYPEFRAG:
+               case KILL_FRAGGED:
+               case KILL_TYPEFRAGGED:
+
+               // accident
+               case WATCH_STEP: 
+               
+               case DEATH_QUIET: break;
+
+               // ideally we should have ALL deathtypes listed here
+               default:
+                       backtrace(strcat("Unhandled deathtype: ", ftos(deathtype), ". Please notify Samual!\n"));
+                       break;
+       }*/
index 6dffb6656560ef11f430107ef5f85fe986c744bb..1d2adbd41a1c6664b935c40baa5330e7158101df 100644 (file)
 
 #define HANDLE_CPID(cpid) ((min(NOTIF_MAX, cpid) == NO_CPID) ? FALSE : cpid)
 #define NOTIF_MATCH(a,b) if(min(NOTIF_MAX, a) == b)
-#define VAR_TO_TEXT(var) #var
-
-#define CHECK_FIELD_AND_COUNT(field,count) if(!field) { field = (NOTIF_FIRST + count); ++count; }
-#define CHECK_MAX_NOTIFICATIONS(name,count) if(count == NOTIF_MAX) { error(strcat("Maximum notifications hit: ", VAR_TO_TEXT(name), ": ", ftos(count), ".\n")); }
 
 
 // ====================================
@@ -97,13 +93,13 @@ float NOTIF_NOTIFY_COUNT;
 float NOTIF_CENTER_COUNT;
 float NOTIF_WEAPON_COUNT;
 float NOTIF_CPID_COUNT;
-       
+
 #define MSG_INFO_NOTIF(name,args,normal,gentle) \
        float name; \
        void DecNotif_##name() \
        { \
-               CHECK_FIELD_AND_COUNT(name, NOTIF_INFO_COUNT) \
-               CHECK_MAX_NOTIFICATIONS(name, NOTIF_INFO_COUNT) \
+               SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_INFO_COUNT) \
+               CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_INFO_COUNT, "notifications") \
        } \
        ACCUMULATE_FUNCTION(DecNotifs, DecNotif_##name)
 
@@ -111,8 +107,8 @@ float NOTIF_CPID_COUNT;
        float name; \
        void DecNotif_##name() \
        { \
-               CHECK_FIELD_AND_COUNT(name, NOTIF_NOTIFY_COUNT) \
-               CHECK_MAX_NOTIFICATIONS(name, NOTIF_NOTIFY_COUNT) \
+               SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_NOTIFY_COUNT) \
+               CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_NOTIFY_COUNT, "notifications") \
        } \
        ACCUMULATE_FUNCTION(DecNotifs, DecNotif_##name)
 
@@ -121,9 +117,9 @@ float NOTIF_CPID_COUNT;
        float cpid; \
        void DecNotif_##name() \
        { \
-               CHECK_FIELD_AND_COUNT(name, NOTIF_CENTER_COUNT) \
-               CHECK_FIELD_AND_COUNT(cpid, NOTIF_CPID_COUNT) \
-               CHECK_MAX_NOTIFICATIONS(name, NOTIF_CENTER_COUNT) \
+               SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_CENTER_COUNT) \
+               SET_FIELD_COUNT(cpid, NOTIF_FIRST, NOTIF_CPID_COUNT) \
+               CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_CENTER_COUNT, "notifications") \
        } \
        ACCUMULATE_FUNCTION(DecNotifs, DecNotif_##name)
 
@@ -131,8 +127,8 @@ float NOTIF_CPID_COUNT;
        float name; \
        void DecNotif_##name() \
        { \
-               CHECK_FIELD_AND_COUNT(name, NOTIF_WEAPON_COUNT) \
-               CHECK_MAX_NOTIFICATIONS(name, NOTIF_WEAPON_COUNT) \
+               SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_WEAPON_COUNT) \
+               CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_WEAPON_COUNT, "notifications") \
        } \
        ACCUMULATE_FUNCTION(DecNotifs, DecNotif_##name)
 
index faa605f887598c0dba17c7a6d5ae99654eb8e409..c7dbb561187b95be2891d6d65317a844692b1c13 100644 (file)
@@ -1,6 +1,9 @@
 // a dummy macro that prevents the "hanging ;" warning
 #define ENDS_WITH_CURLY_BRACE
 
+// return the actual code name of a var as a string
+#define VAR_TO_TEXT(var) #var
+
 #ifdef HAVE_YO_DAWG_CPP
 // TODO make ascii art pic of xzibit
 // YO DAWG!
@@ -37,6 +40,11 @@ void ACCUMULATE_call(string func)
        ACCUMULATE_call(#func)
 #endif
 
+// used for simplifying ACCUMULATE_FUNCTIONs
+#define SET_FIRST_OR_LAST(input,first,count) if(input) { input = (first + count); }
+#define SET_FIELD_COUNT(field,first,count) if(!field) { field = (first + count); ++count; }
+#define CHECK_MAX_COUNT(name,max,count,type) if(count == max) { error(strcat("Maximum ", type, " hit: ", VAR_TO_TEXT(name), ": ", ftos(count), ".\n")); }
+
 // this returns a tempstring containing a copy of s with additional \n newlines added, it also replaces \n in the text with a real newline
 // NOTE: s IS allowed to be a tempstring
 string wordwrap(string s, float l);
index 0f545e60cfa368967ca4cb6f694132fff6558fd1..e6493dd114250cdc9e8fb6c5514029b2244222a1 100644 (file)
@@ -15,6 +15,7 @@ oo/base.h
 ../common/mapinfo.qh
 ../common/campaign_common.qh
 ../common/items.qh
+../common/deathtypes.qh
 ../common/command/markup.qh
 ../common/command/rpn.qh
 ../common/command/generic.qh
index 9c62fedc9a0ba76858e4f570860a058258d55a88..e78c3d979704d3c9e8258c5b0cac9044c6f0f3ea 100644 (file)
@@ -15,6 +15,7 @@ sys-post.qh
 ../common/constants.qh
 ../common/util.qh
 ../common/items.qh
+../common/deathtypes.qh
 ../common/explosion_equation.qh
 ../common/urllib.qh
 ../common/command/markup.qh