diff --git a/source/general/game_state/player.cpp b/source/general/game_state/player.cpp index 4efe5bff1c6a1b6fe5a0f7c65bf6b4ced99b07ac..bde37b8f817c860699ba403b8f80770c2a39d2a9 100644 --- a/source/general/game_state/player.cpp +++ b/source/general/game_state/player.cpp @@ -82,6 +82,10 @@ void player::set_finished_turn() { this->_finished_turn->set_value(true); } +bool player::is_broke() { + return _money->get_value() + _bet_size->get_value() <= 0; +} + #ifdef BLACKJACK_SERVER void player::setup_round(std::string& err) { @@ -128,11 +132,6 @@ bool player::make_bet(int bet_size, std::string &err) { return true; } - -bool player::is_broke() { - return _money->get_value() + _bet_size->get_value() <= 0; -} - void player::won_round() { int winnings = this->get_bet_size(); int holdings = this->get_money(); diff --git a/source/general/game_state/player.hpp b/source/general/game_state/player.hpp index 079b6ffb751a6ca374f94b983ffd8d9713a05fff..a60529ccc3b532639063fbe8ffac46a575e6af0f 100644 --- a/source/general/game_state/player.hpp +++ b/source/general/game_state/player.hpp @@ -20,7 +20,7 @@ private: serializable_value<int>* _money; serializable_value<bool>* _finished_turn; hand* _player_hand; - + #ifdef BLACKJACK_SERVER // is this macro needed? std::string _game_id; @@ -55,6 +55,7 @@ public: hand* get_hand() const noexcept; std::string get_player_name() const noexcept; void set_finished_turn(); + bool is_broke(); #ifdef BLACKJACK_SERVER // state update functions @@ -65,7 +66,6 @@ public: bool make_bet(int bet_size, std::string &err); // helper functions for game_state - bool is_broke(); // helper functions to calculate winnings void won_round(); void lost_round();