22#ifndef HEADER_NETWORK_PLAYER_PROFILE
23#define HEADER_NETWORK_PLAYER_PROFILE
25#include "network/kart_data.hpp"
35enum KartTeam : int8_t;
44 std::weak_ptr<STKPeer> m_peer;
52 float m_default_kart_color;
71 std::atomic<KartTeam> m_team;
79 static std::shared_ptr<NetworkPlayerProfile>
80 getReservedProfile(KartTeam team)
82 return std::make_shared<NetworkPlayerProfile>(team);
90 m_host_id = std::numeric_limits<uint32_t>::max();
91 m_default_kart_color = 0.0f;
100 const irr::core::stringw &name, uint32_t host_id,
101 float default_kart_color, uint32_t online_id,
103 uint8_t local_player_id, KartTeam team,
104 const std::string& country_code)
109 m_default_kart_color = default_kart_color;
110 m_online_id = online_id;
115 resetGrandPrixData();
146 float getDefaultKartColor()
const {
return m_default_kart_color; }
148 uint32_t getOnlineId()
const {
return m_online_id; }
150 bool isOfflineAccount()
const {
return m_online_id == 0; }
152 std::shared_ptr<STKPeer> getPeer()
const {
return m_peer.lock(); }
154 int getScore()
const {
return m_score; }
158 void setScore(
int score) {
m_score = score; }
162 void resetGrandPrixData()
168 void setTeam(KartTeam team) { m_team.store(team); }
170 KartTeam getTeam()
const {
return m_team.load(); }
172 const std::string& getCountryCode()
const {
return m_country_code; }
174 void setKartData(
const KartData& data) { m_kart_data = data; }
176 const KartData& getKartData()
const {
return m_kart_data; }
Definition: kart_data.hpp:12
Contains the profile of a player.
Definition: network_player_profile.hpp:42
const irr::core::stringw & getName() const
Returns the name of this player.
Definition: network_player_profile.hpp:144
uint8_t m_local_player_id
The local player id relative to each peer.
Definition: network_player_profile.hpp:63
const std::string & getKartName() const
Returns the name of the kart this player has selected.
Definition: network_player_profile.hpp:133
uint8_t getLocalPlayerId() const
Retuens the local player id for this player.
Definition: network_player_profile.hpp:136
irr::core::stringw m_player_name
The name of the player.
Definition: network_player_profile.hpp:47
std::string m_country_code
2-letter country code of player.
Definition: network_player_profile.hpp:74
void setKartName(const std::string &kart_name)
Sets the kart name for this player.
Definition: network_player_profile.hpp:126
int m_score
Score if grand prix.
Definition: network_player_profile.hpp:66
std::string m_kart_name
The selected kart id.
Definition: network_player_profile.hpp:60
HandicapLevel getHandicap() const
Returns the player's handicap.
Definition: network_player_profile.hpp:139
uint32_t getHostId() const
Returns the host id of this player.
Definition: network_player_profile.hpp:123
float m_overall_time
Overall time if grand prix.
Definition: network_player_profile.hpp:69
bool isLocalPlayer() const
Returns true if this player is local, i.e.
Definition: network_player_profile.cpp:28
std::atomic< HandicapLevel > m_handicap
Handicap level of this player.
Definition: network_player_profile.hpp:57
uint32_t m_host_id
Host id of this player.
Definition: network_player_profile.hpp:50
Represents a peer. This class is used to interface the ENetPeer structure.
Definition: stk_peer.hpp:76
HandicapLevel
Handicap per player.
Definition: remote_kart_info.hpp:42
Declares the general types that are used by the network.