Re: [CODE] bug fix in zedit new 97 11:59:32 am

From: Andrew Helm (ashe@IGLOU.COM)
Date: 07/30/97


>    Ok, this looked great, but is it too good to be true?
> I added this little fix and tested it out, this is what I got:
> I created a new zone and typed show zones
> I see this for the zone I jsut created:
> 32000 (null)                         Age:   0; Reset:   0 (0); Top:
> 0
> where it should be:
> 33 New Zone                      Age:   0; Reset:   30(2); Top:    3399
>

Doh! *mutters something about OasisOLC being cursed*


  Okay, I'm tired of that akward for loop. Just replace it with the
following code and everything should work fine (I hope):
-----

  zedit_create_index(vzone_num, "shp");

  /*. Make a new zone in memory.*/
  CREATE(new_table, struct zone_data, top_of_zone_table+2);
  new_table[top_of_zone_table + 1].number = 32000;
/* START NEW CODE HERE */
  if (vzone_num > zone_table[top_of_zone_table].number) {
    memcpy(new_table, zone_table, (sizeof(struct zone_data) * (top_of_zone_table + 1)));
    i = top_of_zone_table + 1;
  }else
    for (i=0;vzone_num > zone_table[i].number;++i)
      new_table[i] = zone_table[i];
  new_table[i].name = str_dup("New Zone");
  new_table[i].number = vzone_num;
  new_table[i].top = (vzone_num * 100) + 99;
  new_table[i].lifespan = 30;
  new_table[i].age = 0;
  new_table[i].reset_mode = 2;
  CREATE(new_table[i].cmd, struct reset_com, 1);
  new_table[i].cmd[0].command = 'S';
  for(;i <= top_of_zone_table;++i)
    new_table[i+1] = zone_table[i];
/* END NEW CODE */
  free(zone_table);
  zone_table = new_table;
  top_of_zone_table++;

-----


     +------------------------------------------------------------+
     | 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/08/00 PST