+static void lampcheck(void)
+/* Check game limit and lamp timers */
+{
+ if (game.prop[LAMP] == 1)
+ --game.limit;
+
+ /* Another way we can force an end to things is by having the
+ * lamp give out. When it gets close, we come here to warn
+ * him. First following ar, if the lamp and fresh batteries are
+ * here, in which case we replace the batteries and continue.
+ * Second is for other cases of lamp dying. 12400 is when it
+ * goes out. Even then, he can explore outside for a while
+ * if desired. */
+ if (game.limit <= WARNTIME && HERE(BATTER) && game.prop[BATTER]==0 && HERE(LAMP))
+ {
+ RSPEAK(REPLACE_BATTERIES);
+ game.prop[BATTER]=1;
+ if (TOTING(BATTER))
+ DROP(BATTER,game.loc);
+ game.limit=game.limit+2500;
+ game.lmwarn=false;
+ } else if (game.limit == 0) {
+ game.limit= -1;
+ game.prop[LAMP]=0;
+ if (HERE(LAMP))
+ RSPEAK(LAMP_OUT);
+ } else if (game.limit <= WARNTIME) {
+ if (!game.lmwarn && HERE(LAMP)) {
+ game.lmwarn=true;
+ int spk=GET_BATTERIES;
+ if (game.place[BATTER] == 0)spk=LAMP_DIM;
+ if (game.prop[BATTER] == 1)spk=MISSING_BATTERIES;
+ RSPEAK(spk);
+ }
+ }
+}
+
+static void listobjects(void)
+/* Print out descriptions of objects at this location. If
+ * not closing and property value is negative, tally off
+ * another treasure. Rug is special case; once seen, its
+ * game.prop is 1 (dragon on it) till dragon is killed.
+ * Similarly for chain; game.prop is initially 1 (locked to
+ * bear). These hacks are because game.prop=0 is needed to
+ * get full score. */
+{
+ if (!DARK(game.loc)) {
+ ++game.abbrev[game.loc];
+ for (int i=game.atloc[game.loc]; i != 0; i=game.link[i]) {
+ long obj=i;
+ if (obj > NOBJECTS)obj=obj-NOBJECTS;
+ if (obj == STEPS && TOTING(NUGGET))
+ continue;
+ if (game.prop[obj] < 0) {
+ if (game.closed)
+ continue;
+ game.prop[obj]=0;
+ if (obj == RUG || obj == CHAIN)
+ game.prop[obj]=1;
+ --game.tally;
+ /* Note: There used to be a test here to see whether the
+ * player had blown it so badly that he could never ever see
+ * the remaining treasures, and if so the lamp was zapped to
+ * 35 turns. But the tests were too simple-minded; things
+ * like killing the bird before the snake was gone (can never
+ * see jewelry), and doing it "right" was hopeless. E.G.,
+ * could cross troll bridge several times, using up all
+ * available treasures, breaking vase, using coins to buy
+ * batteries, etc., and eventually never be able to get
+ * across again. If bottle were left on far side, could then
+ * never get eggs or trident, and the effects propagate. So
+ * the whole thing was flushed. anyone who makes such a
+ * gross blunder isn't likely to find everything else anyway
+ * (so goes the rationalisation). */
+ }
+ int kk=game.prop[obj];
+ if (obj == STEPS && game.loc == game.fixed[STEPS])
+ kk=1;
+ PSPEAK(obj,kk);
+ }
+ }
+}