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

Character code reorganization 23-jul-2022 #1752

Merged
merged 20 commits into from
Aug 4, 2022

Conversation

olanti-p
Copy link
Contributor

Summary

SUMMARY: Infrastructure "Reorganized some Character-related code"

Purpose of change

Move some code around for the following immediate and long-term goals:

  1. Localize code related to character creation into newcharacter.h/newcharacter.cpp
  2. Make Character family methods into namespaced functions
  3. Extract rarely-used definitions from common headers into dedicated headers
  4. Slim down player class for its eventual removal
  5. Change some functions to accept Character instead of player
  6. Outline headers and source files for Character/map methods-turned-functions:
    • character_effects.h - functions for calculating impact on Character's stats/speed/etc.
    • character_display.h - Character display functions
    • character_encumbrance.h - Character encumbrance functions
    • character_stat.h - Character stat enum (and relevant functions in the future)
    • character_functions.h - miscellaneous Character functions
    • consumption.h - Character consumption functions (rename to character_consumption.h?)
    • map_functions.h - miscellaneous map functions
  7. Rename player_display.cpp to character_display.cpp to match

Describe the solution

Copy-paste sprinkled with some boilerplate.

Describe alternatives you've considered

map_functions.h and character_functions.h are horrible names, but I don't have any better.
Also, not sure whether I'm being overzealous with putting them in a separate header instead of settling on a namespace in map.h/character.h.
It'd be great to have a dedicated .cpp for every .h added here, but those would negatively impact compilation times due to how much inclusions even the most common headers like character.h, item.h, map.h, etc. pull in.

Testing

Game compiles locally, old saves load. Should have no behavior changes.

Additional context

May be easier to review on a per-commit basis.

@Coolthulhu Coolthulhu self-assigned this Aug 3, 2022
@Coolthulhu Coolthulhu merged commit d4b1509 into cataclysmbnteam:upload Aug 4, 2022
@olanti-p olanti-p deleted the declutter-player branch August 4, 2022 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants