The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: makie on May 11, 2026, 08:40:37 AM

Title: Problem setting lake_height via simuconf.tab
Post by: makie on May 11, 2026, 08:40:37 AM
It is only possible to set lake_height to 0 or 8 with the parameter in simuconf.tab
I think this not intended because this value can be set in the GUI from "Water level"(means sea level) to 127


settings.cc at line 1286
Quote
    tree_distribution = contents.get_int_clamped( "tree_distribution", tree_distribution, TREE_DIST_NONE, TREE_DIST_COUNT-1 );
    lake_height      = (contents.get_int("no_lakes", (lake_height == 0) )) ? 0 : 8;
    lake_height      = contents.get_int_clamped("lake_height", lake_height, 0, INT_MAX );

The last line looks ok, but why this doesn't work?
Form 0 to INT_MAX is allowed. The value can negativ also in the GUI.

The reason: there are more pass throw the code.
One for the pak specific simuconf.tab and then for the user-specific simuconf.tab.

) ? 0 : 8; set lake_height to 0 or 8 no matter if "no_lakes" is set or not.

QuoteMessage: simu_main():    Parsing /usr/share/simutrans/PAK128.german/config/simuconf.tab
ERROR: set lake_height:    lake_height = 2 values
Message: simu_main():    Parsing /home/martin/.local/share/simutrans/simuconf.tab
ERROR: set lake_height:    lake_height = 8 values

One possible solution is delete the second line with "no_lakes" at all.
Maybe change
clamped("lake_height", lake_height, -2, 127 );
or accordingly climates.cc
clamped("lake_height", lake_height,sets->get_groundwater(), 127 );
Title: Re: Problem setting lake_height via simuconf.tab
Post by: ceeac on May 11, 2026, 06:24:09 PM
I think originally lake_height was meant as "lake height above groundwater" but the actual algoritm now uses lake_height as absolute height. I've changed lake_height back to be groundwater-relative in r11950 for now (so negative values for lake_height will disable lakes).
Title: Re: Problem setting lake_height via simuconf.tab
Post by: makie on May 12, 2026, 08:27:27 AM
R11950 alters the program's behavior especially when the value is set via the GUI. However, the validation logic for this value in `climates.cc` was not updated and still assumes an absolute value. To be considered that all other altitude values in the GUI window are absolute values, rather than being relative to sea level.

However, this change does not resolve the bug described above that prevents the value from being specified properly via `simuconfig.tab`.


(https://makie.de/lakehight.png)
Title: Re: Problem setting lake_height via simuconf.tab
Post by: prissi on May 16, 2026, 12:26:05 PM
I think it is meant as an absolute value.

However, the code in settings was remainder of the old lagic between 120.2 and 122.2 safegames
Check r11593.
Title: Re: Problem setting lake_height via simuconf.tab
Post by: makie on May 16, 2026, 03:52:56 PM
The bug above ist solved. Thank you.
(A tricky solution that I wouldn't have thought of.  8)  )

Configure the goundwater in simuconf.tab ist fine. Thank you.

Here a patch for more landscape settings in simuconf.tab
https://makie.de/landscape_settings.patch (https://makie.de/landscape_settings.patch)
Title: Re: Problem setting lake_height via simuconf.tab
Post by: prissi on May 17, 2026, 02:54:23 AM
Is incorporated in r11959, with the humidity base climates too.
Title: Re: Problem setting lake_height via simuconf.tab
Post by: makie on May 17, 2026, 11:37:01 AM
That looks good. Thank you.  ;D
Title: Re: Problem setting lake_height via simuconf.tab
Post by: makie on May 17, 2026, 05:07:20 PM
A few more little things.
Ok, nothing that affects the function.

In simuconf.tab
Typo in the comment:

# climate hight = min, max --> hight ---> height

Quote# which climate generator preferred (only heights and humidity at the moment)
#climate_generator = humidity;
Is the semicolon at the end really intentional?
Title: Re: Problem setting lake_height via simuconf.tab
Post by: prissi on May 18, 2026, 12:15:18 PM
Thanks, fixed as well.