[CODE] Fixed shops

From: Dust (dustlos@hotmail.com)
Date: 08/08/01

With substantial help from Del and a little of my own sidework as
well as previous inquiries into the matter (Torgny Bjers), I
believe I've hammered down quite a few quirks that reared their
ugly heads. This stuff may only be specific to my MUD, but for the
ake of anyone out there with similar problems here are some changes:
Everything of major concern takes place in genshp.c:
I'm trying to format things to fit 70 lines.

int real_shop(int vshop_num)
  int rshop_num;

  /* You could just remove the offset and +1. I had to make this just
   * be top_shop, otherwise every reboot, I would lose my top shop
   * which was just annoying. This seemed to fix everything up, I
   * could go ahead and show shops after adding in new shops, save
   * the shops, reboot and everything worked fine.
 for (rshop_num=0;rshop_num<=top_shop-top_shop_offset+1; rshop_num++)
   if (SHOP_NUM(rshop_num) == vshop_num)
     return rshop_num;

 return NOWHERE;

In add_shop, look for:
 for (rshop = top_shop - top_shop_offset; rshop > 0; rshop--) {
and change to
  for (rshop = top_shop - top_shop_offset + 1; rshop > 0; rshop--) {

This makes it so the top shop will actually save now. This was the
problem in my MUD that Del found out, the last shop wasn't saving,
but top_shop is incremented earlier, to the MUD tries to look for
this shop which isn't there and it got ugly :)

Other shop things to note:
*Make sure the bitvectors for shops aren't being saved improperly,
 saving as ints does the trick.
*I believe there was an article about the shop strings becoming
 malformed because of them being freed, look for that.. hard to
 find things in the mailing list archives though.
*If you don't have a shop problem, don't fix what isn't broken.
 Look for sedit bug in the archives or for Torgny's posts for
 more on shops.
*If anyone has any other fixed or problems with shops please reply
 its about time shops get cleaned out.

   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |

This archive was generated by hypermail 2b30 : 12/06/01 PST