Reformat score.c like normal C, since it now almost is.
Still two gotos to get rid of.
This commit is contained in:
parent
7555eb7de3
commit
db4b972fc7
1 changed files with 102 additions and 99 deletions
35
score.c
35
score.c
|
@ -6,8 +6,9 @@
|
|||
* scoring and wrap-up
|
||||
*/
|
||||
|
||||
void score(long mode) {
|
||||
/* arg is <0 if scoring, >0 if quitting, =0 if died or won */
|
||||
void score(long mode)
|
||||
/* mode is <0 if scoring, >0 if quitting, =0 if died or won */
|
||||
{
|
||||
long i, score = 0, mxscor = 0;
|
||||
|
||||
/* The present scoring algorithm is as follows:
|
||||
|
@ -43,7 +44,7 @@ void score(long mode) {
|
|||
score=score+K-2;
|
||||
mxscor=mxscor+K;
|
||||
}
|
||||
} /* end loop */
|
||||
}
|
||||
|
||||
/* Now look at how he finished and how far he got. MAXDIE and
|
||||
* game.numdie tell us how well he survived. game.dflag will tell us
|
||||
|
@ -61,29 +62,31 @@ void score(long mode) {
|
|||
if(game.closng)score=score+25;
|
||||
mxscor=mxscor+25;
|
||||
if(game.closed) {
|
||||
if(game.bonus == 0)score=score+10;
|
||||
if(game.bonus == 135)score=score+25;
|
||||
if(game.bonus == 134)score=score+30;
|
||||
if(game.bonus == 133)score=score+45;
|
||||
if(game.bonus == 0)
|
||||
score=score+10;
|
||||
if(game.bonus == 135)
|
||||
score=score+25;
|
||||
if(game.bonus == 134)
|
||||
score=score+30;
|
||||
if(game.bonus == 133)
|
||||
score=score+45;
|
||||
}
|
||||
mxscor=mxscor+45;
|
||||
|
||||
/* Did he come to Witt's End as he should? */
|
||||
|
||||
if(game.place[MAGZIN] == 108)
|
||||
score=score+1;
|
||||
mxscor=mxscor+1;
|
||||
|
||||
/* Round it off. */
|
||||
|
||||
score=score+2;
|
||||
mxscor=mxscor+2;
|
||||
|
||||
/* Deduct for hints/turns/saves. Hints < 4 are special; see database desc. */
|
||||
|
||||
for (i=1; i<=HNTMAX; i++) {
|
||||
if(game.hinted[i])score=score-HINTS[i][2];
|
||||
} /* end loop */
|
||||
if(game.hinted[i])
|
||||
score=score-HINTS[i][2];
|
||||
}
|
||||
if(game.novice)
|
||||
score=score-5;
|
||||
if(game.clshnt)
|
||||
|
@ -91,7 +94,6 @@ void score(long mode) {
|
|||
score=score-game.trnluz-game.saved;
|
||||
|
||||
/* Return to score command if that's where we came from. */
|
||||
|
||||
if(mode < 0) {
|
||||
SETPRM(1,score,mxscor);
|
||||
SETPRM(3,game.turns,game.turns);
|
||||
|
@ -100,9 +102,10 @@ void score(long mode) {
|
|||
}
|
||||
|
||||
/* that should be good enough. Let's tell him all about it. */
|
||||
|
||||
if(score+game.trnluz+1 >= mxscor && game.trnluz != 0)RSPEAK(242);
|
||||
if(score+game.saved+1 >= mxscor && game.saved != 0)RSPEAK(143);
|
||||
if(score+game.trnluz+1 >= mxscor && game.trnluz != 0)
|
||||
RSPEAK(242);
|
||||
if(score+game.saved+1 >= mxscor && game.saved != 0)
|
||||
RSPEAK(143);
|
||||
SETPRM(1,score,mxscor);
|
||||
SETPRM(3,game.turns,game.turns);
|
||||
RSPEAK(262);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue