Cleanup enchant context, ryzomclassic/#37

ryzomclassic-develop
kaetemi 5 years ago
parent d496d54ac4
commit 024447d9fb

@ -97,7 +97,7 @@ protected:
if ( !user ) if ( !user )
return; return;
TLogContext_Item_RechargeSapLoad logContext(user->getId()); TLogContext_Item_SapRechargeSpell logContext(user->getId());
uint moneyCost = uint( phrase->getSabrinaCost() * RechargeMoneyFactor ); uint moneyCost = uint( phrase->getSabrinaCost() * RechargeMoneyFactor );
if ( ! moneyCost ) if ( ! moneyCost )

@ -2605,6 +2605,7 @@ void CCharacter::enchantOrRechargeItem(INVENTORIES::TInventory invId, uint32 slo
if (item == NULL) if (item == NULL)
return; return;
TLogContext_Item_EnchantOrRecharge logContext(_Id);
if (item->getSheetId() == crystalSheetId) if (item->getSheetId() == crystalSheetId)
{ {
enchantItem(invId, slot); enchantItem(invId, slot);
@ -2724,8 +2725,6 @@ void CCharacter::enchantItem(INVENTORIES::TInventory invId, uint32 slot)
{ {
if (checkSlotsForEnchantOrRecharge(invId, slot, true)) if (checkSlotsForEnchantOrRecharge(invId, slot, true))
{ {
TLogContext_Item_EnchantItem logContext(_Id);
CInventoryPtr inv = getInventory(invId); CInventoryPtr inv = getInventory(invId);
CInventoryPtr handlingInv = getInventory(INVENTORIES::handling); CInventoryPtr handlingInv = getInventory(INVENTORIES::handling);
nlassert(inv != NULL); nlassert(inv != NULL);

@ -580,8 +580,8 @@ public:
{ {
LGS::TLogDefinition &logDef = _LogDefs[37]; LGS::TLogDefinition &logDef = _LogDefs[37];
logDef.setLogName("Item_EnchantItem"); logDef.setLogName("Item_EnchantOrRecharge");
logDef.setLogText("A player character enchants an item with a crystallized spell phrase"); logDef.setLogText("A player character enchants an item with a crystallized spell phrase or recharges the sap load");
logDef.setContext(true); logDef.setContext(true);
} }
@ -589,8 +589,8 @@ public:
{ {
LGS::TLogDefinition &logDef = _LogDefs[38]; LGS::TLogDefinition &logDef = _LogDefs[38];
logDef.setLogName("Item_RechargeSapLoad"); logDef.setLogName("Item_SapRechargeSpell");
logDef.setLogText("A player character recharges the sap load of an item"); logDef.setLogText("A player character creates a sap load recharge");
logDef.setContext(true); logDef.setContext(true);
} }
@ -1301,9 +1301,9 @@ TLogContext_Item_EnchantPhrase::~TLogContext_Item_EnchantPhrase()
} }
const std::string TLogContext_Item_EnchantItem::_ContextName("Item_EnchantItem"); const std::string TLogContext_Item_EnchantOrRecharge::_ContextName("Item_EnchantOrRecharge");
/// The constructor push a log context in the logger system /// The constructor push a log context in the logger system
TLogContext_Item_EnchantItem::TLogContext_Item_EnchantItem(const NLMISC::CEntityId &charId) TLogContext_Item_EnchantOrRecharge::TLogContext_Item_EnchantOrRecharge(const NLMISC::CEntityId &charId)
{ {
if (LGS::ILoggerServiceClient::isInitialized()) if (LGS::ILoggerServiceClient::isInitialized())
LGS::ILoggerServiceClient::getInstance()->pushLogContext(_ContextName); LGS::ILoggerServiceClient::getInstance()->pushLogContext(_ContextName);
@ -1314,7 +1314,7 @@ TLogContext_Item_EnchantItem::TLogContext_Item_EnchantItem(const NLMISC::CEntity
} }
/// The destructor pop a context in the logger system /// The destructor pop a context in the logger system
TLogContext_Item_EnchantItem::~TLogContext_Item_EnchantItem() TLogContext_Item_EnchantOrRecharge::~TLogContext_Item_EnchantOrRecharge()
{ {
if (LGS::ILoggerServiceClient::isInitialized()) if (LGS::ILoggerServiceClient::isInitialized())
LGS::ILoggerServiceClient::getInstance()->popLogContext(_ContextName); LGS::ILoggerServiceClient::getInstance()->popLogContext(_ContextName);
@ -1324,9 +1324,9 @@ TLogContext_Item_EnchantItem::~TLogContext_Item_EnchantItem()
} }
const std::string TLogContext_Item_RechargeSapLoad::_ContextName("Item_RechargeSapLoad"); const std::string TLogContext_Item_SapRechargeSpell::_ContextName("Item_SapRechargeSpell");
/// The constructor push a log context in the logger system /// The constructor push a log context in the logger system
TLogContext_Item_RechargeSapLoad::TLogContext_Item_RechargeSapLoad(const NLMISC::CEntityId &charId) TLogContext_Item_SapRechargeSpell::TLogContext_Item_SapRechargeSpell(const NLMISC::CEntityId &charId)
{ {
if (LGS::ILoggerServiceClient::isInitialized()) if (LGS::ILoggerServiceClient::isInitialized())
LGS::ILoggerServiceClient::getInstance()->pushLogContext(_ContextName); LGS::ILoggerServiceClient::getInstance()->pushLogContext(_ContextName);
@ -1337,7 +1337,7 @@ TLogContext_Item_RechargeSapLoad::TLogContext_Item_RechargeSapLoad(const NLMISC:
} }
/// The destructor pop a context in the logger system /// The destructor pop a context in the logger system
TLogContext_Item_RechargeSapLoad::~TLogContext_Item_RechargeSapLoad() TLogContext_Item_SapRechargeSpell::~TLogContext_Item_SapRechargeSpell()
{ {
if (LGS::ILoggerServiceClient::isInitialized()) if (LGS::ILoggerServiceClient::isInitialized())
LGS::ILoggerServiceClient::getInstance()->popLogContext(_ContextName); LGS::ILoggerServiceClient::getInstance()->popLogContext(_ContextName);

@ -430,13 +430,13 @@ private:
}; };
struct TLogContext_Item_EnchantItem struct TLogContext_Item_EnchantOrRecharge
{ {
/// The constructor push a log context in the logger system /// The constructor push a log context in the logger system
TLogContext_Item_EnchantItem(const NLMISC::CEntityId &charId); TLogContext_Item_EnchantOrRecharge(const NLMISC::CEntityId &charId);
/// The desstructor pop a context in the logger system /// The desstructor pop a context in the logger system
~TLogContext_Item_EnchantItem(); ~TLogContext_Item_EnchantOrRecharge();
private: private:
/// The name of the context /// The name of the context
@ -445,13 +445,13 @@ private:
}; };
struct TLogContext_Item_RechargeSapLoad struct TLogContext_Item_SapRechargeSpell
{ {
/// The constructor push a log context in the logger system /// The constructor push a log context in the logger system
TLogContext_Item_RechargeSapLoad(const NLMISC::CEntityId &charId); TLogContext_Item_SapRechargeSpell(const NLMISC::CEntityId &charId);
/// The desstructor pop a context in the logger system /// The desstructor pop a context in the logger system
~TLogContext_Item_RechargeSapLoad(); ~TLogContext_Item_SapRechargeSpell();
private: private:
/// The name of the context /// The name of the context

Loading…
Cancel
Save