Ranking related changes

This commit is contained in:
Alayan-stk-2 2018-05-15 04:20:44 +02:00 committed by GitHub
parent 322f0e77f8
commit 1fc3e0916e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 0 deletions

View File

@ -49,6 +49,7 @@ NetworkConfig::NetworkConfig()
m_auto_connect = false; m_auto_connect = false;
m_is_server = false; m_is_server = false;
m_is_public_server = false; m_is_public_server = false;
m_is_ranked_server = false;
m_done_adding_network_players = false; m_done_adding_network_players = false;
m_max_players = 4; m_max_players = 4;
m_cur_user_id = 0; m_cur_user_id = 0;

View File

@ -67,6 +67,9 @@ private:
/** True if this host is a server, false otherwise. */ /** True if this host is a server, false otherwise. */
bool m_is_server; bool m_is_server;
/** True if this is a ranked server */
bool m_is_ranked_server;
/** The password for a server (or to authenticate to a server). */ /** The password for a server (or to authenticate to a server). */
std::string m_password; std::string m_password;
@ -260,6 +263,11 @@ public:
/** Returns if an immediate connection to the first server was /** Returns if an immediate connection to the first server was
* requested. */ * requested. */
bool isAutoConnect() const { return m_auto_connect; } bool isAutoConnect() const { return m_auto_connect; }
// ------------------------------------------------------------------------
/** Returns if the server use multi-session rankings. */
bool isRankedServer() const { return m_is_ranked_server; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Returns the minor and majar game mode from server database id. */ /** Returns the minor and majar game mode from server database id. */
std::pair<RaceManager::MinorRaceModeType, RaceManager::MajorRaceModeType> std::pair<RaceManager::MinorRaceModeType, RaceManager::MajorRaceModeType>

View File

@ -65,7 +65,18 @@ private:
/** Overall time if grand prix. */ /** Overall time if grand prix. */
float m_overall_time; float m_overall_time;
/** Multi-session ranking points */
int m_ranking_points;
/** The maximum ranking achieved by this player */
int m_max_ranking_points;
/** Number of ranked races */
unsigned int m_ranked_races;
public: public:
NetworkPlayerProfile(std::shared_ptr<STKPeer> peer, NetworkPlayerProfile(std::shared_ptr<STKPeer> peer,
const irr::core::stringw &name, uint32_t host_id, const irr::core::stringw &name, uint32_t host_id,
float default_kart_color, uint32_t online_id, float default_kart_color, uint32_t online_id,
@ -121,6 +132,18 @@ public:
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void setOverallTime(float time) { m_overall_time = time; } void setOverallTime(float time) { m_overall_time = time; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
int getRankingPoints() const { return m_ranking_points; }
// ------------------------------------------------------------------------
void setRankingPoints(int points) { m_ranking_points = points;
if (points > m_max_ranking_points) m_max_ranking_points = points; }
// ------------------------------------------------------------------------
int getMaxRankingPoints() const { return m_max_ranking_points; }
// ------------------------------------------------------------------------
unsigned int getNumRankedRaces() const { return m_ranked_races; }
// ------------------------------------------------------------------------
void incrementNumRankedRaces() { m_ranked_races++; }
// ------------------------------------------------------------------------
void resetGrandPrixData() void resetGrandPrixData()
{ {
m_score = 0; m_score = 0;