[General] Fix "using after move" warning

This commit is contained in:
Koncord 2018-01-20 21:02:41 +08:00
parent edd883853d
commit 6197636fac
3 changed files with 6 additions and 3 deletions

View file

@ -20,7 +20,8 @@ inline void AddPacket(mwmp::ActorPacketController::packets_t *packets, RakNet::R
{ {
T *packet = new T(peer); T *packet = new T(peer);
typedef mwmp::ActorPacketController::packets_t::value_type value_t; typedef mwmp::ActorPacketController::packets_t::value_type value_t;
packets->insert(value_t(packet->GetPacketID(), value_t::second_type(std::move(packet)))); unsigned char packetId = packet->GetPacketID();
packets->insert(value_t(packetId, value_t::second_type(std::move(packet))));
} }
mwmp::ActorPacketController::ActorPacketController(RakNet::RakPeerInterface *peer) mwmp::ActorPacketController::ActorPacketController(RakNet::RakPeerInterface *peer)

View file

@ -47,7 +47,8 @@ inline void AddPacket(mwmp::PlayerPacketController::packets_t *packets, RakNet::
{ {
T *packet = new T(peer); T *packet = new T(peer);
typedef mwmp::PlayerPacketController::packets_t::value_type value_t; typedef mwmp::PlayerPacketController::packets_t::value_type value_t;
packets->insert(value_t(packet->GetPacketID(), value_t::second_type(std::move(packet)))); unsigned char packetId = packet->GetPacketID();
packets->insert(value_t(packetId, value_t::second_type(std::move(packet))));
} }
mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *peer) mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *peer)

View file

@ -27,7 +27,8 @@ inline void AddPacket(mwmp::WorldPacketController::packets_t *packets, RakNet::R
{ {
T *packet = new T(peer); T *packet = new T(peer);
typedef mwmp::WorldPacketController::packets_t::value_type value_t; typedef mwmp::WorldPacketController::packets_t::value_type value_t;
packets->insert(value_t(packet->GetPacketID(), value_t::second_type(std::move(packet)))); unsigned char packetId = packet->GetPacketID();
packets->insert(value_t(packetId, value_t::second_type(std::move(packet))));
} }
mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *peer) mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *peer)