Use lowerCamelCase in tes3mp server networking function names

coverity_scan^2
David Cernat 8 years ago
parent 7be86388db
commit 25dc2b19e7

@ -150,7 +150,7 @@ void MasterClient::Update()
RakSleep(timeout);
;
players = mwmp::Networking::Get().NumberOfConnections();
players = mwmp::Networking::get().numberOfConnections();
response = Send(motd, players, maxPlayers, update);
update = true;
}

@ -24,7 +24,7 @@ Networking::Networking(RakNet::RakPeerInterface *peer)
{
sThis = this;
this->peer = peer;
players = Players::GetPlayers();
players = Players::getPlayers();
playerController = new PlayerPacketController(peer);
worldController = new WorldPacketController(peer);
@ -48,9 +48,9 @@ Networking::~Networking()
LOG_QUIT();
}
void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
void Networking::processPlayerPacket(RakNet::Packet *packet)
{
Player *player = Players::GetPlayer(packet->guid);
Player *player = Players::getPlayer(packet->guid);
PlayerPacket *myPacket = playerController->GetPacket(packet->data[0]);
@ -63,45 +63,45 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
if (player->isHandshaked())
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Wrong handshake with player %d, name: %s",
player->GetID(),
player->getId(),
player->Npc()->mName.c_str());
KickPlayer(player->guid);
kickPlayer(player->guid);
return;
}
if (*player->getPassw() != passw)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Wrong server password for player %d, name: %s (pass: %s)",
player->GetID(),
player->getId(),
player->Npc()->mName.c_str(),
player->getPassw()->c_str());
KickPlayer(player->guid);
kickPlayer(player->guid);
return;
}
player->Handshake();
player->setHandshake();
return;
}
if (!player->isHandshaked())
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Have not completed handshake with player %d",
player->GetID());
player->getId());
//KickPlayer(player->guid);
return;
}
if (packet->data[0] == ID_LOADED)
{
player->Loaded(Player::LOADED);
player->setLoadState(Player::LOADED);
static constexpr unsigned int ident = Script::CallbackIdentity("OnPlayerConnect");
Script::CallBackReturn<ident> result = true;
Script::Call<ident>(result, Players::GetPlayer(packet->guid)->GetID());
Script::Call<ident>(result, Players::getPlayer(packet->guid)->getId());
if (!result)
{
playerController->GetPacket(ID_USER_DISCONNECTED)->Send(Players::GetPlayer(packet->guid), false);
Players::DeletePlayer(packet->guid);
playerController->GetPacket(ID_USER_DISCONNECTED)->Send(Players::getPlayer(packet->guid), false);
Players::deletePlayer(packet->guid);
return;
}
}
@ -114,12 +114,12 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
myPacket->Send(player, true);
}
if (player->LoadedState() == Player::NOTLOADED)
if (player->getLoadState() == Player::NOTLOADED)
return;
else if (player->LoadedState() == Player::LOADED)
else if (player->getLoadState() == Player::LOADED)
{
player->Loaded(Player::POSTLOADED);
NewPlayer(packet->guid);
player->setLoadState(Player::POSTLOADED);
newPlayer(packet->guid);
return;
}
@ -160,7 +160,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
player->GetCell()->getDescription().c_str());
myPacket->Send(player, true); //send to other clients
Script::Call<Script::CallbackIdentity("OnPlayerChangeCell")>(player->GetID());
Script::Call<Script::CallbackIdentity("OnPlayerChangeCell")>(player->getId());
}
else
{
@ -178,7 +178,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
myPacket->Read(player);
myPacket->Send(player, true);
Script::Call<Script::CallbackIdentity("OnPlayerChangeAttributes")>(player->GetID());
Script::Call<Script::CallbackIdentity("OnPlayerChangeAttributes")>(player->getId());
}
break;
@ -191,7 +191,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
myPacket->Read(player);
myPacket->Send(player, true);
Script::Call<Script::CallbackIdentity("OnPlayerChangeSkills")>(player->GetID());
Script::Call<Script::CallbackIdentity("OnPlayerChangeSkills")>(player->getId());
}
break;
@ -204,7 +204,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
myPacket->Read(player);
myPacket->Send(player, true);
Script::Call<Script::CallbackIdentity("OnPlayerChangeLevel")>(player->GetID());
Script::Call<Script::CallbackIdentity("OnPlayerChangeLevel")>(player->getId());
}
break;
@ -216,7 +216,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
myPacket->Read(player);
myPacket->Send(player, true);
Script::Call<Script::CallbackIdentity("OnPlayerChangeEquipment")>(player->GetID());
Script::Call<Script::CallbackIdentity("OnPlayerChangeEquipment")>(player->getId());
break;
}
@ -226,7 +226,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
DEBUG_PRINTF("ID_GAME_INVENTORY\n");
myPacket->Read(player);
Script::Call<Script::CallbackIdentity("OnPlayerChangeInventory")>(player->GetID());
Script::Call<Script::CallbackIdentity("OnPlayerChangeInventory")>(player->getId());
break;
}
@ -239,7 +239,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
{
myPacket->Read(player);
Player *target = Players::GetPlayer(player->getAttack()->target);
Player *target = Players::getPlayer(player->getAttack()->target);
if (target == nullptr)
target = player;
@ -252,7 +252,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
if (player->getAttack()->success == 1)
{
LOG_APPEND(Log::LOG_VERBOSE, "damage: %d", player->getAttack()->damage == 1);
target->setLastAttackerId(player->GetID());
target->setLastAttackerId(player->getId());
target->setLastAttackerTime(std::chrono::steady_clock::now());
}
}
@ -276,7 +276,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_DIE from %s",
player->Npc()->mName.c_str());
Player *killer = Players::GetPlayer(player->getLastAttackerId());
Player *killer = Players::getPlayer(player->getLastAttackerId());
short reason = 0; // unknown;
int secondsSinceLastAttacker = std::chrono::duration_cast<std::chrono::duration<double>>(
@ -295,7 +295,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
player->CreatureStats()->mDead = true;
myPacket->Send(player, true);
Script::Call<Script::CallbackIdentity("OnPlayerDeath")>(player->GetID(), reason, killer->GetID());
Script::Call<Script::CallbackIdentity("OnPlayerDeath")>(player->getId(), reason, killer->getId());
break;
}
@ -309,7 +309,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
playerController->GetPacket(ID_GAME_POS)->RequestData(player->guid);
playerController->GetPacket(ID_GAME_CELL)->RequestData(player->guid);
Script::Call<Script::CallbackIdentity("OnPlayerResurrect")>(player->GetID());
Script::Call<Script::CallbackIdentity("OnPlayerResurrect")>(player->getId());
break;
}
@ -327,11 +327,11 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
DEBUG_PRINTF("ID_CHAT_MESSAGE\n");
myPacket->Read(player);
Script::CallBackReturn<Script::CallbackIdentity("OnPlayerSendMessage")> result = true;
Script::Call<Script::CallbackIdentity("OnPlayerSendMessage")>(result, player->GetID(), player->ChatMessage()->c_str());
Script::Call<Script::CallbackIdentity("OnPlayerSendMessage")>(result, player->getId(), player->ChatMessage()->c_str());
if (result)
{
*player->ChatMessage() = player->Npc()->mName + " (" + std::to_string(player->GetID()) + "): "
*player->ChatMessage() = player->Npc()->mName + " (" + std::to_string(player->getId()) + "): "
+ *player->ChatMessage() + "\n";
myPacket->Send(player, false);
myPacket->Send(player, true);
@ -345,7 +345,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
if (player->CharGenStage()->current == player->CharGenStage()->end && player->CharGenStage()->current != 0)
{
Script::Call<Script::CallbackIdentity("OnPlayerEndCharGen")>(player->GetID());
Script::Call<Script::CallbackIdentity("OnPlayerEndCharGen")>(player->getId());
cout << "RACE: " << player->Npc()->mRace << endl;
}
break;
@ -356,7 +356,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
DEBUG_PRINTF("ID_GUI_MESSAGEBOX\n");
myPacket->Read(player);
Script::Call<Script::CallbackIdentity("OnGUIAction")>(player->GetID(), (int)player->guiMessageBox.id,
Script::Call<Script::CallbackIdentity("OnGUIAction")>(player->getId(), (int)player->guiMessageBox.id,
player->guiMessageBox.data.c_str());
break;
}
@ -375,11 +375,11 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
}
}
void Networking::ProcessWorldPacket(RakNet::Packet *packet)
void Networking::processWorldPacket(RakNet::Packet *packet)
{
Player *player = Players::GetPlayer(packet->guid);
Player *player = Players::getPlayer(packet->guid);
if (!player->isHandshaked() || player->LoadedState() != Player::POSTLOADED)
if (!player->isHandshaked() || player->getLoadState() != Player::POSTLOADED)
return;
WorldPacket *myPacket = worldController->GetPacket(packet->data[0]);
@ -659,9 +659,9 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
}
void Networking::Update(RakNet::Packet *packet)
void Networking::update(RakNet::Packet *packet)
{
Player *player = Players::GetPlayer(packet->guid);
Player *player = Players::getPlayer(packet->guid);
RakNet::BitStream bsIn(&packet->data[1], packet->length, false);
@ -676,20 +676,20 @@ void Networking::Update(RakNet::Packet *packet)
playerController->SetStream(&bsIn, 0);
playerController->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid);
Players::NewPlayer(packet->guid);
player = Players::GetPlayer(packet->guid);
playerController->GetPacket(ID_USER_MYID)->Send(Players::GetPlayer(packet->guid), false);
Players::newPlayer(packet->guid);
player = Players::getPlayer(packet->guid);
playerController->GetPacket(ID_USER_MYID)->Send(Players::getPlayer(packet->guid), false);
return;
}
else if (playerController->ContainsPacket(packet->data[0]))
{
playerController->SetStream(&bsIn, 0);
ProcessPlayerPacket(packet);
processPlayerPacket(packet);
}
else if (worldController->ContainsPacket(packet->data[0]))
{
worldController->SetStream(&bsIn, 0);
ProcessWorldPacket(packet);
processWorldPacket(packet);
}
else
{
@ -698,7 +698,7 @@ void Networking::Update(RakNet::Packet *packet)
}
}
void Networking::NewPlayer(RakNet::RakNetGUID guid)
void Networking::newPlayer(RakNet::RakNetGUID guid)
{
playerController->GetPacket(ID_GAME_BASE_INFO)->RequestData(guid);
playerController->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(guid);
@ -718,7 +718,7 @@ void Networking::NewPlayer(RakNet::RakNetGUID guid)
else if (pl->first == -1) continue;
// If we are iterating over a player who has inputted their name, proceed
else if (pl->second->LoadedState() == Player::POSTLOADED)
else if (pl->second->getLoadState() == Player::POSTLOADED)
{
playerController->GetPacket(ID_GAME_BASE_INFO)->Send(pl->second, guid);
playerController->GetPacket(ID_GAME_DYNAMICSTATS)->Send(pl->second, guid);
@ -736,44 +736,44 @@ void Networking::NewPlayer(RakNet::RakNetGUID guid)
void Networking::DisconnectPlayer(RakNet::RakNetGUID guid)
void Networking::disconnectPlayer(RakNet::RakNetGUID guid)
{
Player *player = Players::GetPlayer(guid);
Player *player = Players::getPlayer(guid);
if (!player)
return;
Script::Call<Script::CallbackIdentity("OnPlayerDisconnect")>(player->GetID());
Script::Call<Script::CallbackIdentity("OnPlayerDisconnect")>(player->getId());
playerController->GetPacket(ID_USER_DISCONNECTED)->Send(player, true);
Players::DeletePlayer(guid);
Players::deletePlayer(guid);
}
PlayerPacketController *Networking::GetPlayerController() const
PlayerPacketController *Networking::getPlayerController() const
{
return playerController;
}
WorldPacketController *Networking::GetWorldController() const
WorldPacketController *Networking::getWorldController() const
{
return worldController;
}
const Networking &Networking::Get()
const Networking &Networking::get()
{
return *sThis;
}
Networking *Networking::GetPtr()
Networking *Networking::getPtr()
{
return sThis;
}
void Networking::StopServer(int code)
void Networking::stopServer(int code)
{
running = false;
exitCode = code;
}
int Networking::MainLoop()
int Networking::mainLoop()
{
RakNet::Packet *packet;
@ -812,15 +812,15 @@ int Networking::MainLoop()
case ID_DISCONNECTION_NOTIFICATION:
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Client at %s has disconnected",
packet->systemAddress.ToString());
DisconnectPlayer(packet->guid);
disconnectPlayer(packet->guid);
break;
case ID_CONNECTION_LOST:
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Client at %s has lost connection",
packet->systemAddress.ToString());
DisconnectPlayer(packet->guid);
disconnectPlayer(packet->guid);
break;
default:
Update(packet);
update(packet);
break;
}
}
@ -832,22 +832,22 @@ int Networking::MainLoop()
return exitCode;
}
void Networking::KickPlayer(RakNet::RakNetGUID guid)
void Networking::kickPlayer(RakNet::RakNetGUID guid)
{
peer->CloseConnection(guid, true);
}
unsigned short Networking::NumberOfConnections() const
unsigned short Networking::numberOfConnections() const
{
return peer->NumberOfConnections();
}
unsigned int Networking::MaxConnections() const
unsigned int Networking::maxConnections() const
{
return peer->GetMaximumIncomingConnections();
}
int Networking::GetAvgPing(RakNet::AddressOrGUID addr) const
int Networking::getAvgPing(RakNet::AddressOrGUID addr) const
{
return peer->GetAveragePing(addr);
}

@ -17,27 +17,27 @@ namespace mwmp
Networking(RakNet::RakPeerInterface *peer);
~Networking();
void NewPlayer(RakNet::RakNetGUID guid);
void DisconnectPlayer(RakNet::RakNetGUID guid);
void KickPlayer(RakNet::RakNetGUID guid);
void newPlayer(RakNet::RakNetGUID guid);
void disconnectPlayer(RakNet::RakNetGUID guid);
void kickPlayer(RakNet::RakNetGUID guid);
void ProcessPlayerPacket(RakNet::Packet *packet);
void ProcessWorldPacket(RakNet::Packet *packet);
void Update(RakNet::Packet *packet);
void processPlayerPacket(RakNet::Packet *packet);
void processWorldPacket(RakNet::Packet *packet);
void update(RakNet::Packet *packet);
unsigned short NumberOfConnections() const;
unsigned int MaxConnections() const;
int GetAvgPing(RakNet::AddressOrGUID) const;
unsigned short numberOfConnections() const;
unsigned int maxConnections() const;
int getAvgPing(RakNet::AddressOrGUID) const;
int MainLoop();
int mainLoop();
void StopServer(int code);
void stopServer(int code);
PlayerPacketController *GetPlayerController() const;
WorldPacketController *GetWorldController() const;
PlayerPacketController *getPlayerController() const;
WorldPacketController *getWorldController() const;
static const Networking &Get();
static Networking *GetPtr();
static const Networking &get();
static Networking *getPtr();
private:
static Networking *sThis;

