Re: [CIRLCE] Bug in oasis olc pre 11

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


Nocturnal Occulto wrote:
>
> Found another bug,
> sedit <some shop that doesnt exists yet, using shop number 2507>
> set a value, save it internally, then show shops
>
>   2     2506     2519      2506   0.30   2.50    GENM___
>   3     2507       -1      3300   1.00   1.00    GENMCTW
>   4     3000       -1      3000   0.15   1.15    G_NMCTW
>
> shop 2507 has where = -1, thats ok, but
> somehow the shop below gets its location messed up,
> the old location was 3033

I think this is the fix that's needed:


--- genshp.c    1999/06/04 20:03:22     1.4
+++ genshp.c    1999/06/15 17:15:11
@@ -382,14 +382,24 @@ int add_shop(struct shop_data *nshp)
        for (rshop = top_shop - top_shop_offset; rshop > 0; rshop--) {
                if (nshp->vnum  > SHOP_NUM(rshop - 1)) {
                        found = rshop;
+                       /* need to null out the old shop and produce, or
copy shop frees them
+                        * and hence frees the stuff for the shop above!
*/
+                       shop_index[rshop].in_room = NULL;
+                       shop_index[rshop].producing = NULL;
+                       shop_index[rshop].type = NULL;
                        copy_shop(&shop_index[rshop], nshp);
                        break;
                }
                shop_index[rshop] = shop_index[rshop - 1];
        }

-       if (!found)
+       if (!found) {
+               /* must be the very bottom, again NULL pointers */
+               shop_index[rshop].in_room = NULL;
+               shop_index[rshop].producing = NULL;
+               shop_index[rshop].type = NULL;
                copy_shop(&shop_index[0], nshp);
+       }

        if (rznum != NOWHERE)
                add_to_save_list(zone_table[rznum].number, SL_SHP);


     +------------------------------------------------------------+
     | 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