Unspk'd (v)carry. Made logic more visible.

And tested some of newly exposed cases.
This commit is contained in:
NHOrus 2017-07-04 19:27:00 +03:00
parent 665103410a
commit e46cbdf194
3 changed files with 114 additions and 60 deletions

View file

@ -281,7 +281,6 @@ static int vcarry(token_t verb, token_t obj)
* take one without the other). Liquids also special, since they depend on * take one without the other). Liquids also special, since they depend on
* status of bottle. Also various side effects, etc. */ * status of bottle. Also various side effects, etc. */
{ {
int spk;
if (obj == INTRANSITIVE) { if (obj == INTRANSITIVE) {
/* Carry, no object given yet. OK if only one object present. */ /* Carry, no object given yet. OK if only one object present. */
if (game.atloc[game.loc] == 0 || if (game.atloc[game.loc] == 0 ||
@ -295,46 +294,63 @@ static int vcarry(token_t verb, token_t obj)
rspeak(ALREADY_CARRYING); rspeak(ALREADY_CARRYING);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
spk = YOU_JOKING;
if (obj == PLANT && game.prop[PLANT] <= 0)
spk = DEEP_ROOTS;
if (obj == BEAR && game.prop[BEAR] == SITTING_BEAR)
spk = BEAR_CHAINED;
if (obj == CHAIN && game.prop[BEAR] != UNTAMED_BEAR)
spk = STILL_LOCKED;
if (obj == URN)
spk = URN_NOBUDGE;
if (obj == CAVITY)
spk = DOUGHNUT_HOLES;
if (obj == BLOOD)
spk = FEW_DROPS;
if (obj == RUG && game.prop[RUG] == RUG_HOVER)
spk = RUG_HOVERS;
if (obj == SIGN)
spk = HAND_PASSTHROUGH;
if (obj == MESSAG) { if (obj == MESSAG) {
rspeak(REMOVE_MESSAGE); rspeak(REMOVE_MESSAGE);
DESTROY(MESSAG); DESTROY(MESSAG);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
if (game.fixed[obj] != 0) { if (game.fixed[obj] != 0) {
rspeak(spk); if (obj == PLANT && game.prop[PLANT] <= 0) {
rspeak(DEEP_ROOTS);
return GO_CLEAROBJ;
}
if (obj == BEAR && game.prop[BEAR] == SITTING_BEAR) {
rspeak(BEAR_CHAINED);
return GO_CLEAROBJ;
}
if (obj == CHAIN && game.prop[BEAR] != UNTAMED_BEAR) {
rspeak(STILL_LOCKED);
return GO_CLEAROBJ;
}
if (obj == URN) {
rspeak(URN_NOBUDGE);
return GO_CLEAROBJ;
}
if (obj == CAVITY) {
rspeak(DOUGHNUT_HOLES);
return GO_CLEAROBJ;
}
if (obj == BLOOD) {
rspeak(FEW_DROPS);
return GO_CLEAROBJ;
}
if (obj == RUG && game.prop[RUG] == RUG_HOVER) {
rspeak(RUG_HOVERS);
return GO_CLEAROBJ;
}
if (obj == SIGN) {
rspeak(HAND_PASSTHROUGH);
return GO_CLEAROBJ;
}
rspeak(YOU_JOKING);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
int spk;
if (obj == WATER || if (obj == WATER ||
obj == OIL) { obj == OIL) {
if (!HERE(BOTTLE) || if (!HERE(BOTTLE) ||
LIQUID() != obj) { LIQUID() != obj) {
if (TOTING(BOTTLE) && game.prop[BOTTLE] == EMPTY_BOTTLE) if (TOTING(BOTTLE)) {
return (fill(verb, BOTTLE)); if (game.prop[BOTTLE] == EMPTY_BOTTLE) {
else { return (fill(verb, BOTTLE));
if (game.prop[BOTTLE] != EMPTY_BOTTLE) } else if (game.prop[BOTTLE] != EMPTY_BOTTLE)
spk = BOTTLE_FULL; rspeak(BOTTLE_FULL);
if (!TOTING(BOTTLE))
spk = NO_CONTAINER;
rspeak(spk);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
rspeak(NO_CONTAINER);
return GO_CLEAROBJ;
} }
obj = BOTTLE; obj = BOTTLE;
} }
@ -367,10 +383,11 @@ static int vcarry(token_t verb, token_t obj)
-1 - game.prop[BIRD] == 1)) -1 - game.prop[BIRD] == 1))
carry(BIRD + CAGE - obj, game.loc); carry(BIRD + CAGE - obj, game.loc);
carry(obj, game.loc); carry(obj, game.loc);
if (obj == BOTTLE && LIQUID() != 0) if (obj == BOTTLE && LIQUID() != NO_OBJECT)
game.place[LIQUID()] = CARRIED; game.place[LIQUID()] = CARRIED;
if (GSTONE(obj) && game.prop[obj] != 0) { if (GSTONE(obj) && game.prop[obj] != 0) {
game.prop[obj] = STATE_GROUND; game.prop[obj]
= STATE_GROUND;
game.prop[CAVITY] = CAVITY_EMPTY; game.prop[CAVITY] = CAVITY_EMPTY;
} }
rspeak(OK_MAN); rspeak(OK_MAN);

View file

@ -1090,6 +1090,42 @@ You're at west end of Twopit Room.
There is a huge beanstalk growing out of the west pit up to the hole. There is a huge beanstalk growing out of the west pit up to the hole.
> w
You're in Slab Room.
> u
You are in a secret n/s canyon above a large room.
> reservoir
You're at reservoir.
The waters have parted to form a narrow path across the reservoir.
> take water
Your bottle is now full of water.
> s
You're in Mirror Canyon.
> s
You are in a secret n/s canyon above a large room.
> d
You're in Slab Room.
> s
You're at west end of Twopit Room.
There is a huge beanstalk growing out of the west pit up to the hole.
> drop appendage > drop appendage
OK OK
@ -1113,6 +1149,14 @@ a small pool of oil in one corner of the pit.
Don't be ridiculous! Don't be ridiculous!
> get
Get what?
> drink water
The bottle of water is now empty.
> get oil > get oil
Your bottle is now full of oil. Your bottle is now full of oil.
@ -1125,7 +1169,8 @@ There is a huge beanstalk growing out of the west pit up to the hole.
> w > w
You're at west end of Twopit Room. You are at the west end of the Twopit Room. There is a large hole in
the wall above the pit at this end of the room.
Your keen eye spots a severed leporine appendage lying on the ground. Your keen eye spots a severed leporine appendage lying on the ground.
@ -1281,24 +1326,10 @@ OK
> se > se
There is a threatening little dwarf in the room with you!
You are in a room whose walls resemble swiss cheese. Obvious passages You are in a room whose walls resemble swiss cheese. Obvious passages
go west, east, ne, and nw. Part of the room is occupied by a large go west, east, ne, and nw. Part of the room is occupied by a large
bedrock block. bedrock block.
> throw axe
You killed a little dwarf.
You're in Swiss Cheese Room.
There is a little axe here.
> take axe
OK
> e > e
You are in the Soft Room. The walls are covered with heavy curtains, You are in the Soft Room. The walls are covered with heavy curtains,
@ -1432,16 +1463,12 @@ OK
It is now pitch dark. If you proceed you will likely fall into a pit. It is now pitch dark. If you proceed you will likely fall into a pit.
A hollow voice says "PLUGH".
> on > on
Your lamp is now on. Your lamp is now on.
You're at "Y2". You're at "Y2".
A hollow voice says "PLUGH".
> s > s
You're in n/s passage above e/w passage. You're in n/s passage above e/w passage.
@ -1510,8 +1537,7 @@ There is a huge beanstalk growing out of the west pit up to the hole.
> w > w
You are at the west end of the Twopit Room. There is a large hole in You're at west end of Twopit Room.
the wall above the pit at this end of the room.
Your keen eye spots a severed leporine appendage lying on the ground. Your keen eye spots a severed leporine appendage lying on the ground.
@ -1767,9 +1793,7 @@ There is a huge beanstalk growing out of the west pit up to the hole.
> e > e
You are in a room whose walls resemble swiss cheese. Obvious passages You're in Swiss Cheese Room.
go west, east, ne, and nw. Part of the room is occupied by a large
bedrock block.
There is a little axe here. There is a little axe here.
@ -1851,7 +1875,11 @@ There is a huge beanstalk growing out of the west pit up to the hole.
> w > w
You're in Slab Room. You are in a large low circular chamber whose floor is an immense slab
fallen from the ceiling (Slab Room). East and west there once were
large passages, but they are now filled with boulders. Low small
passages go north and south, and the south one quickly bends west
around the boulders.
> u > u
@ -1879,8 +1907,6 @@ You're in n/s passage above e/w passage.
You're at "Y2". You're at "Y2".
A hollow voice says "PLUGH".
> off > off
Your lamp is now off. Your lamp is now off.
@ -2029,6 +2055,9 @@ Extinguish what?
> look > look
Tsk! A wizard wouldn't have to take 350 turns. This is going to cost
you a couple of points.
Sorry, but I am not allowed to give more detail. I will repeat the Sorry, but I am not allowed to give more detail. I will repeat the
long description of your location. long description of your location.
@ -2076,8 +2105,8 @@ If you mean to use the persian rug, it does not appear inclined to
cooperate. cooperate.
You scored 267 out of a possible 430, using 350 turns. You scored 265 out of a possible 430, using 358 turns.
You have reached "Junior Master" status. You have reached "Junior Master" status.
To achieve the next higher rating, you need 54 more points. To achieve the next higher rating, you need 56 more points.

View file

@ -180,10 +180,20 @@ s
d d
water plant water plant
u u
w
u
reservoir
take water
s
s
d
s
drop appendage drop appendage
e e
d d
drink oil drink oil
get
drink water
get oil get oil
u u
w w
@ -215,8 +225,6 @@ nw
s s
take vase take vase
se se
throw axe
take axe
e e
take pillow take pillow
w w