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

Simplified code

This commit is contained in:
Ivan Savenko 2024-02-13 23:49:00 +02:00
parent 45c971a405
commit 6d6137accc

View File

@ -1383,10 +1383,8 @@ bool CGameState::checkForVictory(const PlayerColor & player, const EventConditio
int total = 0; //creature counter
for(auto object : map->objects)
{
const CArmedInstance *ai = nullptr;
if(object
&& object->tempOwner == player //object controlled by player
&& (ai = dynamic_cast<const CArmedInstance *>(object.get()))) //contains army
const CArmedInstance *ai = dynamic_cast<const CArmedInstance *>(object.get());
if(ai && ai->getOwner() == player)
{
for(const auto & elem : ai->Slots()) //iterate through army
if(elem.second->getId() == condition.objectType.as<CreatureID>()) //it's searched creature