From 0fc8851faef219be6a3e161946fd6a09930efeb0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 13 Sep 2016 23:15:31 +0300 Subject: Add support for removepacket tag in network.xml --- src/resources/db/networkdb.cpp | 19 +++++++++++++++++-- src/resources/db/networkdb.h | 11 ++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src/resources') diff --git a/src/resources/db/networkdb.cpp b/src/resources/db/networkdb.cpp index c430d0f7a..70a5b814f 100644 --- a/src/resources/db/networkdb.cpp +++ b/src/resources/db/networkdb.cpp @@ -32,7 +32,8 @@ namespace { bool mLoaded = false; - NetworkInfos mInPackets; + NetworkInPacketInfos mInPackets; + NetworkRemovePacketInfos mRemovePackets; } // namespace void NetworkDb::load() @@ -58,15 +59,29 @@ void NetworkDb::loadXmlFile(const std::string &fileName, "len", mInPackets, skipError); + + readXmlIntVector(fileName, + "network", + "inpackets", + "removepacket", + "id", + mRemovePackets, + skipError); } void NetworkDb::unload() { mInPackets.clear(); + mRemovePackets.clear(); mLoaded = false; } -const NetworkInfos &NetworkDb::getFakePackets() +const NetworkInPacketInfos &NetworkDb::getFakePackets() { return mInPackets; } + +const NetworkRemovePacketInfos &NetworkDb::getRemovePackets() +{ + return mRemovePackets; +} diff --git a/src/resources/db/networkdb.h b/src/resources/db/networkdb.h index 899fc6cda..b6eb47726 100644 --- a/src/resources/db/networkdb.h +++ b/src/resources/db/networkdb.h @@ -24,10 +24,13 @@ #include "enums/simpletypes/skiperror.h" #include +#include #include -typedef std::map NetworkInfos; -typedef NetworkInfos::const_iterator NetworkInfosIter; +typedef std::map NetworkInPacketInfos; +typedef NetworkInPacketInfos::const_iterator NetworkInPacketInfosIter; +typedef std::vector NetworkRemovePacketInfos; +typedef NetworkRemovePacketInfos::const_iterator NetworkRemovePacketInfosIter; namespace NetworkDb { @@ -44,7 +47,9 @@ namespace NetworkDb */ void unload(); - const NetworkInfos &getFakePackets(); + const NetworkInPacketInfos &getFakePackets(); + + const NetworkRemovePacketInfos &getRemovePackets(); } // namespace NetworkDb #endif // RESOURCES_DB_NETWORKDB_H -- cgit v1.2.3-70-g09d2