summaryrefslogtreecommitdiff
path: root/src/map/instance.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-17 01:21:28 +0200
committerHaru <haru@dotalux.com>2015-10-11 00:24:22 +0200
commit70265291d62280c525adc317158e9f531e0147ff (patch)
tree8beae9d0edc99a38bc678b86f2709780314ad327 /src/map/instance.c
parent502703d2b632125b35a2b8d341a90a13d7445f02 (diff)
downloadhercules-70265291d62280c525adc317158e9f531e0147ff.tar.gz
hercules-70265291d62280c525adc317158e9f531e0147ff.tar.bz2
hercules-70265291d62280c525adc317158e9f531e0147ff.tar.xz
hercules-70265291d62280c525adc317158e9f531e0147ff.zip
Cleanup of the HPluginData implementation (First part)
- Several explicit casts are removed, to have a slightly better type-checking at compile time. - A destructor function is provided, to remove code duplication. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/instance.c')
-rw-r--r--src/map/instance.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/map/instance.c b/src/map/instance.c
index 300247fe7..7213c43a1 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -588,19 +588,8 @@ void instance_destroy(int instance_id) {
instance->list[instance_id].state = INSTANCE_FREE;
instance->list[instance_id].num_map = 0;
- if (instance->list[instance_id].hdata)
- {
- for( j = 0; j < instance->list[instance_id].hdatac; j++ ) {
- if( instance->list[instance_id].hdata[j]->flag.free ) {
- aFree(instance->list[instance_id].hdata[j]->data);
- }
- aFree(instance->list[instance_id].hdata[j]);
- }
- aFree(instance->list[instance_id].hdata);
- }
-
+ HPM->data_store_destroy(instance->list[instance_id].hdata);
instance->list[instance_id].hdata = NULL;
- instance->list[instance_id].hdatac = 0;
}
/*--------------------------------------