@ -8,7 +8,7 @@
TPlayers Players::players;
TSlots Players::slots;
void Players::DeletePlayer(RakNet::RakNetGUID guid)
void Players::deletePlayer(RakNet::RakNetGUID guid)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Deleting player with guid %lu",
guid.g);
@ -16,15 +16,15 @@ void Players::DeletePlayer(RakNet::RakNetGUID guid)
if (players[guid.g] != 0)
{
LOG_APPEND(Log::LOG_INFO, "- Emptying slot %i",
players[guid.g]->GetID());
players[guid.g]->getId());
slots[players[guid.g]->GetID()] = 0;
slots[players[guid.g]->getId()] = 0;
delete players[guid.g];
players.erase(guid.g);
}
}
void Players::NewPlayer(RakNet::RakNetGUID guid)
void Players::newPlayer(RakNet::RakNetGUID guid)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Creating new player with guid %lu",
guid.g);
@ -36,7 +36,7 @@ void Players::NewPlayer(RakNet::RakNetGUID guid)
players[guid.g]->CreatureStats()->blank();
players[guid.g]->charClass.blank();
for (int i = 0; i < mwmp::Networking::Get().MaxConnections(); i++)
for (int i = 0; i < mwmp::Networking::get().maxConnections(); i++)
{
if (slots[i] == 0)
{
@ -44,26 +44,26 @@ void Players::NewPlayer(RakNet::RakNetGUID guid)
i);
slots[i] = players[guid.g];
slots[i]->SetID(i);
slots[i]->setId(i);
break;
}
}
}
Player *Players::GetPlayer(RakNet::RakNetGUID guid)
Player *Players::getPlayer(RakNet::RakNetGUID guid)
{
return players[guid.g];
}
std::map<uint64_t, Player*> *Players::GetPlayers()
std::map<uint64_t, Player*> *Players::getPlayers()
{
return &players;
}
Player::Player(RakNet::RakNetGUID guid) : BasePlayer(guid)
{
handshake = false;
loaded = false;
handshakeState = false;
loadState = false;
lastAttacker = 0;
}
@ -72,37 +72,37 @@ Player::~Player()
}
unsigned short Player::GetID()
unsigned short Player::getId()
{
return id;
}
void Player::SetID(unsigned short id)
void Player::setId(unsigned short id)
{
this->id = id;
}
void Player::Handshake()
void Player::setHandshake()
{
handshake = true;
handshakeState = true;
}
bool Player::isHandshaked()
{
return handshake;
return handshakeState;
}
void Player::Loaded(int state)
void Player::setLoadState(int state)
{
loaded = state;
loadState = state;
}
int Player::LoadedState()
int Player::getLoadState()
{
return loaded;
return loadState;
}
Player *Players::GetPlayer(unsigned short id)
Player *Players::getPlayer(unsigned short id)
{
if (slots.find(id) == slots.end())
return nullptr;

@ -25,11 +25,11 @@ typedef std::map<unsigned short, Player*> TSlots;
class Players
{
public:
static void NewPlayer(RakNet::RakNetGUID guid);
static void DeletePlayer(RakNet::RakNetGUID guid);
static Player *GetPlayer(RakNet::RakNetGUID guid);
static Player *GetPlayer(unsigned short id);
static TPlayers *GetPlayers();
static void newPlayer(RakNet::RakNetGUID guid);
static void deletePlayer(RakNet::RakNetGUID guid);
static Player *getPlayer(RakNet::RakNetGUID guid);
static Player *getPlayer(unsigned short id);
static TPlayers *getPlayers();
private:
static TPlayers players;
@ -49,14 +49,14 @@ public:
};
Player(RakNet::RakNetGUID guid);
unsigned short GetID();
void SetID(unsigned short id);
unsigned short getId();
void setId(unsigned short id);
bool isHandshaked();
void Handshake();
void setHandshake();
void Loaded(int state);
int LoadedState();
void setLoadState(int state);
int getLoadState();
void setLastAttackerId(unsigned short pid);
void resetLastAttacker();
@ -69,8 +69,8 @@ public:
public:
mwmp::Inventory inventorySendBuffer;
private:
bool handshake;
int loaded;
bool handshakeState;
int loadState;
unsigned short lastAttacker;
std::chrono::steady_clock::time_point lastAttackerTime;

@ -15,7 +15,7 @@ void CharClassFunctions::SendClass(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CHARCLASS)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CHARCLASS)->Send(player, false);
}
void CharClassFunctions::SetDefaultClass(unsigned short pid, const char *id) noexcept

