Ver Fonte

Initialize new animations if current one is over

Ivan Savenko há 2 anos atrás
pai
commit
d157735846
1 ficheiros alterados com 5 adições e 10 exclusões
  1. 5 10
      client/battle/BattleStacksController.cpp

+ 5 - 10
client/battle/BattleStacksController.cpp

@@ -350,27 +350,22 @@ void BattleStacksController::updateBattleAnimations()
 {
 	// operate on copy - to prevent potential iterator invalidation due to push_back's
 	// FIXME? : remove remaining calls to addNewAnim from BattleAnimation::nextFrame (only Catapult explosion at the time of writing)
+
 	auto copiedVector = currentAnimations;
 
 	for (auto & elem : copiedVector)
-	{
-		if (!elem)
-			continue;
-
-		if (elem->isInitialized())
+		if (elem && elem->isInitialized())
 			elem->nextFrame();
-		else
+
+	for (auto & elem : copiedVector)
+		if (elem && !elem->isInitialized())
 			elem->tryInitialize();
-	}
 
 	bool hadAnimations = !currentAnimations.empty();
 	vstd::erase(currentAnimations, nullptr);
 
 	if (hadAnimations && currentAnimations.empty())
-	{
-		//anims ended
 		owner.setAnimationCondition(EAnimationEvents::ACTION, false);
-	}
 }
 
 void BattleStacksController::addNewAnim(BattleAnimation *anim)