Reset extra server info each game for live changing
This commit is contained in:
parent
6be39f7ef8
commit
a69db65c71
@ -63,6 +63,7 @@ GameSetup::GameSetup()
|
|||||||
(StringUtils::xmlDecode(server_name));
|
(StringUtils::xmlDecode(server_name));
|
||||||
m_connected_players_count.store(0);
|
m_connected_players_count.store(0);
|
||||||
m_extra_server_info = -1;
|
m_extra_server_info = -1;
|
||||||
|
m_is_grand_prix.store(false);
|
||||||
reset();
|
reset();
|
||||||
} // GameSetup
|
} // GameSetup
|
||||||
|
|
||||||
@ -183,14 +184,6 @@ void GameSetup::loadWorld()
|
|||||||
}
|
}
|
||||||
} // loadWorld
|
} // loadWorld
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
bool GameSetup::isGrandPrix() const
|
|
||||||
{
|
|
||||||
return m_extra_server_info != -1 &&
|
|
||||||
ServerConfig::getLocalGameModeFromConfig().second ==
|
|
||||||
RaceManager::MAJOR_MODE_GRAND_PRIX;
|
|
||||||
} // isGrandPrix
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GameSetup::addServerInfo(NetworkString* ns)
|
void GameSetup::addServerInfo(NetworkString* ns)
|
||||||
{
|
{
|
||||||
|
@ -52,14 +52,16 @@ private:
|
|||||||
|
|
||||||
unsigned m_laps;
|
unsigned m_laps;
|
||||||
|
|
||||||
bool m_reverse;
|
|
||||||
|
|
||||||
int m_extra_server_info;
|
int m_extra_server_info;
|
||||||
|
|
||||||
int m_hit_capture_limit;
|
int m_hit_capture_limit;
|
||||||
|
|
||||||
float m_battle_time_limit;
|
float m_battle_time_limit;
|
||||||
|
|
||||||
|
bool m_reverse;
|
||||||
|
|
||||||
|
std::atomic_bool m_is_grand_prix;
|
||||||
|
|
||||||
std::atomic<uint32_t> m_connected_players_count;
|
std::atomic<uint32_t> m_connected_players_count;
|
||||||
|
|
||||||
irr::core::stringw m_message_of_today;
|
irr::core::stringw m_message_of_today;
|
||||||
@ -123,13 +125,23 @@ public:
|
|||||||
m_battle_time_limit = 0.0f;
|
m_battle_time_limit = 0.0f;
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void setGrandPrixTrack(int tracks_no) { m_extra_server_info = tracks_no; }
|
void resetExtraServerInfo()
|
||||||
|
{
|
||||||
|
m_is_grand_prix.store(false);
|
||||||
|
m_extra_server_info = -1;
|
||||||
|
}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
void setGrandPrixTrack(int tracks_no)
|
||||||
|
{
|
||||||
|
m_is_grand_prix.store(true);
|
||||||
|
m_extra_server_info = tracks_no;
|
||||||
|
}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void addServerInfo(NetworkString* ns);
|
void addServerInfo(NetworkString* ns);
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void loadWorld();
|
void loadWorld();
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
bool isGrandPrix() const;
|
bool isGrandPrix() const { return m_is_grand_prix.load(); }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
bool hasExtraSeverInfo() const { return m_extra_server_info != -1; }
|
bool hasExtraSeverInfo() const { return m_extra_server_info != -1; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -615,6 +615,7 @@ void ClientLobby::handleServerInfo(Event* event)
|
|||||||
|
|
||||||
uint8_t extra_server_info = data.getUInt8();
|
uint8_t extra_server_info = data.getUInt8();
|
||||||
bool grand_prix_started = false;
|
bool grand_prix_started = false;
|
||||||
|
m_game_setup->resetExtraServerInfo();
|
||||||
switch (extra_server_info)
|
switch (extra_server_info)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -2660,6 +2660,7 @@ void ServerLobby::handleServerConfiguration(Event* event)
|
|||||||
race_manager->setMinorMode(modes.first);
|
race_manager->setMinorMode(modes.first);
|
||||||
race_manager->setMajorMode(modes.second);
|
race_manager->setMajorMode(modes.second);
|
||||||
race_manager->setDifficulty(RaceManager::Difficulty(new_difficulty));
|
race_manager->setDifficulty(RaceManager::Difficulty(new_difficulty));
|
||||||
|
m_game_setup->resetExtraServerInfo();
|
||||||
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER)
|
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER)
|
||||||
m_game_setup->setSoccerGoalTarget(new_soccer_goal_target);
|
m_game_setup->setSoccerGoalTarget(new_soccer_goal_target);
|
||||||
m_difficulty.store(new_difficulty);
|
m_difficulty.store(new_difficulty);
|
||||||
|
Loading…
Reference in New Issue
Block a user