X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=blobdiff_plain;f=main.c;h=724194df110d6f73d5434a47f4b9980e8daf8963;hp=f9d0284e8b775eea35b2bf08965676f60e71ca8d;hb=79ffdb36f0c9f2fa8f9f2470e5a0c81729d8f622;hpb=c8f6ff3701534e6c1ce59cf3e33aec5e824ed144 diff --git a/main.c b/main.c index f9d0284..724194d 100644 --- a/main.c +++ b/main.c @@ -189,18 +189,18 @@ static bool fallback_handler(char *buf) static void checkhints(void) { if (COND[game.loc] >= game.conds) { - for (int hint = 1; hint <= HINT_COUNT; hint++) { + for (int hint = 0; hint < HINT_COUNT; hint++) { if (game.hinted[hint]) continue; - if (!CNDBIT(game.loc, hint + HBASE)) + if (!CNDBIT(game.loc, hint + 1 + HBASE)) game.hintlc[hint] = -1; ++game.hintlc[hint]; /* Come here if he's been long enough at required loc(s) for some * unused hint. */ - if (game.hintlc[hint] >= hints[hint-1].turns) { + if (game.hintlc[hint] >= hints[hint].turns) { int i; - switch (hint - 1) { + switch (hint) { case 0: /* cave */ if (game.prop[GRATE] == 0 && !HERE(KEYS)) @@ -263,12 +263,12 @@ static void checkhints(void) /* Fall through to hint display */ game.hintlc[hint] = 0; - if (!YES(hints[hint-1].question, arbitrary_messages[NO_MESSAGE], arbitrary_messages[OK_MAN])) + if (!YES(hints[hint].question, arbitrary_messages[NO_MESSAGE], arbitrary_messages[OK_MAN])) return; - rspeak(HINT_COST, hints[hint-1].penalty, hints[hint-1].penalty); - game.hinted[hint] = YES(arbitrary_messages[WANT_HINT], hints[hint-1].hint, arbitrary_messages[OK_MAN]); + rspeak(HINT_COST, hints[hint].penalty, hints[hint].penalty); + game.hinted[hint] = YES(arbitrary_messages[WANT_HINT], hints[hint].hint, arbitrary_messages[OK_MAN]); if (game.hinted[hint] && game.limit > WARNTIME) - game.limit += WARNTIME * hints[hint-1].penalty; + game.limit += WARNTIME * hints[hint].penalty; } } }