ManaPlus
dbmanager.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2017-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "resources/dbmanager.h"
23 
24 #include "being/being.h"
25 
26 #include "net/loginhandler.h"
27 #include "net/net.h"
28 
29 #include "resources/db/avatardb.h"
30 #include "resources/db/badgesdb.h"
31 #include "resources/db/chardb.h"
32 #include "resources/db/clandb.h"
33 #include "resources/db/colordb.h"
34 #include "resources/db/deaddb.h"
36 #include "resources/db/emotedb.h"
37 #include "resources/db/groupdb.h"
39 #include "resources/db/horsedb.h"
40 #include "resources/db/itemdb.h"
44 #include "resources/db/sounddb.h"
45 #include "resources/db/mapdb.h"
47 #include "resources/db/moddb.h"
48 #include "resources/db/monsterdb.h"
49 #include "resources/db/networkdb.h"
50 #include "resources/db/npcdb.h"
52 #include "resources/db/palettedb.h"
53 #include "resources/db/petdb.h"
55 #include "resources/db/statdb.h"
57 #include "resources/db/textdb.h"
58 #include "resources/db/unitsdb.h"
59 #include "resources/db/weaponsdb.h"
60 
61 #include "debug.h"
62 
64 {
65  CharDB::load();
66  GroupDb::load();
67  StatDb::load();
68  DeadDB::load();
70  ColorDB::load();
71  SoundDB::load();
73  TextDb::load();
74  MapDB::load();
77  ItemDB::load();
78  Being::load();
79  const ServerTypeT type = Net::getNetworkType();
80  if (type == ServerType::EATHENA ||
81  type == ServerType::EVOL2)
82  {
84  if (loginHandler != nullptr)
90  HorseDB::load();
91  ClanDb::load();
92  }
97  UnitsDb::load();
98  NPCDB::load();
100  PETDB::load();
101  EmoteDB::load();
102 // ModDB::load();
104 }
105 
107 {
108  CharDB::unload();
109  GroupDb::unload();
110  StatDb::unload();
111  DeadDB::unload();
112  ColorDB::unload();
113  SoundDB::unload();
115  TextDb::unload();
116  EmoteDB::unload();
117  ItemDB::unload();
120  const ServerTypeT type = Net::getNetworkType();
121  if (type == ServerType::EATHENA ||
122  type == ServerType::EVOL2)
123  {
126  ClanDb::unload();
129  HorseDB::unload();
131  }
133  NPCDB::unload();
138  UnitsDb::unload();
140  PETDB::unload();
142  ModDB::unload();
143 }
static void load()
virtual void updatePacketVersion() const =0
Net::LoginHandler * loginHandler
Definition: net.cpp:90
void load()
Definition: avatardb.cpp:46
void unload()
Definition: avatardb.cpp:133
void unload()
Definition: badgesdb.cpp:86
void load()
Definition: badgesdb.cpp:74
void unload()
Definition: chardb.cpp:125
void load()
Definition: chardb.cpp:47
void load()
Definition: clandb.cpp:46
void unload()
Definition: clandb.cpp:113
void unload()
Definition: colordb.cpp:182
void load()
Definition: colordb.cpp:42
void loadDb()
Definition: dbmanager.cpp:63
void unloadDb()
Definition: dbmanager.cpp:106
void unload()
Definition: deaddb.cpp:96
void load()
Definition: deaddb.cpp:39
void load()
Definition: emotedb.cpp:48
void unload()
Definition: emotedb.cpp:227
void load()
Definition: groupdb.cpp:46
void unload()
Definition: groupdb.cpp:333
void unload()
Definition: horsedb.cpp:266
void load()
Definition: horsedb.cpp:60
void load()
Definition: itemdb.cpp:147
void unload()
Definition: itemdb.cpp:759
void load()
Definition: languagedb.cpp:40
void unload()
Definition: languagedb.cpp:104
void load()
Definition: mapdb.cpp:47
void unload()
Definition: moddb.cpp:100
void load()
Definition: monsterdb.cpp:47
void unload()
Definition: monsterdb.cpp:135
void load()
Definition: npcdb.cpp:48
void unload()
Definition: npcdb.cpp:179
ServerTypeT getNetworkType()
Definition: net.cpp:189
void load()
Definition: networkdb.cpp:40
void unload()
Definition: networkdb.cpp:73
void load()
Definition: petdb.cpp:45
void unload()
Definition: petdb.cpp:148
void unload()
Definition: palettedb.cpp:103
void load()
Definition: palettedb.cpp:40
void unload()
Definition: sounddb.cpp:87
void load()
Definition: sounddb.cpp:40
void load()
Definition: statdb.cpp:87
void unload()
Definition: statdb.cpp:228
void load()
Definition: textdb.cpp:37
void unload()
Definition: textdb.cpp:86
void load()
Definition: unitsdb.cpp:73
void unload()
Definition: unitsdb.cpp:120
void load()
Definition: weaponsdb.cpp:51
void unload()
Definition: weaponsdb.cpp:63
ServerType ::T ServerTypeT
Definition: servertype.h:36