X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=main.c;h=7e165a70040e3c8047f6eac763f65eab257b859b;hb=7d690e0b95e5a0eea6df9c2bcc026a5f5f7c18a8;hp=997bfe26bf050d9453b9c7932a506f2604fec4df;hpb=2bdf9e2803c83d19f375d97dd8147e8d221ec057;p=open-adventure.git diff --git a/main.c b/main.c index 997bfe2..7e165a7 100644 --- a/main.c +++ b/main.c @@ -501,15 +501,16 @@ static void croak(void) drop(i, (i == LAMP) ? LOC_START : game.oldlc2); } } - game.loc = LOC_BUILDING; - game.oldloc = game.loc; + game.oldloc = game.loc = game.newloc = LOC_BUILDING; } } static bool traveleq(long a, long b) /* Are two travel entries equal for purposes of skip after failed condition? */ { - return (travel[a].cond == travel[b].cond) + return (travel[a].condtype == travel[b].condtype) + && (travel[a].condarg1 == travel[b].condarg1) + && (travel[a].condarg2 == travel[b].condarg2) && (travel[a].desttype == travel[b].desttype) && (travel[a].destval == travel[b].destval); } @@ -634,22 +635,23 @@ static void playermove( int motion) do { for (;;) { /* L12 loop */ for (;;) { - long cond = travel[travel_entry].cond; - long arg = MOD(cond, 100); - if (!SPECIAL(cond)) { + enum condtype_t condtype = travel[travel_entry].condtype; + long condarg1 = travel[travel_entry].condarg1; + long condarg2 = travel[travel_entry].condarg2; + if (condtype < cond_not) { /* YAML N and [pct N] conditionals */ - if (cond <= 100) { - if (cond == 0 || - PCT(cond)) + if (condtype == cond_goto || condtype == cond_pct) { + if (condarg1 == 0 || + PCT(condarg1)) break; /* else fall through */ } /* YAML [with OBJ] clause */ - if (TOTING(arg) || - (cond > 200 && AT(arg))) + else if (TOTING(condarg1) || + (condtype == cond_with && AT(condarg1))) break; /* else fall through to check [not OBJ STATE] */ - } else if (game.prop[arg] != cond / 100 - 3) + } else if (game.prop[condarg1] != condarg2) break; /* We arrive here on conditional failure.