X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=main.c;h=997bfe26bf050d9453b9c7932a506f2604fec4df;hb=2bdf9e2803c83d19f375d97dd8147e8d221ec057;hp=5f7cd3fe2788d49ac449491d68ddc2ddad590acf;hpb=d51da9d0b8b623cecb096eec91b599cfc3e4dd41;p=open-adventure.git diff --git a/main.c b/main.c index 5f7cd3f..997bfe2 100644 --- a/main.c +++ b/main.c @@ -116,6 +116,10 @@ int main(int argc, char *argv[]) } else { restore(rfp); } +#else + game.novice = yes(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]); + if (game.novice) + game.limit = NOVICELIMIT; #endif if (settings.logfp) @@ -380,9 +384,10 @@ static bool dwarfmove(void) kk = tkey[game.dloc[i]]; if (kk != 0) do { - game.newloc = travel[kk].dest; + enum desttype_t desttype = travel[kk].desttype; + game.newloc = travel[kk].destval; /* Have we avoided a dwarf encounter? */ - if (SPECIAL(game.newloc)) + if (desttype != dest_goto) continue; else if (!INDEEP(game.newloc)) continue; @@ -505,7 +510,8 @@ 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) - && (travel[a].dest == travel[b].dest); + && (travel[a].desttype == travel[b].desttype) + && (travel[a].destval == travel[b].destval); } /* Given the current location in "game.loc", and a motion verb number in @@ -541,10 +547,11 @@ static void playermove( int motion) if (spk == 0) { int te_tmp = 0; for (;;) { - scratchloc = travel[travel_entry].dest; - if (scratchloc != motion) { - if (!SPECIAL(scratchloc)) { - if (FORCED(scratchloc) && travel[tkey[scratchloc]].dest == motion) + enum desttype_t desttype = travel[travel_entry].desttype; + scratchloc = travel[travel_entry].destval; + if (desttype != dest_goto || scratchloc != motion) { + if (desttype == dest_goto) { + if (FORCED(scratchloc) && travel[tkey[scratchloc]].destval == motion) te_tmp = travel_entry; } if (!travel[travel_entry].stop) { @@ -658,17 +665,17 @@ static void playermove( int motion) } /* Found an eligible rule, now execute it */ - game.newloc = travel[travel_entry].dest; - if (!SPECIAL(game.newloc)) + enum desttype_t desttype = travel[travel_entry].desttype; + game.newloc = travel[travel_entry].destval; + if (desttype == dest_goto) return; - if (game.newloc > 500) { + if (desttype == dest_speak) { /* Execute a speak rule */ - rspeak(L_SPEAK(game.newloc)); + rspeak(game.newloc); game.newloc = game.loc; return; } else { - game.newloc -= SPECIALBASE; switch (game.newloc) { case 1: /* Special travel 1. Plover-alcove passage. Can carry only @@ -1014,9 +1021,7 @@ static bool do_command() listobjects(); L2012: - command.verb = 0; game.oldobj = command.obj; - command.obj = 0; L2600: checkhints(); @@ -1047,10 +1052,12 @@ L2600: return (false); if (word_count(input) > 2) { rspeak(TWO_WORDS); + free(input); continue; } if (strcmp(input, "") != 0) break; + free(input); } strncpy(inputbuf, input, LINESIZE - 1);