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. */
|
* location. */
|
||||||
if (HERE(command->obj))
|
if (HERE(command->obj))
|
||||||
/* FALL THROUGH */;
|
/* FALL THROUGH */;
|
||||||
else if (command->obj == GRATE) {
|
else if (command->obj == DWARF && atdwrf(game.loc) > 0)
|
||||||
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)
|
|
||||||
/* FALL THROUGH */;
|
/* FALL THROUGH */;
|
||||||
else if ((LIQUID() == command->obj && HERE(BOTTLE)) ||
|
else if ((LIQUID() == command->obj && HERE(BOTTLE)) ||
|
||||||
command->obj == LIQLOC(game.loc))
|
command->obj == LIQLOC(game.loc))
|
||||||
|
|
17
main.c
17
main.c
|
@ -1126,7 +1126,22 @@ Lclearobj:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.type1 == OBJECT) {
|
if (command.type1 == OBJECT) {
|
||||||
if (!((command.id1 != WATER && command.id1 != OIL) || (command.id2 != PLANT && command.id2 != DOOR))) {
|
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)) {
|
if (AT(command.id2)) {
|
||||||
command.id2 = POUR;
|
command.id2 = POUR;
|
||||||
command.type2 = ACTION;
|
command.type2 = ACTION;
|
||||||
|
|
|
@ -52,7 +52,7 @@ A three foot black rod with a rusty star on an end lies nearby.
|
||||||
|
|
||||||
> eat grate
|
> eat grate
|
||||||
|
|
||||||
Don't be ridiculous!
|
I see no grate here.
|
||||||
|
|
||||||
> w
|
> w
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ You're in front of building.
|
||||||
|
|
||||||
> eat grate
|
> eat grate
|
||||||
|
|
||||||
Don't be ridiculous!
|
I see no grate here.
|
||||||
|
|
||||||
> eat building
|
> eat building
|
||||||
|
|
||||||
|
@ -513,11 +513,11 @@ Sorry, I don't know the word "frob".
|
||||||
|
|
||||||
> read grate
|
> read grate
|
||||||
|
|
||||||
I'm afraid I don't understand.
|
I see no grate here.
|
||||||
|
|
||||||
> grate
|
> grate
|
||||||
|
|
||||||
What do you want to do with the grate?
|
I see no grate here.
|
||||||
|
|
||||||
> pour bottle
|
> pour bottle
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue