Browse Source

Simplified code

Ivan Savenko 1 year ago
parent
commit
6d6137accc
1 changed files with 2 additions and 4 deletions
  1. 2 4
      lib/gameState/CGameState.cpp

+ 2 - 4
lib/gameState/CGameState.cpp

@@ -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