I've been asked to make a zpurge command that will do the same thing as
typing purge in every room of the zone. It's 99% done, except for one
small crash I keep having and I can't figure out why. Here's the command
first of all:
ACMD(do_zpurge)
{
extern int top_of_zone_table;
extern struct zone_data *zone_table;
struct obj_data *obj, *next_obj;
struct char_data *mob, *next_mob;
int i, stored = -1, zone, found = FALSE;
int room;
one_argument(argument, arg);
if(!*arg) {
send_to_char("Please supply a zone number!\r\n", ch);
return;
}
zone = atoi(arg);
for (i = 0; i <= top_of_zone_table && !found; i++)
if (zone_table[i].number == zone) {
stored = i;
found = TRUE;
}
if(!found) {
send_to_char("That zone does not exist. Try again.\r\n", ch);
return;
}
for(room = zone * 100;room <= zone_table[stored].top;room++) {
if(real_room(room)) {
for (mob = world[real_room(room)].people; mob; mob = next_mob) {
next_mob = mob->next_in_room;
if (IS_NPC(mob))
extract_char(mob);
}
for (obj = world[real_room(room)].contents; obj; obj = next_obj) {
next_obj = obj->next_content;
extract_obj(obj);
}
}
}
sprintf(buf, "All mobiles and objects in zone %d purged.\r\n", zone);
send_to_char(buf, ch);
sprintf(buf, "%s has zpurged zone %d.\r\n", GET_NAME(ch), zone);
mudlog(buf, NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE);
}
Now, it crashes on the next_mob = mob->next_in_room line. Any idears why?
Chuck Reed
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST