|
|
@@ -1036,10 +1036,14 @@ IImage * CMapHandler::CMapBlitter::findBoatFlagBitmap(const CGBoat * boat, int a
|
|
|
|
|
|
IImage * CMapHandler::CMapBlitter::findFlagBitmapInternal(std::shared_ptr<CAnimation> animation, int anim, int group, ui8 dir, bool moving) const
|
|
|
{
|
|
|
+ size_t groupSize = animation->size(group);
|
|
|
+ if(groupSize == 0)
|
|
|
+ return nullptr;
|
|
|
+
|
|
|
if(moving)
|
|
|
- return animation->getImage(anim % animation->size(group), group);
|
|
|
+ return animation->getImage(anim % groupSize, group);
|
|
|
else
|
|
|
- return animation->getImage((anim / 4) % animation->size(group), group);
|
|
|
+ return animation->getImage((anim / 4) % groupSize, group);
|
|
|
}
|
|
|
|
|
|
CMapHandler::AnimBitmapHolder CMapHandler::CMapBlitter::findObjectBitmap(const CGObjectInstance * obj, int anim) const
|
|
|
@@ -1053,7 +1057,13 @@ CMapHandler::AnimBitmapHolder CMapHandler::CMapBlitter::findObjectBitmap(const C
|
|
|
|
|
|
// normal object
|
|
|
std::shared_ptr<CAnimation> animation = graphics->getAnimation(obj);
|
|
|
- IImage * bitmap = animation->getImage((anim + getPhaseShift(obj)) % animation->size());
|
|
|
+ size_t groupSize = animation->size();
|
|
|
+ if(groupSize == 0)
|
|
|
+ return CMapHandler::AnimBitmapHolder();
|
|
|
+
|
|
|
+ IImage * bitmap = animation->getImage((anim + getPhaseShift(obj)) % groupSize);
|
|
|
+ if(!bitmap)
|
|
|
+ return CMapHandler::AnimBitmapHolder();
|
|
|
|
|
|
bitmap->setFlagColor(obj->tempOwner);
|
|
|
|