mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-24 03:00:13 +01:00
Should fix the 'crash' bug related to input > 2 kb, as well as fix the mobile deletion crash bug, also a small memory leak plugged
This commit is contained in:
parent
2aed18ba52
commit
870bb8ef38
5 changed files with 47 additions and 3 deletions
34
src/genmob.c
34
src/genmob.c
|
|
@ -102,17 +102,46 @@ int copy_mobile(struct char_data *to, struct char_data *from)
|
|||
static void extract_mobile_all(mob_vnum vnum)
|
||||
{
|
||||
struct char_data *next, *ch;
|
||||
int i;
|
||||
|
||||
for (ch = character_list; ch; ch = next) {
|
||||
next = ch->next;
|
||||
if (GET_MOB_VNUM(ch) == vnum)
|
||||
if (GET_MOB_VNUM(ch) == vnum) {
|
||||
if ((i = GET_MOB_RNUM(ch)) != NOBODY) {
|
||||
if (ch->player.name && ch->player.name != mob_proto[i].player.name)
|
||||
free(ch->player.name);
|
||||
ch->player.name = NULL;
|
||||
|
||||
if (ch->player.title && ch->player.title != mob_proto[i].player.title)
|
||||
free(ch->player.title);
|
||||
ch->player.title = NULL;
|
||||
|
||||
if (ch->player.short_descr && ch->player.short_descr != mob_proto[i].player.short_descr)
|
||||
free(ch->player.short_descr);
|
||||
ch->player.short_descr = NULL;
|
||||
|
||||
if (ch->player.long_descr && ch->player.long_descr != mob_proto[i].player.long_descr)
|
||||
free(ch->player.long_descr);
|
||||
ch->player.long_descr = NULL;
|
||||
|
||||
if (ch->player.description && ch->player.description != mob_proto[i].player.description)
|
||||
free(ch->player.description);
|
||||
ch->player.description = NULL;
|
||||
|
||||
/* free script proto list if it's not the prototype */
|
||||
if (ch->proto_script && ch->proto_script != mob_proto[i].proto_script)
|
||||
free_proto_script(ch, MOB_TRIGGER);
|
||||
ch->proto_script = NULL;
|
||||
}
|
||||
extract_char(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int delete_mobile(mob_rnum refpt)
|
||||
{
|
||||
struct char_data *live_mob;
|
||||
struct char_data *proto;
|
||||
int counter, cmd_no;
|
||||
mob_vnum vnum;
|
||||
zone_rnum zone;
|
||||
|
|
@ -127,7 +156,10 @@ int delete_mobile(mob_rnum refpt)
|
|||
}
|
||||
|
||||
vnum = mob_index[refpt].vnum;
|
||||
proto = &mob_proto[refpt];
|
||||
|
||||
extract_mobile_all(vnum);
|
||||
extract_char(proto);
|
||||
|
||||
for (counter = refpt; counter < top_of_mobt; counter++) {
|
||||
mob_index[counter] = mob_index[counter + 1];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue