Encapsulate object-state state tests and setttings in macros.

This isn't a complete refwctoring, just the part than can be done with
transparetly correct capture of inlinre logic into macros.

No logic changes. Tests pass, 100% coverage.
This commit is contained in:
Eric S. Raymond 2023-04-07 16:11:04 -04:00
parent 9cd7c53d78
commit 02987d0330
7 changed files with 32 additions and 25 deletions

View file

@ -229,8 +229,7 @@ bool is_valid(struct game_t valgame)
/* Check that properties of objects aren't beyond expected */
for (obj_t obj = 0; obj <= NOBJECTS; obj++) {
/* Magic number -2 allows a STASHED version of state 1 */
if (valgame.objects[obj].prop < -2 || valgame.objects[obj].prop > 1) {
if (PROP_IS_INVALID(valgame.objects[obj].prop)) {
switch (obj) {
case RUG:
case DRAGON: