Use ServerConfig::m_max_ping for delaying server if supports live join

So any players having ping below that value can play the game smooth
This commit is contained in:
Benau 2018-12-26 16:22:15 +08:00
parent 4a546f6802
commit 43761e4d9e
2 changed files with 15 additions and 0 deletions

View File

@ -2606,6 +2606,12 @@ void ServerLobby::configPeersStartTime()
}
max_ping = std::max(peer->getAveragePing(), max_ping);
}
if (race_manager->supportsLiveJoining())
{
Log::info("ServerLobby", "Max ping to ServerConfig::m_max_ping for "
"live joining.");
max_ping = ServerConfig::m_max_ping;
}
// Start up time will be after 2500ms, so even if this packet is sent late
// (due to packet loss), the start time will still ahead of current time
uint64_t start_time = STKHost::get()->getNetworkTimer() + (uint64_t)2500;

View File

@ -901,6 +901,15 @@ public:
void setFlagReturnTicks(unsigned ticks) { m_flag_return_ticks = ticks; }
// ------------------------------------------------------------------------
unsigned getFlagReturnTicks() const { return m_flag_return_ticks; }
// ------------------------------------------------------------------------
/** Whether the current game mode allow live joining even the current game
*. started in network*/
bool supportsLiveJoining() const
{
return m_minor_mode == MINOR_MODE_SOCCER ||
m_minor_mode == MINOR_MODE_CAPTURE_THE_FLAG ||
m_minor_mode == MINOR_MODE_FREE_FOR_ALL;
}
}; // RaceManager
extern RaceManager *race_manager;