diff --git a/changelog b/changelog index 7460a66..f63cf00 100644 --- a/changelog +++ b/changelog @@ -35,6 +35,9 @@ export (QQ's a zone into a tarball)t Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) (lots of major bugfixes too) tbaMUD 3.59 +[Mar 14 2009] - Jamdog + Bug-Fix: real_shop function could hang if a shop was added with the max VNUM (Thanks Slicer) + Removed find_shop function, which was a duplicate of real_shop. [Mar 13 2009] - Jamdog Bug-Fix: Character deletion (remove_player, players.c), where the wrong player was potentially being deleted. Added Zone Flags, including zedit sub-menu diff --git a/src/genshp.c b/src/genshp.c index 0c5979d..ef38b1f 100644 --- a/src/genshp.c +++ b/src/genshp.c @@ -263,7 +263,7 @@ shop_rnum real_shop(shop_vnum vnum) if (SHOP_NUM(mid) == vnum) return (mid); if (SHOP_NUM(mid) > vnum) - top = mid; + top = mid - 1; else bot = mid + 1; } diff --git a/src/shop.c b/src/shop.c index f22d949..71d3853 100644 --- a/src/shop.c +++ b/src/shop.c @@ -51,7 +51,6 @@ static void push(struct stack_data *stack, int pushval); /**< @todo Move to util static int top(struct stack_data *stack); /**< @todo Move to utils.c */ static int pop(struct stack_data *stack); /**< @todo Move to utils.c */ static char *list_object(struct obj_data *obj, int cnt, int oindex, int shop_nr, struct char_data *keeper, struct char_data *seller); -static int find_shop(int); static void sort_keeper_objs(struct char_data *keeper, int shop_nr); static char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why); static int read_type_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max); @@ -1492,7 +1491,7 @@ void show_shops(struct char_data *ch, char *arg) return; } } else if (is_number(arg)) - shop_nr = find_shop(atoi(arg)); + shop_nr = real_shop(atoi(arg)); else shop_nr = -1; @@ -1543,23 +1542,3 @@ void destroy_shops(void) shop_index = NULL; top_shop = -1; } - -static int find_shop(int vnum) -{ - int bot, mid, ltop; - - bot = 0; - ltop= top_shop; - - while (bot <= ltop) { - mid = (ltop + bot) / 2; - - if (shop_index[mid].vnum == vnum) - return mid; - else if (shop_index[mid].vnum < vnum) - bot = mid + 1; - else - ltop = mid - 1; - } - return -1; -}