polserver/pol-core/pol/stackcfg.cpp
turleypol dbb25bdb62
Include and buildsystem cleanup (#45)
Include cleanup
Reworked buildsystem (Linux only)
Removed dynamic libs, Linux now again uses static linking (like windows)
2018-01-29 21:55:48 +01:00

63 lines
1.3 KiB
C++

/** @file
*
* @par History
*/
#include "stackcfg.h"
#include <string>
#include "../clib/cfgelem.h"
#include "../clib/cfgfile.h"
#include "../clib/fileutil.h"
#include "../clib/stlutil.h"
#include "../plib/pkg.h"
#include "../plib/systemstate.h"
#include "globals/uvars.h"
namespace Pol
{
namespace Core
{
void read_stacking_cfg( Clib::ConfigFile& cf )
{
Clib::ConfigElem elem;
if ( cf.read( elem ) )
{
if ( elem.type_is( "Stacking" ) )
{
std::string temp = elem.remove_string( "IgnoreCprops" );
ISTRINGSTREAM is( temp );
std::string cprop_name;
while ( is >> cprop_name )
gamestate.Global_Ignore_CProps.insert( cprop_name );
}
}
}
void load_stacking_cfg()
{
std::string main_cfg = "config/stacking.cfg";
if ( Clib::FileExists( main_cfg.c_str() ) )
{
Clib::ConfigFile cf_main( main_cfg.c_str() );
read_stacking_cfg( cf_main );
}
for ( Plib::Packages::iterator itr = Plib::systemstate.packages.begin();
itr != Plib::systemstate.packages.end(); ++itr )
{
Plib::Package* pkg = ( *itr );
// string filename = pkg->dir() + cfgname + ".cfg";
std::string filename = Plib::GetPackageCfgPath( pkg, "stacking.cfg" );
if ( Clib::FileExists( filename.c_str() ) )
{
Clib::ConfigFile cf( filename.c_str() );
read_stacking_cfg( cf );
}
}
}
}
}