this is release 3 of my more heightlevels patch. My tests with some
city at heightlevel 53, with trains and busses and industries are
The glitches are almost history. There where two main reasons for
First, frequently the z coordinate was saved in a byte. Occasionally,
the old code even casted a int to a byte for one call of some helper
function and continued operating on ints afterwards. Hmm... I tried
to find all those places and replaced byte with int32.
If you encounter glitches where something located above height level
32 is painted too low, this is probably the reason.
Second, in the old code when painting the landscape, the heightlevel
was treated by (a) looking which tiles would be at sea level at the
edges of the to be painted area and (b) painting some fixed number of
tiles south of that area too. (if you have a look at the landscape,
by giving some tile height > 0, you shift the place where it must be
painted to the north).
I replaced this algorithm by a new one which also first determines
which tiles would be at the edges of the to be painted area assuming
sea level. But then, my algorithm has a look on the heights of the
tiles and by having this look, it determines which actually have to be
painted. For more information, have a look into the code.
Known bugs or things that still need to be done:
(1) The smoke of power plants e.g. at heightlevel 53 is painted too low.
(2) If you scroll across the map border in northwest, you will get
some glitches. Probably, under some circumstances the to be painted
area my algorithm determines is a bit too small. This can probably be
solved by applying an appropriate offset to some variable at a
(3) I didn't touch airplanes. I think for their flying height, an
algorithm like "fly at the usual height if tile_height <= 15, else fly
at height tile_height + some_offset" would be appropriate.
(4) According to some forum entry above, there is a not-yet-finished
patch for the minimap. I didn't touch the minimap.
(5) I did not yet switch back to the old behaviour of levelling.
However, this is relatively simple - you just would have to call my
terraforming algorithm for each to-be-levelled tile individually and
ignore the errors for tiles where levelling is not possible.
(6) I had to make z_pos in struct Vehicle in vehicle_base.h an int32
(previously a byte). I don't know wether one has to write some
handling procedure for older safegames because of that.
Note that I will not be able to do anything with this patch during the
next few weeks. So if someone solves some of the problems above,
thanks, and feel free to publish version 4 / 5 / 6 / etc. of the
I think the patch is nearly finished now, except for some bugs and the
issues stated above, so it would be quite good if we could remove the
"nearly" in that sentence soon