Pārlūkot izejas kodu

Remove max mana info leak + tiny refactor

dydzio 9 gadi atpakaļ
vecāks
revīzija
f9b5ca3374

+ 8 - 8
client/battle/CBattleInterfaceClasses.cpp

@@ -649,14 +649,14 @@ CHeroInfoWindow::CHeroInfoWindow(const InfoAboutHero &hero, Point *position) : C
 		moveTo(*position);
 	background->colorize(hero.owner); //maybe add this functionality to base class?
 
-	attack = hero.details->primskills[0];
-	defense = hero.details->primskills[1];
-	power = hero.details->primskills[2];
-	knowledge = hero.details->primskills[3];
-	morale = hero.details->morale;
-	luck = hero.details->luck;
-	currentSpellPoints = hero.details->mana;
-	maxSpellPoints = hero.details->manaLimit;
+	int attack = hero.details->primskills[0];
+	int defense = hero.details->primskills[1];
+	int power = hero.details->primskills[2];
+	int knowledge = hero.details->primskills[3];
+	int morale = hero.details->morale;
+	int luck = hero.details->luck;
+	int currentSpellPoints = hero.details->mana;
+	int maxSpellPoints = hero.details->manaLimit;
 
 	new CAnimImage("PortraitsLarge", hero.portrait, 0, 10, 6);
 

+ 0 - 10
client/battle/CBattleInterfaceClasses.h

@@ -74,16 +74,6 @@ class CHeroInfoWindow : public CWindowObject
 {
 public:
 	CHeroInfoWindow(const InfoAboutHero &hero, Point *position);
-
-private:
-	int attack;
-	int defense;
-	int power;
-	int knowledge;
-	int morale;
-	int luck;
-	int currentSpellPoints;
-	int maxSpellPoints;
 };
 
 /// Class which manages the battle options window

+ 3 - 0
lib/CGameInfoCallback.cpp

@@ -292,6 +292,9 @@ bool CGameInfoCallback::getHeroInfo(const CGObjectInstance * hero, InfoAboutHero
 
 	dest.initFromHero(h, accessFlag);
 
+	if (accessFlag && !gs->curB)
+		dest.details->manaLimit = -1; //we do not want to leak max mana info outside battle so set to meaningless value
+
 	//DISGUISED bonus implementation
 
 	if(getPlayerRelations(getLocalPlayer(), hero->tempOwner) == PlayerRelations::ENEMIES)