Fix ryzomclassic/#14 crash on spell crystalize. Add TLogContext_Item_EnchantPhrase log context

ryzomclassic-develop
kaetemi 5 years ago
parent 613bb7ccd0
commit 84e924b496

@ -1857,6 +1857,7 @@ void CMagicPhrase::setPrimaryTarget( const TDataSetRow &entityRowId ) // virtual
void CMagicPhrase::enchantPhrase(CCharacter * user,float successFactor)
{
H_AUTO(CMagicPhrase_enchantPhrase);
TLogContext_Item_EnchantPhrase(user->getId());
MBEHAV::CBehaviour behav;
uint moneyCost = uint( getSabrinaCost() * CristalMoneyFactor );

@ -1187,6 +1187,29 @@ TLogContext_Item_OutpostDriller::~TLogContext_Item_OutpostDriller()
}
const std::string TLogContext_Item_EnchantPhrase::_ContextName("Item_EnchantPhrase");
/// The constructor push a log context in the logger system
TLogContext_Item_EnchantPhrase::TLogContext_Item_EnchantPhrase(const NLMISC::CEntityId &charId)
{
if (LGS::ILoggerServiceClient::isInitialized())
LGS::ILoggerServiceClient::getInstance()->pushLogContext(_ContextName);
// stack the context param in the context class object
ItemDesc.pushContextVar_charId(charId);
}
/// The destructor pop a context in the logger system
TLogContext_Item_EnchantPhrase::~TLogContext_Item_EnchantPhrase()
{
if (LGS::ILoggerServiceClient::isInitialized())
LGS::ILoggerServiceClient::getInstance()->popLogContext(_ContextName);
// pop the context param in the context class object
ItemDesc.popContextVar_charId();
}
/// No context context. Use this to disable any contextual log underneath
TLogNoContext_Item::TLogNoContext_Item()

@ -383,6 +383,21 @@ private:
static const std::string _ContextName;
};
struct TLogContext_Item_EnchantPhrase
{
/// The constructor push a log context in the logger system
TLogContext_Item_EnchantPhrase(const NLMISC::CEntityId &charId);
/// The desstructor pop a context in the logger system
~TLogContext_Item_EnchantPhrase();
private:
/// The name of the context
static const std::string _ContextName;
};

Loading…
Cancel
Save