Eliminate some promiscuous variable reuse.
This was making the opcode-conditional evaluation logic much more difficult to read than it needed to be.
This commit is contained in:
parent
7281c39807
commit
9d918edeaa
1 changed files with 11 additions and 10 deletions
21
main.c
21
main.c
|
@ -624,32 +624,33 @@ static bool playermove(token_t verb, int motion)
|
||||||
*/
|
*/
|
||||||
for (;;) { /* L12 loop */
|
for (;;) { /* L12 loop */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
game.newloc = scratchloc / 1000;
|
long cond = scratchloc / 1000;
|
||||||
long arg = MOD(game.newloc, 100);
|
long arg = MOD(cond, 100);
|
||||||
if (!SPECIAL(game.newloc)) {
|
if (!SPECIAL(cond)) {
|
||||||
/* YAML N and [pct N] conditionals */
|
/* YAML N and [pct N] conditionals */
|
||||||
if (game.newloc <= 100) {
|
if (cond <= 100) {
|
||||||
if (game.newloc == 0 || PCT(game.newloc))
|
if (cond == 0 || PCT(cond))
|
||||||
break;
|
break;
|
||||||
/* else fall through */
|
/* else fall through */
|
||||||
}
|
}
|
||||||
/* YAML [with OBJ] clause */
|
/* YAML [with OBJ] clause */
|
||||||
if (TOTING(arg) || (game.newloc > 200 && AT(arg)))
|
if (TOTING(arg) || (cond > 200 && AT(arg)))
|
||||||
break;
|
break;
|
||||||
/* else fall through to check [not OBJ STATE] */
|
/* else fall through to check [not OBJ STATE] */
|
||||||
} else if (game.prop[arg] != game.newloc / 100 - 3)
|
} else if (game.prop[arg] != cond / 100 - 3)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* We arrive here on conditional failure.
|
/* We arrive here on conditional failure.
|
||||||
* Skip to next non-matching destination */
|
* Skip to next non-matching destination */
|
||||||
|
long nextup;
|
||||||
do {
|
do {
|
||||||
if (travel[kk].stop)
|
if (travel[kk].stop)
|
||||||
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
|
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
|
||||||
++kk;
|
++kk;
|
||||||
game.newloc = T_HIGH(travel[kk]);
|
nextup = T_HIGH(travel[kk]);
|
||||||
} while
|
} while
|
||||||
(game.newloc == scratchloc);
|
(nextup == scratchloc);
|
||||||
scratchloc = game.newloc;
|
scratchloc = nextup;
|
||||||
}
|
}
|
||||||
|
|
||||||
game.newloc = MOD(scratchloc, 1000);
|
game.newloc = MOD(scratchloc, 1000);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue