From: <mua...@us...> - 2009-09-15 21:57:00
|
Revision: 57 http://polserver.svn.sourceforge.net/polserver/?rev=57&view=rev Author: muaddib_pol Date: 2009-09-15 21:56:53 +0000 (Tue, 15 Sep 2009) Log Message: ----------- + Unregistering from multi on NPC/Character destroy. Modified Paths: -------------- trunk/pol-core/pol/mobile/charactr.cpp trunk/pol-core/pol/mobile/charactr.h trunk/pol-core/pol/npc.cpp trunk/pol-core/pol/npc.h Modified: trunk/pol-core/pol/mobile/charactr.cpp =================================================================== --- trunk/pol-core/pol/mobile/charactr.cpp 2009-09-15 19:50:58 UTC (rev 56) +++ trunk/pol-core/pol/mobile/charactr.cpp 2009-09-15 21:56:53 UTC (rev 57) @@ -124,6 +124,7 @@ #include "../watch.h" #include "../item/weapon.h" #include "../item/wepntmpl.h" +#include "../multi/house.h" #include "charactr.h" @@ -327,6 +328,9 @@ party_can_loot_(false), party_decline_timeout_(NULL), murderer_(false), + + registered_house( 0 ), + langid_(0) { gradual_boost = 0; @@ -466,6 +470,17 @@ void Character::destroy() { stop_skill_script(); + if ( registered_house > 0 ) + { + UMulti* multi = system_find_multi(registered_house); + if(multi != NULL) + { + UHouse* house = multi->as_house(); + if(house != NULL) + house->unregister_object((UObject*)this); + } + registered_house = 0; + } base::destroy(); } Modified: trunk/pol-core/pol/mobile/charactr.h =================================================================== --- trunk/pol-core/pol/mobile/charactr.h 2009-09-15 19:50:58 UTC (rev 56) +++ trunk/pol-core/pol/mobile/charactr.h 2009-09-15 21:56:53 UTC (rev 57) @@ -53,6 +53,7 @@ #include "../reftypes.h" #include "../ssopt.h" +#include "../multi/house.h" class Account; class Attribute; @@ -724,6 +725,8 @@ ref_ptr<WornItemsContainer> wornitems_ref; WornItemsContainer& wornitems; + u32 registered_house; + // s16 strength_mod_; // s16 intelligence_mod_; // s16 dexterity_mod_; Modified: trunk/pol-core/pol/npc.cpp =================================================================== --- trunk/pol-core/pol/npc.cpp 2009-09-15 19:50:58 UTC (rev 56) +++ trunk/pol-core/pol/npc.cpp 2009-09-15 21:56:53 UTC (rev 57) @@ -18,11 +18,11 @@ */ #include "../clib/stl_inc.h" + #ifdef _MSC_VER -#pragma warning(disable:4786) +# pragma warning(disable:4786) #endif - #include "../clib/cfgelem.h" #include "../clib/clib.h" #include "../clib/endian.h" @@ -76,6 +76,7 @@ #include "watch.h" #include "item/weapon.h" #include "wrldsize.h" +#include "multi/house.h" /* An area definition is as follows: pt: (x,y) @@ -123,6 +124,17 @@ { // stop_scripts(); wornitems.destroy_contents(); + if ( registered_house > 0 ) + { + UMulti* multi = system_find_multi(registered_house); + if(multi != NULL) + { + UHouse* house = multi->as_house(); + if(house != NULL) + house->unregister_object((UObject*)this); + } + registered_house = 0; + } base::destroy(); } Modified: trunk/pol-core/pol/npc.h =================================================================== --- trunk/pol-core/pol/npc.h 2009-09-15 19:50:58 UTC (rev 56) +++ trunk/pol-core/pol/npc.h 2009-09-15 21:56:53 UTC (rev 57) @@ -99,8 +99,6 @@ void readPropertiesForNewNPC( ConfigElem& elem ); virtual void destroy(); - - NpcTemplate::ALIGNMENT alignment() const; unsigned damaged_sound; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |