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:
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
}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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user