Disambiguate b_trapped null bodypart value
b_trapped was treating 0 as a null value for its bodypart parameter, but 0 is actually the value of ARM, so b_trapped(..., ARM) would be treated as intending no A_CON abuse. Add NO_PART = -1 to the bodypart_types enum, and use that instead of 0 as the "no body part" value in b_trapped, so that ARM can be passed to it without any ambiguity. aosdict identified this issue in xNetHack and handled it differently; he added NO_PART with a value of 0, incremented the existing bodypart_types values, and padded the body part arrays so the actual body parts would start at index 1. I think using NO_PART = -1 is simpler, but that's an alternative approach that can be used instead -- it is advantageous in that it automatically fixes any other places where 0 is assumed to be a non-body-part value that I may have overlooked.
This commit is contained in:
committed by
Pasi Kallinen
parent
234c0da66f
commit
fa1f1134c8
@@ -693,7 +693,7 @@ still_chewing(coordxy x, coordxy y)
|
||||
} else if (lev->typ == SDOOR) {
|
||||
if (lev->doormask & D_TRAPPED) {
|
||||
lev->doormask = D_NODOOR;
|
||||
b_trapped("secret door", 0);
|
||||
b_trapped("secret door", NO_PART);
|
||||
} else {
|
||||
digtxt = "chew through the secret door.";
|
||||
lev->doormask = D_BROKEN;
|
||||
@@ -707,7 +707,7 @@ still_chewing(coordxy x, coordxy y)
|
||||
}
|
||||
if (lev->doormask & D_TRAPPED) {
|
||||
lev->doormask = D_NODOOR;
|
||||
b_trapped("door", 0);
|
||||
b_trapped("door", NO_PART);
|
||||
} else {
|
||||
digtxt = "chew through the door.";
|
||||
lev->doormask = D_BROKEN;
|
||||
|
||||
Reference in New Issue
Block a user