Pol  Revision:cb584c9
loadunld.cpp
Go to the documentation of this file.
1 
10 #include "loadunld.h"
11 
12 #include <string>
13 
14 #include "../clib/strutil.h"
15 #include "../plib/pkg.h"
16 #include "../plib/systemstate.h"
17 #include "checkpnt.h"
18 #include "cmbtcfg.h"
19 #include "console.h"
20 #include "extobj.h"
21 #include "globals/settings.h"
22 #include "item/equipmnt.h"
23 #include "item/itemdesc.h"
24 #include "objtype.h"
25 #include "polcfg.h"
26 
27 namespace Pol
28 {
29 namespace Items
30 {
32 void unload_itemdesc();
33 void load_itemdesc();
34 }
35 namespace Mobile
36 {
37 void unload_armor_zones();
38 void load_armor_zones();
39 void load_attributes_cfg();
40 }
41 namespace Multi
42 {
43 void load_special_storedconfig( const std::string& cfgname );
44 void read_multidefs();
45 void read_boat_cfg();
46 }
47 namespace Network
48 {
49 void read_bannedips_config( bool initial_load );
51 }
52 namespace Module
53 {
54 void load_fileaccess_cfg();
55 }
56 namespace Core
57 {
58 void load_stacking_cfg();
59 void load_repsys_cfg( bool reload );
60 void unload_repsys_cfg();
61 
62 void load_npc_templates();
63 void load_resource_cfg();
64 
65 void set_watch_vars();
66 void load_skill_scripts();
67 void load_anim_xlate_cfg( bool reload );
68 void load_spell_data();
69 
70 void load_cmdlevels();
72 void load_tips();
73 
74 
76 
77 void read_justice_zones();
78 void read_nocast_zones();
79 void read_music_zones();
80 void read_light_zones();
81 void read_weather_zones();
82 
83 
84 void load_vitals_cfg();
85 void load_uoskills_cfg();
86 void load_uoclient_cfg();
87 
88 void read_npc_templates();
89 
90 void load_tiles_cfg();
91 void load_landtile_cfg();
92 void load_party_cfg( bool reload );
93 
94 void load_movecost( bool reload );
95 
96 void unload_party();
97 void read_npc_templates();
98 
100 {
101  // Check if secure trading is enabled and that the container for it is setup.
102  if ( Plib::systemstate.config.enable_secure_trading )
103  {
104  const Items::ItemDesc& stid =
106  if ( stid.type != Items::ItemDesc::CONTAINERDESC )
107  throw std::runtime_error( "Secure trade container (" +
109  ") must be defined in itemdesc.cfg as a container." );
110  }
111 
112  // Make sure backpack container is defined.
113  const Items::ItemDesc& backpackid = Items::find_itemdesc( UOBJ_BACKPACK );
114  if ( backpackid.type != Items::ItemDesc::CONTAINERDESC )
115  throw std::runtime_error( "Backpack container (" + Clib::hexint( UOBJ_BACKPACK ) +
116  ") must be defined in itemdesc.cfg as a container." );
117 
118  // Make sure corpse container is defined.
119  const Items::ItemDesc& corpseid = Items::find_itemdesc( UOBJ_CORPSE );
120  if ( corpseid.type != Items::ItemDesc::CONTAINERDESC )
121  throw std::runtime_error( "Corpse container (" + Clib::hexint( UOBJ_CORPSE ) +
122  ") must be defined in itemdesc.cfg as a container." );
123 
124  // Make sure the WornItems container is defined.
125  const Items::ItemDesc& wic_id =
127  if ( wic_id.type != Items::ItemDesc::CONTAINERDESC )
128  throw std::runtime_error( "WornItems container (" +
130  ") must be defined in itemdesc.cfg as a container." );
131 
132  const Items::ContainerDesc& cd =
135 }
136 
137 void load_config( bool reload )
138 {
139  checkpoint( "load movement cost" );
140  load_movecost( reload );
141 
142  checkpoint( "load animation translations" );
143  load_anim_xlate_cfg( reload );
144 
145  checkpoint( "load repsys config" );
146  load_repsys_cfg( reload );
147 
148  checkpoint( "load party config" );
149  load_party_cfg( reload );
150 }
151 
152 void load_data()
153 {
154  // checkpoint( "read_translations" );
155  // read_translations();
156 
157  checkpoint( "load_cmdlevels" );
158  load_cmdlevels();
159 
160  checkpoint( "read_combat_config" );
162 
163  checkpoint( "read_boat_cfg" );
165 
166  checkpoint( "read_multidefs" );
168 
169  checkpoint( "set_watch_vars" );
170  set_watch_vars();
171 
172  checkpoint( "load_packages" );
174 
175  checkpoint( "load_package_cmdlevels" );
177 
178  checkpoint( "load_resource_cfg" );
180 
181  checkpoint( "read_justice_zones" );
183 
184  checkpoint( "read_music_zones" );
186 
187  checkpoint( "read_nocast_zones" );
189 
190  checkpoint( "read_light_zones" );
192 
193  checkpoint( "read_weather_zones" );
195 
196  checkpoint( "load_armor_zones" );
198 
199  checkpoint( "load_attributes_cfg" );
201 
202  checkpoint( "load_vitals_cfg" );
203  load_vitals_cfg();
204 
205  checkpoint( "load_uoskills_cfg" );
207 
208  checkpoint( "load_uoclient_cfg" );
210 
211  checkpoint( "initialize_client_interfaces" );
213 
214  checkpoint( "load_tiles_cfg" );
215  load_tiles_cfg();
216 
217  checkpoint( "load_landtile_cfg" );
219 
220  checkpoint( "load_itemdesc" );
222 
223  checkpoint( "load_special_storedconfig: itemdesc" );
224  Multi::load_special_storedconfig( "itemdesc" );
225 
226  checkpoint( "load_special_storedconfig: spells" );
228 
229  checkpoint( "load_npc_intrinsic_equip" );
231 
232  checkpoint( "load_npc_templates" );
234 
235  checkpoint( "preload_test_scripts" );
237 
238  checkpoint( "load_spell_data" );
239  load_spell_data();
240 
241  checkpoint( "load_tips" );
242  load_tips();
243 
244  checkpoint( "load stacking cfg" ); // dave 1/26/3
246 
247  load_config( false );
248 
250 
251 
252  //#ifdef _WIN32
253  checkpoint( "load console commands" );
255  //#endif
256 
258 
259  checkpoint( "check configuration" );
260  check_config();
261 }
262 
264 {
268  read_npc_templates(); // dave 1/12/3 npc template data wasn't actually being read, just names.
271 }
272 
274 {
276 
277  unload_repsys_cfg(); // Any better place?
278 
280 
281  unload_party();
282 }
283 }
284 }
void load_tiles_cfg()
Definition: tiles.cpp:39
void unload_armor_zones()
Definition: charactr.cpp:252
void load_config(bool reload)
Definition: loadunld.cpp:137
void load_spell_data()
Definition: spells.cpp:481
void unload_party()
Definition: party.cpp:258
ExternalObject extobj
Definition: settings.h:30
SystemState systemstate
Definition: systemstate.cpp:12
static void load_console_commands()
Definition: console.cpp:111
void set_watch_vars()
Definition: settings.cpp:43
void initialize_client_interfaces()
Definition: cliface.cpp:34
void unload_data()
Definition: loadunld.cpp:273
void unload_repsys_cfg()
Definition: repsys.cpp:135
static void read_pol_config(bool initial_load)
Definition: polcfg.cpp:46
void read_light_zones()
Definition: miscrgn.cpp:51
void load_resource_cfg()
Definition: resource.cpp:352
void preload_test_scripts(const std::string &script_ecl)
Definition: item.cpp:1082
void read_justice_zones()
Definition: guardrgn.cpp:37
void load_skill_scripts()
void load_itemdesc()
Definition: itemdesc.cpp:1190
void reload_configuration()
Definition: loadunld.cpp:263
void load_npc_intrinsic_equip()
Recreates intrinsic equipment for defined NPCs must be called at startup.
Definition: equipmnt.cpp:181
static void read_combat_config()
Definition: cmbtcfg.cpp:25
void read_nocast_zones()
Definition: miscrgn.cpp:34
const ItemDesc & find_itemdesc(unsigned int objtype)
Definition: itemdesc.cpp:933
void read_weather_zones()
Definition: miscrgn.cpp:190
std::string hexint(unsigned short v)
Definition: strutil.cpp:23
unsigned short getgraphic(u32 objtype)
Definition: itemdesc.cpp:906
void read_music_zones()
Definition: musicrgn.cpp:45
void read_bannedips_config(bool initial_load)
Definition: bannedips.cpp:45
void read_npc_templates()
void checkpoint(const char *msg, unsigned short minlvl)
Definition: checkpnt.cpp:17
void load_landtile_cfg()
Definition: landtile.cpp:33
#define UOBJ_CORPSE
Definition: objtype.h:218
void load_vitals_cfg()
Definition: vital.cpp:120
void load_anim_xlate_cfg(bool)
Definition: bowsalut.cpp:74
void load_tips()
Definition: tiplstwn.cpp:16
void load_npc_templates()
Definition: npctmpl.cpp:124
void unload_itemdesc()
Definition: itemdesc.cpp:1203
void load_fileaccess_cfg()
Definition: filemod.cpp:695
void load_attributes_cfg()
Definition: attribute.cpp:99
void load_repsys_cfg(bool reload)
Definition: repsys.cpp:140
#define UOBJ_BACKPACK
Definition: objtype.h:202
SettingsManager settingsManager
Definition: settings.cpp:14
unsigned int wornitems_container
Definition: extobj.h:36
void load_armor_zones()
Definition: charactr.cpp:214
void load_party_cfg(bool reload)
Definition: party.cpp:160
void load_movecost(bool reload)
Definition: movecost.cpp:116
void check_config()
Definition: loadunld.cpp:99
void load_cmdlevels()
Definition: cmdlevel.cpp:152
void load_stacking_cfg()
Definition: stackcfg.cpp:40
void read_boat_cfg()
Definition: boat.cpp:244
void load_special_storedconfig(const std::string &cfgname)
Definition: multicfg.cpp:21
void load_package_cmdlevels()
Definition: cmdlevel.cpp:222
void load_uoclient_cfg()
Definition: uoclient.cpp:128
void load_intrinsic_weapons()
Creates the intrinsic wrestling weapon for PCs must be called at startup.
Definition: weapon.cpp:244
void read_multidefs()
Definition: multidef.cpp:309
const ContainerDesc & find_container_desc(u32 objtype)
Definition: itemdesc.cpp:942
void load_uoskills_cfg()
Definition: uoskills.cpp:87
unsigned int secure_trade_container
Definition: extobj.h:35
Definition: berror.cpp:12
void load_data()
Definition: loadunld.cpp:152
void load_packages(const std::string &basedir, bool quiet)
Definition: pkg.cpp:312