made some map operations consistent #79423
Closed
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
Make methods of the map class consistently work on the object map rather than the official reality bubble map.
This is the first PR of a series of unknown length, as there's quite a lot to check and modify.
Describe the solution
Examine methods to see what operations they call, and whether these operations implicitly use the game reality bubble map (i.e. get_map() or g->m) rather than the own map object. Note that this check is transitive.
If an operation implicitly uses the wrong map, pass the map object to a an overloading version of the operation to make it possible to use the correct map, and adjust the overloading operation accordingly. Typically have the original operation call the new one, passing &get_map() as the map parameter.
Introduced Character::pos_bub(map *here) to make it easier to get the bubble coordinates you actually want and replace "here->get_bub(pos_abs())" with the shorter "pos_bub(here)".
Describe alternatives you've considered
Testing
This should not result in any functional changes to the existing functionality. Failing to catch all implicit usages of the official reality bubble map will, unfortunately, not result in visible bugs until the code is used with other maps.
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. The only oddity seen was that the zombie corpse wasn't destroyed this time (but some items were). Backed over it and the corpse was destroyed. This is attributed to normal variability.
Additional context
Why am I doing this?
Madness can't be ruled out, but the longer term objective (not coordinated with senior devs, but not known to be in conflict either) is to allow for usage of other maps during game play without having to go through this upgrade at the same time as trying to produce new functionality. The first usage of additional maps (outside mapgen) was for explosion purposes, and trying to get that to work properly highlighted the underlying issue of the code simply not being consistent when it comes to the usage of map objects.
At some time it would be desirable to be able to keep multiple reality bubbles in play in order to allow activities to proceed normally e.g. in a camp while the PC is away. That's probably a fair way off due to performance issues, but it is still useful trying to make the foundation a bit sounder.