Abstract out some state arithmetic.

This commit is contained in:
Eric S. Raymond 2017-07-04 13:40:05 -04:00
parent 4ac9df527b
commit a8ac2f477a
3 changed files with 8 additions and 4 deletions

View file

@ -29,6 +29,11 @@
#define STATE_NOTFOUND -1 // 'Not found" state of treasures */
#define STATE_GROUND 0 // After discovered, before messed with
/* Map a state property value to a negative range, where the object cannot be
* picked up but the value can be recovered later. Avoid colliding with -1,
* which has its own meaning. */
#define STASHED(obj) (-1 - game.prop[obj])
/*
* MOD(N,M) = Arithmetic modulus
* AT(OBJ) = true if on either side of two-placed object