From: terencehill Date: Tue, 28 Jul 2015 16:28:45 +0000 (+0200) Subject: Cleanup X-Git-Tag: xonotic-v0.8.1~12^2~18 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dbd95f6eea2ddf17ad2143c363eafefcdcc1a65f;p=xonotic%2Fxonotic-data.pk3dir.git Cleanup --- diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 4c6933248..6867fe9e2 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -195,7 +195,7 @@ void PutObserverInServer (void) if(IS_REAL_CLIENT(self)) { - Item_ItemsTime_Get(self); + Item_ItemsTime_SetTimesForPlayer(self); msg_entity = self; WriteByte(MSG_ONE, SVC_SETVIEW); WriteEntity(MSG_ONE, self); @@ -508,7 +508,7 @@ void PutClientInServer (void) self.superweapons_finished = 0; if(!warmup_stage) - Item_ItemsTime_ResetForPlayer(self); + Item_ItemsTime_ResetTimesForPlayer(self); if(g_weaponarena_random) // WEAPONTODO: more stuff that should be in a mutator. also: rename those cvars { diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 59348d7af..6ea03dd43 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -462,7 +462,7 @@ void ReadyRestart_force() // disable the warmup global for the server warmup_stage = 0; // once the game is restarted the game is in match stage - Item_ItemsTime_Reset(); + Item_ItemsTime_ResetTimes(); // reset the .ready status of all players (also spectators) FOR_EACH_REALCLIENT(tmp_player) { tmp_player.ready = 0; } diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index c31926550..2ad260769 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -436,7 +436,7 @@ void Item_ItemsTime_Init() it_jetpack_time = -1; it_superweapons_time = -1; } -void Item_ItemsTime_Reset() +void Item_ItemsTime_ResetTimes() { it_armor_large_time = (it_armor_large_time == -1) ? -1 : 0; it_health_mega_time = (it_health_mega_time == -1) ? -1 : 0; @@ -449,7 +449,7 @@ void Item_ItemsTime_Reset() it_jetpack_time = (it_jetpack_time == -1) ? -1 : 0; it_superweapons_time= (it_superweapons_time== -1) ? -1 : 0; } -void Item_ItemsTime_ResetForPlayer(entity e) +void Item_ItemsTime_ResetTimesForPlayer(entity e) { e.item_armor_large_time = (it_armor_large_time == -1) ? -1 : 0; e.item_health_mega_time = (it_health_mega_time == -1) ? -1 : 0; @@ -462,7 +462,7 @@ void Item_ItemsTime_ResetForPlayer(entity e) e.item_jetpack_time = (it_jetpack_time == -1) ? -1 : 0; e.item_superweapons_time= (it_superweapons_time== -1) ? -1 : 0; } -void Item_ItemsTime_Get(entity e) +void Item_ItemsTime_SetTimesForPlayer(entity e) { e.item_armor_large_time = it_armor_large_time; e.item_health_mega_time = it_health_mega_time; @@ -475,13 +475,13 @@ void Item_ItemsTime_Get(entity e) e.item_jetpack_time = it_jetpack_time; e.item_superweapons_time = it_superweapons_time; } -float Item_ItemsTime_UpdateTime_Check(float item_time, float t) +bool Item_ItemsTime_UpdateTime_Check(float item_time, float t) { if(t == 0 && item_time == -1) - return TRUE; + return true; if(time < t && (item_time <= time || t < item_time)) - return TRUE; - return FALSE; + return true; + return false; } void Item_ItemsTime_UpdateTime(entity e, float t) { @@ -547,20 +547,20 @@ void Item_ItemsTime_UpdateTime(entity e, float t) break; } } -void Item_ItemsTime_GetForAll() +void Item_ItemsTime_SetTimesForAllPlayers() { entity e; if(warmup_stage) { FOR_EACH_REALCLIENT(e) - Item_ItemsTime_Get(e); + Item_ItemsTime_SetTimesForPlayer(e); } else { FOR_EACH_REALCLIENT(e) { - if (e.classname != "player") - Item_ItemsTime_Get(e); + if(!IS_PLAYER(e)) + Item_ItemsTime_SetTimesForPlayer(e); } } } @@ -580,7 +580,7 @@ void Item_Respawn (void) if(self.flags & FL_POWERUP || self.classname == "item_armor_large" || self.items == IT_HEALTH || (self.weapons & WEPSET_SUPERWEAPONS)) { Item_ItemsTime_UpdateTime(self, 0); - Item_ItemsTime_GetForAll(); + Item_ItemsTime_SetTimesForAllPlayers(); } self.think = Item_Think; @@ -720,7 +720,7 @@ void Item_ScheduleRespawnIn(entity e, float t) } } Item_ItemsTime_UpdateTime(e, t); - Item_ItemsTime_GetForAll(); + Item_ItemsTime_SetTimesForAllPlayers(); } else { diff --git a/qcsrc/server/t_items.qh b/qcsrc/server/t_items.qh index bc632ece4..e05e4ef66 100644 --- a/qcsrc/server/t_items.qh +++ b/qcsrc/server/t_items.qh @@ -113,9 +113,9 @@ const float ITEM_RESPAWN_TICKS = 10; .float max_armorvalue; .float pickup_anyway; -void Item_ItemsTime_Get(entity e); +void Item_ItemsTime_SetTimesForPlayer(entity e); -void Item_ItemsTime_ResetForPlayer(entity e); +void Item_ItemsTime_ResetTimesForPlayer(entity e); void Item_Show (entity e, float mode);