@ -15,9 +15,9 @@ void ScriptFunctions::SendMessage(unsigned short pid, const char *message, bool
DEBUG_PRINTF("System: %s", message);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, false);
if (broadcast)
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, true);
}
void ScriptFunctions::CleanChat(unsigned short pid)

@ -18,7 +18,7 @@ void GUIFunctions::_MessageBox(unsigned short pid, int id, const char *label) no
player->guiMessageBox.label = label;
player->guiMessageBox.type = Player::GUIMessageBox::MessageBox;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
}
void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *label, const char *buttons) noexcept
@ -31,7 +31,7 @@ void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *labe
player->guiMessageBox.buttons = buttons;
player->guiMessageBox.type = Player::GUIMessageBox::CustomMessageBox;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
}
void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) noexcept
@ -43,7 +43,7 @@ void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) no
player->guiMessageBox.label = label;
player->guiMessageBox.type = Player::GUIMessageBox::InputDialog;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
}
void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const char *items)
@ -56,7 +56,7 @@ void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const
player->guiMessageBox.data = items;
player->guiMessageBox.type = Player::GUIMessageBox::ListBox;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
}
void GUIFunctions::SetMapVisibility(unsigned short targetPID, unsigned short affectedPID, unsigned short state) noexcept
@ -76,5 +76,5 @@ void GUIFunctions::SetConsoleAllow(unsigned short pid, char state)
player->consoleAllowed = state;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CONSOLE)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CONSOLE)->Send(player, false);
}

