aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/misccommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest/misccommands.cpp')
-rw-r--r--NorthstarDedicatedTest/misccommands.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/misccommands.cpp b/NorthstarDedicatedTest/misccommands.cpp
new file mode 100644
index 00000000..c03ba713
--- /dev/null
+++ b/NorthstarDedicatedTest/misccommands.cpp
@@ -0,0 +1,28 @@
+#include "pch.h"
+#include "misccommands.h"
+#include "concommand.h"
+#include "gameutils.h"
+
+void ForceLoadMapCommand(const CCommand& arg)
+{
+ if (arg.ArgC() < 2)
+ return;
+
+ g_pHostState->m_iNextState = HS_NEW_GAME;
+ strncpy(g_pHostState->m_levelName, arg.Arg(1), sizeof(g_pHostState->m_levelName));
+}
+
+void LeaveToLobbyCommand(const CCommand& arg)
+{
+ SetCurrentPlaylist("tdm");
+
+ // note: for host, this will kick all clients, since it hits HS_GAME_SHUTDOWN
+ g_pHostState->m_iNextState = HS_NEW_GAME;
+ strcpy(g_pHostState->m_levelName, "mp_lobby");
+}
+
+void AddMiscConCommands()
+{
+ RegisterConCommand("force_newgame", ForceLoadMapCommand, "forces a map load through directly setting g_pHostState->m_iNextState to HS_NEW_GAME", FCVAR_NONE);
+ RegisterConCommand("ns_leave_to_lobby", LeaveToLobbyCommand, "called by the server, used to return the player to lobby when leaving a game", FCVAR_SERVER_CAN_EXECUTE);
+} \ No newline at end of file