mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-21 12:06:49 +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;
|
currentSelection = selection;
|
||||||
|
|
||||||
if (selection)
|
if (adventureInt && selection)
|
||||||
adventureInt->onSelectionChanged(selection);
|
adventureInt->onSelectionChanged(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,6 +212,9 @@ void PlayerLocalState::addWanderingHero(const CGHeroInstance * hero)
|
|||||||
assert(hero);
|
assert(hero);
|
||||||
assert(!vstd::contains(wanderingHeroes, hero));
|
assert(!vstd::contains(wanderingHeroes, hero));
|
||||||
wanderingHeroes.push_back(hero);
|
wanderingHeroes.push_back(hero);
|
||||||
|
|
||||||
|
if (currentSelection == nullptr)
|
||||||
|
setSelection(hero);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerLocalState::removeWanderingHero(const CGHeroInstance * hero)
|
void PlayerLocalState::removeWanderingHero(const CGHeroInstance * hero)
|
||||||
@ -260,6 +263,9 @@ void PlayerLocalState::addOwnedTown(const CGTownInstance * town)
|
|||||||
assert(town);
|
assert(town);
|
||||||
assert(!vstd::contains(ownedTowns, town));
|
assert(!vstd::contains(ownedTowns, town));
|
||||||
ownedTowns.push_back(town);
|
ownedTowns.push_back(town);
|
||||||
|
|
||||||
|
if (currentSelection == nullptr)
|
||||||
|
setSelection(town);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerLocalState::removeOwnedTown(const CGTownInstance * town)
|
void PlayerLocalState::removeOwnedTown(const CGTownInstance * town)
|
||||||
|
@ -395,8 +395,6 @@ void AdventureMapInterface::adjustActiveness()
|
|||||||
|
|
||||||
void AdventureMapInterface::onCurrentPlayerChanged(PlayerColor playerID)
|
void AdventureMapInterface::onCurrentPlayerChanged(PlayerColor playerID)
|
||||||
{
|
{
|
||||||
LOCPLINT->localState->setSelection(nullptr);
|
|
||||||
|
|
||||||
if (playerID == currentPlayerID)
|
if (playerID == currentPlayerID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user