if (HERE(ROD2))
game.bonus=135;
RSPEAK(game.bonus);
- score(0);
+ score(endgame);
return GO_CLEAROBJ; /* pacify compiler - we never get here */
}
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
{
if (YES(input,REALLY_QUIT,OK_MAN,OK_MAN))
- score(1);
+ score(quitgame);
return GO_CLEAROBJ;
}
static int vscore(void)
/* Score. Call scoring routine but tell it to return. */
{
- score(-1);
+ score(scoregame);
return GO_CLEAROBJ;
}
extern void TYPE(void);
extern void DATIME(long*, long*);
+enum termination {endgame, quitgame, scoregame};
+
extern void set_seed(long);
extern unsigned long get_next_lcg_value(void);
extern long randrange(long);
-extern void score(long);
+extern void score(enum termination);
extern int saveresume(FILE *, bool);
/*
bool prompt = true;
extern void initialise();
-extern void score(long);
extern int action(FILE *, long, long, long);
void sig_handler(int signo)
break;
}
/* show score and exit */
- score(1);
+ score(quitgame);
}
static bool fallback_handler(char *buf)
/* He died during closing time. No resurrection. Tally up a
* death and exit. */
RSPEAK(DEATH_CLOSING);
- score(0);
+ score(endgame);
} else {
/* FIXME: Arithmetic on message numbers */
if (!YES(cmdin,WATCH_IT+game.numdie*2,WHICH_WAY+game.numdie*2,OK_MAN))
- score(0);
+ score(endgame);
if (game.numdie == MAXDIE)
- score(0);
+ score(endgame);
game.place[WATER]=0;
game.place[OIL]=0;
if (TOTING(LAMP))
case GO_DWARFWAKE:
/* Oh dear, he's disturbed the dwarves. */
RSPEAK(DWARVES_AWAKEN);
- score(0);
+ score(endgame);
return true;
default:
BUG(99);
* scoring and wrap-up
*/
-void score(long mode)
-/* mode is <0 if scoring, >0 if quitting, =0 if died or won */
+void score(enum termination mode)
+/* mode is 'report' if scoring, 'quit' if quitting, 'end' if died or won */
{
long score = 0, mxscor = 0;
* mundane exits or 133, 134, 135 if he blew it (so to speak). */
score += (MAXDIE-game.numdie)*10;
mxscor += MAXDIE*10;
- if(mode == 0)score += 4;
+ if(mode == endgame)
+ score += 4;
mxscor += 4;
if(game.dflag != 0)score += 25;
mxscor += 25;
score=score-game.trnluz-game.saved;
/* Return to score command if that's where we came from. */
- if(mode < 0) {
+ if(mode == scoregame) {
SETPRM(1,score,mxscor);
SETPRM(3,game.turns,game.turns);
RSPEAK(GARNERED_POINTS);