port/mars-tycoon
Last change
on this file since 25c4774 was aad5afa, checked in by Jonathan Neufeld <support@…>, 3 years ago |
Fix YAML provider bugs preventing YAML configurations from loading properly.
|
-
Property mode
set to
100644
|
File size:
965 bytes
|
Rev | Line | |
---|
[80a6a52] | 1 | #include "rough.h"
|
---|
| 2 |
|
---|
| 3 | #include <mars_grids.h>
|
---|
| 4 |
|
---|
| 5 | namespace geoworld
|
---|
| 6 | {
|
---|
| 7 | void RoughGM::doMorph( LockedGWSection & section ) const
|
---|
| 8 | { section += *_ngen.compute(section.getActualWidth(), section.getActualHeight()); }
|
---|
| 9 |
|
---|
| 10 | GeoMorph * RoughGTFactory::createRandomInstance() const
|
---|
| 11 | {
|
---|
| 12 | return new RoughGM(
|
---|
| 13 | _mmfCoarseness.next(),
|
---|
| 14 | _mmfBrownIterations.next()
|
---|
| 15 | );
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | void RoughGTFactory::configure( IConfigGTFactory * pFactoryConfig, const IConfigGTFactory::Settings & settings )
|
---|
| 19 | {
|
---|
| 20 | const geoworld::IConfigSection & section = *pFactoryConfig->getSection();
|
---|
| 21 |
|
---|
| 22 | *section["coarseness"] >> _mmfCoarseness;
|
---|
| 23 | *section["roughness"] >> _mmfBrownIterations;
|
---|
| 24 |
|
---|
| 25 | if (_mmfCoarseness.minimum < 0 || _mmfCoarseness.maximum > 1.0)
|
---|
| 26 | throw GMInvalidPropertyEx("coarseness", "Coarseness must be between zero and one");
|
---|
| 27 | if (_mmfBrownIterations.minimum < 0 || _mmfBrownIterations.maximum > 1.0)
|
---|
| 28 | throw GMInvalidPropertyEx("roughness", "Roughness must be between zero and one");
|
---|
| 29 | }
|
---|
| 30 |
|
---|
[aad5afa] | 31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.