Avoid redundant per-frame calls to getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false)

--HG--
branch : kaetemi-optimize
This commit is contained in:
kaetemi 2013-07-28 00:29:32 +02:00
parent 0897092fe3
commit 2a57f6c647
2 changed files with 9 additions and 2 deletions

View file

@ -941,6 +941,8 @@ void CSPhraseManager::reset()
CSkillManager *pSM= CSkillManager::getInstance();
pBM->removeBrickLearnedCallback(&_ProgressionUpdate);
pSM->removeSkillChangeCallback(&_ProgressionUpdate);
_TotalMalusEquipLeaf = NULL;
}
// ***************************************************************************
@ -1122,7 +1124,9 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
// **** Compute Phrase Elements from phrase
// get the current action malus (0-100)
uint32 totalActionMalus= 0;
CCDBNodeLeaf *actMalus= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false);
CCDBNodeLeaf *actMalus = (CCDBNodeLeaf *)_TotalMalusEquipLeaf ? &*_TotalMalusEquipLeaf
: (_TotalMalusEquipLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false));
// root brick must not be Power or aura, because Action malus don't apply to them
// (ie leave 0 ActionMalus for Aura or Powers
if(actMalus && !rootBrick->isSpecialPower())
@ -4501,7 +4505,8 @@ uint32 CSPhraseManager::getTotalActionMalus(const CSPhraseCom &phrase) const
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CSBrickManager *pBM= CSBrickManager::getInstance();
uint32 totalActionMalus= 0;
CCDBNodeLeaf *actMalus= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false);
CCDBNodeLeaf *actMalus = (CCDBNodeLeaf *)_TotalMalusEquipLeaf ? &*_TotalMalusEquipLeaf
: (_TotalMalusEquipLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false));
// root brick must not be Power or aura, because Action malus don't apply to them
// (ie leave 0 ActionMalus for Aura or Powers
if (!phrase.Bricks.empty())

View file

@ -651,6 +651,8 @@ private:
void computePhraseProgression();
void insertProgressionSkillRecurs(SKILLS::ESkills skill, uint32 value, sint *skillReqLevel, std::vector<SKILLS::ESkills> &skillsToInsert);
mutable NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _TotalMalusEquipLeaf;
// @}
/// return the skill of the root