Minor refactoring step.
This commit is contained in:
parent
b3b6314fa4
commit
d891b883b9
1 changed files with 29 additions and 23 deletions
44
main.c
44
main.c
|
@ -636,6 +636,7 @@ static bool playermove(token_t verb, int motion)
|
||||||
break;
|
break;
|
||||||
/* else fall through */
|
/* else fall through */
|
||||||
}
|
}
|
||||||
|
/* handles the YAML "with" clause */
|
||||||
if (TOTING(motion) || (game.newloc > 200 && AT(motion)))
|
if (TOTING(motion) || (game.newloc > 200 && AT(motion)))
|
||||||
break;
|
break;
|
||||||
/* else fall through */
|
/* else fall through */
|
||||||
|
@ -654,14 +655,20 @@ static bool playermove(token_t verb, int motion)
|
||||||
game.newloc = MOD(scratchloc, 1000);
|
game.newloc = MOD(scratchloc, 1000);
|
||||||
if (!SPECIAL(game.newloc))
|
if (!SPECIAL(game.newloc))
|
||||||
return true;
|
return true;
|
||||||
if (game.newloc <= 500) {
|
|
||||||
|
if (game.newloc > 500) {
|
||||||
|
/* Execute a speak rule */
|
||||||
|
rspeak(L_SPEAK(game.newloc));
|
||||||
|
game.newloc = game.loc;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
game.newloc -= SPECIALBASE;
|
game.newloc -= SPECIALBASE;
|
||||||
switch (game.newloc) {
|
switch (game.newloc) {
|
||||||
case 1:
|
case 1:
|
||||||
/* Travel 301. Plover-alcove passage. Can carry only
|
/* Travel 301. Plover-alcove passage. Can carry only
|
||||||
* emerald. Note: travel table must include "useless"
|
* emerald. Note: travel table must include "useless"
|
||||||
* entries going through passage, which can never be used for
|
* entries going through passage, which can never be used
|
||||||
* actual motion, but can be spotted by "go back". */
|
* for actual motion, but can be spotted by "go back". */
|
||||||
/* FIXME: Arithmetic on location numbers */
|
/* FIXME: Arithmetic on location numbers */
|
||||||
game.newloc = 99 + 100 - game.loc;
|
game.newloc = 99 + 100 - game.loc;
|
||||||
if (game.holdng > 1 || (game.holdng == 1 && !TOTING(EMERALD))) {
|
if (game.holdng > 1 || (game.holdng == 1 && !TOTING(EMERALD))) {
|
||||||
|
@ -670,9 +677,10 @@ static bool playermove(token_t verb, int motion)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case 2:
|
case 2:
|
||||||
/* Travel 302. Plover transport. Drop the emerald (only use
|
/* Travel 302. Plover transport. Drop the
|
||||||
* special travel if toting it), so he's forced to use the
|
* emerald (only use special travel if toting
|
||||||
* plover-passage to get it out. Having dropped it, go back and
|
* it), so he's forced to use the plover-passage
|
||||||
|
* to get it out. Having dropped it, go back and
|
||||||
* pretend he wasn't carrying it after all. */
|
* pretend he wasn't carrying it after all. */
|
||||||
drop(EMERALD, game.loc);
|
drop(EMERALD, game.loc);
|
||||||
do {
|
do {
|
||||||
|
@ -685,13 +693,15 @@ static bool playermove(token_t verb, int motion)
|
||||||
scratchloc = game.newloc;
|
scratchloc = game.newloc;
|
||||||
continue; /* goto L12 */
|
continue; /* goto L12 */
|
||||||
case 3:
|
case 3:
|
||||||
/* Travel 303. Troll bridge. Must be done only as special
|
/* Travel 303. Troll bridge. Must be done only
|
||||||
* motion so that dwarves won't wander across and encounter
|
* as special motion so that dwarves won't wander
|
||||||
* the bear. (They won't follow the player there because
|
* across and encounter the bear. (They won't
|
||||||
* that region is forbidden to the pirate.) If
|
* follow the player there because that region is
|
||||||
* game.prop(TROLL)=1, he's crossed since paying, so step out
|
* forbidden to the pirate.) If
|
||||||
* and block him. (standard travel entries check for
|
* game.prop(TROLL)=1, he's crossed since paying,
|
||||||
* game.prop(TROLL)=0.) Special stuff for bear. */
|
* so step out and block him. (standard travel
|
||||||
|
* entries check for game.prop(TROLL)=0.) Special
|
||||||
|
* stuff for bear. */
|
||||||
if (game.prop[TROLL] == 1) {
|
if (game.prop[TROLL] == 1) {
|
||||||
pspeak(TROLL,look, 1);
|
pspeak(TROLL,look, 1);
|
||||||
game.prop[TROLL] = 0;
|
game.prop[TROLL] = 0;
|
||||||
|
@ -716,18 +726,14 @@ static bool playermove(token_t verb, int motion)
|
||||||
croak();
|
croak();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
default:
|
||||||
BUG(SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST);
|
BUG(SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break; /* Leave L12 loop */
|
break; /* Leave L12 loop */
|
||||||
}
|
}
|
||||||
} while
|
} while
|
||||||
(false);
|
(false);
|
||||||
|
|
||||||
/* Execute a speak rule */
|
|
||||||
rspeak(L_SPEAK(game.newloc));
|
|
||||||
game.newloc = game.loc;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool closecheck(void)
|
static bool closecheck(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue