top_of_zone_table?

From: Templar Viper (templarviper@hotmail.com)
Date: 10/02/02


Ok, I've had many bugs in my mud, and most of them I fixed 
on my own.. But I'm completely baffled by this one.

I've made a builder entry in zedit recently, so builders can type 
in thier name there, and it will appear in the mortal area command,
a command for mortals to display all area's with their respective
builders. Everything fine, until my mud went live on a redhat 7.0 
system and a problem appeared: When booting the mud, it doesn't
seem to load a builder names propery, and builder names appeared
corruptly on the screen. What was weird however, that all names
loaded, except the name in the last zone. I double checked the 
loading routine in db.c but I couldn't find anything that shouldn't be 
there. After some more investigation, I noticed that when you tried 
to save the last zone, real_zone returns an invalid number. However, 
in cygwin everything worked properly, both the builder name loading 
and the zone saving. I've got no clue what the problem is.. I included
some of my code below. Thanks for any help, or for atleast pointing 
me in the right direction.

Loading routine in db.c:

  line_num += get_line(fl, buf);
  if ((ptr = strchr(buf, '~')) != NULL) /* take off the '~' if it's there */
    *ptr = '\0';
  Z.builder = strdup(buf); 

Several functions that modify or use top_of_zone_table:

int real_zone(int number)
{
  int counter;
      
  for (counter = 0; counter <= top_of_zone_table; counter++)
    if ((number >= (zone_table[counter].number * 100)) &&
      (number <= (zone_table[counter].top)))
      return counter;
 
  return -1;
}

int save_zone(zone_rnum zone_num)
{
  int subcmd, arg1 = -1, arg2 = -1, arg3 = -1;
  char fname[64], buf2[MAX_STRING_LENGTH];
  const char *comment = NULL;
  FILE *zfile;
  
  if (zone_num == NOWHERE || zone_num > top_of_zone_table) {
    log("SYSERR: GenOLC: save_zone: Invalid real zone number %d. (0-%d)", zone_num, top_of_zone_table); /* This is the log message the mud prints */
    return FALSE;
  }

If there is any more code anybody may need, I'm happy to send it.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT