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 27-nov-2022 #2208

Merged
merged 32 commits into from
Dec 16, 2022

Conversation

olanti-p
Copy link
Contributor

@olanti-p olanti-p commented Nov 27, 2022

Summary

SUMMARY: Infrastructure "Reorganized some Character-related code"

Purpose of change

Dismantling player.

Describe the solution

See commits.

  1. Move some functions and members out of player into Character
  2. Move some functions out of player and turn them into namespaced functions
  3. Break up character_functions.cpp as it keeps growing
  4. Create character_turn.h/.cpp for various process-on-each-turn functions
  5. Rename some moved functions
  6. Opportunistically refactor questionable spots
  7. Fix some bugs caused by wrong usage of passed item vs wielded item, or passed position vs character position
  8. Get rid of bionic indexing

Testing

Game compiles. No behavior changes intended.

TODO:

  • Playtest bionics ui
  • Fix clang-tidy warnings

Additional context

That's a lot of line changes, may cause lot of merge conflicts. Should I break it up?

@github-actions github-actions bot added src changes related to source code. tests changes related to tests labels Nov 27, 2022
@olanti-p olanti-p changed the title [WiP] Character code reorganization 27-nov-2022 Character code reorganization 27-nov-2022 Nov 28, 2022
@Coolthulhu Coolthulhu self-assigned this Dec 11, 2022
@Coolthulhu Coolthulhu merged commit cc23abc into cataclysmbnteam:upload Dec 16, 2022
@Coolthulhu
Copy link
Member

Much cleaner now!

That can_sleep thing reminded me we don't have a standard for "rng checking" functions.
roll_* is fine, but it feels a bit weird, like with bool getters named like get_male(). Feels like there could be a better prefix, like is_* is for bool getters.
Or maybe it's just an artifact of the old sleep check being written as one "check and maybe do" monolith instead of

if( roll() >= difficulty ) {
  do();
}

I'm pretty sure we do have some of the get_* bool getters. I'll try to rename them when change anything about them.

@olanti-p olanti-p deleted the code-reorg-27-nov-2022 branch December 17, 2022 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code. tests changes related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants