From f9b5ca33747e23c2dd01224bb39e4160e3bbeb9f Mon Sep 17 00:00:00 2001 From: dydzio Date: Wed, 28 Sep 2016 00:20:45 +0200 Subject: [PATCH] Remove max mana info leak + tiny refactor --- client/battle/CBattleInterfaceClasses.cpp | 16 ++++++++-------- client/battle/CBattleInterfaceClasses.h | 10 ---------- lib/CGameInfoCallback.cpp | 3 +++ 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/client/battle/CBattleInterfaceClasses.cpp b/client/battle/CBattleInterfaceClasses.cpp index afc8e3588..3bfd26527 100644 --- a/client/battle/CBattleInterfaceClasses.cpp +++ b/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); diff --git a/client/battle/CBattleInterfaceClasses.h b/client/battle/CBattleInterfaceClasses.h index 40e354caa..2a1c0a1ec 100644 --- a/client/battle/CBattleInterfaceClasses.h +++ b/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 diff --git a/lib/CGameInfoCallback.cpp b/lib/CGameInfoCallback.cpp index 54effd756..dc2a12a10 100644 --- a/lib/CGameInfoCallback.cpp +++ b/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)