Allocated Lists merged into one functions for extra expandability

This commit is contained in:
Vatiken 2012-04-09 17:53:13 +00:00
parent fa8a1e23b7
commit 5847a57d7f
6 changed files with 18 additions and 22 deletions

View file

@ -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);

View file

@ -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");

View file

@ -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;

View file

@ -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) +

View file

@ -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);

View file

@ -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));