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:
parent
5ccf6750ab
commit
2584432b92
@ -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)
|
||||
|
@ -395,8 +395,6 @@ void AdventureMapInterface::adjustActiveness()
|
||||
|
||||
void AdventureMapInterface::onCurrentPlayerChanged(PlayerColor playerID)
|
||||
{
|
||||
LOCPLINT->localState->setSelection(nullptr);
|
||||
|
||||
if (playerID == currentPlayerID)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user