Skip to content

Commit

Permalink
added player deconstructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Dpbm committed Jan 23, 2024
1 parent 835aadc commit d7b49a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions game/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ namespace Players {
this->max_score = max_score;
}

Player::~Player(){
delete player;
delete head;
delete tail;
}

void Player::randomize_position(){
unsigned int x = Utils::get_random_pos(WIDTH, PLAYER_W);
unsigned int y = Utils::get_random_pos(HEIGHT, PLAYER_H);
Expand Down
1 change: 1 addition & 0 deletions game/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace Players {
Players::LinkedList* get_body();
bool is_game_over();
bool has_won();
~Player();

private:
unsigned int x, y;
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [ ] check destructors
- [ ] check the use of constants
- [ ] check the use of references
- [ ] gh workflows

- Matrix
- [x] scalar multiplication
Expand Down

0 comments on commit d7b49a2

Please sign in to comment.