port/mars-tycoon
Last change
on this file since 25c4774 was 4962c49, checked in by Jonathan Neufeld <support@…>, 3 years ago |
Introduce CLI Terrain Generator utility
|
-
Property mode
set to
100644
|
File size:
847 bytes
|
Rev | Line | |
---|
[4962c49] | 1 | #include "yamlmetaconfig.h"
|
---|
| 2 | #include "yamlext.h"
|
---|
| 3 |
|
---|
| 4 | namespace genesis
|
---|
| 5 | {
|
---|
| 6 | using namespace geoworld;
|
---|
| 7 |
|
---|
| 8 | YAMLMetaConfigReader::YAMLMetaConfigReader( std::istream & input )
|
---|
| 9 | : _input(input) {}
|
---|
| 10 | YAMLMetaConfigReader::~YAMLMetaConfigReader() {}
|
---|
| 11 |
|
---|
| 12 | bool YAMLMetaConfigReader::load( geoworld::MetaConfig & cfg )
|
---|
| 13 | {
|
---|
| 14 | using namespace YAML;
|
---|
| 15 |
|
---|
| 16 | Node nd = Load(_input);
|
---|
| 17 | try
|
---|
| 18 | {
|
---|
| 19 | const YAML::Node
|
---|
| 20 | & ndRsrc = nd["resources"];
|
---|
| 21 |
|
---|
| 22 | ndRsrc["genesis"] >> cfg.resources.genesis;
|
---|
| 23 | ndRsrc["gmfactories"] >> cfg.resources.gmfactories;
|
---|
| 24 | ndRsrc["depsynth"] >> cfg.resources.depsynth;
|
---|
| 25 | ndRsrc["minerals"] >> cfg.resources.minerals;
|
---|
| 26 | ndRsrc["classes"] >> cfg.resources.classes;
|
---|
| 27 |
|
---|
| 28 | return true;
|
---|
| 29 | }
|
---|
| 30 | catch (YAML::RepresentationException &)
|
---|
| 31 | {
|
---|
| 32 | return false;
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.