Pol  Revision:cb584c9
stackcfg.cpp
Go to the documentation of this file.
1 
7 #include "stackcfg.h"
8 
9 #include <string>
10 
11 #include "../clib/cfgelem.h"
12 #include "../clib/cfgfile.h"
13 #include "../clib/fileutil.h"
14 #include "../clib/stlutil.h"
15 #include "../plib/pkg.h"
16 #include "../plib/systemstate.h"
17 #include "globals/uvars.h"
18 
19 
20 namespace Pol
21 {
22 namespace Core
23 {
25 {
26  Clib::ConfigElem elem;
27  if ( cf.read( elem ) )
28  {
29  if ( elem.type_is( "Stacking" ) )
30  {
31  std::string temp = elem.remove_string( "IgnoreCprops" );
32  ISTRINGSTREAM is( temp );
33  std::string cprop_name;
34  while ( is >> cprop_name )
35  gamestate.Global_Ignore_CProps.insert( cprop_name );
36  }
37  }
38 }
39 
41 {
42  std::string main_cfg = "config/stacking.cfg";
43 
44  if ( Clib::FileExists( main_cfg.c_str() ) )
45  {
46  Clib::ConfigFile cf_main( main_cfg.c_str() );
47  read_stacking_cfg( cf_main );
48  }
49  for ( Plib::Packages::iterator itr = Plib::systemstate.packages.begin();
50  itr != Plib::systemstate.packages.end(); ++itr )
51  {
52  Plib::Package* pkg = ( *itr );
53  // string filename = pkg->dir() + cfgname + ".cfg";
54  std::string filename = Plib::GetPackageCfgPath( pkg, "stacking.cfg" );
55  if ( Clib::FileExists( filename.c_str() ) )
56  {
57  Clib::ConfigFile cf( filename.c_str() );
58  read_stacking_cfg( cf );
59  }
60  }
61 }
62 }
63 }
PropSet Global_Ignore_CProps
Definition: uvars.h:232
std::string remove_string(const char *propname)
Definition: cfgfile.cpp:381
void read_stacking_cfg(Clib::ConfigFile &cf)
Definition: stackcfg.cpp:24
SystemState systemstate
Definition: systemstate.cpp:12
GameState gamestate
Definition: uvars.cpp:74
#define ISTRINGSTREAM
Definition: stlutil.h:73
bool type_is(const char *name) const
Definition: cfgfile.cpp:95
void load_stacking_cfg()
Definition: stackcfg.cpp:40
std::string GetPackageCfgPath(const Package *pkg, const std::string &filename)
Definition: pkg.cpp:491
bool FileExists(const char *filename)
Definition: fileutil.cpp:118
bool read(ConfigElem &elem)
Definition: cfgfile.cpp:1015
Definition: berror.cpp:12