src/debug_menu.cpp
: split functions from void debug()
#73428
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
#73400 failed because
void debug()
is too long (among other things)https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/8889143243/job/24407971501?pr=73400#step:9:938
Make the
void debug()
considerably shorter so the next person does not have to deal with this when they are nice enough to add something to the debug menu.Describe the solution
Made a simple Python function
and ran it on the huge switch in the debug menu. It shows the biggest case statements (by line count), output:
Then I made these
case
s intostatic void
functions starting at the bottom of this list and making my way up. It is a straightforward task, the only changes are fixing aliases:player_character
forget_avatar()
, andhere
forget_map()
andreturn
in one case.This PR is refactoring, except for
debug_menu_index::GEN_SOUND
, which doesn'treturn
from thevoid debug()
function, so it runshere.invalidate_map_cache( here.get_abs_sub().z() );
on last line.Describe alternatives you've considered
Do more or less. Ask, whether this is a correct solution before doing it.
Testing
Additional context