{
vocab_t verb = command->verb;
vocab_t obj = command->obj;
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == 0 || obj == INTRANSITIVE) {
if (atdwrf(game.loc) > 0)
obj = DWARF;
pspeak(DRAGON, look, 3);
game.prop[DRAGON] = 1;
game.prop[RUG] = 0;
- int k = (object_descriptions[DRAGON].plac + object_descriptions[DRAGON].fixd) / 2;
+ int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2;
move(DRAGON + NOBJECTS, -1);
move(RUG + NOBJECTS, 0);
move(DRAGON, k);
move(RUG, k);
drop(BLOOD, k);
for (obj = 1; obj <= NOBJECTS; obj++) {
- if (game.place[obj] == object_descriptions[DRAGON].plac || game.place[obj] == object_descriptions[DRAGON].fixd)
+ if (game.place[obj] == objects[DRAGON].plac || game.place[obj] == objects[DRAGON].fixd)
move(obj, k);
}
game.loc = k;
return GO_CLEAROBJ;
}
game.foobar = 0;
- if (game.place[EGGS] == object_descriptions[EGGS].plac || (TOTING(EGGS) && game.loc == object_descriptions[EGGS].plac)) {
+ if (game.place[EGGS] == objects[EGGS].plac || (TOTING(EGGS) && game.loc == objects[EGGS].plac)) {
rspeak(spk);
return GO_CLEAROBJ;
} else {
game.prop[TROLL] = 1;
k = 2;
if (HERE(EGGS))k = 1;
- if (game.loc == object_descriptions[EGGS].plac)k = 0;
- move(EGGS, object_descriptions[EGGS].plac);
+ if (game.loc == objects[EGGS].plac)k = 0;
+ move(EGGS, objects[EGGS].plac);
pspeak(EGGS, look, k);
return GO_CLEAROBJ;
}
static int vbreak(token_t verb, token_t obj)
/* Break. Only works for mirror in repository and, of course, the vase. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == MIRROR)spk = TOO_FAR;
if (obj == VASE && game.prop[VASE] == 0) {
if (TOTING(VASE))drop(VASE, game.loc);
} else {
spk = CHAIN_LOCKED;
if (game.prop[CHAIN] != 0)spk = ALREADY_LOCKED;
- if (game.loc != object_descriptions[CHAIN].plac)spk = NO_LOCKSITE;
+ if (game.loc != objects[CHAIN].plac)spk = NO_LOCKSITE;
if (spk != CHAIN_LOCKED) {
rspeak(spk);
return GO_CLEAROBJ;
* bird (might attack snake or dragon) and cage (might contain bird) and vase.
* Drop coins at vending machine for extra batteries. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (!just_do_it) {
if (TOTING(ROD2) && obj == ROD && !TOTING(ROD))obj = ROD2;
if (!TOTING(obj)) {
if (spk != RUG_WIGGLES) {
int k = 2 - game.prop[RUG];
game.prop[RUG] = k;
- if (k == 2) k = object_descriptions[SAPPH].plac;
+ if (k == 2) k = objects[SAPPH].plac;
move(RUG + NOBJECTS, k);
}
}
rspeak(TROLL_SCAMPERS);
move(TROLL, 0);
move(TROLL + NOBJECTS, 0);
- move(TROLL2, object_descriptions[TROLL].plac);
- move(TROLL2 + NOBJECTS, object_descriptions[TROLL].fixd);
+ move(TROLL2, objects[TROLL].plac);
+ move(TROLL2 + NOBJECTS, objects[TROLL].fixd);
juggle(CHASM);
game.prop[TROLL] = 2;
- } else if (obj != VASE || game.loc == object_descriptions[PILLOW].plac) {
+ } else if (obj != VASE || game.loc == objects[PILLOW].plac) {
rspeak(OK_MAN);
} else {
game.prop[VASE] = 2;
/* Drink. If no object, assume water and look for it here. If water is in
* the bottle, drink that, else must be at a water loc, so drink stream. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == 0 && LIQLOC(game.loc) != WATER && (LIQUID() != WATER || !HERE(BOTTLE)))
return GO_UNKNOWN;
if (obj != BLOOD) {
/* Eat. Intransitive: assume food if present, else ask what. Transitive: food
* ok, some things lose appetite, rest are ridiculous. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
if (!HERE(FOOD))
return GO_UNKNOWN;
static int extinguish(token_t verb, int obj)
/* Extinguish. Lamp, urn, dragon/volcano (nice try). */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
if (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT)
obj = LAMP;
/* Feed. If bird, no seed. Snake, dragon, troll: quip. If dwarf, make him
* mad. Bear, special. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == BIRD) {
rspeak(BIRD_PINING);
return GO_CLEAROBJ;
* is nasty.) */
{
int k;
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == VASE) {
spk = ARENT_CARRYING;
if (LIQLOC(game.loc) == 0)spk = FILL_INVALID;
static int find(token_t verb, token_t obj)
/* Find. Might be carrying it, or it might be here. Else give caveat. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (AT(obj) ||
(LIQUID() == obj && AT(BOTTLE)) ||
obj == LIQLOC(game.loc) ||
static int fly(token_t verb, token_t obj)
/* Fly. Snide remarks unless hovering rug is here. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
if (game.prop[RUG] != 2)spk = RUG_NOTHING2;
if (!HERE(RUG))spk = FLAP_ARMS;
static int light(token_t verb, token_t obj)
/* Light. Applicable only to lamp and urn. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0)
obj = LAMP;
spk = NO_MESSAGE;
}
for (int i = 1; i <= NOBJECTS; i++) {
- if (!HERE(i) || object_descriptions[i].sounds[0] == NULL || game.prop[i] < 0)
+ if (!HERE(i) || objects[i].sounds[0] == NULL || game.prop[i] < 0)
continue;
int mi = game.prop[i];
if (i == BIRD)
static int lock(token_t verb, token_t obj)
/* Lock, unlock, no object given. Assume various things if present. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
spk = NOTHING_LOCKED;
if (HERE(CLAM))obj = CLAM;
/* Pour. If no object, or object is bottle, assume contents of bottle.
* special tests for pouring water or oil on plant or rusty door. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj == BOTTLE || obj == 0)obj = LIQUID();
if (obj == 0) return GO_UNKNOWN;
if (!TOTING(obj)) {
if (command.obj == INTRANSITIVE) {
command.obj = 0;
for (int i = 1; i <= NOBJECTS; i++) {
- if (HERE(i) && object_descriptions[i].texts[0] != NULL && game.prop[i] >= 0)
+ if (HERE(i) && objects[i].texts[0] != NULL && game.prop[i] >= 0)
command.obj = command.obj * NOBJECTS + i;
}
if (command.obj > NOBJECTS || command.obj == 0 || DARK(game.loc))
rspeak(NO_SEE, command.wd1, command.wd1x);
} else if (command.obj == OYSTER && !game.clshnt && game.closed) {
game.clshnt = yes(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
- } else if (object_descriptions[command.obj].texts[0] == NULL || game.prop[command.obj] < 0) {
- rspeak(actspk[command.verb]);
+ } else if (objects[command.obj].texts[0] == NULL || game.prop[command.obj] < 0) {
+ rspeak(actions[command.verb].message);
} else
pspeak(command.obj, study, game.prop[command.obj]);
return GO_CLEAROBJ;
static int rub(token_t verb, token_t obj)
/* Rub. Yields various snide remarks except for lit urn. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if (obj != LAMP)
spk = PECULIAR_NOTHING;
if (obj == URN && game.prop[URN] == 2) {
* (Only way to do so!) Axe also special for dragon, bear, and
* troll. Treasures special for troll. */
{
- int spk = actspk[command->verb];
+ int spk = actions[command->verb].message;
if (TOTING(ROD2) && command->obj == ROD && !TOTING(ROD))command->obj = ROD2;
if (!TOTING(command->obj)) {
rspeak(spk);
return GO_CLEAROBJ;
}
- if (object_descriptions[command->obj].is_treasure && AT(TROLL)) {
+ if (objects[command->obj].is_treasure && AT(TROLL)) {
spk = TROLL_SATISFIED;
/* Snarf a treasure for the troll. */
drop(command->obj, 0);
move(TROLL, 0);
move(TROLL + NOBJECTS, 0);
- drop(TROLL2, object_descriptions[TROLL].plac);
- drop(TROLL2 + NOBJECTS, object_descriptions[TROLL].fixd);
+ drop(TROLL2, objects[TROLL].plac);
+ drop(TROLL2 + NOBJECTS, objects[TROLL].fixd);
juggle(CHASM);
rspeak(spk);
return GO_CLEAROBJ;
/* Wake. Only use is to disturb the dwarves. */
{
if (obj != DWARF || !game.closed) {
- rspeak(actspk[verb]);
+ rspeak(actions[verb].message);
return GO_CLEAROBJ;
} else {
rspeak(PROD_DWARF);
static int wave(token_t verb, token_t obj)
/* Wave. No effect unless waving rod at fissure or at bird. */
{
- int spk = actspk[verb];
+ int spk = actions[verb].message;
if ((!TOTING(obj)) && (obj != ROD || !TOTING(ROD2)))spk = ARENT_CARRYING;
if (obj != ROD ||
!TOTING(obj) ||
* unless verb is "say", which snarfs arbitrary second word.
*/
{
- token_t spk = actspk[command->verb];
+ token_t spk = actions[command->verb].message;
if (command->part == unknown) {
/* Analyse an object word. See if the thing is here, whether
} else if (command->obj == ROD && HERE(ROD2)) {
command->obj = ROD2;
/* FALL THROUGH */;
- } else if ((command->verb == FIND || command->verb == INVENT) && command->wd2 <= 0)
+ } else if ((command->verb == FIND || command->verb == INVENTORY) && command->wd2 <= 0)
/* FALL THROUGH */;
else {
rspeak(NO_SEE, command->wd1, command->wd1x);
if (command->verb == SAY)command->obj = command->wd2;
if (command->obj == 0 || command->obj == INTRANSITIVE) {
/* Analyse an intransitive verb (ie, no object given yet). */
- switch (command->verb - 1) {
- case 0: /* CARRY */
+ switch (command->verb) {
+ case CARRY:
return vcarry(command->verb, INTRANSITIVE);
- case 1: /* DROP */
+ case DROP:
return GO_UNKNOWN;
- case 2: /* SAY */
+ case SAY:
return GO_UNKNOWN;
- case 3: /* UNLOC */
+ case UNLOCK:
return lock(command->verb, INTRANSITIVE);
- case 4: { /* NOTHI */
+ case NOTHING: {
rspeak(OK_MAN);
return (GO_CLEAROBJ);
}
- case 5: /* LOCK */
+ case LOCK:
return lock(command->verb, INTRANSITIVE);
- case 6: /* LIGHT */
+ case LIGHT:
return light(command->verb, INTRANSITIVE);
- case 7: /* EXTIN */
+ case EXTINGUISH:
return extinguish(command->verb, INTRANSITIVE);
- case 8: /* WAVE */
+ case WAVE:
return GO_UNKNOWN;
- case 9: /* CALM */
+ case TAME:
return GO_UNKNOWN;
- case 10: { /* WALK */
+ case GO: {
rspeak(spk);
return GO_CLEAROBJ;
}
- case 11: /* ATTAC */
+ case ATTACK:
return attack(input, command);
- case 12: /* POUR */
+ case POUR:
return pour(command->verb, command->obj);
- case 13: /* EAT */
+ case EAT:
return eat(command->verb, INTRANSITIVE);
- case 14: /* DRINK */
+ case DRINK:
return drink(command->verb, command->obj);
- case 15: /* RUB */
+ case RUB:
return GO_UNKNOWN;
- case 16: /* TOSS */
+ case THROW:
return GO_UNKNOWN;
- case 17: /* QUIT */
+ case QUIT:
return quit();
- case 18: /* FIND */
+ case FIND:
return GO_UNKNOWN;
- case 19: /* INVEN */
+ case INVENTORY:
return inven();
- case 20: /* FEED */
+ case FEED:
return GO_UNKNOWN;
- case 21: /* FILL */
+ case FILL:
return fill(command->verb, command->obj);
- case 22: /* BLAST */
+ case BLAST:
blast();
return GO_CLEAROBJ;
- case 23: /* SCOR */
+ case SCORE:
score(scoregame);
return GO_CLEAROBJ;
- case 24: /* FOO */
+ case GIANTWORDS:
return bigwords(command->wd1);
- case 25: /* BRIEF */
+ case BRIEF:
return brief();
- case 26: /* READ */
+ case READ:
command->obj = INTRANSITIVE;
return read(*command);
- case 27: /* BREAK */
+ case BREAK:
return GO_UNKNOWN;
- case 28: /* WAKE */
+ case WAKE:
return GO_UNKNOWN;
- case 29: /* SUSP */
+ case SAVE:
return suspend();
- case 30: /* RESU */
+ case RESUME:
return resume();
- case 31: /* FLY */
+ case FLY:
return fly(command->verb, INTRANSITIVE);
- case 32: /* LISTE */
+ case LISTEN:
return listen();
- case 33: /* ZZZZ */
+ case PART:
return reservoir();
+ default:
+ BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
}
- BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST);
}
/* FALLTHRU */
case transitive:
/* Analyse a transitive verb. */
- switch (command->verb - 1) {
- case 0: /* CARRY */
+ switch (command->verb) {
+ case CARRY:
return vcarry(command->verb, command->obj);
- case 1: /* DROP */
+ case DROP:
return discard(command->verb, command->obj, false);
- case 2: /* SAY */
+ case SAY:
return say(command);
- case 3: /* UNLOC */
+ case UNLOCK:
return lock(command->verb, command->obj);
- case 4: { /* NOTHI */
+ case NOTHING: {
rspeak(OK_MAN);
return (GO_CLEAROBJ);
}
- case 5: /* LOCK */
+ case LOCK:
return lock(command->verb, command->obj);
- case 6: /* LIGHT */
+ case LIGHT:
return light(command->verb, command->obj);
- case 7: /* EXTI */
+ case EXTINGUISH:
return extinguish(command->verb, command->obj);
- case 8: /* WAVE */
+ case WAVE:
return wave(command->verb, command->obj);
- case 9: { /* CALM */
+ case TAME: {
rspeak(spk);
return GO_CLEAROBJ;
}
- case 10: { /* WALK */
+ case GO: {
rspeak(spk);
return GO_CLEAROBJ;
}
- case 11: /* ATTAC */
+ case ATTACK:
return attack(input, command);
- case 12: /* POUR */
+ case POUR:
return pour(command->verb, command->obj);
- case 13: /* EAT */
+ case EAT:
return eat(command->verb, command->obj);
- case 14: /* DRINK */
+ case DRINK:
return drink(command->verb, command->obj);
- case 15: /* RUB */
+ case RUB:
return rub(command->verb, command->obj);
- case 16: /* TOSS */
+ case THROW:
return throw(input, command);
- case 17: { /* QUIT */
+ case QUIT: {
rspeak(spk);
return GO_CLEAROBJ;
}
- case 18: /* FIND */
+ case FIND:
return find(command->verb, command->obj);
- case 19: /* INVEN */
+ case INVENTORY:
return find(command->verb, command->obj);
- case 20: /* FEED */
+ case FEED:
return feed(command->verb, command->obj);
- case 21: /* FILL */
+ case FILL:
return fill(command->verb, command->obj);
- case 22: /* BLAST */
+ case BLAST:
blast();
return GO_CLEAROBJ;
- case 23: { /* SCOR */
+ case SCORE: {
rspeak(spk);
return GO_CLEAROBJ;
}
- case 24: { /* FOO */
+ case GIANTWORDS: {
rspeak(spk);
return GO_CLEAROBJ;
}
- case 25: { /* BRIEF */
+ case BRIEF: {
rspeak(spk);
return GO_CLEAROBJ;
}
- case 26: /* READ */
+ case READ:
return read(*command);
- case 27: /* BREAK */
+ case BREAK:
return vbreak(command->verb, command->obj);
- case 28: /* WAKE */
+ case WAKE:
return wake(command->verb, command->obj);
- case 29: { /* SUSP */
+ case SAVE: {
rspeak(spk);
return GO_CLEAROBJ;
}
- case 30: { /* RESU */
+ case RESUME: {
rspeak(spk);
return GO_CLEAROBJ;
}
- case 31: /* FLY */
+ case FLY:
return fly(command->verb, command->obj);
- case 32: { /* LISTE */
+ case LISTEN: {
rspeak(spk);
return GO_CLEAROBJ;
}
- case 33: /* ZZZZ */
+ case PART:
return reservoir();
- }
- BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST);
+ default:
+ BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
+ }
case unknown:
/* Unknown verb, couldn't deduce object - might need hint */
rspeak(WHAT_DO, command->wd1, command->wd1x);
return GO_CHECKHINT;
default:
- BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN);
+ BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN); // LCOV_EXCL_LINE
}
}