From 1558c28c0a72a3f40c9cb08512ca38196c544e6a Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 12 Dec 2022 00:05:00 +0200 Subject: [PATCH] Fix obstacle rendering --- client/battle/BattleObstacleController.cpp | 3 ++- lib/battle/CObstacleInstance.h | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/battle/BattleObstacleController.cpp b/client/battle/BattleObstacleController.cpp index da16c579f..b7fb78d14 100644 --- a/client/battle/BattleObstacleController.cpp +++ b/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(); animation->setCustom(animationName, 0, 0); animationsCache[animationName] = animation; + animation->preload(); } else { diff --git a/lib/battle/CObstacleInstance.h b/lib/battle/CObstacleInstance.h index c668b8ba4..1ca3d38fb 100644 --- a/lib/battle/CObstacleInstance.h +++ b/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();