mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-18 08:10:13 +01:00
Added bug-fix to real_shop function (Thanks Slicer), and removed the duplicate (find_shop) function
This commit is contained in:
parent
4a4ba0cf0a
commit
15c7e83d3e
3 changed files with 5 additions and 23 deletions
|
|
@ -35,6 +35,9 @@ export (QQ's a zone into a tarball)t
|
||||||
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
|
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
|
||||||
(lots of major bugfixes too)
|
(lots of major bugfixes too)
|
||||||
tbaMUD 3.59
|
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
|
[Mar 13 2009] - Jamdog
|
||||||
Bug-Fix: Character deletion (remove_player, players.c), where the wrong player was potentially being deleted.
|
Bug-Fix: Character deletion (remove_player, players.c), where the wrong player was potentially being deleted.
|
||||||
Added Zone Flags, including zedit sub-menu
|
Added Zone Flags, including zedit sub-menu
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ shop_rnum real_shop(shop_vnum vnum)
|
||||||
if (SHOP_NUM(mid) == vnum)
|
if (SHOP_NUM(mid) == vnum)
|
||||||
return (mid);
|
return (mid);
|
||||||
if (SHOP_NUM(mid) > vnum)
|
if (SHOP_NUM(mid) > vnum)
|
||||||
top = mid;
|
top = mid - 1;
|
||||||
else
|
else
|
||||||
bot = mid + 1;
|
bot = mid + 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
src/shop.c
23
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 top(struct stack_data *stack); /**< @todo Move to utils.c */
|
||||||
static int pop(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 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 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 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);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
} else if (is_number(arg))
|
} else if (is_number(arg))
|
||||||
shop_nr = find_shop(atoi(arg));
|
shop_nr = real_shop(atoi(arg));
|
||||||
else
|
else
|
||||||
shop_nr = -1;
|
shop_nr = -1;
|
||||||
|
|
||||||
|
|
@ -1543,23 +1542,3 @@ void destroy_shops(void)
|
||||||
shop_index = NULL;
|
shop_index = NULL;
|
||||||
top_shop = -1;
|
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;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue