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
100755
|
File size:
983 bytes
|
Rev | Line | |
---|
[80a6a52] | 1 | #include "yamlsessreader.h"
|
---|
| 2 | #include "yamlext.h"
|
---|
| 3 |
|
---|
| 4 | namespace genesis
|
---|
| 5 | {
|
---|
| 6 | using namespace geoworld;
|
---|
| 7 |
|
---|
| 8 | YAMLSynthSessCfgReader::YAMLSynthSessCfgReader( std::istream & input )
|
---|
| 9 | : _input(input) {}
|
---|
| 10 | YAMLSynthSessCfgReader::~YAMLSynthSessCfgReader() {}
|
---|
| 11 |
|
---|
| 12 | bool YAMLSynthSessCfgReader::load( geoworld::SynthesisSessionConfig & cfg )
|
---|
| 13 | {
|
---|
| 14 | using namespace YAML;
|
---|
| 15 |
|
---|
| 16 | Node nd = Load(_input);
|
---|
| 17 | try
|
---|
| 18 | {
|
---|
| 19 | const YAML::Node
|
---|
| 20 | & ndPasses = nd["passes"],
|
---|
| 21 | & ndGeohost = nd["geohost"],
|
---|
[4962c49] | 22 | & ndMacro = nd["macro"],
|
---|
| 23 | & ndRsrc = nd["resources"];
|
---|
[80a6a52] | 24 |
|
---|
| 25 | ndPasses["count"] >> cfg.passes.count;
|
---|
| 26 | ndPasses["morphs"] >> cfg.passes.morphcount;
|
---|
| 27 | ndGeohost["layers"] >> cfg.geohost.layercount;
|
---|
| 28 | ndGeohost["classes"] >> cfg.geohost.classcount;
|
---|
| 29 | ndMacro["morphs"] >> cfg.macro.morphcount;
|
---|
| 30 | ndMacro["lod"] >> cfg.macro.lod;
|
---|
| 31 | ndMacro["coarseness"] >> cfg.macro.coarseness;
|
---|
| 32 |
|
---|
| 33 | return true;
|
---|
| 34 | }
|
---|
| 35 | catch (YAML::RepresentationException &)
|
---|
| 36 | {
|
---|
| 37 | return false;
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.