Added bug-fix to real_shop function (Thanks Slicer), and removed the duplicate (find_shop) function

This commit is contained in:
JamDog 2009-03-14 23:49:13 +00:00
parent 4a4ba0cf0a
commit 15c7e83d3e
3 changed files with 5 additions and 23 deletions

View file

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

View file

@ -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;
}

View file

@ -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;
}