]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/vote.qc
Merge branch 'master' into TimePath/global_self
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / vote.qc
index 4bd4e414a7a7def435eff21fbd907311f78ccfe0..3e9f129622c61ac64dcccc4d2f96a1cdc16547dd 100644 (file)
@@ -348,60 +348,60 @@ void VoteThink()
 
 // Resets the state of all clients, items, weapons, waypoints, ... of the map.
 void reset_map(float dorespawn)
-{
-       entity oldself;
-       oldself = self;
+{SELFPARAM();
 
        if(time <= game_starttime && round_handler_IsActive())
                round_handler_Reset(game_starttime);
 
        MUTATOR_CALLHOOK(reset_map_global);
 
-       // ALL the times need to be reset before .reset()ing each item
-       // since Item_Reset schedules respawn of superweapons and powerups
-       for(self = world; (self = nextent(self)); )
-       if(IS_NOT_A_CLIENT(self))
-               Item_ItemsTime_SetTime(self, 0);
-
-       for(self = world; (self = nextent(self)); )
-       if(IS_NOT_A_CLIENT(self))
+       for(entity e = world; (e = nextent(e)); )
        {
-               if(self.reset)
+               setself(e);
+               if(IS_NOT_A_CLIENT(self))
                {
-                       self.reset();
-                       continue;
-               }
+                       if(self.reset)
+                       {
+                               self.reset();
+                               continue;
+                       }
 
-               if(self.team_saved)
-                       self.team = self.team_saved;
+                       if(self.team_saved)
+                               self.team = self.team_saved;
 
-               if(self.flags & FL_PROJECTILE) // remove any projectiles left
-                       remove(self);
+                       if(self.flags & FL_PROJECTILE) // remove any projectiles left
+                               remove(self);
+               }
        }
 
        // Waypoints and assault start come LAST
-       for(self = world; (self = nextent(self)); )
-       if(IS_NOT_A_CLIENT(self))
+       for(entity e = world; (e = nextent(e)); )
        {
-               if(self.reset2)
+               setself(e);
+               if(IS_NOT_A_CLIENT(self))
                {
-                       self.reset2();
-                       continue;
+                       if(self.reset2)
+                       {
+                               self.reset2();
+                               continue;
+                       }
                }
        }
 
-       Item_ItemsTime_SetTimesForAllPlayers();
-
-       FOR_EACH_PLAYER(self)
-       if(self.frozen)
-               Unfreeze(self);
+       entity e;
+       FOR_EACH_PLAYER(e)
+       if(e.frozen)
+       {
+               WITH(entity, self, e, Unfreeze(self));
+       }
 
        // Moving the player reset code here since the player-reset depends
        // on spawnpoint entities which have to be reset first --blub
        if(dorespawn)
        if(!MUTATOR_CALLHOOK(reset_map_players))
-       FOR_EACH_CLIENT(self) // reset all players
+       FOR_EACH_CLIENT(e) // reset all players
        {
+               setself(e);
                /*
                only reset players if a restart countdown is active
                this can either be due to cvar sv_ready_restart_after_countdown having set
@@ -426,12 +426,12 @@ void reset_map(float dorespawn)
        if(g_keyhunt)
                kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round + (game_starttime - time), kh_StartRound);
 
-       self = oldself;
+       setself(this);
 }
 
 // Restarts the map after the countdown is over (and cvar sv_ready_restart_after_countdown is set)
 void ReadyRestart_think()
-{
+{SELFPARAM();
        restart_mapalreadyrestarted = 1;
        reset_map(true);
        Score_ClearAll();
@@ -470,8 +470,6 @@ 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_ResetTimes();
-
        // reset the .ready status of all players (also spectators)
        FOR_EACH_REALCLIENT(tmp_player) { tmp_player.ready = 0; }
        readycount = 0;