Fix zone rotation in faction camp farms #51703
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
Bugfixes "Fix zone rotation in faction camp farms"
Purpose of change
Fixes #51459 - player-defined zones in basecamp farm OMTs get rotated when interacting with the bulletin board.
Describe the solution
Avoid calling
map::generate
on thetinymap
loaded from the farm OMT. Usefake_map
instead and call mapgen directly, usingmapgendata
extracted from the farm OMT.Refactor
fake_map
to make it easier to use (no-arg constructor, hardcoded z-level).Revert the
no_rotate_npcs
workaround from #47730.Describe alternatives you've considered
Implement something similar to
get_changed_ids_from_update()
(mapgen.cpp
) that runs mapgen in afake_map
and returns terrain/furniture data instd::map
format.Refactor mapgen code to not rotate maps, but rather transform the coordinates of the json template before applying modifications to the map. I think bugs of this nature will continue to crop up until this is done.
Testing
Load the save from the bug. Inspect the bulletin board. Open zone manager and check that zones have not moved. Also the follower NPCs are still in the same places.
Build a field base camp with a farm, plow and plant seeds from the camp menu.
Additional context
While testing I discovered that the "type 2" farm for the field base camp is broken (missing the "farming" capability) so I'll fix that in another PR.