Permalink
Browse files

remove cpu info / spelling / variable scope

  • Loading branch information...
abma committed Sep 18, 2018
1 parent 62d642f commit 3e124ea12427d320ee972904dc90269f74a641b4
Showing with 17 additions and 31 deletions.
  1. +1 −1 src/ibattle.cpp
  2. +1 −2 src/serverevents.cpp
  3. +1 −1 src/serverevents.h
  4. +3 −4 src/tasserver.cpp
  5. +8 −9 src/user.cpp
  6. +3 −14 src/user.h
@@ -1134,7 +1134,7 @@ void IBattle::GetBattleFromScript(bool loadmapmod)
if (player.ok() || bot.ok()) {
if (bot.ok())
player = bot;
User user(player->GetString("Name"), boost::to_upper_copy(player->GetString("CountryCode")), 0);
User user(player->GetString("Name"), boost::to_upper_copy(player->GetString("CountryCode")));
UserBattleStatus& status = user.BattleStatus();
status.isfromdemo = true;
status.spectator = player->GetInt("Spectator", 0);
@@ -125,7 +125,7 @@ void ServerEvents::OnPong(wxLongLong ping_time)
}


void ServerEvents::OnNewUser(const std::string& nick, const std::string& country, int cpu, int id, const std::string& clientAgent)
void ServerEvents::OnNewUser(const std::string& nick, const std::string& country, int id, const std::string& clientAgent)
{
slLogDebugFunc("");
if (m_serv.UserExists(nick)) {
@@ -134,7 +134,6 @@ void ServerEvents::OnNewUser(const std::string& nick, const std::string& country
}
User& user = m_serv._AddUser(nick);
user.SetCountry(country);
user.SetCpu(cpu);
user.SetID(id);
user.SetClientAgent(clientAgent);
if (!m_serv.IsOnline()) { //login info isn't complete yet
@@ -44,7 +44,7 @@ class ServerEvents
void OnMotd(const std::string& msg);
void OnPong(wxLongLong ping_time);

void OnNewUser(const std::string& nick, const std::string& conutry, int cpu, int id, const std::string& clientAgent);
void OnNewUser(const std::string& nick, const std::string& country, int id, const std::string& clientAgent);
void OnUserStatus(const std::string& nick, UserStatus status);
void OnUserQuit(const std::string& nick);

@@ -523,7 +523,7 @@ static LSL::StringMap parseKeyValue(const std::string& str)
void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inparams, int replyid)
{
std::string params = inparams;
std::string nick, contry, host, map, title, channel, error, msg, owner, topic, engineName, engineVersion;
std::string nick, host, map, title, channel, error, msg, owner, topic, engineName, engineVersion;
//NatType ntype;
UserStatus cstatus;
int tasstatus;
@@ -564,8 +564,7 @@ void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inpara
} else if (cmd == "ADDUSER") {
int id;
nick = GetWordParam(params);
contry = GetWordParam(params);
const int cpu = GetIntParam(params);
const std::string country = GetWordParam(params);
if (params.empty()) {
// if server didn't send any account id to us, fill with an always increasing number
id = m_account_id_count;
@@ -574,7 +573,7 @@ void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inpara
id = GetIntParam(params);
}
// params contains user's lobby client and version.
m_se->OnNewUser(nick, contry, cpu, id, params);
m_se->OnNewUser(nick, country, id, params);
if (nick == m_relay_host_bot) {
RelayCmd("OPENBATTLE", m_delayed_open_command); // relay bot is deployed, send host command
m_delayed_open_command = "";
@@ -24,7 +24,7 @@ lsl/user/user.cpp
#include "utils/conversion.h"

User::User(IServer& serv)
: CommonUser("", "", 0)
: CommonUser("", "")
, panel(nullptr)
, m_serv(&serv)
, m_battle(0)
@@ -36,7 +36,7 @@ User::User(IServer& serv)
}

User::User(const std::string& nick, IServer& serv)
: CommonUser(nick, "", 0)
: CommonUser(nick, "")
, panel(nullptr)
, m_serv(&serv)
, m_battle(0)
@@ -47,8 +47,8 @@ User::User(const std::string& nick, IServer& serv)
{
}

User::User(const std::string& nick, const std::string& country, const int& cpu, IServer& serv)
: CommonUser(nick, country, cpu)
User::User(const std::string& nick, const std::string& country, IServer& serv)
: CommonUser(nick, country)
, panel(nullptr)
, m_serv(&serv)
, m_battle(0)
@@ -60,7 +60,7 @@ User::User(const std::string& nick, const std::string& country, const int& cpu,
}

User::User(const std::string& nick)
: CommonUser(nick, "", 0)
: CommonUser(nick, "")
, panel(nullptr)
, m_serv(0)
, m_battle(0)
@@ -71,8 +71,8 @@ User::User(const std::string& nick)
{
}

User::User(const std::string& nick, const std::string& country, const int& cpu)
: CommonUser(nick, country, cpu)
User::User(const std::string& nick, const std::string& country)
: CommonUser(nick, country)
, panel(nullptr)
, m_serv(0)
, m_battle(0)
@@ -84,7 +84,7 @@ User::User(const std::string& nick, const std::string& country, const int& cpu)
}

User::User()
: CommonUser("", "", 0)
: CommonUser("", "")
, panel(nullptr)
, m_serv(0)
, m_battle(0)
@@ -279,7 +279,6 @@ bool User::IsBot() const
// m_status = other.GetStatus();
// m_battle = other.GetBattle();
// m_nick = other.GetNick();
// m_cpu = other.GetCpu();
// m_country = other.GetCountry();
// m_bstatus = other.GetBattleStatus();
// uidata = other.uidata;
@@ -190,11 +190,10 @@ class lslColor;
class CommonUser
{
public:
CommonUser(const std::string& nick, const std::string& country, const int& cpu)
CommonUser(const std::string& nick, const std::string& country)
: m_nick(std::string(nick))
, m_country(std::string(country))
, m_id(0)
, m_cpu(cpu)
, m_trueSkill(0.0f)
{
}
@@ -223,15 +222,6 @@ class CommonUser
m_country = country;
}

int GetCpu() const
{
return m_cpu;
}
void SetCpu(const int& cpu)
{
m_cpu = cpu;
}

int GetID() const
{
return m_id;
@@ -297,7 +287,6 @@ class CommonUser
std::string m_client_agent;
std::string m_country;
int m_id;
int m_cpu;
double m_trueSkill; //This data is not included into UserStatus because it is not part of MYSTATUS or MYBATTLESTATUS commands
UserStatus m_status;
UserBattleStatus m_bstatus;
@@ -314,8 +303,8 @@ class User : public CommonUser
explicit User(IServer& serv);
explicit User(const std::string& nick);
User(const std::string& nick, IServer& serv);
User(const std::string& nick, const std::string& country, const int& cpu, IServer& serv);
User(const std::string& nick, const std::string& country, const int& cpu);
User(const std::string& nick, const std::string& country, IServer& serv);
User(const std::string& nick, const std::string& country);
User();

virtual ~User();

0 comments on commit 3e124ea

Please sign in to comment.