inventory overflow prompting
If someone manages to get three or more items with inventory "letter"
'#', compact inventory selection prompts to list "#-#" instead of showing
every #. It isn't possible to selectively pick a particular one anyway,
so this doesn't affect player choices.
1 #: Which item? [$#a-zA-Z]
2 #: Which item? [$##a-zA-Z]
3 #: Which item? [$#-#a-zA-Z]
4 or more #: same as 3.
This doesn't address the fact that picking up enough boulders as a
giant might overflow the BUFSZ buffer getobj() uses to collect inventory
letters prior to calling compactify() on them.
This commit is contained in:
@@ -716,6 +716,15 @@ register char *buf;
|
||||
ilet = buf[i1];
|
||||
continue;
|
||||
}
|
||||
} else if (ilet == NOINVSYM) {
|
||||
/* compact three or more consecutive '#'
|
||||
characters into "#-#" */
|
||||
if (i2 >= 2 && buf[i2 - 2] == NOINVSYM &&
|
||||
buf[i2 - 1] == NOINVSYM)
|
||||
buf[i2 - 1] = '-';
|
||||
else if (i2 >= 3 && buf[i2 - 3] == NOINVSYM &&
|
||||
buf[i2 - 2] == '-' && buf[i2 - 1] == NOINVSYM)
|
||||
--i2;
|
||||
}
|
||||
ilet2 = ilet1;
|
||||
ilet1 = ilet;
|
||||
|
||||
Reference in New Issue
Block a user