News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

Fix for crash when there is no climate available for a height

Started by ceeac, July 04, 2020, 01:30:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ceeac

This patch fixes a crash which occurs when generating a map with the attached map parameters.

prissi

This should never happen, since just before all tie with single or no climates are handled. Moreover, climate from height arrz is set to emperate, if there is no climate at all. I will investigate further.

kierongreen


prissi

Yes, but this is fixing symptoms, the real error happened elsewhere before.

Dwachs

I committed this fix (with small change) in r9164. Symptons are cured...
Parsley, sage, rosemary, and maggikraut.

prissi


kierongreen

I'm still getting issues here - when you increase the water level in the landscape settings window the climate setting heights aren't updated correctly. As a result out of bounds array accesses were occurring which didn't generate an exception immediately but corrupted zeiger and viewport pointers causing issues later. This patch handles this window more robustly to ensure that negative values aren't passed as an array offset, and also addresses what I think is an issue relating to an incorrect height - on one comparison the difference from groundwater was used rather than the absolute height value. Should be ok to commit just putting it here first to check people are happy with it - if I don't hear any negatives will commit tomorrow.

prissi

Changing the groundwater height should lead to all bad effects also with existing maps, since the lookup of climates by height after a change of groundwater level without recalculating the table will lead to wrong offsets anyway. Changing climates was never a good idea after starting a game

kierongreen

Quote from: prissi on July 14, 2020, 02:51:19 PM
Changing the groundwater height should lead to all bad effects also with existing maps, since the lookup of climates by height after a change of groundwater level without recalculating the table will lead to wrong offsets anyway. Changing climates was never a good idea after starting a game
To be clear the errors I was getting was when creating a new map with a different groundwater height from that previously used in settings. The climate window appeared to update climate boundaries but didn't actually apply these values to settings, hence when the new map creation began some climates had negative offsets relative to groundwater, which then caused an out of bounds memory write. The patch forces changes to the values in the GUI to be written to settings.

prissi

Ahh, thanks, I misunderstood. Still you report got me think about the above issue as well.