← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~alocritani/widelands/fix_editor_noise_height_tool into lp:widelands

 

Angelo Locritani has proposed merging lp:~alocritani/widelands/fix_editor_noise_height_tool into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~alocritani/widelands/fix_editor_noise_height_tool/+merge/86899

At the moment, the noise height tool returns an height between min + (min-max) * rand and min.

In other words, it lowers terrain below the min value; this is not what the user expect and creates problem (negative value of terrain height -> very high value because of the "negative overflow" -> assertion height <= max_height failed) if you set the gap between min and max to high value (ie: min=0, max = 10).

This branch changes it in order to return a value between min and min+(max-min)+1*rand

so min = 0, max = 10 ->  0<=values<=10
-- 
https://code.launchpad.net/~alocritani/widelands/fix_editor_noise_height_tool/+merge/86899
Your team Widelands Developers is requested to review the proposed merge of lp:~alocritani/widelands/fix_editor_noise_height_tool into lp:widelands.
=== modified file 'src/editor/tools/editor_noise_height_tool.cc'
--- src/editor/tools/editor_noise_height_tool.cc	2011-12-07 22:32:39 +0000
+++ src/editor/tools/editor_noise_height_tool.cc	2011-12-26 13:08:27 +0000
@@ -47,7 +47,7 @@
 				 	 +
 				 	 static_cast<int32_t>
 				 	 	(static_cast<double>
-				 	 	 	(m_interval.min - m_interval.max) * rand()
+				 	 	 	(m_interval.max - m_interval.min + 1) * rand()
 				 	 	 /
 				 	 	 (RAND_MAX + 1.0))));
 	while (mr.advance(map));


Follow ups