Make code style more consistent with the rest of the codebase.
This commit is contained in:
parent
5dce7eb912
commit
d299c066cd
25
src/game.c
25
src/game.c
@ -206,14 +206,19 @@ void game_end() {
|
||||
}
|
||||
|
||||
bool game_won() {
|
||||
// if any card is covered, game is not won
|
||||
for (int i = 0; i < MANEUVRE_STACKS_NUMBER; i++)
|
||||
for (struct stack *j = deck->maneuvre[i]; j!= NULL; j = j->next)
|
||||
if (j->card->face == COVERED)
|
||||
return false;
|
||||
// else look in stock and waste pile
|
||||
if (stack_empty(deck->stock) &&
|
||||
stack_empty(deck->waste_pile))
|
||||
return true;
|
||||
else return false;
|
||||
// If any card in the maneuvre stacks is covered, game is not won.
|
||||
for (int i = 0; i < MANEUVRE_STACKS_NUMBER; i++) {
|
||||
for (struct stack *j = deck->maneuvre[i]; j!= NULL; j = j->next) {
|
||||
if (j->card->face == COVERED) {
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the stock pile or the waste pile aren't empty, game is not won.
|
||||
if (!stack_empty(deck->stock) || !stack_empty(deck->waste_pile)) {
|
||||
return(false);
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user