diff --git a/src/act.informative.c b/src/act.informative.c index b311131..5957ad1 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -2370,8 +2370,7 @@ ACMD(do_whois) CREATE(victim, struct char_data, 1); clear_char(victim); - /* Allocate mobile event list */ - victim->events = create_list(); + new_mobile_data(victim); CREATE(victim->player_specials, struct player_special_data, 1); diff --git a/src/act.wizard.c b/src/act.wizard.c index 3b06fde..e5c6401 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -1009,8 +1009,7 @@ ACMD(do_stat) CREATE(victim, struct char_data, 1); clear_char(victim); CREATE(victim->player_specials, struct player_special_data, 1); - /* Allocate mobile event list */ - victim->events = create_list(); + new_mobile_data(victim); if (load_char(buf2, victim) >= 0) { char_to_room(victim, 0); if (GET_LEVEL(victim) > GET_LEVEL(ch)) @@ -2051,8 +2050,7 @@ ACMD(do_last) CREATE(vict, struct char_data, 1); clear_char(vict); CREATE(vict->player_specials, struct player_special_data, 1); - /* Allocate mobile event list */ - vict->events = create_list(); + new_mobile_data(vict); if (load_char(name, vict) < 0) { send_to_char(ch, "There is no such player.\r\n"); free_char(vict); @@ -2571,8 +2569,7 @@ ACMD(do_show) CREATE(vict, struct char_data, 1); clear_char(vict); CREATE(vict->player_specials, struct player_special_data, 1); - /* Allocate mobile event list */ - vict->events = create_list(); + new_mobile_data(vict); if (load_char(value, vict) < 0) { send_to_char(ch, "There is no such player.\r\n"); free_char(vict); @@ -3353,8 +3350,7 @@ ACMD(do_set) CREATE(cbuf, struct char_data, 1); clear_char(cbuf); CREATE(cbuf->player_specials, struct player_special_data, 1); - /* Allocate mobile event list */ - cbuf->events = create_list(); + new_mobile_data(cbuf); if ((player_i = load_char(name, cbuf)) > -1) { if (GET_LEVEL(cbuf) > GET_LEVEL(ch)) { free_char(cbuf); @@ -4621,8 +4617,7 @@ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_ CREATE(temp_ch, struct char_data, 1); clear_char(temp_ch); CREATE(temp_ch->player_specials, struct player_special_data, 1); - /* Allocate mobile event list */ - temp_ch->events = create_list(); + new_mobile_data(temp_ch); if ((plr_i = load_char(new_name, temp_ch)) > -1) { free_char(temp_ch); send_to_char(ch, "Sorry, the new name already exists.\r\n"); diff --git a/src/comm.c b/src/comm.c index ad074e4..385c519 100644 --- a/src/comm.c +++ b/src/comm.c @@ -450,8 +450,7 @@ void copyover_recover() clear_char(d->character); CREATE(d->character->player_specials, struct player_special_data, 1); - /* Allocate mobile event list */ - d->character->events = create_list(); + new_mobile_data(d->character); d->character->desc = d; diff --git a/src/db.c b/src/db.c index 4eb95d9..e31730b 100644 --- a/src/db.c +++ b/src/db.c @@ -2322,8 +2322,7 @@ struct char_data *create_char(void) CREATE(ch, struct char_data, 1); clear_char(ch); - /* Allocate mobile event list */ - ch->events = create_list(); + new_mobile_data(ch); ch->next = character_list; character_list = ch; @@ -2335,6 +2334,12 @@ struct char_data *create_char(void) return (ch); } +void new_mobile_data(struct char_data *ch) +{ + ch->events = create_list(); +} + + /* create a new mobile from a prototype */ struct char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */ { @@ -2356,8 +2361,7 @@ struct char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */ mob->next = character_list; character_list = mob; - /* Allocate mobile event list */ - mob->events = create_list(); + new_mobile_data(mob); if (!mob->points.max_hit) { mob->points.max_hit = dice(mob->points.hit, mob->points.mana) + diff --git a/src/db.h b/src/db.h index 42c1992..6b58d6a 100644 --- a/src/db.h +++ b/src/db.h @@ -256,6 +256,7 @@ void free_text_files(void); void free_help_table(void); void free_player_index(void); void load_help(FILE *fl, char *name); +void new_mobile_data(struct char_data *ch); zone_rnum real_zone(zone_vnum vnum); room_rnum real_room(room_vnum vnum); diff --git a/src/interpreter.c b/src/interpreter.c index 8fdd79c..8eabdf5 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -1354,8 +1354,7 @@ void nanny(struct descriptor_data *d, char *arg) clear_char(d->character); CREATE(d->character->player_specials, struct player_special_data, 1); - /* Allocate mobile event list */ - d->character->events = create_list(); + new_mobile_data(d->character); GET_HOST(d->character) = strdup(d->host); d->character->desc = d; @@ -1392,8 +1391,7 @@ void nanny(struct descriptor_data *d, char *arg) clear_char(d->character); CREATE(d->character->player_specials, struct player_special_data, 1); - /* Allocate mobile event list */ - d->character->events = create_list(); + new_mobile_data(d->character); if (GET_HOST(d->character)) free(GET_HOST(d->character));