Restructure lightcheck
This commit is contained in:
parent
7d690e0b95
commit
386ca2b8d2
1 changed files with 25 additions and 24 deletions
25
main.c
25
main.c
|
@ -879,28 +879,29 @@ static void lampcheck(void)
|
|||
* here, in which case we replace the batteries and continue.
|
||||
* Second is for other cases of lamp dying. Eve after it goes
|
||||
* out, he can explore outside for a while if desired. */
|
||||
if (game.limit <= WARNTIME && HERE(BATTERY) && game.prop[BATTERY] == FRESH_BATTERIES && HERE(LAMP)) {
|
||||
if (game.limit <= WARNTIME) {
|
||||
if (HERE(BATTERY) && game.prop[BATTERY] == FRESH_BATTERIES && HERE(LAMP)) {
|
||||
rspeak(REPLACE_BATTERIES);
|
||||
game.prop[BATTERY] = DEAD_BATTERIES;
|
||||
if (TOTING(BATTERY))
|
||||
drop(BATTERY, game.loc);
|
||||
game.limit += BATTERYLIFE;
|
||||
game.lmwarn = false;
|
||||
} else if (game.limit == 0) {
|
||||
} else if (!game.lmwarn && HERE(LAMP)) {
|
||||
game.lmwarn = true;
|
||||
if (game.prop[BATTERY] == DEAD_BATTERIES)
|
||||
rspeak(MISSING_BATTERIES);
|
||||
else if (game.place[BATTERY] == LOC_NOWHERE)
|
||||
rspeak(LAMP_DIM);
|
||||
else
|
||||
rspeak(GET_BATTERIES);
|
||||
}
|
||||
}
|
||||
if (game.limit == 0) {
|
||||
game.limit = -1;
|
||||
game.prop[LAMP] = LAMP_DARK;
|
||||
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[BATTERY] == LOC_NOWHERE)
|
||||
spk = LAMP_DIM;
|
||||
if (game.prop[BATTERY] == DEAD_BATTERIES)
|
||||
spk = MISSING_BATTERIES;
|
||||
rspeak(spk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue