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

--HG--
branch : kaetemi-optimize
hg/feature/sound
kaetemi 11 years ago
parent 0897092fe3
commit 2a57f6c647

@ -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())

@ -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

Loading…
Cancel
Save