/* Open vlist command by Pwrdemon (jseldon@usa.net) of Stormbringer Mud * Syntax is simple: openvlist * Displays blocks of vnums not currently assigned to areas. */ void do_openvlist( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; BUFFER *buffer; int loop = 1, x, lowvnum = 0; bool found = FALSE; bool havehighvnum = FALSE; AREA_DATA *pArea; extern int top_vnum_room; /* From db.c */ buffer = new_buf(); add_buf(buffer, "===== Unassigned Vnum List =====\n\r\n\r"); for (x = 1; x <= top_vnum_room ; x++) { int count = 0; havehighvnum = FALSE; for ( pArea = area_first; pArea != NULL; pArea = pArea->next ) { if (x <= pArea->max_vnum && x >= pArea->min_vnum) { count++; /* count adds 1 if vnum in area */ havehighvnum = TRUE; /* Might be the high vnum, trap it */ } } if (x == top_vnum_room && count == 0) /* Lame hack to catch last vnum */ havehighvnum = TRUE; if (count == 0 && lowvnum == 0) /* no areas found in and no low */ lowvnum = x; /* vnum yet, assign this one */ if (lowvnum > 0 && havehighvnum) /* Have low and high vnum now */ { sprintf(buf, "[%d] %d thru %d (count: %d)\n\r" ,loop, lowvnum, x - 1, x - lowvnum); add_buf(buffer,buf); lowvnum = 0; /* Reset low vnum */ loop++; found = TRUE; } } if (!found) send_to_char("No free range of vnums was found.\n\r",ch); else page_to_char(buf_string(buffer),ch); free_buf(buffer); return; }