The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: poppo on September 08, 2026, 02:29:12 AM

Title: BUG: field's height can be changed unlimitedly
Post by: poppo on September 08, 2026, 02:29:12 AM
in tool_setslope_t, we check the height differences from the adjacent tiles. But the tile with field of factory, this check was skipped:
// check, if action is valid ...
const sint16 hgt=new_pos.z;
// maximum difference check with tiles to north, south east and west
const sint8 test_hgt = hgt+(new_slope!=0);

- if(  gr1->get_typ()==grund_t::boden  ) {
+ if(  gr1->get_typ()==grund_t::boden  ||  gr1->get_typ()==grund_t::fundament  ) {
for(  sint16 i = 0 ;  i < 4 ;  i++  ) {
const koord neighbour = k + koord::nesw[i];
grund_t::fundament means there is a building or fields, but in building case, returned early.
Title: Re: BUG: field's height can be changed unlimitedly
Post by: victor_18993 on September 12, 2026, 01:29:21 AM
Thanks, Poppo! Your fix is now integrated in r12276.

I reproduced the issue and added a regression test covering raising and lowering factory fields, including repeated rejected attempts without changes to the terrain or player funds.

The full suite passes locally (311/311); the GitHub CI run is still in progress. Thanks for spotting this and providing the fix!