33 Client(
int socket_fd,
struct sockaddr_in client_addr,
double start_y_pos);
88 void setPseudo(
const std::string &pseudo);
98 void setPosition(
const std::array<double, 2> &position);
103 const std::size_t &
getScore()
const;
143 std::vector<std::array<std::size_t, 2>> &
getCoinsList();
148 std::string _next_command;
149 const int _socket_fd;
150 const struct sockaddr_in _client_addr;
153 std::array<double, 2> _position = {0.0, 0.0};
154 std::size_t _score = 0;
156 bool _jetpack =
false;
158 std::vector<std::array<std::size_t, 2>> _coins_list;
A class that represents a client connected to the server.
Definition ServerClient.hpp:23
void setPosition(const std::array< double, 2 > &position)
Sets the position of the client.
Definition ServerClient.cpp:143
Client(int socket_fd, struct sockaddr_in client_addr, double start_y_pos)
Constructor for Client class.
Definition ServerClient.cpp:22
const std::size_t & getScore() const
Gets the score of the client.
Definition ServerClient.cpp:152
void setPseudo(const std::string &pseudo)
Sets the pseudo of the client.
Definition ServerClient.cpp:125
const std::string & getPseudo() const
Gets the pseudo of the client.
Definition ServerClient.cpp:116
void setAlive(bool alive)
Sets the alive status of the client.
Definition ServerClient.cpp:179
const std::string & getNextCommand() const
Gets the next command to be executed.
Definition ServerClient.cpp:80
~Client()
Destructor for Client class.
Definition ServerClient.cpp:33
void setJetpack(bool jetpack)
Sets the jetpack status of the client.
Definition ServerClient.cpp:199
const double & getSpeed() const
Gets the speed of the client.
Definition ServerClient.cpp:208
const struct sockaddr_in & getClientAddr() const
Gets the client address.
Definition ServerClient.cpp:107
void setSpeed(double speed)
Sets the speed of the client.
Definition ServerClient.cpp:217
Client & operator=(const Client &)
Assignment operator for Client class.
Definition ServerClient.cpp:61
void setScore(std::size_t score)
Sets the score of the client.
Definition ServerClient.cpp:161
void setNextCommand(const std::string &nextCommand)
Sets the next command to be executed.
Definition ServerClient.cpp:89
const std::array< double, 2 > & getPosition() const
Gets the position of the client.
Definition ServerClient.cpp:134
const bool & isAlive() const
Gets the alive status of the client.
Definition ServerClient.cpp:170
const bool & useJetpack() const
Gets the jetpack status of the client.
Definition ServerClient.cpp:190
const int & getSocketFd() const
Gets the socket file descriptor.
Definition ServerClient.cpp:98
std::vector< std::array< std::size_t, 2 > > & getCoinsList()
Gets the list of coins collected by the client.
Definition ServerClient.cpp:226