From 976872893a5b5847246e0fd4932261405140857d Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 28 Feb 2022 23:26:50 +0100 Subject: [PATCH] Avoid changing timelimit in the endmatch alias so that the timer shows the correct elapsed / remaining time --- commands.cfg | 3 ++- qcsrc/server/intermission.qc | 2 +- qcsrc/server/world.qc | 10 +++++----- qcsrc/server/world.qh | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/commands.cfg b/commands.cfg index a6162badf..e9dfc0e02 100644 --- a/commands.cfg +++ b/commands.cfg @@ -238,7 +238,8 @@ alias unlockteams "qc_cmd_sv unlockteams ${* ?}" // Enable alias warp "qc_cmd_sv warp ${* ?}" // Choose different level in campaign // other aliases for server commands -alias endmatch "timelimit -1" +set _endmatch 0 "if set to 1 ends the match immediately; use it instead of timelimit -1 (deprecated)" +alias endmatch "_endmatch 1" alias bots "minplayers 4; minplayers_per_team 2" alias nobots "minplayers 0; minplayers_per_team 0" diff --git a/qcsrc/server/intermission.qc b/qcsrc/server/intermission.qc index 81850d8df..98d2ef25b 100644 --- a/qcsrc/server/intermission.qc +++ b/qcsrc/server/intermission.qc @@ -399,7 +399,7 @@ string GotoMap(string m) if(!MapInfo_CheckMap(m)) return "The map you suggested does not support the current game mode."; cvar_set("nextmap", m); - cvar_set("timelimit", "-1"); + cvar_set("_endmatch", "1"); if(mapvote_initialized || alreadychangedlevel) { if(DoNextMapOverride(0)) diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index be272b1fc..f7a281998 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -1275,6 +1275,7 @@ only called if a time or frag limit has expired */ void NextLevel() { + cvar_set("_endmatch", "0"); game_stopped = true; intermission_running = true; // game over @@ -1613,17 +1614,16 @@ void CheckRules_World() leadlimit = 0; // no leadlimit for now } - if(timelimit > 0) - { - timelimit += game_starttime; - } - else if (timelimit < 0) + if (autocvar__endmatch || timelimit < 0) { // endmatch NextLevel(); return; } + if(timelimit > 0) + timelimit += game_starttime; + float wantovertime; wantovertime = 0; diff --git a/qcsrc/server/world.qh b/qcsrc/server/world.qh index b23ffc4d8..bf2092bbc 100644 --- a/qcsrc/server/world.qh +++ b/qcsrc/server/world.qh @@ -3,6 +3,7 @@ #include bool autocvar__sv_init; +bool autocvar__endmatch; bool autocvar_g_use_ammunition; bool autocvar_g_jetpack; bool autocvar_g_warmup_allguns; -- 2.39.2