1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fixed CID 1366287, CID 1366286

This commit is contained in:
AlexVinS 2016-11-25 23:02:13 +03:00
parent 5058d5771e
commit a497824288

View File

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