Re: [code][newbie] bitvectors and shop files

From: Carlos Myers (farix@stargate.net)
Date: 09/06/01


From: "Paul" <pcschuler@ATT.NET>
> I am sure that I am not the first person to experience this, but
> I can't seem to find the answer anywhere else, so here goes:
>
> I am running Circle build 19 with oasis 2.0.1.  When editing a shop using
> sedit, it saves the 'with who' bitvector using the alpha form of the
> bitvector (i.e. NOCLERIC and NOTHIEF = fg).  This should be allowed per
> building.doc, but upon loading I receive the SYSERR: Error in shop #xxxxx.
> Manually changing the bitvector back to it's numeric form (96) corrects
the
> problem.
>
> I have also tried using alpha bitvectors on stock bpl19 and receive the
> same error.
>
> Any suggestions on the correct way of fixing this??

It's a bug in the shop.c file, the function that reads the ship data is not
working as documented.

I think I may have fixed the problem, but I can give not guarantees if this
will even work.  The patch below was made against patch level 19, so you may
need to tinker with it to get it to work with other earlier patches.

Carlos

diff -upNB Original/shop.c src/shop.c
--- Original/shop.c Thu Jun 28 10:24:18 2001
+++ src/shop.c Thu Aug 23 11:07:42 2001
@@ -33,6 +33,7 @@ ACMD(do_action);
 ACMD(do_echo);
 ACMD(do_say);
 void sort_keeper_objs(struct char_data *keeper, int shop_nr);
+bitvector_t asciiflag_conv(char *flag);

 /* Local variables */
 struct shop_data *shop_index;
@@ -1089,6 +1090,7 @@ char *read_shop_message(int mnum, room_v
 void boot_the_shops(FILE *shop_f, char *filename, int rec_count)
 {
   char *buf, buf2[150];
+  char f1[128];
   int temp, count, new_format = 0;
   struct shop_buy_data list[MAX_SHOP_OBJ + 1];
   int done = 0;
@@ -1129,11 +1131,15 @@ void boot_the_shops(FILE *shop_f, char *
       shop_index[top_shop].message_buy = read_shop_message(5,
SHOP_NUM(top_shop), shop_f, buf2);
       shop_index[top_shop].message_sell = read_shop_message(6,
SHOP_NUM(top_shop), shop_f, buf2);
       read_line(shop_f, "%d", &SHOP_BROKE_TEMPER(top_shop));
-      read_line(shop_f, "%d", &SHOP_BITVECTOR(top_shop));
-      read_line(shop_f, "%hd", &SHOP_KEEPER(top_shop));

+      read_line(shop_f, "%s", &f1);
+      SHOP_BITVECTOR(top_shop) = asciiflag_conv(f1);
+
+      read_line(shop_f, "%hd", &SHOP_KEEPER(top_shop));
       SHOP_KEEPER(top_shop) = real_mobile(SHOP_KEEPER(top_shop));
-      read_line(shop_f, "%d", &SHOP_TRADE_WITH(top_shop));
+
+      read_line(shop_f, "%s", &f1);
+      SHOP_TRADE_WITH(top_shop) = asciiflag_conv(f1);

       temp = read_list(shop_f, list, new_format, 1, LIST_ROOM);
       CREATE(shop_index[top_shop].in_room, room_rnum, temp);

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