CARRY(BIRD+CAGE-obj,game.loc);
CARRY(obj,game.loc);
if (obj == BOTTLE && LIQUID() != 0)
- game.place[LIQUID()] = -1;
+ game.place[LIQUID()] = CARRIED;
if (GSTONE(obj) && game.prop[obj] != 0) {
game.prop[obj]=0;
game.prop[CAVITY]=1;
int k = LIQUID();
if (k == obj)obj=BOTTLE;
if (obj == BOTTLE && k != 0)
- game.place[k]=0;
+ game.place[k] = NOWHERE;
if (obj == CAGE && game.prop[BIRD] == 1)DROP(BIRD,game.loc);
DROP(obj,game.loc);
if (obj != BIRD) return GO_CLEAROBJ;
if (obj != BLOOD) {
if (obj != 0 && obj != WATER)spk=RIDICULOUS_ATTEMPT;
if (spk != RIDICULOUS_ATTEMPT && LIQUID() == WATER && HERE(BOTTLE)) {
- game.prop[BOTTLE]=1;
- game.place[WATER]=0;
+ game.prop[BOTTLE] = 1;
+ game.place[WATER] = NOWHERE;
spk=BOTTLE_EMPTY;
}
} else {
spk=FILL_INVALID;
k=LIQUID();
if (k == 0 || !HERE(BOTTLE)) {RSPEAK(spk); return GO_CLEAROBJ;}
- game.place[k]=0;
- game.prop[BOTTLE]=1;
+ game.place[k] = NOWHERE;
+ game.prop[BOTTLE] = 1;
if (k == OIL)game.prop[URN]=1;
spk=WATER_URN+game.prop[URN];
RSPEAK(spk);
game.prop[BOTTLE]=MOD(COND[game.loc],4)/2*2;
k=LIQUID();
if (TOTING(BOTTLE))
- game.place[k] = -1;
+ game.place[k] = CARRIED;
if (k == OIL)
spk=BOTTLED_OIL;
}
if (obj != OIL && obj != WATER) {RSPEAK(spk); return GO_CLEAROBJ;}
if (HERE(URN) && game.prop[URN] == 0)
return fill(verb, URN);
- game.prop[BOTTLE]=1;
- game.place[obj]=0;
+ game.prop[BOTTLE] = 1;
+ game.place[obj] = NOWHERE;
spk=GROUND_WET;
if (!(AT(PLANT) || AT(DOOR)))
{RSPEAK(spk); return GO_CLEAROBJ;}
* TOTING(OBJ) = true if the OBJ is being carried */
#define MOD(N,M) ((N) % (M))
-#define TOTING(OBJ) (game.place[OBJ] == -1)
+#define TOTING(OBJ) (game.place[OBJ] == CARRIED)
#define AT(OBJ) (game.place[OBJ] == game.loc || game.fixed[OBJ] == game.loc)
#define HERE(OBJ) (AT(OBJ) || TOTING(OBJ))
#define LIQ2(PBOTL) ((1-(PBOTL))*WATER+((PBOTL)/2)*(WATER+OIL))
#define HOGRE 19 /* Trying to deal with ogre */
#define HJADE 20 /* Found all treasures except jade */
+/* Special object statuses in game.place - can also be a location number (> 0) */
+#define CARRIED -1 /* Player is toting it */
+#define NOWHERE 0 /* It's destroyed */
+
/* hack to ignore GCC Unused Result */
#define IGNORE(r) do{if (r){}}while(0)
printf("Initialising...\n");
for (int i=1; i<=NOBJECTS; i++) {
- game.place[i]=0;
- game.prop[i]=0;
+ game.place[i] = NOWHERE;
+ game.prop[i] = 0;
game.link[i+NOBJECTS]=game.link[i]=0;
}
/* The pirate's spotted him. He leaves him alone once we've
* found chest. K counts if a treasure is here. If not, and
- * tally=1 for an unseen chest, let the pirate be spotted.
- * Note that game.place[CHEST]=0 might mean that he's thrown
+ * tally=1 for an unseen chest, let the pirate be spotted. Note
+ * that game.place[CHEST] = NOWHERE might mean that he's thrown
* it to the troll, but in that case he's seen the chest
* (game.prop=0). */
if (game.loc == game.chloc || game.prop[CHEST] >= 0)
}
}
/* Force chest placement before player finds last treasure */
- if (game.tally == 1 && snarfed == 0 && game.place[CHEST] == 0 && HERE(LAMP) && game.prop[LAMP] == 1) {
+ if (game.tally == 1 && snarfed == 0 && game.place[CHEST] == NOWHERE && HERE(LAMP) && game.prop[LAMP] == 1) {
RSPEAK(PIRATE_SPOTTED);
movechest = true;
}
score(endgame);
if (game.numdie == MAXDIE)
score(endgame);
- game.place[WATER]=0;
- game.place[OIL]=0;
+ game.place[WATER] = NOWHERE;
+ game.place[OIL] = NOWHERE;
if (TOTING(LAMP))
game.prop[LAMP]=0;
for (int j=1; j<=NOBJECTS; j++) {
if (!game.lmwarn && HERE(LAMP)) {
game.lmwarn=true;
int spk=GET_BATTERIES;
- if (game.place[BATTER] == 0)spk=LAMP_DIM;
+ if (game.place[BATTER] == NOWHERE)spk=LAMP_DIM;
if (game.prop[BATTER] == 1)spk=MISSING_BATTERIES;
RSPEAK(spk);
}
from=game.fixed[object-NOBJECTS];
else
from=game.place[object];
- if (from > 0 && !SPECIAL(from))
+ if (from > NOWHERE && !SPECIAL(from))
CARRY(object,from);
DROP(object,where);
}
long temp;
if (object <= NOBJECTS) {
- if (game.place[object] == -1)
+ if (game.place[object] == CARRIED)
return;
- game.place[object]= -1;
+ game.place[object] = CARRIED;
++game.holdng;
}
if (game.atloc[where] == object) {
game.fixed[object-NOBJECTS] = where;
else
{
- if (game.place[object] == -1)
+ if (game.place[object] == CARRIED)
--game.holdng;
game.place[object] = where;
}
if(i > CHEST)k=16;
if(game.prop[i] >= 0)
score += 2;
- if(game.place[i] == 3 && game.prop[i] == 0)
+ if(game.place[i] == LOC_BUILDING && game.prop[i] == 0)
score += k-2;
mxscor += k;
}
mxscor += 45;
/* Did he come to Witt's End as he should? */
- if(game.place[MAGZIN] == 108)
+ if(game.place[MAGZIN] == LOC_WITTSEND)
score += 1;
mxscor += 1;