diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-11 14:11:37 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-11 14:11:37 +0100 |
commit | 862a115b08017e02b45a786e59feb436d1de278f (patch) | |
tree | d45b4920da15a12f1395b4c05cf4babec84e632e /NorthstarDedicatedTest/dedicated.cpp | |
parent | 2dba51a6a281573ea40cc52c80d10155387d4720 (diff) | |
download | NorthstarLauncher-862a115b08017e02b45a786e59feb436d1de278f.tar.gz NorthstarLauncher-862a115b08017e02b45a786e59feb436d1de278f.zip |
move hoststate to its own file and add host_init hooks
Diffstat (limited to 'NorthstarDedicatedTest/dedicated.cpp')
-rw-r--r-- | NorthstarDedicatedTest/dedicated.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp index 41de0594..646439ab 100644 --- a/NorthstarDedicatedTest/dedicated.cpp +++ b/NorthstarDedicatedTest/dedicated.cpp @@ -5,10 +5,12 @@ #include "gameutils.h" #include "tier0.h" #include "playlist.h" +#include "hoststate.h" #include "serverauthentication.h" #include "masterserver.h" using namespace Tier0; +using namespace R2; bool IsDedicated() { @@ -53,17 +55,14 @@ void RunServer(CDedicatedExports* dedicated) if (!CommandLine()->CheckParm("+map")) CommandLine()->AppendParm("+map", g_pCVar->FindVar("match_defaultMap")->GetString()); + // ensure playlist initialises right, if we've not explicitly called setplaylist + SetCurrentPlaylist(GetCurrentPlaylistName()); + // run server autoexec and re-run commandline Cbuf_AddText(Cbuf_GetCurrentPlayer(), "exec autoexec_ns_server", cmd_source_t::kCommandSrcCode); Cbuf_AddText(Cbuf_GetCurrentPlayer(), "stuffcmds", cmd_source_t::kCommandSrcCode); Cbuf_Execute(); - // ensure playlist initialises right, if we've not explicitly called setplaylist - R2::SetCurrentPlaylist(R2::GetCurrentPlaylistName()); - - // note: we no longer manually set map and hoststate to start server in g_pHostState, we just use +map which seems to initialise stuff - // better - // get tickinterval ConVar* Cvar_base_tickinterval_mp = g_pCVar->FindVar("base_tickinterval_mp"); @@ -80,7 +79,7 @@ void RunServer(CDedicatedExports* dedicated) frameTitle = frameStart; // this way of getting playercount/maxplayers honestly really sucks, but not got any other methods of doing it rn - const char* maxPlayers = R2::GetCurrentPlaylistVar("max_players", false); + const char* maxPlayers = GetCurrentPlaylistVar("max_players", false); if (!maxPlayers) maxPlayers = "6"; @@ -90,7 +89,7 @@ void RunServer(CDedicatedExports* dedicated) g_pHostState->m_levelName, g_ServerAuthenticationManager->m_additionalPlayerData.size(), maxPlayers, - R2::GetCurrentPlaylistName()) + GetCurrentPlaylistName()) .c_str()); } |