Switch to 0-indexing for hint handling code.
This commit is contained in:
parent
c8f6ff3701
commit
79ffdb36f0
3 changed files with 11 additions and 11 deletions
2
init.c
2
init.c
|
@ -225,7 +225,7 @@ void initialise(void)
|
||||||
/* Clear the hint stuff. game.hintlc[i] is how long he's been at LOC
|
/* Clear the hint stuff. game.hintlc[i] is how long he's been at LOC
|
||||||
* with cond bit i. game.hinted[i] is true iff hint i has been
|
* with cond bit i. game.hinted[i] is true iff hint i has been
|
||||||
* used. */
|
* used. */
|
||||||
for (int i = 1; i <= HINT_COUNT; i++) {
|
for (int i = 0; i < HINT_COUNT; i++) {
|
||||||
game.hinted[i] = false;
|
game.hinted[i] = false;
|
||||||
game.hintlc[i] = 0;
|
game.hintlc[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
16
main.c
16
main.c
|
@ -189,18 +189,18 @@ static bool fallback_handler(char *buf)
|
||||||
static void checkhints(void)
|
static void checkhints(void)
|
||||||
{
|
{
|
||||||
if (COND[game.loc] >= game.conds) {
|
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])
|
if (game.hinted[hint])
|
||||||
continue;
|
continue;
|
||||||
if (!CNDBIT(game.loc, hint + HBASE))
|
if (!CNDBIT(game.loc, hint + 1 + HBASE))
|
||||||
game.hintlc[hint] = -1;
|
game.hintlc[hint] = -1;
|
||||||
++game.hintlc[hint];
|
++game.hintlc[hint];
|
||||||
/* Come here if he's been long enough at required loc(s) for some
|
/* Come here if he's been long enough at required loc(s) for some
|
||||||
* unused hint. */
|
* unused hint. */
|
||||||
if (game.hintlc[hint] >= hints[hint-1].turns) {
|
if (game.hintlc[hint] >= hints[hint].turns) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (hint - 1) {
|
switch (hint) {
|
||||||
case 0:
|
case 0:
|
||||||
/* cave */
|
/* cave */
|
||||||
if (game.prop[GRATE] == 0 && !HERE(KEYS))
|
if (game.prop[GRATE] == 0 && !HERE(KEYS))
|
||||||
|
@ -263,12 +263,12 @@ static void checkhints(void)
|
||||||
|
|
||||||
/* Fall through to hint display */
|
/* Fall through to hint display */
|
||||||
game.hintlc[hint] = 0;
|
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;
|
return;
|
||||||
rspeak(HINT_COST, hints[hint-1].penalty, hints[hint-1].penalty);
|
rspeak(HINT_COST, hints[hint].penalty, hints[hint].penalty);
|
||||||
game.hinted[hint] = YES(arbitrary_messages[WANT_HINT], hints[hint-1].hint, arbitrary_messages[OK_MAN]);
|
game.hinted[hint] = YES(arbitrary_messages[WANT_HINT], hints[hint].hint, arbitrary_messages[OK_MAN]);
|
||||||
if (game.hinted[hint] && game.limit > WARNTIME)
|
if (game.hinted[hint] && game.limit > WARNTIME)
|
||||||
game.limit += WARNTIME * hints[hint-1].penalty;
|
game.limit += WARNTIME * hints[hint].penalty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
score.c
4
score.c
|
@ -87,9 +87,9 @@ long score(enum termination mode)
|
||||||
mxscor += 2;
|
mxscor += 2;
|
||||||
|
|
||||||
/* Deduct for hints/turns/saves. Hints < 4 are special; see database desc. */
|
/* Deduct for hints/turns/saves. Hints < 4 are special; see database desc. */
|
||||||
for (long i = 1; i <= HINT_COUNT; i++) {
|
for (long i = 0; i < HINT_COUNT; i++) {
|
||||||
if (game.hinted[i])
|
if (game.hinted[i])
|
||||||
score = score - hints[i-1].penalty;
|
score = score - hints[i].penalty;
|
||||||
}
|
}
|
||||||
if (game.novice)
|
if (game.novice)
|
||||||
score -= 5;
|
score -= 5;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue