Pol  Revision:4b29d2b
settings.cpp
Go to the documentation of this file.
1 #include "settings.h"
2 
3 #include "../../clib/cfgelem.h"
4 #include "../../clib/cfgfile.h"
5 #include "../../clib/fileutil.h"
6 #include "../../clib/logfacility.h"
7 #include "../../plib/systemstate.h"
8 #include "../watch.h"
9 
10 namespace Pol
11 {
12 namespace Core
13 {
15 
17  : combat_config(),
18  watch(),
19  extobj(),
20  party_cfg(),
21  ssopt(),
22  polvar(),
23  movecost_walking(),
24  movecost_running(),
25  movecost_walking_mounted(),
26  movecost_running_mounted(),
27  repsys_cfg()
28 {
29 }
30 
32 
33 
35 
37 {
38  size_t size = sizeof( SettingsManager );
39  return size;
40 }
41 
42 
44 {
46  Clib::ConfigElem elem;
47  if ( Clib::FileExists( "config/watch.cfg" ) )
48  {
49  cf.open( "config/watch.cfg" );
50  cf.readraw( elem );
51  }
52  else if ( Plib::systemstate.config.loglevel > 1 )
53  INFO_PRINT << "File config/watch.cfg not found, skipping.\n";
54 
55  settingsManager.watch.combat = elem.remove_bool( "COMBAT", false );
56  settingsManager.watch.profile_scripts = elem.remove_bool( "ProfileScripts", false );
57 }
58 }
59 }
bool combat
Definition: watch.h:14
size_t estimateSize() const
Definition: settings.cpp:36
SystemState systemstate
Definition: systemstate.cpp:12
void set_watch_vars()
Definition: settings.cpp:43
bool profile_scripts
Definition: watch.h:15
void readraw(ConfigElem &elem)
Definition: cfgfile.cpp:1028
void open(const char *i_filename)
Definition: cfgfile.cpp:600
SettingsManager settingsManager
Definition: settings.cpp:14
bool FileExists(const char *filename)
Definition: fileutil.cpp:118
#define INFO_PRINT
Definition: logfacility.h:223
Definition: berror.cpp:12
bool remove_bool(const char *propname)
Definition: cfgfile.cpp:426