Fix issue #51: rug flying is broken

And add a test for the fix.
This commit is contained in:
Eric S. Raymond 2022-04-05 15:18:17 -04:00
parent bb2b8e0fca
commit 73b49d27f4
4 changed files with 2404 additions and 5 deletions

3
NEWS
View file

@ -1,5 +1,8 @@
= Open Adventure project news =
Repository head::
Fixed a bug that manifested after two "fly rug" commands - third one fails.
1.9: 2020-08-27::
Update the dungeon maker to avoid a deprecation due to security issues

View file

@ -845,15 +845,20 @@ static phase_codes_t fly(verb_t verb, obj_t obj)
rspeak(RUG_NOTHING1);
return GO_CLEAROBJ;
}
game.oldlc2 = game.oldloc;
game.oldloc = game.loc;
if (game.prop[SAPPH] == STATE_NOTFOUND) {
game.newloc = game.place[SAPPH];
if (game.loc == LOC_CLIFF) {
game.oldlc2 = game.oldloc;
game.oldloc = game.loc;
game.newloc = LOC_LEDGE;
rspeak(RUG_GOES);
} else {
} else if (game.loc == LOC_LEDGE) {
game.oldlc2 = game.oldloc;
game.oldloc = game.loc;
game.newloc = LOC_CLIFF;
rspeak(RUG_RETURNS);
} else {
/* should never happen */
rspeak(NOTHING_HAPPENS);
}
return GO_TERMINATE;
}

2048
tests/flyback.chk Normal file

File diff suppressed because it is too large Load diff

343
tests/flyback.log Normal file
View file

@ -0,0 +1,343 @@
## Test fix for issue #51: rug flying is broken
n
seed 1838473132
in
take lamp
xyzzy
on
take rod
e
take cage
w
w
w
drop rod
take bird
take rod
w
free bird
wave rod
take necklace
drop rod
take bird
take rod
d
d
free bird
drop rod
drop cage
take cage
take bird
w
take coins
e
s
take jewelry
n
up
s
take gold
n
d
n
n
plugh
extinguish lamp
drop coins
drop jewelry
drop necklace
drop gold
plugh
on
s
take silver
s
sw
take axe
w
kill dragon
yes
drink blood
take rug
e
e
up
d
n
n
off
plugh
inven
drop rug
drop silver
out
s
w
n
take appendage
free bird
drop cage
listen
s
s
n
in
take water
plugh
on
plover
ne
take pyramid
s
plover
s
s
take rod
up
w
wave rod
drop rod
west
take diamonds
w
w
w
s
sw
se
s
kill machine
s
s
kill ogre
n
take ruby
s
w
n
n
n
nw
d
e
e
e
e
e
throw axe
take axe
n
n
n
off
plugh
drop ruby
drop diamonds
drop pyramid
plugh
on
s
s
u
n
n
d
bedquilt
throw axe
take axe
slab
s
d
water plant
u
w
u
reservoir
H'CFL
n
n
nw
u
u
u
u
ne
take ebony
sw
d
d
d
d
d
take water
s
s
s
s
d
s
d
water plant
u
drop appendage
e
d
get oil
u
w
d
climb
w
n
oil door
drop bottle
n
take trident
w
d
se
n
w
drop trident
drop ebony
drop axe
drop lantern
e
take emerald
w
take lamp
take axe
take ebony
take trident
nw
s
take vase
se
throw axe
take axe
e
take pillow
w
drop axe
ne
e
n
open clam
s
u
e
u
n
off
plugh
drop pillow
drop vase
drop trident
drop emerald
drop ebony
take keys
take food
plugh
on
s
d
w
d
n
d
d
take pearl
u
u
s
w
w
w
w
d
climb
w
get eggs
n
take bottle
n
w
d
sw
u
toss eggs
ne
ne
barren
in
feed bear
unlock chain
take chain
take bear
fork
ne
e
take spices
fork
w
w
sw
free bear
sw
sw
d
se
se
w
d
get oil
up
e
take axe
w
w
d
climb
w
fee
fie
foe
foo
take eggs
s
d
u
w
u
s
e
e
n
drop keys
n
off
plugh
drop eggs
drop pearl
drop spices
drop chain
take rug
take ruby
take emerald
out
w
n
n
n
inven
fill urn
light urn
rub urn
take amber
drop rug
drop emerald
fly rug
fly rug
fly rug