1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-08 23:36:33 +02:00

Fix hotseat

This commit is contained in:
Ivan Savenko 2023-09-26 17:28:50 +03:00
parent 0a0c01d639
commit 42030ed10f

View File

@ -167,16 +167,6 @@ void CPlayerInterface::initGameInterface(std::shared_ptr<Environment> ENV, std::
CCS->musich->loadTerrainMusicThemes(); CCS->musich->loadTerrainMusicThemes();
initializeHeroTownList(); initializeHeroTownList();
// always recreate advmap interface to avoid possible memory-corruption bugs
adventureInt.reset(new AdventureMapInterface());
if(GH.windows().findWindows<AdventureMapInterface>().empty())
{
// after map load - remove all active windows and replace them with adventure map
GH.windows().clear();
GH.windows().pushWindow(adventureInt);
}
} }
void CPlayerInterface::playerEndsTurn(PlayerColor player) void CPlayerInterface::playerEndsTurn(PlayerColor player)
@ -213,6 +203,16 @@ void CPlayerInterface::playerEndsTurn(PlayerColor player)
void CPlayerInterface::playerStartsTurn(PlayerColor player) void CPlayerInterface::playerStartsTurn(PlayerColor player)
{ {
if(GH.windows().findWindows<AdventureMapInterface>().empty())
{
// after map load - remove all active windows and replace them with adventure map
// always recreate advmap interface to avoid possible memory-corruption bugs
adventureInt.reset(new AdventureMapInterface());
GH.windows().clear();
GH.windows().pushWindow(adventureInt);
}
EVENT_HANDLER_CALLED_BY_CLIENT; EVENT_HANDLER_CALLED_BY_CLIENT;
if (player != playerID && LOCPLINT == this) if (player != playerID && LOCPLINT == this)
{ {