The reason for this patch is that I like to manipulate and enhance heightmaps with graphic editors
and before starting a game I like to prepare a scenario.
In the game are two places where you can play with heightmaps.
First place is 'Play heightmap'.
Second place is in the scenario editor.
Here you can load and save heightmaps at will.
Normally after creating a map I save it and edit it with a graphic editor.
After editing I load it again in ottd to see the results, make some changes and save it again.
Until I am happy.
Things that it should do:
Load 16 level height maps correct without loss of information.(old format)
Save 16 level height maps in without loss of information.(old format)
Load 256 level height maps correct without loss of information.
Save 256 level height maps correct without loss of information.
Scale maps properly.
It works as follows.
If user does not change the level with option 'maximum map height' the map will be loaded without scaling.
There is however a procedure 'FixSlopes' that fixes differences of more than 1 between tiles.
It will smoothen things out.
Heightmaps generated with ottd however should be loaded and saved without loss of data!
If user changes the level with option 'maximum map height' the scaling will be activated.
The program checks the level of the highest tile in the heightmap data.
When found it adjusts the maximum map height to that tile level.
The scaling itself tries if possible to raise or lower the highest peak to the desired 'maximum map height' level.
If user does not touch the 'maximum map height' option no scaling will take place.
After scaling an extra 5 tile levels are added to 'maximum map height' to facilitate some extra construction.
To add an extra 5 levels without scaling you simply save and reload the heightmap.
Attachment includes patch and 2 heightmaps for testing.
To see if maps are saved without loss of data you should keep in mind that the file header of the original file may be different.
.
Have fun.
