Clean up overmap drawing code and consolidate to one function #74700
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
Infrastructure "clean up overmap drawing code and consolidate to one function"
Purpose of change
There are four separate places that take information from the overmap and draw colored symbols to represent it. This creates a maintenance burden and makes it so that changing how this is done requires writing the same code in each of these four places.
These four places are:
Describe the solution
Remove the unused game::draw_minimap, and replace the code in the three remaining places that finds the symbol and color to draw for each tile with a call to a common function, oter_symbol_and_color.
Because the different ways to draw the overmap have a wide variety of options, this function takes two structs as arguments.
The first struct,
oter_display_options
, holds the settings for drawing that do not change from tile to tile.It controls
It also provides information on where the PC is, where their mission target is, and some zone and path info used by the overmap screen. If positions and colors of NPCs are provided, they will be drawn on the map as well.
The second struct provides information that changes between tiles
It can also take a pointer to a structure which serves as a LRU cache - this was already existing in the map screen version of the draw code.
Testing