diff --git a/src/common/game_state/player/player.cpp b/src/common/game_state/player/player.cpp index 3dd4a0c379da18fbbbf94afe128111d005bc7170..7d36248cfa72ea4f9d45c0dd3e432bdca882dc8a 100644 --- a/src/common/game_state/player/player.cpp +++ b/src/common/game_state/player/player.cpp @@ -7,7 +7,7 @@ player::player(const std::string& name) : unique_serializable() { this->_player_name = new serializable_value<std::string>(name); this->_nof_predicted = new serializable_value<int>(-1); this->_nof_tricks = new serializable_value<int>(0); - this->_scores = std::vector<serializable_value<int>*>(0); + this->_scores = std::vector<serializable_value<int>*>(); this->_hand = new hand(); } @@ -30,12 +30,17 @@ player::~player() { delete _hand; delete _player_name; delete _nof_predicted; - delete _nof_predicted; + delete _nof_tricks; _hand = nullptr; _player_name = nullptr; _nof_predicted = nullptr; _nof_tricks = nullptr; + + for (auto score : _scores) { + delete score; + } + _scores.clear(); } } @@ -45,7 +50,7 @@ player::player(const std::string& id, const std::string& name) : unique_serializable(id) { this->_player_name = new serializable_value<std::string>(name); - this->_scores = std::vector< serializable_value<int>*>(0); + this->_scores = std::vector< serializable_value<int>*>(); this->_hand = new hand(); this->_nof_predicted = new serializable_value<int>(0); this->_nof_tricks = new serializable_value<int>(0);