Enable sandbox mode and keep reducing the map size eventual the game will freeze, on some levels it freezes after the first click
Not surprising, that function really messes with the map in ways that probably aren't compatible with normal play mode.
Exactly. That's also why it's turned off when you exit OpenRCT2. RCT2 was never designed to handle these kinds of things, and you can break your game with it.
However, I do think it should be fixed anyway, though it might take some time, considering the reasons I mentioned
It may have something to do with scenery that would end up partially in the void. Increasing the map size works fine, this only occurs when decreasing map size.
In "Africa - Victoria Falls" (the scenario in OP's screenshot), if you go directly right when you first load the scenario, the tree at the edge is both inside and outside the park, and is also at the map boundary (meaning if you decrease the map size, it would technically be partially in the void.).
It should also be noted that if you open the scenario mentioned above in the original game and use 8cars to own all land (under the Park menu), the crash still happens even though the tree is fully in the park's ownership. This makes me think that it has to do with the scenery object being partially in the map and partially in the void.
A possible fix would be to forcibly delete any large, multiblock scenery objects when resizing the map if they would end up partially in the void (in a similar fashion to what the scenario editor does, as park ownership is ignored there and there is no issue with resizing). Rides and attractions should be taken into account as well (possibly just prohibit the map from being resized down so the attraction can't be partially in the void).
(Apologies for the long comment, I wanted to be thorough.)
Does it crash if you do this in the scenario editor? I remember handling large scenery objects in the map resize function.
Nope, it works just fine in the scenario editor (which was why I recommended making it work like that where it just deletes the object that would be in the void).
OK, its crashing deep within original code... although that is only because 0x0068D6B4 hasn't been reversed yet. Otherwise the functions that its getting stuck in have already been reversed.
The goto statement in sub_68AE2A() in map.c causes an infinite loop
https://github.com/OpenRCT2/OpenRCT2/blob/develop/src/world/map.c#L4189
It seems not to crash when I remove the large objects on the edge of the map first.
I'm currently working on this. Probably this evening I'll have a fix for this issue
Most helpful comment
I'm currently working on this. Probably this evening I'll have a fix for this issue