Small Oasis 2.0 patch

From: Chris Gilbert (chris@buzzbee.freeserve.co.uk)
Date: 10/04/99


Hi,

I've found a bug with zedit, and removing things from a zones reset
(well the builders found and crashed with it ;)  I couldn't see this in
the mailing list archives, and don't remember anything about it.

It appears that when you remove something from loading, when you save
it's meant to remove anything that relies on it being loaded, eg put for
objects.  It seems that all cmds are added into the main list, but not
removed from the zones list, but from the actual list you're copying
from, so that list  you're copying from shrinks while you're copying
things over, so you end up trashing the zone list.  Anyway this might be
unique to me, but attached is a patch that fixes it.

It may need hand patching as the lines might not match up for some ppl.

Cheers,
Chris

--- zedit.c     1999/09/25 22:23:14     1.3
+++ zedit.c     1999/10/04 19:37:41
@@ -159,6 +159,7 @@ void
 zedit_save_internally(struct descriptor_data *d)
 {
   int             mobloaded = FALSE, objloaded = FALSE, subcmd = 0;
+  int newcmdpos = 0;
   room_rnum       room_num = real_room(OLC_NUM(d));

   remove_room_zone_commands(OLC_ZNUM(d), room_num);
@@ -166,8 +167,8 @@ zedit_save_internally(struct descriptor_
   /*
    * Now add all the entries in the players descriptor list
    */
-  for (subcmd = 0; MYCMD.command != 'S'; subcmd++) {
-    add_cmd_to_list(&(zone_table[OLC_ZNUM(d)].cmd), &MYCMD, subcmd);
+  for (subcmd = 0; MYCMD.command != 'S'; subcmd++, newcmdpos++) {
+    add_cmd_to_list(&(zone_table[OLC_ZNUM(d)].cmd), &MYCMD, newcmdpos);
     /*
      * Since Circle does not keep track of what rooms the 'G', 'E', and
      * 'P' commands are exitted in, but OasisOLC groups zone commands
@@ -188,7 +189,8 @@ zedit_save_internally(struct descriptor_
       SEND_TO_Q
        ("Equip/Give command not saved since no mob was loaded first.\r\n",
         d);
-      remove_cmd_from_list(&(OLC_ZONE(d)->cmd), subcmd);
+      remove_cmd_from_list(&(zone_table[OLC_ZNUM(d)].cmd), newcmdpos);
+      newcmdpos--;
       break;
     case 'O':
       objloaded = TRUE;
@@ -199,7 +201,8 @@ zedit_save_internally(struct descriptor_
       SEND_TO_Q
        ("Put command not saved since another object was not loaded
first.\r\n",
         d);
-      remove_cmd_from_list(&(OLC_ZONE(d)->cmd), subcmd);
+      remove_cmd_from_list(&(zone_table[OLC_ZNUM(d)].cmd), newcmdpos);
+      newcmdpos--;
       break;
     default:
       mobloaded = objloaded = FALSE;


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST