mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 08:15:35 +00:00
Client: inline trivial getters & setters
This commit is contained in:
parent
0f30706a0a
commit
61776d6a1b
@ -37,31 +37,32 @@ private:
|
||||
int ID = -1;
|
||||
|
||||
public:
|
||||
bool isConnected = false;
|
||||
bool isSynced = false;
|
||||
bool isGuest = false;
|
||||
|
||||
void AddNewCar(int ident, const std::string& Data);
|
||||
void SetCarData(int ident, const std::string& Data);
|
||||
std::set<std::unique_ptr<VData>>& GetAllCars();
|
||||
void SetName(const std::string& name);
|
||||
void SetRoles(const std::string& role);
|
||||
void SetName(const std::string& name) { Name = name; }
|
||||
void SetRoles(const std::string& role) { Role = role; }
|
||||
std::string GetCarData(int ident);
|
||||
void SetUDPAddr(sockaddr_in Addr);
|
||||
void SetDownSock(SOCKET CSock);
|
||||
void SetTCPSock(SOCKET CSock);
|
||||
void SetStatus(int status);
|
||||
void SetUDPAddr(sockaddr_in Addr) { UDPADDR = Addr; }
|
||||
void SetDownSock(SOCKET CSock) { SOCK[1] = CSock; }
|
||||
void SetTCPSock(SOCKET CSock) { SOCK[0] = CSock; }
|
||||
void SetStatus(int status) { Status = status; }
|
||||
void DeleteCar(int ident);
|
||||
sockaddr_in GetUDPAddr();
|
||||
bool isConnected = false;
|
||||
std::string GetRoles();
|
||||
std::string GetName();
|
||||
bool isSynced = false;
|
||||
bool isGuest = false;
|
||||
SOCKET GetDownSock();
|
||||
SOCKET GetTCPSock();
|
||||
void SetID(int ID);
|
||||
sockaddr_in GetUDPAddr() { return UDPADDR; }
|
||||
std::string GetRoles() { return Role; }
|
||||
std::string GetName() { return Name; }
|
||||
SOCKET GetDownSock() { return SOCK[1]; }
|
||||
SOCKET GetTCPSock() { return SOCK[0]; }
|
||||
void SetID(int ID) { this->ID = ID; }
|
||||
int GetOpenCarID();
|
||||
int GetCarCount();
|
||||
void ClearCars();
|
||||
int GetStatus();
|
||||
int GetID();
|
||||
int GetStatus() { return Status; }
|
||||
int GetID() { return ID; }
|
||||
};
|
||||
struct ClientInterface {
|
||||
std::set<std::unique_ptr<Client>> Clients;
|
||||
@ -80,7 +81,7 @@ struct ClientInterface {
|
||||
}
|
||||
void AddClient(Client*&& c) {
|
||||
Assert(c);
|
||||
Clients.insert(std::move(std::unique_ptr<Client>(c)));
|
||||
Clients.insert(std::unique_ptr<Client>(c));
|
||||
}
|
||||
int Size() {
|
||||
return int(Clients.size());
|
||||
|
@ -9,50 +9,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
std::string Client::GetName() {
|
||||
return Name;
|
||||
}
|
||||
void Client::SetName(const std::string& name) {
|
||||
Name = name;
|
||||
}
|
||||
void Client::SetRoles(const std::string& role) {
|
||||
Role = role;
|
||||
}
|
||||
std::string Client::GetRoles() {
|
||||
return Role;
|
||||
}
|
||||
int Client::GetID() {
|
||||
return ID;
|
||||
}
|
||||
void Client::SetID(int id) {
|
||||
ID = id;
|
||||
}
|
||||
void Client::SetStatus(int state) {
|
||||
Status = state;
|
||||
}
|
||||
int Client::GetStatus() {
|
||||
return Status;
|
||||
}
|
||||
void Client::SetUDPAddr(sockaddr_in Addr) {
|
||||
UDPADDR = Addr;
|
||||
}
|
||||
|
||||
void Client::SetDownSock(SOCKET CSock) {
|
||||
SOCK[1] = CSock;
|
||||
}
|
||||
SOCKET Client::GetDownSock() {
|
||||
return SOCK[1];
|
||||
}
|
||||
sockaddr_in Client::GetUDPAddr() {
|
||||
return UDPADDR;
|
||||
}
|
||||
void Client::SetTCPSock(SOCKET CSock) {
|
||||
SOCK[0] = CSock;
|
||||
}
|
||||
SOCKET Client::GetTCPSock() {
|
||||
return SOCK[0];
|
||||
}
|
||||
|
||||
void Client::DeleteCar(int ident) {
|
||||
for (auto& v : VehicleData) {
|
||||
if (v != nullptr && v->ID == ident) {
|
||||
@ -95,6 +51,7 @@ std::string Client::GetCarData(int ident) {
|
||||
DeleteCar(ident);
|
||||
return "";
|
||||
}
|
||||
|
||||
void Client::SetCarData(int ident, const std::string& Data) {
|
||||
for (auto& v : VehicleData) {
|
||||
if (v != nullptr && v->ID == ident) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user