fix #K3564 - obj sanity failure: N globs for N>1
Using #name and picking an item on the floor to be assigned a type name allowed any of the four types of globs to be named. After that, wishing for those by the assigned name bypassed the code that forced the quantity to stay at 1. Asking for "3 foo" could then produce "3 small globs of gray ooze" which fails obj_sanity() and issues an impossible warning (which the fuzzer escalates to panic). The "getobj refactor" patch changed the return value of call_ok(). When it gets used to check whether an object on the floor could have a type name assigned (rather than as a getobj() callback), the test that should have rejected the naming attempt accepted it instead. Update the wishing code to handle globs differently: you can still specify the relative size via small, medium, large, or very large, but now you can specify a count either instead or in addition. A count of more than 1 is used to multiply the created glob's weight, although it's less likely to be honored as-is when the size is bigger than small. Quantity is always forced to 1, at a different place in readobjnam() than previously.
This commit is contained in:
@@ -1478,7 +1478,7 @@ docallcmd(void)
|
||||
if (!obj->dknown) {
|
||||
You("would never recognize another one.");
|
||||
#if 0
|
||||
} else if (!call_ok(obj)) {
|
||||
} else if (call_ok(obj) == GETOBJ_EXCLUDE) {
|
||||
You("know those as well as you ever will.");
|
||||
#endif
|
||||
} else {
|
||||
@@ -1645,7 +1645,7 @@ namefloorobj(void)
|
||||
pline("%s %s to call you \"%s.\"",
|
||||
The(buf), use_plural ? "decide" : "decides",
|
||||
unames[rn2_on_display_rng(SIZE(unames))]);
|
||||
} else if (!call_ok(obj)) {
|
||||
} else if (call_ok(obj) == GETOBJ_EXCLUDE) {
|
||||
pline("%s %s can't be assigned a type name.",
|
||||
use_plural ? "Those" : "That", buf);
|
||||
} else if (!obj->dknown) {
|
||||
|
||||
Reference in New Issue
Block a user