Browse Source

Moved default_uuid_func to RenX_Functions as RenX::default_uuid_func.

pull/3/head
JustinAJ 10 years ago
parent
commit
25fb5c62a1
  1. 7
      RenX.Core/RenX_Functions.cpp
  2. 9
      RenX.Core/RenX_Functions.h
  3. 11
      RenX.Core/RenX_Server.cpp

7
RenX.Core/RenX_Functions.cpp

@ -791,6 +791,11 @@ time_t RenX::getGameTime(const RenX::PlayerInfo *player)
return currentTime - player->joinTime;
}
Jupiter::StringS RenX::default_uuid_func(RenX::Server *server, RenX::PlayerInfo *player)
{
return server->formatSteamID(player);
}
double RenX::getKillDeathRatio(const RenX::PlayerInfo *player, bool includeSuicides)
{
double deaths = player->deaths;
@ -808,4 +813,4 @@ double RenX::getHeadshotKillRatio(const RenX::PlayerInfo *player)
double RenX::getKillsPerSecond(const RenX::PlayerInfo *player)
{
return ((double)player->kills) / ((double)RenX::getGameTime(player));
}
}

9
RenX.Core/RenX_Functions.h

@ -152,6 +152,15 @@ namespace RenX
*/
RENX_API time_t getGameTime(const RenX::PlayerInfo *player);
/**
* @brief Calculates a player's UUID, based on their steam ID.
*
* @param server Server the player is in
* @param player Player to calculate UUID of
* @return UUID of the player based on their steam ID.
*/
RENX_API Jupiter::StringS default_uuid_func(RenX::Server *server, RenX::PlayerInfo *player);
/**
* @brief Calculates a player's Kill-Death ratio, based on their data.
* Note: If the player has not died, this function will use 1 for their death count.

11
RenX.Core/RenX_Server.cpp

@ -27,11 +27,6 @@
#include "RenX_Plugin.h"
#include "RenX_BanDatabase.h"
Jupiter::StringS default_uuid_func(RenX::Server *server, RenX::PlayerInfo *player)
{
return server->formatSteamID(player);
}
int RenX::Server::think()
{
if (RenX::Server::connected == false)
@ -1080,7 +1075,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
if (steamid != 0)
{
player->steamid = steamid;
if (calc_uuid == default_uuid_func)
if (calc_uuid == RenX::default_uuid_func)
setUUID(player, this->formatSteamID(steamid));
else
this->setUUIDIfDifferent(player, calc_uuid(this, player));
@ -1115,7 +1110,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
if (steamid != 0)
{
player->steamid = steamid;
if (calc_uuid == default_uuid_func)
if (calc_uuid == RenX::default_uuid_func)
setUUID(player, this->formatSteamID(steamid));
else
this->setUUIDIfDifferent(player, calc_uuid(this, player));
@ -2230,7 +2225,7 @@ const Jupiter::ReadableString &RenX::Server::getRCONUsername() const
RenX::Server::Server(const Jupiter::ReadableString &configurationSection)
{
RenX::Server::configSection = configurationSection;
RenX::Server::calc_uuid = default_uuid_func;
RenX::Server::calc_uuid = RenX::default_uuid_func;
init();
Jupiter::ArrayList<RenX::Plugin> &xPlugins = *RenX::getCore()->getPlugins();
for (size_t i = 0; i < xPlugins.size(); i++)

Loading…
Cancel
Save