From 82e38560842fa7ac81336d4788de7e3fe51a4cc4 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 14 Nov 2015 19:15:18 +1100 Subject: [PATCH] ReadyRestart: revert uncrustify regression, fixes #1585 --- qcsrc/server/command/vote.qc | 53 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 81d5136f9..d861fbc7c 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -341,30 +341,25 @@ void VoteThink() // ======================= // Resets the state of all clients, items, weapons, waypoints, ... of the map. -void reset_map(float dorespawn) +void reset_map(bool dorespawn) { SELFPARAM(); - if (time <= game_starttime && round_handler_IsActive()) - round_handler_Reset(game_starttime); + if (time <= game_starttime && round_handler_IsActive()) round_handler_Reset(game_starttime); MUTATOR_CALLHOOK(reset_map_global); for (entity e = world; (e = nextent(e)); ) { - setself(e); - if (IS_NOT_A_CLIENT(self)) + if (IS_NOT_A_CLIENT(e)) { - if (self.reset) + if (e.reset) { - self.reset(); + WITH(entity, self, e, e.reset()); continue; } - - if (self.team_saved) self.team = self.team_saved; - - if (self.flags & FL_PROJECTILE) // remove any projectiles left - remove(self); + if (e.team_saved) e.team = e.team_saved; + if (e.flags & FL_PROJECTILE) remove(e); // remove any projectiles left } } @@ -384,7 +379,7 @@ void reset_map(float dorespawn) entity e; FOR_EACH_PLAYER(e) - if (e.frozen) WITH(entity, self, e, Unfreeze(self)); + if (e.frozen) WITH(entity, self, e, Unfreeze(e)); // Moving the player reset code here since the player-reset depends // on spawnpoint entities which have to be reset first --blub @@ -426,28 +421,29 @@ void reset_map(float dorespawn) void ReadyRestart_think() { SELFPARAM(); - restart_mapalreadyrestarted = 1; + restart_mapalreadyrestarted = true; reset_map(true); Score_ClearAll(); - remove(self); + remove(this); } // Forces a restart of the game without actually reloading the map // this is a mess... void ReadyRestart_force() { - entity tmp_player, restart_timer; - bprint("^1Server is restarting...\n"); VoteReset(); // clear overtime, we have to decrease timelimit to its original value again. - if (checkrules_overtimesadded > 0 && g_race_qualifying != 2) cvar_set("timelimit", ftos(autocvar_timelimit - (checkrules_overtimesadded * autocvar_timelimit_overtime))); + if (checkrules_overtimesadded > 0 && g_race_qualifying != 2) + cvar_set("timelimit", ftos(autocvar_timelimit - (checkrules_overtimesadded * autocvar_timelimit_overtime))); checkrules_suddendeathend = checkrules_overtimesadded = checkrules_suddendeathwarning = 0; - readyrestart_happened = 1; + readyrestart_happened = true; game_starttime = time + RESTART_COUNTDOWN; + entity tmp_player; + // clear player attributes FOR_EACH_CLIENT(tmp_player) { @@ -456,7 +452,7 @@ void ReadyRestart_force() PS_GR_P_ADDVAL(tmp_player, PLAYERSTATS_ALIVETIME, -PS_GR_P_ADDVAL(tmp_player, PLAYERSTATS_ALIVETIME, 0)); } - restart_mapalreadyrestarted = 0; // reset this var, needed when cvar sv_ready_restart_repeatable is in use + restart_mapalreadyrestarted = false; // reset this var, needed when cvar sv_ready_restart_repeatable is in use // disable the warmup global for the server warmup_stage = 0; // once the game is restarted the game is in match stage @@ -464,7 +460,7 @@ void ReadyRestart_force() // reset the .ready status of all players (also spectators) FOR_EACH_REALCLIENT(tmp_player) { - tmp_player.ready = 0; + tmp_player.ready = false; } readycount = 0; Nagger_ReadyCounted(); // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client @@ -472,14 +468,15 @@ void ReadyRestart_force() // lock teams with lockonrestart if (autocvar_teamplay_lockonrestart && teamplay) { - lockteams = 1; + lockteams = true; bprint("^1The teams are now locked.\n"); } // initiate the restart-countdown-announcer entity if (autocvar_sv_ready_restart_after_countdown) { - restart_timer = spawn(); + entity restart_timer = new(restart_timer); + make_pure(restart_timer); restart_timer.think = ReadyRestart_think; restart_timer.nextthink = game_starttime; } @@ -491,9 +488,11 @@ void ReadyRestart_force() { tmp_player.allowed_timeouts = autocvar_sv_timeout_number; } - // reset map immediately if this cvar is not set - if (!autocvar_sv_ready_restart_after_countdown) reset_map(true); } - if (autocvar_sv_eventlog) GameLogEcho(":restart"); } + } + // reset map immediately if this cvar is not set + if (!autocvar_sv_ready_restart_after_countdown) reset_map(true); + if (autocvar_sv_eventlog) GameLogEcho(":restart"); +} void ReadyRestart() { @@ -503,7 +502,7 @@ void ReadyRestart() // Reset ALL scores, but only do that at the beginning of the countdown if sv_ready_restart_after_countdown is off! // Otherwise scores could be manipulated during the countdown. - if (!autocvar_sv_ready_restart_after_countdown) Score_ClearAll(); + if (!autocvar_sv_ready_restart_after_countdown) Score_ClearAll(); ReadyRestart_force(); } -- 2.39.2