Restructure quips for invalid movements.

This commit is contained in:
NHOrus 2017-07-08 17:40:57 +03:00
parent 386ca2b8d2
commit d739c111d7
2 changed files with 36 additions and 21 deletions

View file

@ -204,9 +204,9 @@ motions: !!omap
words: ['east', 'e'] words: ['east', 'e']
- WEST: - WEST:
words: ['west', 'w'] words: ['west', 'w']
- MOT_45: - NORTH:
words: ['north', 'n'] words: ['north', 'n']
- MOT_46: - SOUTH:
words: ['south', 's'] words: ['south', 's']
- NE: - NE:
words: ['ne'] words: ['ne']

53
main.c
View file

@ -604,25 +604,40 @@ static void playermove( int motion)
if (travel[travel_entry].stop) { if (travel[travel_entry].stop) {
/* Couldn't find an entry matching the motion word passed /* Couldn't find an entry matching the motion word passed
* in. Various messages depending on word given. */ * in. Various messages depending on word given. */
int spk = CANT_APPLY; switch (motion) {
if (motion >= EAST && motion <= NW) case EAST:
spk = BAD_DIRECTION; case WEST:
if (motion == UP || case SOUTH:
motion == DOWN) case NORTH:
spk = BAD_DIRECTION; case NE:
if (motion == FORWARD || case NW:
motion == LEFT || case SW:
motion == RIGHT) case SE:
spk = UNSURE_FACING; rspeak(BAD_DIRECTION);
if (motion == OUTSIDE || break;
motion == INSIDE) case UP:
spk = NO_INOUT_HERE; case DOWN:
if (motion == XYZZY || rspeak(BAD_DIRECTION);
motion == PLUGH) break;
spk = NOTHING_HAPPENS; case FORWARD:
if (motion == CRAWL) case LEFT:
spk = WHICH_WAY; case RIGHT:
rspeak(spk); rspeak(UNSURE_FACING);
break;
case OUTSIDE:
case INSIDE:
rspeak(NO_INOUT_HERE);
break;
case XYZZY:
case PLUGH:
rspeak(NOTHING_HAPPENS);
break;
case CRAWL:
rspeak(WHICH_WAY);
break;
default:
rspeak(CANT_APPLY);
}
return; return;
} }
++travel_entry; ++travel_entry;