1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

* fixed #438 and crash on ZMM170S.DEF

This commit is contained in:
mateuszb
2010-07-15 16:21:53 +00:00
parent 1c15ee34e5
commit af52f308a2
2 changed files with 5 additions and 9 deletions

View File

@@ -459,6 +459,7 @@ CTerrainRect::CTerrainRect()
pos.h=ADVOPT.advmapH;
moveX = moveY = 0;
arrows = CDefHandler::giveDef("ADAG.DEF");
for(size_t y=0; y < arrows->ourImages.size(); ++y)
{
CSDL_Ext::alphaTransform(arrows->ourImages[y].bitmap);

View File

@@ -235,21 +235,15 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, co
if (SegmentType==0xFF)
{
for (unsigned int k=0; k<SegmentLength;k++)
{
(reinterpret_cast<char*>(ret->pixels))[ftcp++]=FDef[BaseOffset+k];
if ((TotalRowLength+k)>=SpriteWidth)
break;
}
memcpy(reinterpret_cast<char*>(ret->pixels)+ftcp, FDef + BaseOffset, SegmentLength);
BaseOffset+=SegmentLength;
TotalRowLength+=SegmentLength;
}
else
{
memset(reinterpret_cast<char*>(ret->pixels)+ftcp, SegmentType, SegmentLength);
ftcp += SegmentLength;
TotalRowLength += SegmentLength;
}
ftcp += SegmentLength;
TotalRowLength += SegmentLength;
}while(TotalRowLength<SpriteWidth);
RowAdd=SpriteWidth-TotalRowLength;
@@ -322,6 +316,7 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const unsigned char * FDef, co
unsigned char value = (SegmentType & 31) + 1;
int len = std::min<unsigned int>(value, SpriteWidth - TotalRowLength) - std::max(0, -LeftMargin);
amax(len, 0);
if(code==7)
{