mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-24 15:56:22 +00:00
Crash safely with an error when sphrase is missing on client
This commit is contained in:
parent
b38468036d
commit
ebb20fe86c
1 changed files with 7 additions and 5 deletions
|
@ -4504,17 +4504,19 @@ sint32 CSPhraseManager::getSheetFromPhrase(const CSPhraseCom &phrase) const
|
||||||
uint32 CSPhraseManager::getTotalActionMalus(const CSPhraseCom &phrase) const
|
uint32 CSPhraseManager::getTotalActionMalus(const CSPhraseCom &phrase) const
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||||
CSBrickManager *pBM= CSBrickManager::getInstance();
|
CSBrickManager *pBM = CSBrickManager::getInstance();
|
||||||
uint32 totalActionMalus= 0;
|
uint32 totalActionMalus = 0;
|
||||||
CCDBNodeLeaf *actMalus = _TotalMalusEquipLeaf ? &*_TotalMalusEquipLeaf
|
CCDBNodeLeaf *actMalus = _TotalMalusEquipLeaf ? &*_TotalMalusEquipLeaf
|
||||||
: &*(_TotalMalusEquipLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false));
|
: &*(_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
|
// root brick must not be Power or aura, because Action malus don't apply to them
|
||||||
// (ie leave 0 ActionMalus for Aura or Powers
|
// (ie leave 0 ActionMalus for Aura or Powers
|
||||||
if (!phrase.Bricks.empty())
|
if (!phrase.Bricks.empty())
|
||||||
{
|
{
|
||||||
CSBrickSheet *rootBrick= pBM->getBrick(phrase.Bricks[0]);
|
CSBrickSheet *rootBrick = pBM->getBrick(phrase.Bricks[0]);
|
||||||
if(actMalus && !rootBrick->isSpecialPower())
|
if (!rootBrick)
|
||||||
totalActionMalus= actMalus->getValue32();
|
nlerror("Invalid root sbrick in sphrase_com '%s'", phrase.Name.toUtf8().c_str());
|
||||||
|
else if (actMalus && !rootBrick->isSpecialPower())
|
||||||
|
totalActionMalus = actMalus->getValue32();
|
||||||
}
|
}
|
||||||
return totalActionMalus;
|
return totalActionMalus;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue