Przeglądaj źródła

- fix for #775
- fix for crash in battle options window

Ivan Savenko 14 lat temu
rodzic
commit
0893ed816f
2 zmienionych plików z 6 dodań i 12 usunięć
  1. 4 11
      client/CAnimation.cpp
  2. 2 1
      client/CBattleInterface.cpp

+ 4 - 11
client/CAnimation.cpp

@@ -73,16 +73,6 @@ public:
  *  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):
 	data(NULL),
 	palette(NULL)
@@ -119,7 +109,10 @@ CDefFile::CDefFile(std::string Name):
 		palette[i].b = data[it++];
 		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++)
 	{

+ 2 - 1
client/CBattleInterface.cpp

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