Bladeren bron

Fix obstacle rendering

Ivan Savenko 2 jaren geleden
bovenliggende
commit
1558c28c0a
2 gewijzigde bestanden met toevoegingen van 8 en 7 verwijderingen
  1. 2 1
      client/battle/BattleObstacleController.cpp
  2. 6 6
      lib/battle/CObstacleInstance.h

+ 2 - 1
client/battle/BattleObstacleController.cpp

@@ -54,10 +54,11 @@ void BattleObstacleController::loadObstacleImage(const CObstacleInstance & oi)
 	{
 		if (oi.obstacleType == CObstacleInstance::ABSOLUTE_OBSTACLE)
 		{
-			// obstacle use single bitmap image for animations
+			// obstacle uses single bitmap image for animations
 			auto animation = std::make_shared<CAnimation>();
 			animation->setCustom(animationName, 0, 0);
 			animationsCache[animationName] = animation;
+			animation->preload();
 		}
 		else
 		{

+ 6 - 6
lib/battle/CObstacleInstance.h

@@ -18,17 +18,17 @@ class JsonSerializeFormat;
 
 struct DLL_LINKAGE CObstacleInstance
 {
-	BattleHex pos; //position on battlefield, typically left bottom corner
-	ui8 obstacleType; //if true, then position is meaningless
-	si32 uniqueID;
-	si32 ID; //ID of obstacle (defines type of it)
-
-	enum EObstacleType
+	enum EObstacleType : ui8
 	{
 		//ABSOLUTE needs an underscore because it's a Win
 		USUAL, ABSOLUTE_OBSTACLE, SPELL_CREATED, MOAT
 	};
 
+	BattleHex pos; //position on battlefield, typically left bottom corner
+	EObstacleType obstacleType;
+	si32 uniqueID;
+	si32 ID; //ID of obstacle (defines type of it)
+
 	CObstacleInstance();
 	virtual ~CObstacleInstance();