mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
CGameHandler: fix hero removal code on player loss. Fix issue 2347
This commit is contained in:
parent
9e6f836b25
commit
d900e9bec2
@ -4827,11 +4827,15 @@ void CGameHandler::checkVictoryLossConditionsForPlayer(PlayerColor player)
|
||||
}
|
||||
else
|
||||
{
|
||||
//player lost -> all his objects become unflagged (neutral)
|
||||
for (auto h : p->heroes) //eliminate heroes
|
||||
if (h.get())
|
||||
//copy heroes vector to avoid iterator invalidation as removal change PlayerState
|
||||
auto hlp = p->heroes;
|
||||
for(auto h : hlp) //eliminate heroes
|
||||
{
|
||||
if(h.get())
|
||||
removeObject(h);
|
||||
}
|
||||
|
||||
//player lost -> all his objects become unflagged (neutral)
|
||||
for (auto obj : gs->map->objects) //unflag objs
|
||||
{
|
||||
if(obj.get() && obj->tempOwner == player)
|
||||
|
Loading…
Reference in New Issue
Block a user