>I believe I have noticed some strange behaviour with shops - in particular >if the shopkeeper has only one particular item for sale. By the way, this >is with Circle30bpl21, running on Linux 6.1 > >When I look at the shopkeeper with an immortal, he does in fact have the >item he sells, but if I type in list, the response is just: > >"Presently, none of these are for sale." > >If I type "buy <object that I know he has for sale>", then he sells it to >me >in the expected manner (and also takes the money for it!!) Ok, I have looked at this further, and I believe I have a fix. Below is the original code in the shopping_list() routine in shop.c: for (obj = keeper->carrying; obj; obj = obj->next_content) if (CAN_SEE_OBJ(ch, obj) && GET_OBJ_COST(obj) > 0) { if (!last_obj) { last_obj = obj; cnt = 1; } else if (same_obj(last_obj, obj)) cnt++; else { lindex++; if (!*name || isname(name, last_obj->name)) { strncat(buf, list_object(last_obj, cnt, lindex, shop_nr, keeper, ch), sizeof(buf) - len - 1); /* strncat: OK */ len = strlen(buf); if (len + 1 >= sizeof(buf)) break; found = TRUE; /* <=== Offending line */ } cnt = 1; last_obj = obj; } } Notice the position of the fount = TRUE; line. By moving this line to the start of the main if block, then all seems to work. Here is the fixed code: for (obj = keeper->carrying; obj; obj = obj->next_content) if (CAN_SEE_OBJ(ch, obj) && GET_OBJ_COST(obj) > 0) { found = TRUE; /* <== moved to here */ if (!last_obj) { last_obj = obj; cnt = 1; } else if (same_obj(last_obj, obj)) cnt++; else { lindex++; if (!*name || isname(name, last_obj->name)) { strncat(buf, list_object(last_obj, cnt, lindex, shop_nr, keeper, ch), sizeof(buf) - len - 1); /* strncat: OK */ len = strlen(buf); if (len + 1 >= sizeof(buf)) break; } cnt = 1; last_obj = obj; } } The limited testing I have done seems to indicate it all works as desired. Ken Ray _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT