From: NHOrus Date: Sat, 8 Jul 2017 14:40:57 +0000 (+0300) Subject: Restructure quips for invalid movements. X-Git-Tag: 2017-07-10~18 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=d739c111d76d401ca38ea90c7851bb82ffe9caf1;p=open-adventure.git Restructure quips for invalid movements. --- diff --git a/adventure.yaml b/adventure.yaml index b8778a7..e137d8c 100644 --- a/adventure.yaml +++ b/adventure.yaml @@ -204,9 +204,9 @@ motions: !!omap words: ['east', 'e'] - WEST: words: ['west', 'w'] -- MOT_45: +- NORTH: words: ['north', 'n'] -- MOT_46: +- SOUTH: words: ['south', 's'] - NE: words: ['ne'] diff --git a/main.c b/main.c index f89afcc..972e30f 100644 --- a/main.c +++ b/main.c @@ -604,25 +604,40 @@ static void playermove( int motion) if (travel[travel_entry].stop) { /* Couldn't find an entry matching the motion word passed * in. Various messages depending on word given. */ - int spk = CANT_APPLY; - if (motion >= EAST && motion <= NW) - spk = BAD_DIRECTION; - if (motion == UP || - motion == DOWN) - spk = BAD_DIRECTION; - if (motion == FORWARD || - motion == LEFT || - motion == RIGHT) - spk = UNSURE_FACING; - if (motion == OUTSIDE || - motion == INSIDE) - spk = NO_INOUT_HERE; - if (motion == XYZZY || - motion == PLUGH) - spk = NOTHING_HAPPENS; - if (motion == CRAWL) - spk = WHICH_WAY; - rspeak(spk); + switch (motion) { + case EAST: + case WEST: + case SOUTH: + case NORTH: + case NE: + case NW: + case SW: + case SE: + rspeak(BAD_DIRECTION); + break; + case UP: + case DOWN: + rspeak(BAD_DIRECTION); + break; + case FORWARD: + case LEFT: + case RIGHT: + 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; } ++travel_entry;