1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix crash on clicking on map when player is not making turn in MP

This commit is contained in:
Ivan Savenko 2024-07-03 16:52:31 +00:00
parent 5ccf6750ab
commit 2584432b92
2 changed files with 7 additions and 3 deletions

View File

@ -168,7 +168,7 @@ void PlayerLocalState::setSelection(const CArmedInstance * selection)
currentSelection = selection;
if (selection)
if (adventureInt && selection)
adventureInt->onSelectionChanged(selection);
}
@ -212,6 +212,9 @@ void PlayerLocalState::addWanderingHero(const CGHeroInstance * hero)
assert(hero);
assert(!vstd::contains(wanderingHeroes, hero));
wanderingHeroes.push_back(hero);
if (currentSelection == nullptr)
setSelection(hero);
}
void PlayerLocalState::removeWanderingHero(const CGHeroInstance * hero)
@ -260,6 +263,9 @@ void PlayerLocalState::addOwnedTown(const CGTownInstance * town)
assert(town);
assert(!vstd::contains(ownedTowns, town));
ownedTowns.push_back(town);
if (currentSelection == nullptr)
setSelection(town);
}
void PlayerLocalState::removeOwnedTown(const CGTownInstance * town)

View File

@ -395,8 +395,6 @@ void AdventureMapInterface::adjustActiveness()
void AdventureMapInterface::onCurrentPlayerChanged(PlayerColor playerID)
{
LOCPLINT->localState->setSelection(nullptr);
if (playerID == currentPlayerID)
return;