Prevent spawning in rivers with valleys mapgen. Remove unecessary whitespace.

master
Duane Robertson 2016-01-16 03:53:02 -06:00 committed by paramat
parent a58c0f458d
commit 752d820206
2 changed files with 61 additions and 47 deletions

View File

@ -603,9 +603,23 @@ float MapgenValleys::humidityByTerrain(
} }
inline int MapgenValleys::getGroundLevelAtPoint(v2s16 p) int MapgenValleys::getGroundLevelAtPoint(v2s16 p)
{ {
// Base terrain calculation // ***********************************************
// This method (deliberately) does not return correct
// terrain values. This may be a problem in the future.
// ***********************************************
// Since MT doesn't normally deal with rivers, check
// to make sure this isn't a request for a location
// in a river.
float rivers = NoisePerlin2D(&noise_rivers->np, p.X, p.Y, seed);
// If it's wet, return an unusable number.
if (fabs(rivers) < river_size)
return MAX_MAP_GENERATION_LIMIT;
// Otherwise, return the real result.
return terrainLevelAtPoint(p.X, p.Y); return terrainLevelAtPoint(p.X, p.Y);
} }

View File

@ -100,7 +100,7 @@ public:
~MapgenValleys(); ~MapgenValleys();
virtual void makeChunk(BlockMakeData *data); virtual void makeChunk(BlockMakeData *data);
inline int getGroundLevelAtPoint(v2s16 p); int getGroundLevelAtPoint(v2s16 p);
private: private:
EmergeManager *m_emerge; EmergeManager *m_emerge;