Add ContainsPacket method to packet controllers

coverity_scan^2
David Cernat 8 years ago
parent f1ec01cc6b
commit f0fa5e8771

@ -73,4 +73,13 @@ void mwmp::PlayerPacketController::SetStream(RakNet::BitStream *inStream, RakNet
{
BOOST_FOREACH( packets_t::value_type &packet, packets )
packet.second->SetStreams(inStream, outStream);
}
}
bool mwmp::PlayerPacketController::ContainsPacket(RakNet::MessageID id)
{
BOOST_FOREACH(packets_t::value_type &packet, packets) {
if (packet.first == id)
return true;
}
return false;
}

@ -16,6 +16,8 @@ namespace mwmp
PlayerPacket *GetPacket(RakNet::MessageID id);
void SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream);
bool ContainsPacket(RakNet::MessageID id);
typedef std::map<unsigned char, boost::shared_ptr<PlayerPacket> > packets_t;
private:
packets_t packets;

@ -29,4 +29,13 @@ void mwmp::WorldPacketController::SetStream(RakNet::BitStream *inStream, RakNet:
{
BOOST_FOREACH( packets_t::value_type &packet, packets )
packet.second->SetStreams(inStream, outStream);
}
}
bool mwmp::WorldPacketController::ContainsPacket(RakNet::MessageID id)
{
BOOST_FOREACH(packets_t::value_type &packet, packets) {
if (packet.first == id)
return true;
}
return false;
}

@ -16,6 +16,8 @@ namespace mwmp
WorldPacket *GetPacket(RakNet::MessageID id);
void SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream);
bool ContainsPacket(RakNet::MessageID id);
typedef std::map<unsigned char, boost::shared_ptr<WorldPacket> > packets_t;
private:
packets_t packets;

Loading…
Cancel
Save