diff --git a/src/action.hh b/src/action.hh index 3a9503c..a22b709 100644 --- a/src/action.hh +++ b/src/action.hh @@ -10,4 +10,4 @@ struct Action { bool operator==(const Action &other) const; }; -#endif // ACTION_HH +#endif // !ACTION_HH diff --git a/src/lib.hh b/src/lib.hh index ac5d9df..a250d22 100644 --- a/src/lib.hh +++ b/src/lib.hh @@ -1,4 +1,5 @@ #include "action.hh" +#include "player.hh" #include "prep/prep.hh" #include "role.hh" diff --git a/src/player.cc b/src/player.cc new file mode 100644 index 0000000..9764df2 --- /dev/null +++ b/src/player.cc @@ -0,0 +1,16 @@ +#include "player.hh" + +#include "role.hh" + +#include + +Player::Player(uint32_t id, std::string username, Role role, PlayerStatus status): + id(id), + username(username), + role(role), + status(status) { +} + +bool Player::operator==(const Player &other) const { + return this->id == other.id; +} diff --git a/src/player.hh b/src/player.hh new file mode 100644 index 0000000..a2760b4 --- /dev/null +++ b/src/player.hh @@ -0,0 +1,26 @@ +#ifndef PLAYER_HH +#define PLAYER_HH + +#include "role.hh" + +#include +#include + +enum PlayerStatus { + Kicked, + Alive, + Dead, + VotedOut, +}; + +struct Player { + uint32_t id; + std::string username; + Role role; + PlayerStatus status; + + Player(uint32_t id, std::string username, Role role, PlayerStatus status); + bool operator==(const Player &other) const; +}; + +#endif // !PLAYER_HH diff --git a/src/prep/prep.cc b/src/prep/prep.cc index ff0baa1..40252fe 100644 --- a/src/prep/prep.cc +++ b/src/prep/prep.cc @@ -5,17 +5,6 @@ #include #include -Player::Player(uint32_t id, std::string username, Role role, PlayerStatus playerStatus): - id(id), - username(username), - role(role), - playerStatus(playerStatus) { -} - -bool Player::operator==(const Player &other) const { - return this->id == other.id; -} - Room::Room( uint32_t id, std::string title, uint32_t utcTimestampCreatedAt, RoomStatus status, std::vector players): id(id), diff --git a/src/prep/prep.hh b/src/prep/prep.hh index 35e43a5..91e738b 100644 --- a/src/prep/prep.hh +++ b/src/prep/prep.hh @@ -21,27 +21,9 @@ enum RoomStatus { ENDED, }; -enum PlayerStatus { - KICKED, - ALIVE, - DEAD, - VOTED_OUT, -}; - -struct Player; struct Room; struct Event; -struct Player { - uint32_t id; - std::string username; - Role role; - PlayerStatus playerStatus; - - Player(uint32_t id, std::string username, Role role, PlayerStatus playerStatus); - bool operator==(const Player &other) const; -}; - struct Room { uint32_t id; std::string title; diff --git a/src/role.hh b/src/role.hh index d52330f..a209895 100644 --- a/src/role.hh +++ b/src/role.hh @@ -12,4 +12,4 @@ struct Role { Role(std::vector actions); }; -#endif // ROLE_HH +#endif // !ROLE_HH