Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert some vehicle operations to be map aware #79477

Merged
merged 3 commits into from
Feb 3, 2025

Conversation

PatrikLundell
Copy link
Contributor

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 of here->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

@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership Map / Mapgen Overmap, Mapgen, Map extras, Map display Vehicles Vehicles, parts, mechanics & interactions Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Items: Containers Things that hold other things EOC: Effects On Condition Anything concerning Effects On Condition astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Feb 1, 2025
@ashGlaw
Copy link
Contributor

ashGlaw commented Feb 1, 2025

This is leading in an exciting direction!

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 2, 2025
@GuardianDll GuardianDll merged commit 278c26a into CleverRaven:master Feb 3, 2025
27 checks passed
@PatrikLundell PatrikLundell deleted the vehicle branch February 3, 2025 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling EOC: Effects On Condition Anything concerning Effects On Condition Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Items: Containers Things that hold other things json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display Monsters Monsters both friendly and unfriendly. NPC / Factions NPCs, AI, Speech, Factions, Ownership Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants