22 #ifndef HEADER_REMOTE_KART_INFO_HPP
23 #define HEADER_REMOTE_KART_INFO_HPP
25 #include "network/kart_data.hpp"
31 #include <irrString.h>
34 enum KartTeam : int8_t
53 std::string m_kart_name;
54 irr::core::stringw m_user_name;
55 int m_local_player_id;
56 int m_global_player_id;
59 bool m_network_player;
61 float m_default_kart_color;
63 std::string m_country_code;
64 std::weak_ptr<NetworkPlayerProfile> m_profile;
68 const irr::core::stringw& user_name, uint32_t host_id,
70 : m_kart_name(kart_name), m_user_name(user_name),
71 m_local_player_id(player_id), m_global_player_id(-1),
72 m_host_id(host_id), m_kart_team(KART_TEAM_NONE),
73 m_network_player(network),
74 m_handicap(HANDICAP_NONE),
75 m_default_kart_color(0.0f), m_online_id(0)
77 RemoteKartInfo(
const std::string& kart_name) : m_kart_name(kart_name),
78 m_user_name(
""), m_local_player_id(-1),
79 m_global_player_id(-1),
80 m_host_id(std::numeric_limits<uint32_t>::max()),
81 m_kart_team(KART_TEAM_NONE), m_network_player(
false),
82 m_handicap(HANDICAP_NONE),
83 m_default_kart_color(0.0f), m_online_id(0)
86 m_local_player_id(-1), m_global_player_id(-1),
87 m_host_id(std::numeric_limits<uint32_t>::max()),
88 m_kart_team(KART_TEAM_NONE), m_network_player(
false),
89 m_handicap(HANDICAP_NONE),
90 m_default_kart_color(0.0f), m_online_id(0)
92 void setKartName(
const std::string& n) { m_kart_name = n; }
93 void setPlayerName(
const irr::core::stringw& u) { m_user_name = u; }
94 void setHostId(uint32_t
id) { m_host_id = id; }
95 void setLocalPlayerId(
int id) { m_local_player_id = id; }
96 void setGlobalPlayerId(
int id) { m_global_player_id = id; }
97 void setKartTeam(KartTeam team) { m_kart_team = team; }
98 void setNetworkPlayer(
bool value) { m_network_player = value; }
99 void setDefaultKartColor(
float value) { m_default_kart_color = value; }
100 void setHandicap(
HandicapLevel value) { m_handicap = value; }
101 void setOnlineId(uint32_t
id) { m_online_id = id; }
102 uint32_t getHostId()
const {
return m_host_id; }
103 int getLocalPlayerId()
const {
return m_local_player_id; }
104 int getGlobalPlayerId()
const {
return m_global_player_id; }
105 bool isNetworkPlayer()
const {
return m_network_player; }
106 const std::string& getKartName()
const {
return m_kart_name; }
107 const irr::core::stringw& getPlayerName()
const {
return m_user_name; }
108 KartTeam getKartTeam()
const {
return m_kart_team; }
110 float getDefaultKartColor()
const {
return m_default_kart_color; }
111 uint32_t getOnlineId()
const {
return m_online_id; }
112 void setCountryCode(
const std::string&
id) { m_country_code = id; }
113 const std::string& getCountryCode()
const {
return m_country_code; }
114 void setKartData(
const KartData& data) { m_kart_data = data; }
115 const KartData& getKartData()
const {
return m_kart_data; }
116 void setNetworkPlayerProfile(
117 std::weak_ptr<NetworkPlayerProfile> npp) { m_profile = npp; }
118 std::weak_ptr<NetworkPlayerProfile> getNetworkPlayerProfile()
const
119 {
return m_profile; }
120 bool disconnected()
const {
return m_profile.expired(); }
121 bool isReserved()
const
122 {
return m_host_id == std::numeric_limits<uint32_t>::max(); }
125 m_host_id = std::numeric_limits<uint32_t>::max();
128 void copyFrom(std::shared_ptr<NetworkPlayerProfile> p,
132 return ((m_host_id<other.m_host_id) ||
133 (m_host_id==other.m_host_id && m_local_player_id<other.m_local_player_id));
137 typedef std::vector<RemoteKartInfo> RemoteKartInfoList;
Definition: kart_data.hpp:12
Contains the profile of a player.
Definition: network_player_profile.hpp:42
Definition: remote_kart_info.hpp:52
HandicapLevel
Handicap per player.
Definition: remote_kart_info.hpp:43