Fix unfolded vehicles not driveable before stepping off/on #59429
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Bugfixes "Fix unfolded vehicles not driveable before stepping off/on the tile"
Purpose of change
Fixes #54026
Describe the solution
Both
unfold
s (the new generic vehicle and the old convertible one) were skipping over map::board_vehicle so player'sin_vehicle
= false prevented driving when pressing^
before stepping out of/into the controls tile.Also one was missing adding vehicle to cache and the other had a weird nullcheck after already dereferencing so I rearranged the calls a bit to make them cohesive and more or less the same.
Had to go on a hunt into tests why it was complaining about unboarding;
vehicle hp with degradation
tests read a bit weird, can't see where they clean up the created vehicles, may be I missed it somewhere, but unboarding at end of check is enough to pass tests.Also changed debugmsg when boarding to make it clear what was missing ( in one case it was a non-broken boardable part )
Describe alternatives you've considered
Testing
Spawn folding bicycle, unfold, press
^
- just the controls screen pops up (this is the convertible unfold)Spawn wheelchair do the same (this is using generic unfold)
Apply patch
Do the above again and you should be able to drive immediately after unfolding
Additional context