diff options
-rw-r--r-- | src/map/mob.c | 9 | ||||
-rw-r--r-- | src/map/mob.h | 4 | ||||
-rw-r--r-- | src/map/npc.c | 2 | ||||
-rw-r--r-- | src/map/npc.h | 2 | ||||
-rw-r--r-- | src/map/unit.c | 2 |
5 files changed, 10 insertions, 9 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index a32ba3c64..6790d5e92 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -151,9 +151,9 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time) nd->u.tomb.kill_time = time; if (killer) - nd->u.tomb.killer_name = aStrdup(killer); // Don't rely that killer name will be available all time + safestrncpy(nd->u.tomb.killer_name, killer, NAME_LENGTH); else - nd->u.tomb.killer_name = NULL; + nd->u.tomb.killer_name[0] = NULL; map_addnpc(nd->bl.m, nd); map_addblock(&nd->bl); @@ -168,12 +168,7 @@ void mvptomb_destroy(struct mob_data *md) struct npc_data *nd = (struct npc_data *)map_id2bl(md->tomb_nid); if (nd) - { - if (nd->u.tomb.killer_name) - aFree(nd->u.tomb.killer_name); - npc_unload(nd); - } md->tomb_nid = 0; } diff --git a/src/map/mob.h b/src/map/mob.h index 4caf0148c..12c05b15d 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -287,4 +287,8 @@ int mob_clone_delete(struct mob_data *md); void mob_reload(void); +// MvP Tomb System +void mvptomb_create(struct mob_data *md, char *killer, time_t time); +void mvptomb_destroy(struct mob_data *md); + #endif /* _MOB_H_ */ diff --git a/src/map/npc.c b/src/map/npc.c index d0defdf88..0309d6556 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1097,7 +1097,7 @@ void run_tomb(struct map_session_data* sd, struct npc_data* nd) clif_scriptmes(sd, nd->bl.id, msg_txt(660)); - snprintf(buffer, sizeof(buffer), msg_txt(661), nd->u.tomb.killer_name ? nd->u.tomb.killer_name : "Unknown"); + snprintf(buffer, sizeof(buffer), msg_txt(661), nd->u.tomb.killer_name[0] ? nd->u.tomb.killer_name : "Unknown"); clif_scriptmes(sd, nd->bl.id, buffer); clif_scriptclose(sd, nd->bl.id); diff --git a/src/map/npc.h b/src/map/npc.h index 47f6117d9..81491eeb3 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -65,7 +65,7 @@ struct npc_data { struct { struct mob_data *md; time_t kill_time; - char *killer_name; + char killer_name[NAME_LENGTH]; } tomb; } u; }; diff --git a/src/map/unit.c b/src/map/unit.c index 43cbc02e1..7718ed311 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2368,6 +2368,8 @@ int unit_free(struct block_list *bl, clr_type clrtype) } if( mob_is_clone(md->class_) ) mob_clone_delete(md); + if( md->tomb_nid ) + mvptomb_destroy(md); break; } case BL_HOM: |