Two bug fixes (Thanks Slicer) in CAP (utils.c) and delete_object (genobj.c)

This commit is contained in:
JamDog 2009-03-08 20:18:27 +00:00
parent b35073602f
commit 2d52e5cb67
3 changed files with 215 additions and 203 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 08 2009] - Jamdog
Fixed a possible crash bug in delete_object (genobj.c) (Thanks Slicer)
CAP function now recognises both preceeding color codes and ANSI codes (Thanks Slicer)
[Mar 07 2009] - Jamdog
Fixed a bug in find_shop (shop.c) and real_shop (genshp.c) (Thanks Slicer)
[Feb 25 2009] - Jamdog

View file

@ -374,7 +374,7 @@ int delete_object(obj_rnum rnum)
{
obj_rnum i;
zone_rnum zrnum;
struct obj_data *obj, *tmp;
struct obj_data *obj, *tmp, *next_obj;
int shop, j, zone, cmd_no;
if (rnum == NOTHING || rnum > top_of_objt)
@ -387,7 +387,8 @@ int delete_object(obj_rnum rnum)
/* This is something you might want to read about in the logs. */
log("GenOLC: delete_object: Deleting object #%d (%s).", GET_OBJ_VNUM(obj), obj->short_description);
for (tmp = object_list; tmp; tmp = tmp->next) {
for (tmp = object_list; tmp; tmp = next_obj) {
next_obj = tmp->next;
if (tmp->item_number != obj->item_number)
continue;

View file

@ -89,8 +89,16 @@ char *CAP(char *txt)
{
char *p = txt;
while (*p == '@' && *(p+1))
p += 2;
/* Skip all preceeding color codes and ANSI codes */
while ((*p == '@' && *(p+1)) || (*p == '\x1B' && *(p+1) == '[')) {
if (*p == '@') p += 2; /* Skip @ sign and color letter/number */
else {
p += 2; /* Skip the CSI section of the ANSI code */
while (*p && !isalpha(*p)) p++; /* Skip until a 'letter' is found */
if (*p) p++; /* Skip the letter */
}
}
if (*p)
*p = UPPER(*p);
return (txt);