[Server] Minor fixes

new-script-api
Koncord 7 years ago
parent 6cb9c3c713
commit 62588ce088

@ -109,7 +109,7 @@ void MasterClient::SetRuleValue(std::string key, double value)
void MasterClient::PushPlugin(Plugin plugin)
{
mutexData.lock();
queryData.plugins.push_back(plugin);
queryData.plugins.push_back(move(plugin));
updated = true;
mutexData.unlock();
}

@ -30,7 +30,7 @@
using namespace mwmp;
using namespace std;
Networking *Networking::sThis = 0;
Networking *Networking::sThis = nullptr;
static int currentMpNum = 0;
@ -48,9 +48,9 @@ Networking::Networking(RakNet::RakPeerInterface *peer) : mclient(nullptr)
worldPacketController = new WorldPacketController(peer);
// Set send stream
playerPacketController->SetStream(0, &bsOut);
actorPacketController->SetStream(0, &bsOut);
worldPacketController->SetStream(0, &bsOut);
playerPacketController->SetStream(nullptr, &bsOut);
actorPacketController->SetStream(nullptr, &bsOut);
worldPacketController->SetStream(nullptr, &bsOut);
running = true;
exitCode = 0;
@ -244,7 +244,7 @@ bool Networking::update(RakNet::Packet *packet)
return false;
}
playerPacketController->SetStream(&bsIn, 0);
playerPacketController->SetStream(&bsIn, nullptr);
playerPacketController->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid);
player = Players::addPlayer(packet->guid);
@ -253,21 +253,21 @@ bool Networking::update(RakNet::Packet *packet)
if (playerPacketController->ContainsPacket(packet->data[0]))
{
playerPacketController->SetStream(&bsIn, 0);
playerPacketController->SetStream(&bsIn, nullptr);
processPlayerPacket(packet);
return true;
}
if (actorPacketController->ContainsPacket(packet->data[0]))
{
actorPacketController->SetStream(&bsIn, 0);
actorPacketController->SetStream(&bsIn, nullptr);
processActorPacket(packet);
return true;
}
if (worldPacketController->ContainsPacket(packet->data[0]))
{
worldPacketController->SetStream(&bsIn, 0);
worldPacketController->SetStream(&bsIn, nullptr);
processWorldPacket(packet);
return true;
}
@ -398,17 +398,17 @@ PacketPreInit::PluginContainer Networking::getPluginListSample()
{
unsigned field = 0;
auto name = luaState.getEventCtrl().Call<CoreEvent::ON_REQUEST_PLUGIN_LIST, string>(id, field++);
if (name.size() == 0)
if (name.empty())
break;
PacketPreInit::HashList hashList;
while (true)
{
auto hash = luaState.getEventCtrl().Call<CoreEvent::ON_REQUEST_PLUGIN_LIST, string>(id, field++);
if (hash.size() == 0)
if (hash.empty())
break;
hashList.push_back((unsigned)stoul(hash));
}
pls.push_back({name, hashList});
pls.emplace_back(name, hashList);
id++;
}
return pls;
@ -525,7 +525,7 @@ MasterClient *Networking::getMasterClient()
return mclient;
}
void Networking::InitQuery(std::string queryAddr, unsigned short queryPort)
void Networking::InitQuery(const std::string &queryAddr, unsigned short queryPort)
{
mclient = new MasterClient(peer, queryAddr, queryPort);
}

@ -55,7 +55,7 @@ namespace mwmp
int incrementMpNum();
MasterClient *getMasterClient();
void InitQuery(std::string queryAddr, unsigned short queryPort);
void InitQuery(const std::string &queryAddr, unsigned short queryPort);
void setServerPassword(std::string passw) noexcept;
bool isPassworded() const;

Loading…
Cancel
Save