@ -114,8 +114,8 @@ void ItemFunctions::SendEquipment(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, false);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, true);
}
void ItemFunctions::SendInventory(unsigned short pid) noexcept
@ -123,7 +123,7 @@ void ItemFunctions::SendInventory(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player, );
std::swap(player->inventory, player->inventorySendBuffer);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_INVENTORY)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_INVENTORY)->Send(player, false);
player->inventory = std::move(player->inventorySendBuffer);
player->inventorySendBuffer.items.clear();
}

@ -454,14 +454,14 @@ void StatsFunctions::SetCharGenStage(unsigned short pid, int start, int end) noe
player->CharGenStage()->current = start;
player->CharGenStage()->end = end;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CHARGEN)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CHARGEN)->Send(player, false);
}
void StatsFunctions::Resurrect(unsigned short pid)
{
Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_RESURRECT)->RequestData(player->guid);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_RESURRECT)->RequestData(player->guid);
}
void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept
@ -469,16 +469,16 @@ void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, false);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, true);
}
void StatsFunctions::SendDynamicStats(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, false);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, true);
}
void StatsFunctions::SendAttributes(unsigned short pid) noexcept
@ -486,8 +486,8 @@ void StatsFunctions::SendAttributes(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, false);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, true);
}
void StatsFunctions::SendSkills(unsigned short pid) noexcept
@ -495,8 +495,8 @@ void StatsFunctions::SendSkills(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_SKILL)->Send(player, false);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_SKILL)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_SKILL)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_SKILL)->Send(player, true);
}
void StatsFunctions::SendLevel(unsigned short pid) noexcept
@ -504,6 +504,6 @@ void StatsFunctions::SendLevel(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_LEVEL)->Send(player, false);
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_LEVEL)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_LEVEL)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_LEVEL)->Send(player, true);
}

