From: terencehill Date: Fri, 1 Jan 2016 22:16:25 +0000 (+0100) Subject: Merge branch 'master' into terencehill/lms_itemtimes_fix X-Git-Tag: xonotic-v0.8.2~1284^2 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=f41d9f31538bef0259d2b2c74536bb977901f99d;hp=-c;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into terencehill/lms_itemtimes_fix Conflicts: qcsrc/server/mutators/mutator/gamemode_lms.qc --- f41d9f31538bef0259d2b2c74536bb977901f99d diff --combined qcsrc/common/mutators/mutator/itemstime.qc index f5a53d167,20b430323..4f4f81fb6 --- a/qcsrc/common/mutators/mutator/itemstime.qc +++ b/qcsrc/common/mutators/mutator/itemstime.qc @@@ -26,17 -26,6 +26,17 @@@ NET_HANDLE(itemstime, bool isNew #endif #ifdef CSQC +void Item_ItemsTime_Init() +{ + FOREACH(Items, true, LAMBDA( + ItemsTime_time[it.m_id] = -1; + )); +} + +STATIC_INIT(ItemsTime_Init) { + Item_ItemsTime_Init(); +} + int autocvar_hud_panel_itemstime = 2; float autocvar_hud_panel_itemstime_dynamicsize = 1; float autocvar_hud_panel_itemstime_ratio = 2; @@@ -121,9 -110,7 +121,7 @@@ void Item_ItemsTime_SetTime(entity e, f void Item_ItemsTime_SetTimesForAllPlayers() { - entity e; - FOR_EACH_REALCLIENT(e) if (warmup_stage || !IS_PLAYER(e)) - Item_ItemsTime_SetTimesForPlayer(e); + FOREACH_CLIENT(IS_REAL_CLIENT(it) && (warmup_stage || !IS_PLAYER(it)), LAMBDA(Item_ItemsTime_SetTimesForPlayer(it))); } float Item_ItemsTime_UpdateTime(entity e, float t) @@@ -157,17 -144,6 +155,17 @@@ MUTATOR_HOOKFUNCTION(itemstime, MakePla Item_ItemsTime_SetTimesForPlayer(self); } +MUTATOR_HOOKFUNCTION(itemstime, ClientConnect, CBC_ORDER_LAST) +{SELFPARAM(); + if(IS_PLAYER(self)) + { + // client became player on connection skipping putObserverInServer step + if (IS_REAL_CLIENT(self)) + if (warmup_stage) + Item_ItemsTime_SetTimesForPlayer(self); + } +} + MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn) {SELFPARAM(); if (warmup_stage) return; diff --combined qcsrc/server/mutators/mutator/gamemode_lms.qc index 442f539fa,9c9e191d2..9d82004e2 --- a/qcsrc/server/mutators/mutator/gamemode_lms.qc +++ b/qcsrc/server/mutators/mutator/gamemode_lms.qc @@@ -44,8 -44,8 +44,8 @@@ float LMS_NewPlayerLives() #ifdef IMPLEMENTATION - #include "../../campaign.qh" - #include "../../command/cmd.qh" + #include + #include int autocvar_g_lms_extra_lives; bool autocvar_g_lms_join_anytime; @@@ -74,21 -74,18 +74,18 @@@ float LMS_NewPlayerLives( // LMS winning condition: game terminates if and only if there's at most one // one player who's living lives. Top two scores being equal cancels the time // limit. - float WinningCondition_LMS() + int WinningCondition_LMS() { entity head, head2; - float have_player; - float have_players; - float l; + bool have_player = false; + bool have_players = false; - have_player = false; - have_players = false; - l = LMS_NewPlayerLives(); + int l = LMS_NewPlayerLives(); - head = find(world, classname, "player"); + head = find(world, classname, STR_PLAYER); if(head) have_player = true; - head2 = find(head, classname, "player"); + head2 = find(head, classname, STR_PLAYER); if(head2) have_players = true; @@@ -160,14 -157,10 +157,9 @@@ MUTATOR_HOOKFUNCTION(lms, reset_map_glo } MUTATOR_HOOKFUNCTION(lms, reset_map_players) -{SELFPARAM(); +{ - entity e; if(restart_mapalreadyrestarted || (time < game_starttime)) - FOR_EACH_PLAYER(e) - { - PlayerScore_Add(e, SP_LMS_LIVES, LMS_NewPlayerLives()); - } - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(WITH(entity, self, it, PlayerScore_Add(it, SP_LMS_LIVES, LMS_NewPlayerLives())))); -- ++ FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(PlayerScore_Add(it, SP_LMS_LIVES, LMS_NewPlayerLives()))); return false; } @@@ -342,12 -335,10 +334,10 @@@ MUTATOR_HOOKFUNCTION(lms, ItemTouch MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE) { - entity head; - FOR_EACH_REALCLIENT(head) - { + FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA( ++bot_activerealplayers; ++bot_realplayers; - } + )); return true; }