mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Parameterize changelevel or map in CServerListManager::LaunchServer()
Parameterized; whether or not to drop all clients (map = drop, changelevel = keep).
This commit is contained in:
parent
6cecc3297e
commit
54536a2652
@ -559,6 +559,9 @@ void CBrowser::HostPanel(void)
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
const bool bServerActive = g_pServer->IsActive();
|
||||
|
||||
if (!g_pHostState->m_bActiveGame)
|
||||
{
|
||||
if (ImGui::Button("Start server", ImVec2(ImGui::GetWindowContentRegionWidth(), 32)))
|
||||
@ -568,7 +571,7 @@ void CBrowser::HostPanel(void)
|
||||
bool bEnforceField = g_pServerListManager->m_ServerVisibility == EServerVisibility_t::OFFLINE ? true : !g_pServerListManager->m_Server.m_svHostName.empty();
|
||||
if (bEnforceField && !g_pServerListManager->m_Server.m_svPlaylist.empty() && !g_pServerListManager->m_Server.m_svHostMap.empty())
|
||||
{
|
||||
g_pServerListManager->LaunchServer(); // Launch server.
|
||||
g_pServerListManager->LaunchServer(bServerActive); // Launch server.
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -622,7 +625,7 @@ void CBrowser::HostPanel(void)
|
||||
{
|
||||
if (!g_pServerListManager->m_Server.m_svHostMap.empty())
|
||||
{
|
||||
g_pServerListManager->LaunchServer();
|
||||
g_pServerListManager->LaunchServer(bServerActive);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -631,7 +634,7 @@ void CBrowser::HostPanel(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_pServer->IsActive())
|
||||
if (bServerActive)
|
||||
{
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
|
@ -55,13 +55,13 @@ void CServerListManager::ClearServerList(void)
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Launch server with given parameters
|
||||
//-----------------------------------------------------------------------------
|
||||
void CServerListManager::LaunchServer(void) const
|
||||
void CServerListManager::LaunchServer(const bool bChangeLevel) const
|
||||
{
|
||||
if (!ThreadInMainThread())
|
||||
{
|
||||
g_TaskScheduler->Dispatch([this]()
|
||||
g_TaskScheduler->Dispatch([this, bChangeLevel]()
|
||||
{
|
||||
this->LaunchServer();
|
||||
this->LaunchServer(bChangeLevel);
|
||||
}, 0);
|
||||
return;
|
||||
}
|
||||
@ -77,7 +77,7 @@ void CServerListManager::LaunchServer(void) const
|
||||
KeyValues::ParsePlaylists(m_Server.m_svPlaylist.c_str());
|
||||
mp_gamemode->SetValue(m_Server.m_svPlaylist.c_str());
|
||||
|
||||
ProcessCommand(Format("%s \"%s\"", g_pServer->IsActive() ? "changelevel" : "map", m_Server.m_svHostMap.c_str()).c_str());
|
||||
ProcessCommand(Format("%s \"%s\"", bChangeLevel ? "changelevel" : "map", m_Server.m_svHostMap.c_str()).c_str());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
size_t RefreshServerList(string& svMessage);
|
||||
void ClearServerList(void);
|
||||
|
||||
void LaunchServer(void) const;
|
||||
void LaunchServer(const bool bChangeLevel) const;
|
||||
void ConnectToServer(const string& svIp, const string& svPort, const string& svNetKey) const;
|
||||
void ConnectToServer(const string& svServer, const string& svNetKey) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user