mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-10 09:19:01 +00:00
Fix EGS sheet rebuild crashes
This commit is contained in:
parent
4a95333992
commit
32c0f2d7f7
2 changed files with 46 additions and 48 deletions
|
@ -237,24 +237,12 @@ void SItemSpecialEffects::serial(class NLMISC::IStream &f)
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
// init()
|
// init()
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
void CStaticItem::init()
|
void CStaticItem::init(bool doDelete)
|
||||||
{
|
{
|
||||||
Family = ITEMFAMILY::UNDEFINED;
|
Family = ITEMFAMILY::UNDEFINED;
|
||||||
Type = ITEM_TYPE::UNDEFINED;
|
Type = ITEM_TYPE::UNDEFINED;
|
||||||
|
|
||||||
Armor = NULL;
|
clearPtrs(doDelete);
|
||||||
MeleeWeapon = NULL;
|
|
||||||
RangeWeapon = NULL;
|
|
||||||
Ammo = NULL;
|
|
||||||
Shield = NULL;
|
|
||||||
TamingTool = NULL;
|
|
||||||
Mp = NULL;
|
|
||||||
GuildOption = NULL;
|
|
||||||
Cosmetics = NULL;
|
|
||||||
ItemServiceData = NULL;
|
|
||||||
ConsumableItem = NULL;
|
|
||||||
XpCatalyser = NULL;
|
|
||||||
CommandTicket = NULL;
|
|
||||||
|
|
||||||
Skill = SKILLS::unknown;
|
Skill = SKILLS::unknown;
|
||||||
MinSkill = 0;
|
MinSkill = 0;
|
||||||
|
@ -287,16 +275,54 @@ void CStaticItem::init()
|
||||||
RequiredCharacQualityFactor = 0.0f;
|
RequiredCharacQualityFactor = 0.0f;
|
||||||
RequiredCharacQualityOffset = 0;
|
RequiredCharacQualityOffset = 0;
|
||||||
|
|
||||||
ItemSpecialEffects = NULL;
|
|
||||||
} // init //
|
} // init //
|
||||||
|
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
void CStaticItem::clearPtrs(bool doDelete)
|
||||||
|
{
|
||||||
|
if (doDelete)
|
||||||
|
{
|
||||||
|
delete Armor;
|
||||||
|
delete MeleeWeapon;
|
||||||
|
delete RangeWeapon;
|
||||||
|
delete Ammo;
|
||||||
|
delete Shield;
|
||||||
|
delete TamingTool;
|
||||||
|
delete Mp;
|
||||||
|
delete GuildOption;
|
||||||
|
delete Cosmetics;
|
||||||
|
delete ItemServiceData;
|
||||||
|
delete ConsumableItem;
|
||||||
|
delete XpCatalyser;
|
||||||
|
delete CommandTicket;
|
||||||
|
delete ItemSpecialEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
Armor = NULL;
|
||||||
|
MeleeWeapon = NULL;
|
||||||
|
RangeWeapon = NULL;
|
||||||
|
Ammo = NULL;
|
||||||
|
Shield = NULL;
|
||||||
|
TamingTool = NULL;
|
||||||
|
Mp = NULL;
|
||||||
|
GuildOption = NULL;
|
||||||
|
Cosmetics = NULL;
|
||||||
|
ItemServiceData = NULL;
|
||||||
|
ConsumableItem = NULL;
|
||||||
|
XpCatalyser = NULL;
|
||||||
|
CommandTicket = NULL;
|
||||||
|
ItemSpecialEffects = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
// copy constructor
|
// copy constructor
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
CStaticItem::CStaticItem( const CStaticItem& itm )
|
CStaticItem::CStaticItem( const CStaticItem& itm )
|
||||||
{
|
{
|
||||||
|
clearPtrs(false);
|
||||||
|
|
||||||
*this = itm;
|
*this = itm;
|
||||||
if(itm.Armor)
|
if(itm.Armor)
|
||||||
{
|
{
|
||||||
|
@ -1443,6 +1469,9 @@ void CStaticItem::readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form,
|
||||||
if (form == NULL)
|
if (form == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Clear pointers to previous data
|
||||||
|
clearPtrs(true);
|
||||||
|
|
||||||
// Get the root node, always exist
|
// Get the root node, always exist
|
||||||
UFormElm &root = form->getRootNode ();
|
UFormElm &root = form->getRootNode ();
|
||||||
|
|
||||||
|
@ -1993,37 +2022,6 @@ float CStaticItem::getBaseWeight() const
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CStaticItem::clearPtrs(bool doDelete)
|
|
||||||
{
|
|
||||||
if(doDelete)
|
|
||||||
{
|
|
||||||
if (Ammo != NULL ) delete Ammo;
|
|
||||||
if (Armor != NULL ) delete Armor;
|
|
||||||
if (MeleeWeapon != NULL ) delete MeleeWeapon;
|
|
||||||
if (RangeWeapon != NULL ) delete RangeWeapon;
|
|
||||||
if (Cosmetics != NULL ) delete Cosmetics;
|
|
||||||
if (Mp != NULL ) delete Mp;
|
|
||||||
if (GuildOption != NULL ) delete GuildOption;
|
|
||||||
if (Shield != NULL ) delete Shield;
|
|
||||||
if (TamingTool != NULL) delete TamingTool;
|
|
||||||
if (ItemServiceData != NULL) delete ItemServiceData;
|
|
||||||
if (CommandTicket != NULL) delete CommandTicket;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ammo = NULL;
|
|
||||||
Armor = NULL;
|
|
||||||
MeleeWeapon = NULL;
|
|
||||||
RangeWeapon = NULL;
|
|
||||||
Cosmetics = NULL;
|
|
||||||
Mp = NULL;
|
|
||||||
GuildOption = NULL;
|
|
||||||
Shield = NULL;
|
|
||||||
TamingTool = NULL;
|
|
||||||
ItemServiceData = NULL;
|
|
||||||
CommandTicket = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint32 CStaticItem::getMaxStackSize() const
|
uint32 CStaticItem::getMaxStackSize() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -812,13 +812,13 @@ public:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
CStaticItem() { init(); }
|
CStaticItem() { init(false); }
|
||||||
|
|
||||||
/// copy constructor
|
/// copy constructor
|
||||||
CStaticItem( const CStaticItem& itm );
|
CStaticItem( const CStaticItem& itm );
|
||||||
|
|
||||||
/// init method
|
/// init method
|
||||||
void init();
|
void init(bool doDelete = true);
|
||||||
|
|
||||||
/// destructor
|
/// destructor
|
||||||
virtual ~CStaticItem();
|
virtual ~CStaticItem();
|
||||||
|
|
Loading…
Reference in a new issue