From: terencehill Date: Wed, 3 Mar 2021 22:51:24 +0000 (+0100) Subject: Print an error message if gametype and gotomap are executed when the server isn't... X-Git-Tag: xonotic-v0.8.5~528 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=44b19a9101514c2f7c60db341fc08bc677278901;p=xonotic%2Fxonotic-data.pk3dir.git Print an error message if gametype and gotomap are executed when the server isn't running, rather than showing nonsense output (gametype in particular) --- diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 200aafe2c..9cb909d54 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -715,6 +715,11 @@ void GameCommand_gametype(int request, int argc) { case CMD_REQUEST_COMMAND: { + if (!world_initialized) + { + LOG_INFOF("This command works only when the server is running."); + return; + } if (argv(1) != "") { string s = argv(1); @@ -888,6 +893,11 @@ void GameCommand_gotomap(int request, int argc) { case CMD_REQUEST_COMMAND: { + if (!world_initialized) + { + LOG_INFOF("This command works only when the server is running."); + return; + } if (argv(1)) { LOG_INFO(GotoMap(argv(1))); diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 864ac5dab..b61f75ceb 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -100,7 +100,6 @@ void PingPLReport_Spawn() } const float SPAWNFLAG_NO_WAYPOINTS_FOR_ITEMS = 1; -float world_initialized; void SetDefaultAlpha() { diff --git a/qcsrc/server/world.qh b/qcsrc/server/world.qh index 4141c99e2..e79a6f9df 100644 --- a/qcsrc/server/world.qh +++ b/qcsrc/server/world.qh @@ -35,6 +35,8 @@ float checkrules_overtimesadded; //how many overtimes have been already added // flag set on worldspawn so that the code knows if it is dedicated or not bool server_is_dedicated; +int world_initialized; + string cvar_changes; string cvar_purechanges; float cvar_purechanges_count;