Jelajahi Sumber

Fixed moving creatures in garison in heroWindow

Michał W. Urbańczyk 17 tahun lalu
induk
melakukan
d7b5099b6f
2 mengubah file dengan 10 tambahan dan 1 penghapusan
  1. 1 0
      CHeroWindow.h
  2. 9 1
      CPlayerInterface.cpp

+ 1 - 0
CHeroWindow.h

@@ -134,4 +134,5 @@ public:
 
 	//friends
 	friend void CArtPlace::clickLeft(tribool down);
+	friend CPlayerInterface;
 };

+ 9 - 1
CPlayerInterface.cpp

@@ -345,6 +345,7 @@ void CGarrisonInt::deleteSlots()
 void CGarrisonInt::recreateSlots()
 {
 	splitting = false;
+	highlighted = NULL;
 	deactiveteSlots();
 	deleteSlots();
 	createSlots();
@@ -1913,11 +1914,18 @@ void CPlayerInterface::garrisonChanged(const CGObjectInstance * obj)
 			SDL_FreeSurface(heroWins[hh->subID]);
 			heroWins[hh->subID] = infoWin(hh);
 		}
-		if(castleInt == curint) //opened town window - redraw town garrsion slots (change is within hero garr) 
+		CHeroWindow * hw = dynamic_cast<CHeroWindow *>(curint);
+		if(hw)
+		{
+			hw->garInt->recreateSlots();
+			hw->garInt->show();
+		}
+		else if(castleInt == curint) //opened town window - redraw town garrsion slots (change is within hero garr) 
 		{
 			castleInt->garr->highlighted = NULL;
 			castleInt->garr->recreateSlots();
 		}
+		
 	}
 	else if (obj->ID == 98) //town
 	{