fix odd messages caused by buffer re-use
Reported and diagnosed by entrez: "The <mon> yanks <two-handed weapon> from your corpses!" It became unwielded and that triggered a perm_invent update and such updates reformat entire inventory, so if that contains a dozen or more items it will use all the obuf[] static buffers as least once. In this case, the bullwhip code had plural of "hand" in one of those buffers and by the time it delivered the message which used that, the value had been clobbered. As the diagnosis mentioned, it can be tricky to reproduce since either &obuf[0] or &obuf[PREFIX] might be used and if the value being clobbered didn't overlap, the effect wasn't noticeable. Instead of fixing the bullwhip message, this changes inventory display so that it should no longer churn through all the buffers. It also adds a fixes entry for #K3401, which was already fixed for 3.7 but I hadn't been able to reproduce it for 3.6.x (which I now blame on the PREFIX trickiness).
This commit is contained in:
@@ -1762,6 +1762,7 @@ extern void objects_globals_init(void);
|
||||
|
||||
/* ### objnam.c ### */
|
||||
|
||||
extern void maybereleaseobuf(char *);
|
||||
extern char *obj_typename(int);
|
||||
extern char *simple_typename(int);
|
||||
extern char *safe_typename(int);
|
||||
|
||||
Reference in New Issue
Block a user