diff options
author | shennetsind <ind@henn.et> | 2013-11-13 21:26:21 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-11-13 21:26:21 -0200 |
commit | 8fda38dcdabbb9d252b0e11fb07b2ad37f9e659f (patch) | |
tree | 4b08262c9ef18f9a2dd39d56ae2509320ab26e8c /src/map/npc.c | |
parent | b4d197c667353f417069c406b85a696e3e2e5b6c (diff) | |
download | hercules-8fda38dcdabbb9d252b0e11fb07b2ad37f9e659f.tar.gz hercules-8fda38dcdabbb9d252b0e11fb07b2ad37f9e659f.tar.bz2 hercules-8fda38dcdabbb9d252b0e11fb07b2ad37f9e659f.tar.xz hercules-8fda38dcdabbb9d252b0e11fb07b2ad37f9e659f.zip |
HPM Custom Data Struct Makeover!
- Modified how the core handles it, making it easier to add new points.
- Modified how plugins call it, calls were made shorter, e.g. 'HPMi->getFromSession(session[fd],HPMi->pid,0)' => 'getFromSession(session[fd],0)' -- check src/common/HPMi.h #defines for all the options
- Added support for npc_data (getFromNPCD and so on) as requested in http://hercules.ws/board/topic/2923-hpm-custom-struct-npcs/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 5ca96d587..effc36a4e 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1763,6 +1763,8 @@ void npc_unload_duplicates(struct npc_data* nd) { //Removes an npc from map and db. //Single is to free name (for duplicates). int npc_unload(struct npc_data* nd, bool single) { + unsigned int i; + nullpo_ret(nd); npc->remove_map(nd); @@ -1850,6 +1852,15 @@ int npc_unload(struct npc_data* nd, bool single) { nd->ud = NULL; } + for( i = 0; i < nd->hdatac; i++ ) { + if( nd->hdata[i]->flag.free ) { + aFree(nd->hdata[i]->data); + } + aFree(nd->hdata[i]); + } + if( nd->hdata ) + aFree(nd->hdata); + aFree(nd); return 0; |