From 60f61caa2cf3401243992d52f41020270679db8d Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 11 Nov 2020 11:18:53 +0800 Subject: [PATCH] Disable game item ptr debug code when item ptr debug is disabled... --- .../game_item_manager/game_item.cpp | 12 +++++++++--- .../game_item_manager/game_item.h | 9 ++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp b/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp index dbf270808..04e5fc956 100644 --- a/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp +++ b/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp @@ -749,7 +749,9 @@ void CGameItemPtr::deleteItem() // call dtor now to unlink all children item->dtor(); // check no one else is referencing us +#ifdef GAME_PTR_DEBUG nlassert(item->_Ptrs.empty()); +#endif CGameItem::deleteItem(item); #if 0 @@ -1174,10 +1176,14 @@ CGameItemPtr CGameItem::getItemCopy() // use the default copy ctor to init it CGameItem* item = *ret; - CGameItemPtrArray old; - old= *item; +#ifdef GAME_PTR_DEBUG + std::vector old; + old= item->_Ptrs; +#endif *item = *this; - *(CGameItemPtrArray*)item=old; +#ifdef GAME_PTR_DEBUG + *(CGameItemPtrArray*)item->_Ptrs=old; +#endif // generate a new item id item->_ItemId = INVENTORIES::TItemId(); diff --git a/ryzom/server/src/entities_game_service/game_item_manager/game_item.h b/ryzom/server/src/entities_game_service/game_item_manager/game_item.h index 57110ee12..ad4736c0e 100644 --- a/ryzom/server/src/entities_game_service/game_item_manager/game_item.h +++ b/ryzom/server/src/entities_game_service/game_item_manager/game_item.h @@ -293,6 +293,7 @@ private: }; +#ifdef GAME_PTR_DEBUG class CGameItemPtrArray { public: @@ -326,7 +327,7 @@ protected: /// keep pointers pointing this item std::vector _Ptrs; }; - +#endif /** * CGameItem @@ -335,8 +336,10 @@ protected: * \author Nevrax France * \date 2002 */ -class CGameItem : - public CGameItemPtrArray +class CGameItem +#ifdef GAME_PTR_DEBUG + : public CGameItemPtrArray +#endif { NLMISC_COMMAND_FRIEND(testParanoidItemSystem);