Address GitLab issue #28: Advent hangs on some inputs
This commit is contained in:
parent
b7af7b9e87
commit
342994376a
4 changed files with 21 additions and 19 deletions
15
actions.c
15
actions.c
|
@ -1305,20 +1305,7 @@ int action(struct command_t *command)
|
|||
* location. */
|
||||
if (HERE(command->obj))
|
||||
/* FALL THROUGH */;
|
||||
else if (command->obj == GRATE) {
|
||||
if (game.loc == LOC_START ||
|
||||
game.loc == LOC_VALLEY ||
|
||||
game.loc == LOC_SLIT) {
|
||||
command->obj = DEPRESSION;
|
||||
}
|
||||
if (game.loc == LOC_COBBLE ||
|
||||
game.loc == LOC_DEBRIS ||
|
||||
game.loc == LOC_AWKWARD ||
|
||||
game.loc == LOC_BIRD ||
|
||||
game.loc == LOC_PITTOP) {
|
||||
command->obj = ENTRANCE;
|
||||
}
|
||||
} else if (command->obj == DWARF && atdwrf(game.loc) > 0)
|
||||
else if (command->obj == DWARF && atdwrf(game.loc) > 0)
|
||||
/* FALL THROUGH */;
|
||||
else if ((LIQUID() == command->obj && HERE(BOTTLE)) ||
|
||||
command->obj == LIQLOC(game.loc))
|
||||
|
|
15
main.c
15
main.c
|
@ -1126,6 +1126,21 @@ Lclearobj:
|
|||
}
|
||||
|
||||
if (command.type1 == OBJECT) {
|
||||
if (command.id1 == GRATE) {
|
||||
command.type1 = MOTION;
|
||||
if (game.loc == LOC_START ||
|
||||
game.loc == LOC_VALLEY ||
|
||||
game.loc == LOC_SLIT) {
|
||||
command.id1 = DEPRESSION;
|
||||
}
|
||||
if (game.loc == LOC_COBBLE ||
|
||||
game.loc == LOC_DEBRIS ||
|
||||
game.loc == LOC_AWKWARD ||
|
||||
game.loc == LOC_BIRD ||
|
||||
game.loc == LOC_PITTOP) {
|
||||
command.id1 = ENTRANCE;
|
||||
}
|
||||
}
|
||||
if (!((command.id1 != WATER && command.id1 != OIL) || (command.id2 != PLANT && command.id2 != DOOR))) {
|
||||
if (AT(command.id2)) {
|
||||
command.id2 = POUR;
|
||||
|
|
|
@ -52,7 +52,7 @@ A three foot black rod with a rusty star on an end lies nearby.
|
|||
|
||||
> eat grate
|
||||
|
||||
Don't be ridiculous!
|
||||
I see no grate here.
|
||||
|
||||
> w
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ You're in front of building.
|
|||
|
||||
> eat grate
|
||||
|
||||
Don't be ridiculous!
|
||||
I see no grate here.
|
||||
|
||||
> eat building
|
||||
|
||||
|
@ -513,11 +513,11 @@ Sorry, I don't know the word "frob".
|
|||
|
||||
> read grate
|
||||
|
||||
I'm afraid I don't understand.
|
||||
I see no grate here.
|
||||
|
||||
> grate
|
||||
|
||||
What do you want to do with the grate?
|
||||
I see no grate here.
|
||||
|
||||
> pour bottle
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue