Closed crudelios closed 11 months ago
Interesting one. What do you suggest to do to fix the issue without breaking compatibility? Or should we leave it as-is for Julius since it fixes itself in the end?
A simple check for the building state when the homeless arrives should prevent the issue in the future. If it's not a house or it's not BUILDING_STATE_IN_USE
when the homeless arrives, simply kill him.
Here's the relevant changed I used to fix the issue in Augustus:
@bvschaik Do you want me to fix this issue?
This was unexpected. The change is failing the tests!
I'll have to revert them.
Given that the fix changes the save results, I'm thinking we simply don't fix it.
I was afraid it would. I agree with not fixing this.
https://github.com/bvschaik/julius/blob/bae63eb689737a720445f614ead61f41f86cbb9e/src/figuretype/migrant.c#L282
Buckle up because the above line causes rare corruptions.
So, as you may notice above, the code for a homeless entering a house does not check for the house state, only if the building type is a house.
On some rare occasions (it requires a very specific set of circumstances that I'll describe below) that will cause corruptions.
The requirements are:
building_update_state
is calledIf all the conditions are met, the homeless will enter a house with the state of
BUILDING_STATE_DELETED_BY_GAME
.However, upon entering, the map building tiles will be updated to point to the zombie building id.
Also, when
building_update_state
is called, the building will finally be deleted and the tile will point to a non existent building.This will obviously corrupt the city, but only briefly: if the 2x2 evolves the tile reference will be updated again so the issue should fix itself.
Anyway, it's a pretty interesting and rare bug.
This is causing crashes in Augustus however, due to the different way memory is handled there.