From 8f02054674b582f575371702cb1ec15359b5bce5 Mon Sep 17 00:00:00 2001 From: Stephen Enders Date: Thu, 28 Jan 2021 21:14:33 -0500 Subject: Score on final position Will score and remove the piece upon moving into the final pos --- src/ur.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/ur.cpp') diff --git a/src/ur.cpp b/src/ur.cpp index fac0a5f..c0a0c4f 100644 --- a/src/ur.cpp +++ b/src/ur.cpp @@ -45,7 +45,8 @@ next_turn(std::shared_ptr> roll_sprites) { turn_roll = 0; turn_pid = turn_pid == P1_ID ? P2_ID : P1_ID; - for (auto& s : (*roll_sprites)) s.setColor(sf::Color::White); + for (auto& s : (*roll_sprites)) + s.setColor(sf::Color::White); change_state(GameState::WAITING); } @@ -340,6 +341,15 @@ main() } if (in_place) { + if (grabbed_piece->position == EXIT_SPACE) { + if (p1_turn()) { + makeNum(&p1Score, ++p1->score, textures); + clearPiece(p1->pieces, grabbed_piece); + } else { + makeNum(&p2Score, ++p2->score, textures); + clearPiece(p2->pieces, grabbed_piece); + } + } next_turn(roll_sprites); } else { grabbed_piece->sprite.setPosition(grabbed_piece_origin); -- cgit v1.2.3-54-g00ecf