diff --git a/apps/openmw-mp/MasterClient.cpp b/apps/openmw-mp/MasterClient.cpp index 2b76531e4..e512d6892 100644 --- a/apps/openmw-mp/MasterClient.cpp +++ b/apps/openmw-mp/MasterClient.cpp @@ -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(); } diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index 31491848c..cbf062763 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -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(id, field++); - if (name.size() == 0) + if (name.empty()) break; PacketPreInit::HashList hashList; while (true) { auto hash = luaState.getEventCtrl().Call(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); } diff --git a/apps/openmw-mp/Networking.hpp b/apps/openmw-mp/Networking.hpp index 94df65e7d..b0174adff 100644 --- a/apps/openmw-mp/Networking.hpp +++ b/apps/openmw-mp/Networking.hpp @@ -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;