1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-21 00:19:29 +02:00
- fix for crash in battle options window
This commit is contained in:
Ivan Savenko
2011-07-27 09:35:27 +00:00
parent 2047862eb1
commit 0893ed816f
2 changed files with 6 additions and 12 deletions

View File

@ -73,16 +73,6 @@ public:
* DefFile, class used for def loading * * DefFile, class used for def loading *
*************************************************************************/ *************************************************************************/
size_t getPaletteSize(int type)
{
switch (type)
{
case 66: return 32;
case 71: return 4;
default: return 20;
}
}
CDefFile::CDefFile(std::string Name): CDefFile::CDefFile(std::string Name):
data(NULL), data(NULL),
palette(NULL) palette(NULL)
@ -119,7 +109,10 @@ CDefFile::CDefFile(std::string Name):
palette[i].b = data[it++]; palette[i].b = data[it++];
palette[i].unused = 255; palette[i].unused = 255;
} }
memcpy(palette, H3Palette, getPaletteSize(type));//initialize shadow\selection colors if (type == 71)//Buttons/buildings don't have shadows\semi-transparency
memset(palette, 0, sizeof(SDL_Color)*8);
else
memcpy(palette, H3Palette, sizeof(SDL_Color)*8);//initialize shadow\selection colors
for (unsigned int i=0; i<totalBlocks; i++) for (unsigned int i=0; i<totalBlocks; i++)
{ {

View File

@ -3584,6 +3584,7 @@ void CBattleInterface::showPieceOfWall(SDL_Surface * to, int hex, const std::vec
void CBattleInterface::redrawBackgroundWithHexes(const CStack * activeStack) void CBattleInterface::redrawBackgroundWithHexes(const CStack * activeStack)
{ {
attackableHexes.clear(); attackableHexes.clear();
if (activeStack)
occupyableHexes = curInt->cb->battleGetAvailableHexes(activeStack, true, &attackableHexes); occupyableHexes = curInt->cb->battleGetAvailableHexes(activeStack, true, &attackableHexes);
//preparating background graphic with hexes and shaded hexes //preparating background graphic with hexes and shaded hexes