From cb9aedf463db7c71854f784f0132c017466db1b6 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 15 Oct 2015 00:36:59 +1000 Subject: [PATCH] Merge 3 hooks into 1 and kill another gamemode specific check --- qcsrc/server/g_world.qc | 2 +- qcsrc/server/mutators/events.qh | 23 ++++++++--------------- qcsrc/server/mutators/gamemode_ca.qc | 9 +-------- qcsrc/server/mutators/gamemode_lms.qc | 7 +------ qcsrc/server/scores.qc | 4 ++-- 5 files changed, 13 insertions(+), 32 deletions(-) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 05f08f057..e121e6f96 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1425,7 +1425,7 @@ void DumpStats(float final) { s = strcat(":player:see-labels:", GetPlayerScoreString(other, 0), ":"); s = strcat(s, ftos(rint(time - other.jointime)), ":"); - if(IS_PLAYER(other) || other.caplayer == 1 || g_lms) + if(IS_PLAYER(other) || MUTATOR_CALLHOOK(GetPlayerStatus, other, s)) s = strcat(s, ftos(other.team), ":"); else s = strcat(s, "spectator:"); diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 45e4572e8..c6815e7fb 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -739,21 +739,6 @@ bool want_allguns; bool want_mutatorblocked; MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon); -#define EV_SetPlayerFullStatus(i, o) \ - /**/ i(entity, set_player) \ - /**/ i(string, ret_string) \ - /**/ o(string, ret_string) \ - /**/ -entity set_player; -MUTATOR_HOOKABLE(SetPlayerFullStatus, EV_SetPlayerFullStatus); - -#define EV_SetPlayerStatus(i, o) \ - /**/ i(entity, set_player) \ - /**/ i(string, ret_string) \ - /**/ o(string, ret_string) \ - /**/ -MUTATOR_HOOKABLE(SetPlayerStatus, EV_SetPlayerStatus); - #define EV_AddPlayerScore(i, o) \ /**/ i(int, score_field) \ /**/ i(float, ret_float) \ @@ -761,4 +746,12 @@ MUTATOR_HOOKABLE(SetPlayerStatus, EV_SetPlayerStatus); /**/ int score_field; MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore); + +#define EV_GetPlayerStatus(i, o) \ + /**/ i(entity, set_player) \ + /**/ i(string, ret_string) \ + /**/ o(string, ret_string) \ + /**/ +entity set_player; +MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus); #endif diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index 8e2d9d9e8..af870ec6c 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -462,14 +462,7 @@ MUTATOR_HOOKFUNCTION(ca, WantWeapon) return false; } -MUTATOR_HOOKFUNCTION(ca, SetPlayerFullStatus) -{ - if(set_player.caplayer == 1) - return true; - return false; -} - -MUTATOR_HOOKFUNCTION(ca, SetPlayerStatus) +MUTATOR_HOOKFUNCTION(ca, GetPlayerStatus) { if(set_player.caplayer == 1) return true; diff --git a/qcsrc/server/mutators/gamemode_lms.qc b/qcsrc/server/mutators/gamemode_lms.qc index facf5771c..dc56fb17a 100644 --- a/qcsrc/server/mutators/gamemode_lms.qc +++ b/qcsrc/server/mutators/gamemode_lms.qc @@ -242,12 +242,7 @@ MUTATOR_HOOKFUNCTION(lms, WantWeapon) return false; } -MUTATOR_HOOKFUNCTION(lms, SetPlayerFullStatus) -{ - return true; -} - -MUTATOR_HOOKFUNCTION(lms, SetPlayerStatus) +MUTATOR_HOOKFUNCTION(lms, GetPlayerStatus) { return true; } diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 9ef3e1e75..2279e649d 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -537,13 +537,13 @@ void WinningConditionHelper() s = strcat(s, ":human"); else s = strcat(s, ":bot"); - if(!IS_PLAYER(p) && !MUTATOR_CALLHOOK(SetPlayerFullStatus, p, s)) + if(!IS_PLAYER(p) && !MUTATOR_CALLHOOK(GetPlayerStatus, p, s)) s = strcat(s, ":spectator"); s = strcat(s, ret_string); } else { - if(IS_PLAYER(p) || MUTATOR_CALLHOOK(SetPlayerStatus, p, s)) + if(IS_PLAYER(p) || MUTATOR_CALLHOOK(GetPlayerStatus, p, s)) s = GetPlayerScoreString(p, 2); else s = "-666"; -- 2.39.2