ManaPlus
Functions
WeaponsDB Namespace Reference

Functions

void load ()
 
void unload ()
 
const WeaponsInfosgetBows ()
 
const WeaponsInfosgetSwords ()
 
const WeaponsInfosgetShields ()
 

Function Documentation

◆ getBows()

const WeaponsInfos & WeaponsDB::getBows ( )

Definition at line 73 of file weaponsdb.cpp.

74 {
75  return mBows;
76 }

References anonymous_namespace{weaponsdb.cpp}::mBows.

Referenced by LocalPlayer::changeEquipmentBeforeAttack().

◆ getShields()

const WeaponsInfos & WeaponsDB::getShields ( )

Definition at line 83 of file weaponsdb.cpp.

84 {
85  return mShields;
86 }

References anonymous_namespace{weaponsdb.cpp}::mShields.

Referenced by LocalPlayer::changeEquipmentBeforeAttack().

◆ getSwords()

const WeaponsInfos & WeaponsDB::getSwords ( )

Definition at line 78 of file weaponsdb.cpp.

79 {
80  return mSwords;
81 }

References anonymous_namespace{weaponsdb.cpp}::mSwords.

Referenced by LocalPlayer::changeEquipmentBeforeAttack().

◆ load()

void WeaponsDB::load ( )

Definition at line 51 of file weaponsdb.cpp.

52 {
53  if (mLoaded)
54  unload();
55 
56  logger->log1("Initializing weapon database...");
57 
58  loadDB("swords", mSwords);
59  loadDB("bows", mBows);
60  loadDB("shields", mShields);
61 }
void log1(const char *const log_text)
Definition: logger.cpp:238
Logger * logger
Definition: logger.cpp:89
void unload()
Definition: net.cpp:180
static void loadDB(const std::string &name, WeaponsInfos &arr)
Definition: weaponsdb.cpp:39

References loadDB(), Logger::log1(), logger, anonymous_namespace{weaponsdb.cpp}::mBows, anonymous_namespace{weaponsdb.cpp}::mLoaded, anonymous_namespace{weaponsdb.cpp}::mShields, anonymous_namespace{weaponsdb.cpp}::mSwords, and Net::unload().

Referenced by DbManager::loadDb().

◆ unload()

void WeaponsDB::unload ( )

Definition at line 63 of file weaponsdb.cpp.

64 {
65  logger->log1("Unloading weapon database...");
66 
67  mBows.clear();
68  mSwords.clear();
69  mShields.clear();
70  mLoaded = false;
71 }

References Logger::log1(), logger, anonymous_namespace{weaponsdb.cpp}::mBows, anonymous_namespace{weaponsdb.cpp}::mLoaded, anonymous_namespace{weaponsdb.cpp}::mShields, and anonymous_namespace{weaponsdb.cpp}::mSwords.

Referenced by DbManager::unloadDb().