ManaPlus
Functions
NetworkDb Namespace Reference

Functions

void load ()
 
void loadXmlFile (const std::string &fileName, const SkipError skipError)
 
void unload ()
 
const NetworkInPacketInfosgetFakePackets ()
 
const NetworkRemovePacketInfosgetRemovePackets ()
 

Function Documentation

◆ getFakePackets()

const NetworkInPacketInfos & NetworkDb::getFakePackets ( )

Definition at line 81 of file networkdb.cpp.

82 {
83  return mInPackets;
84 }
NetworkInPacketInfos mInPackets
Definition: networkdb.cpp:36

References anonymous_namespace{networkdb.cpp}::mInPackets.

Referenced by EAthena::Network::registerFakeHandlers().

◆ getRemovePackets()

const NetworkRemovePacketInfos & NetworkDb::getRemovePackets ( )

Definition at line 86 of file networkdb.cpp.

87 {
88  return mRemovePackets;
89 }
NetworkRemovePacketInfos mRemovePackets
Definition: networkdb.cpp:37

References anonymous_namespace{networkdb.cpp}::mRemovePackets.

Referenced by EAthena::Network::registerFakeHandlers().

◆ load()

void NetworkDb::load ( )

Loads the chars data.

Definition at line 40 of file networkdb.cpp.

41 {
42  if (mLoaded)
43  unload();
44 
45  logger->log1("Initializing network database...");
47  loadXmlFile(paths.getStringValue("networkPatchFile"), SkipError_true);
48  loadXmlDir("networkPatchDir", loadXmlFile)
49  mLoaded = true;
50 }
static void loadXmlFile(const std::string &file, const std::string &name, BadgesInfos &arr, const SkipError skipError)
Definition: badgesdb.cpp:43
#define loadXmlDir(name, function)
Definition: beingcommon.h:39
std::string getStringValue(const std::string &key) const
void log1(const char *const log_text)
Definition: logger.cpp:238
Configuration paths
Logger * logger
Definition: logger.cpp:89
void unload()
Definition: net.cpp:180
const bool SkipError_false
Definition: skiperror.h:30
const bool SkipError_true
Definition: skiperror.h:30

References Configuration::getStringValue(), loadXmlDir, loadXmlFile(), Logger::log1(), logger, anonymous_namespace{networkdb.cpp}::mLoaded, paths, SkipError_false, SkipError_true, and Net::unload().

Referenced by DbManager::loadDb().

◆ loadXmlFile()

void NetworkDb::loadXmlFile ( const std::string &  fileName,
const SkipError  skipError 
)

Definition at line 52 of file networkdb.cpp.

54 {
56  "network",
57  "inpackets",
58  "fakepacket",
59  "id",
60  "len",
61  mInPackets,
62  skipError);
63 
65  "network",
66  "inpackets",
67  "removepacket",
68  "id",
70  skipError);
71 }
std::string fileName
Definition: testmain.cpp:39
void readXmlIntMap(const std::string &fileName, const std::string &rootName, const std::string &sectionName, const std::string &itemName, const std::string &attributeKeyName, const std::string &attributeValueName, std::map< int32_t, int32_t > &arr, const SkipError skipError)
Definition: xmlutils.cpp:134
void readXmlIntVector(const std::string &fileName, const std::string &rootName, const std::string &sectionName, const std::string &itemName, const std::string &attributeName, std::vector< int > &arr, const SkipError skipError)
Definition: xmlutils.cpp:30

References fileName, anonymous_namespace{networkdb.cpp}::mInPackets, anonymous_namespace{networkdb.cpp}::mRemovePackets, readXmlIntMap(), and readXmlIntVector().

◆ unload()

void NetworkDb::unload ( )

Clear the chars data

Definition at line 73 of file networkdb.cpp.

74 {
75  logger->log1("Unloading network database...");
76  mInPackets.clear();
77  mRemovePackets.clear();
78  mLoaded = false;
79 }

References Logger::log1(), logger, anonymous_namespace{networkdb.cpp}::mInPackets, anonymous_namespace{networkdb.cpp}::mLoaded, and anonymous_namespace{networkdb.cpp}::mRemovePackets.

Referenced by DbManager::unloadDb().