1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-29 00:41:38 +02:00

bugfixing:

- fixed parsing of campaign bonuses (conversion to building ID)
- CONTROL event condition can be also fulfilled by allies
- fix for crash on opening exchange window in Russian version
This commit is contained in:
Ivan Savenko
2014-02-26 17:32:42 +00:00
parent d049abe644
commit 78609871ae
3 changed files with 38 additions and 29 deletions

View File

@ -2438,16 +2438,20 @@ bool CGameState::checkForVictory( PlayerColor player, const EventCondition & con
}
case EventCondition::CONTROL:
{
// list of players that need to control object to fulfull condition
// NOTE: cgameinfocallback specified explicitly in order to get const version
auto & team = CGameInfoCallback::getPlayerTeam(player)->players;
if (condition.object) // mode A - flag one specific object, like town
{
return condition.object->tempOwner == player;
return team.count(condition.object->tempOwner) != 0;
}
else
{
for(auto & elem : map->objects) // mode B - flag all objects of this type
{
//check not flagged objs
if(elem && elem->tempOwner != player && elem->ID == condition.objectType)
if ( elem && elem->ID == condition.objectType && team.count(elem->tempOwner) == 0 )
return false;
}
return true;