@ -183,7 +183,7 @@ void TranslocationFunctions::SendPos(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false);
}
void TranslocationFunctions::SendCell(unsigned short pid) noexcept
@ -191,6 +191,6 @@ void TranslocationFunctions::SendCell(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CELL)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CELL)->Send(player, false);
}

@ -17,7 +17,7 @@ void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept
player->month = -1;
player->day = -1;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
}
void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept
@ -29,7 +29,7 @@ void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept
player->month = month;
player->day = -1;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
}
@ -42,5 +42,5 @@ void WorldFunctions::SetDay(unsigned short pid, int day) noexcept
player->month = -1;
player->day = day;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
}

@ -111,14 +111,14 @@ boost::any ScriptFunctions::CallPublic(const char *name, ...) noexcept
void ScriptFunctions::StopServer(int code) noexcept
{
mwmp::Networking::GetPtr()->StopServer(code);
mwmp::Networking::getPtr()->stopServer(code);
}
void ScriptFunctions::Kick(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::GetPtr()->KickPlayer(player->guid);
mwmp::Networking::getPtr()->kickPlayer(player->guid);
}
const char *ScriptFunctions::GetServerVersion() noexcept
@ -136,5 +136,5 @@ int ScriptFunctions::GetAvgPing(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player,-1);
return mwmp::Networking::Get().GetAvgPing(player->guid);
return mwmp::Networking::get().getAvgPing(player->guid);
}

@ -19,7 +19,7 @@
#include "Types.hpp"
#define GET_PLAYER(pid, pl, retvalue) \
pl = Players::GetPlayer(pid); \
pl = Players::getPlayer(pid); \
if (player == 0) {\
fprintf(stderr, "%s: Player with pid \'%d\' not found\n", __PRETTY_FUNCTION__, pid);\
/*ScriptFunctions::StopServer(1);*/ \

@ -240,7 +240,7 @@ int main(int argc, char *argv[])
}
int code = networking.MainLoop();
int code = networking.mainLoop();
RakNet::RakPeerInterface::DestroyInstance(peer);

Loading…
Cancel
Save