Disable game item ptr debug code when item ptr debug is disabled...

ryzomclassic-develop
kaetemi 4 years ago
parent a5e9542f2f
commit 60f61caa2c

@ -749,7 +749,9 @@ void CGameItemPtr::deleteItem()
// call dtor now to unlink all children // call dtor now to unlink all children
item->dtor(); item->dtor();
// check no one else is referencing us // check no one else is referencing us
#ifdef GAME_PTR_DEBUG
nlassert(item->_Ptrs.empty()); nlassert(item->_Ptrs.empty());
#endif
CGameItem::deleteItem(item); CGameItem::deleteItem(item);
#if 0 #if 0
@ -1174,10 +1176,14 @@ CGameItemPtr CGameItem::getItemCopy()
// use the default copy ctor to init it // use the default copy ctor to init it
CGameItem* item = *ret; CGameItem* item = *ret;
CGameItemPtrArray old; #ifdef GAME_PTR_DEBUG
old= *item; std::vector<CGameItemPtr*> old;
old= item->_Ptrs;
#endif
*item = *this; *item = *this;
*(CGameItemPtrArray*)item=old; #ifdef GAME_PTR_DEBUG
*(CGameItemPtrArray*)item->_Ptrs=old;
#endif
// generate a new item id // generate a new item id
item->_ItemId = INVENTORIES::TItemId(); item->_ItemId = INVENTORIES::TItemId();

@ -293,6 +293,7 @@ private:
}; };
#ifdef GAME_PTR_DEBUG
class CGameItemPtrArray class CGameItemPtrArray
{ {
public: public:
@ -326,7 +327,7 @@ protected:
/// keep pointers pointing this item /// keep pointers pointing this item
std::vector<CGameItemPtr*> _Ptrs; std::vector<CGameItemPtr*> _Ptrs;
}; };
#endif
/** /**
* CGameItem * CGameItem
@ -335,8 +336,10 @@ protected:
* \author Nevrax France * \author Nevrax France
* \date 2002 * \date 2002
*/ */
class CGameItem : class CGameItem
public CGameItemPtrArray #ifdef GAME_PTR_DEBUG
: public CGameItemPtrArray
#endif
{ {
NLMISC_COMMAND_FRIEND(testParanoidItemSystem); NLMISC_COMMAND_FRIEND(testParanoidItemSystem);

Loading…
Cancel
Save