Convert some vehicle operations to be map aware #79477
Merged
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
None
Purpose of change
Convert operations to be aware of which map they act on, rather than just assume it's the reality bubble one.
This PR starts with a few vehicle related operations which are converted to take a map parameter together with a relative position on that map. Usages are converted (frequently by fetching the reality bubble map at the top of their operations to signal that this is the assumed map (for further conversion at a later stage).
The process involves digging through the operations called from the now map aware operations to make those operations map aware as well, frequently by introducing an overload of the original operation that, again, is assumed to use the reality bubble map. This is done transitively until everything downstream has been converted.
The transitive conversion effort makes the flawed assumption that map methods actually work on the object itself rather than sometimes and spottily at the reality bubble. Handling of that is left for later PRs.
It should be noted that no functional changes should happen when the map operated on is the reality bubble, while operations on the correct map might affect mapgen and explosions (the two cases of usages of other maps). It's unlikely the operations modified this time are used in those contexts, though.
Describe the solution
Mostly described in the previous section.
A few bub coordinate using operations in vehicle.h were converted.
In addition to that, a new
pos_bub (map* here)
operation was introduced for creatures for convenience and usages ofhere->get_bub(critter.pos_abs())
were converted to use this shorter but equivalent pattern instead.Describe alternatives you've considered
Testing
Load save, walk up ramp, jump into car, drive through hay bales, run over zombie corpse with inventory, run over turkey, smash into stationary vehicle. Nothing odd seen. Not a great test, though, as little to nothing of the changed code would be executed by it.
Additional context