]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/lms_itemtimes_fix 266/head
authorterencehill <piuntn@gmail.com>
Fri, 1 Jan 2016 22:16:25 +0000 (23:16 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 1 Jan 2016 22:16:25 +0000 (23:16 +0100)
Conflicts:
qcsrc/server/mutators/mutator/gamemode_lms.qc

1  2 
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc

index f5a53d167f0e2a1be5f8436ae4016f634c088243,20b43032348f0fe94d0122d256c575f76db109cf..4f4f81fb6d5088d4e4fc1ae4a635ffecee765c29
@@@ -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;
index 442f539fa70d0a01819d99cb6e484d357c271a47,9c9e191d2065d59423dd4edadb6a10d1d266417a..9d82004e2758426d40c36a0215c766dc16f5bc48
@@@ -44,8 -44,8 +44,8 @@@ float LMS_NewPlayerLives()
  
  #ifdef IMPLEMENTATION
  
- #include "../../campaign.qh"
- #include "../../command/cmd.qh"
+ #include <server/campaign.qh>
+ #include <server/command/cmd.qh>
  
  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;
  }