X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=main.c;h=7ccffbb9d3019ee251b15f950fd464b00ad88445;hb=9d918edeaa244e97e4fc7b4605bf0efb31f2b5d1;hp=8f98db577ec1d199292cbb5649149392878ceacf;hpb=b5260417dd83b655a4ebe797bbe0548f7ede4099;p=open-adventure.git diff --git a/main.c b/main.c index 8f98db5..7ccffbb 100644 --- a/main.c +++ b/main.c @@ -624,28 +624,33 @@ static bool playermove(token_t verb, int motion) */ for (;;) { /* L12 loop */ for (;;) { - game.newloc = scratchloc / 1000; - motion = MOD(game.newloc, 100); - if (!SPECIAL(game.newloc)) { - if (game.newloc <= 100) { - if (game.newloc == 0 || PCT(game.newloc)) + long cond = scratchloc / 1000; + long arg = MOD(cond, 100); + if (!SPECIAL(cond)) { + /* YAML N and [pct N] conditionals */ + if (cond <= 100) { + if (cond == 0 || PCT(cond)) break; /* else fall through */ } - /* handles the YAML "with" clause */ - if (TOTING(motion) || (game.newloc > 200 && AT(motion))) + /* YAML [with OBJ] clause */ + if (TOTING(arg) || (cond > 200 && AT(arg))) break; - /* else fall through */ - } else if (game.prop[motion] != game.newloc / 100 - 3) + /* else fall through to check [not OBJ STATE] */ + } else if (game.prop[arg] != cond / 100 - 3) break; - do { + + /* We arrive here on conditional failure. + * Skip to next non-matching destination */ + long nextup; + do { if (travel[kk].stop) BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE ++kk; - game.newloc = T_HIGH(travel[kk]); + nextup = T_HIGH(travel[kk]); } while - (game.newloc == scratchloc); - scratchloc = game.newloc; + (nextup == scratchloc); + scratchloc = nextup; } game.newloc = MOD(scratchloc, 1000);