Skip to content

Commit

Permalink
fix: make shutdown down after finish opt-in
Browse files Browse the repository at this point in the history
Make it opt-in so that e2e tests servers don't get shutdown after a tee finishes a map
fixes #3
  • Loading branch information
MilkeeyCat committed Sep 15, 2024
1 parent 14c4c17 commit 86d9daa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/engine/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3048,7 +3048,7 @@ int CServer::Run()
break;
}

if(m_FinishTick != MIN_TICK && Config()->m_SvWaitUntilShutdownAfterFinish < (Tick() - m_FinishTick) / TickSpeed())
if(Config()->m_SvShutdownAfterFinish && m_FinishTick != MIN_TICK && Config()->m_SvWaitUntilShutdownAfterFinish < (Tick() - m_FinishTick) / TickSpeed())
{
str_copy(m_aShutdownReason, "GG! Thanks for playing and have a good one");
break;
Expand Down
1 change: 1 addition & 0 deletions src/engine/shared/config_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -727,4 +727,5 @@ MACRO_CONFIG_INT(ClVideoRecorderFPS, cl_video_recorder_fps, 60, 1, 1000, CFGFLAG
/*
* Add config variables for mods below this comment to avoid merge conflicts.
*/
MACRO_CONFIG_INT(SvShutdownAfterFinish, sv_shutdown_after_finish, 0, 0, 1, CFGFLAG_SERVER, "Time in seconds before the server will be shutdown after finishing the map")
MACRO_CONFIG_INT(SvWaitUntilShutdownAfterFinish, sv_wait_until_shutdown_after_finish, 5, 0, 65536, CFGFLAG_SERVER, "Time in seconds before the server will be shutdown after finishing the map")
2 changes: 1 addition & 1 deletion src/game/server/gamecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ void CGameContext::OnTick()
// Warning: do not put code in this function directly above or below this comment
// Don't you ever dare to tell me what to not do

if(Server()->FinishTick() != 0)
if(Config()->m_SvShutdownAfterFinish && Server()->FinishTick() != 0)
{
float SecondsElapsed = (float)(Server()->Tick() - Server()->FinishTick()) / (float)Server()->TickSpeed();

Expand Down

0 comments on commit 86d9daa

Please sign in to comment.