mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Simplified code
This commit is contained in:
@@ -1383,10 +1383,8 @@ bool CGameState::checkForVictory(const PlayerColor & player, const EventConditio
|
|||||||
int total = 0; //creature counter
|
int total = 0; //creature counter
|
||||||
for(auto object : map->objects)
|
for(auto object : map->objects)
|
||||||
{
|
{
|
||||||
const CArmedInstance *ai = nullptr;
|
const CArmedInstance *ai = dynamic_cast<const CArmedInstance *>(object.get());
|
||||||
if(object
|
if(ai && ai->getOwner() == player)
|
||||||
&& object->tempOwner == player //object controlled by player
|
|
||||||
&& (ai = dynamic_cast<const CArmedInstance *>(object.get()))) //contains army
|
|
||||||
{
|
{
|
||||||
for(const auto & elem : ai->Slots()) //iterate through army
|
for(const auto & elem : ai->Slots()) //iterate through army
|
||||||
if(elem.second->getId() == condition.objectType.as<CreatureID>()) //it's searched creature
|
if(elem.second->getId() == condition.objectType.as<CreatureID>()) //it's searched creature
|
||||||
|
Reference in New Issue
Block a user