]> git.tdb.fi Git - r2c2.git/commitdiff
Use elevation granularity for terrain Z positions
authorMikko Rasa <tdb@tdb.fi>
Wed, 2 Apr 2014 20:20:21 +0000 (23:20 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 2 Apr 2014 20:20:21 +0000 (23:20 +0300)
source/libr2c2/terrain.cpp

index 8e0c60edb76276e8a49bf4f0043073556f64c10f..002a536581a6201698baa2e45ab2870b8cd42cb3 100644 (file)
@@ -38,6 +38,8 @@ Terrain *Terrain::clone(Layout *to_layout) const
 void Terrain::set_position(const Vector &p)
 {
        position = p;
+       float eg = type.get_elevation_granularity();
+       position.z = int(position.z/eg+0.5)*eg;
        signal_moved.emit();
 }