X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=main.c;h=1cff0d1648db7fb827b29fb6f3859ada02bcf16e;hb=85f8334e17b9e3118a73f2e9405e9db5f94ad648;hp=4531be72cb9f2ec82780e34809b3605002248173;hpb=4f08537e2d1c8c361d08e07a2d67cd3f53e03f40;p=open-adventure.git diff --git a/main.c b/main.c index 4531be7..1cff0d1 100644 --- a/main.c +++ b/main.c @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) /* Options. */ #ifndef ADVENT_NOSAVE - const char* opts = "l:or"; + const char* opts = "l:or:"; const char* usage = "Usage: %s [-l logfilename] [-o] [-r restorefilename]\n"; #else const char* opts = "l:o"; @@ -110,9 +110,6 @@ int main(int argc, char *argv[]) /* Initialize game variables */ long seedval = initialise(); - /* Start-up, dwarf stuff */ - make_zzword(game.zzword); - #ifndef ADVENT_NOSAVE if (!rfp) { game.novice = yes(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]); @@ -144,8 +141,6 @@ static bool fallback_handler(char *buf) printf("Seed set to %ld\n", sv); // autogenerated, so don't charge user time for it. --game.turns; - // here we reconfigure any global game state that uses random numbers - make_zzword(game.zzword); return true; } return false; @@ -381,21 +376,27 @@ static bool dwarfmove(void) do { game.newloc = travel[kk].dest; /* Have we avoided a dwarf encounter? */ - bool avoided = (SPECIAL(game.newloc) || - !INDEEP(game.newloc) || - game.newloc == game.odloc[i] || - (j > 1 && game.newloc == tk[j - 1]) || - j >= DIM(tk) - 1 || - game.newloc == game.dloc[i] || - FORCED(game.newloc) || - (i == PIRATE && CNDBIT(game.newloc, COND_NOARRR)) || - travel[kk].nodwarves); - if (!avoided) { - tk[j++] = game.newloc; - } - ++kk; + if (SPECIAL(game.newloc)) + continue; + else if (!INDEEP(game.newloc)) + continue; + else if (game.newloc == game.odloc[i]) + continue; + else if (j > 1 && game.newloc == tk[j - 1]) + continue; + else if (j >= DIM(tk) - 1) + continue; + else if (game.newloc == game.dloc[i]) + continue; + else if (FORCED(game.newloc)) + continue; + else if (i == PIRATE && CNDBIT(game.newloc, COND_NOARRR)) + continue; + else if (travel[kk].nodwarves) + continue; + tk[j++] = game.newloc; } while - (!travel[kk - 1].stop); + (!travel[kk++].stop); tk[j] = game.odloc[i]; if (j >= 2) --j;