Skip to content

Commit 4d7c30d

Browse files
committed
fixed some problem with scratches and with winning
1 parent 59b8be9 commit 4d7c30d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/collide.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ void check_pockets(ball_data* ball, bool* next_turn, bool is_player_1_turn, gfx_
5252
*winning_player = is_player_1_turn ? 2 : 1; // the player who didnt sink the eightball wins in default state
5353

5454
if (win_attempt && i == picked_pocket) {
55-
if ((*num_solids == 0 && *player_1_type == solid) || (*num_stripes == 0 && *player_1_type == stripe))
55+
if (*num_solids == 0 && *num_stripes == 0)
56+
*winning_player = is_player_1_turn ? 1 : 2;
57+
58+
else if ((*num_solids == 0 && *player_1_type == solid) || (*num_stripes == 0 && *player_1_type == stripe))
5659
*winning_player = 1;
5760

5861
else if ((*num_solids == 0 && *player_1_type == stripe) || (*num_stripes == 0 && *player_1_type == solid))

src/main.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ bool step(void) {
134134
gamestate = scratch;
135135
balls[15].pocketed = false;
136136
extra_turn = false;
137-
138-
return true;
139137
}
140138

141139
// if player sunk own ball, dont switch
@@ -210,7 +208,6 @@ bool step(void) {
210208
if (change_state) {
211209
gamestate = setup;
212210
cue.pow = 0;
213-
start_of_setup =! start_of_game;
214211
start_of_game = false;
215212
}
216213
}

0 commit comments

Comments
 (0)