Skip to content

Fix #3503: Crash when placing docks/airports with no track objects loaded#3511

Merged
duncanspumpkin merged 5 commits intoOpenLoco:masterfrom
duncanspumpkin:fix3503
Dec 9, 2025
Merged

Fix #3503: Crash when placing docks/airports with no track objects loaded#3511
duncanspumpkin merged 5 commits intoOpenLoco:masterfrom
duncanspumpkin:fix3503

Conversation

@duncanspumpkin
Copy link
Copy Markdown
Contributor

@duncanspumpkin duncanspumpkin commented Dec 5, 2025

The game currently assumes that track object slot zero is always valid.
Fix #3503

@AaronVanGeffen AaronVanGeffen added this to the v25.11+ milestone Dec 5, 2025
Co-authored-by: Aaron van Geffen <aaron@aaronweb.net>
@duncanspumpkin
Copy link
Copy Markdown
Contributor Author

I've been testing this now that I have the missing object and it turned out there were further issues with the scenario. I've addressed them as well. @AaronVanGeffen suggest you look again.

setTrainModFlags(train, *roadObj);
}
else
else if (mode == TransportMode::rail)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was showing up as a crash on the title screen after the span changes. Turned out airplanes can reach this bit of code

Widget::drawTab(self, drawingCtx, imageId, widx::tab_station);
}
else
else if (cState.byte_1136063 & (1 << 6))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of the following changes are adjusting indentation. Suggest turning off whitespace chagnes.

@duncanspumpkin duncanspumpkin changed the title Fix 3503: Crash when placing docks/airports with no track objects loaded Fix #3503: Crash when placing docks/airports with no track objects loaded Dec 8, 2025
Copy link
Copy Markdown
Member

@AaronVanGeffen AaronVanGeffen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a nice little cleanup!

@duncanspumpkin duncanspumpkin merged commit 478590b into OpenLoco:master Dec 9, 2025
13 checks passed
@duncanspumpkin duncanspumpkin deleted the fix3503 branch December 9, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when trying to build dock in custom scenario

2 participants