-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Global getters #41347
Global getters #41347
Conversation
Enables forward declaration
I'm guessing you've only changed the uses of It wouldn't be hard to write a clang-tidy check to automate this refactoring across all uses. Let me know if that would be useful. |
g->m can definitely be automated, do you think you can automate changing g->u to either get_avatar() or get_player_character()? I think it's worth doing either way, I just wanted to do a little test run first. I also think it's simple enough to just do a mass find replace, but I'm sure the clang tidy route will be pretty simple too. A side note, we won't need enforcement since once everything is migrated over m and u and the other affected members will be set to private and the various getters can be made friends of game. |
Yeah, thinking about it, if we don't need ongoing enforcement then it's probably easier to do mass find & replace. I could write something to choose between |
Works for me I need some low brain activity busy work to do while I'm
juggling a couple of kids anyway.
…On Tue, Jun 16, 2020, 10:20 AM John Bytheway ***@***.***> wrote:
Yeah, thinking about it, if we don't need ongoing enforcement then it's
probably easier to do mass find & replace. I *could* write something to
choose between get_avatar and get_player_character correctly, but it
would be tricky. Probably easier to find-and-replace with
get_player_character and then fix the compiler errors. So, I've convinced
myself not to bother.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#41347 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGSA5CCHLK4U5J67RSWBZ3RW6SVZANCNFSM4N7KTF6Q>
.
|
Once you're done with these |
* Make Character::stat into a standalone enum class Enables forward declaration * Remove player centric overload and unecessary include * Remove player.h dependency from trap.cpp * Add singleton-like accessors for avatar, map, weather and event_bus * use accessors to remove includes of game.h
Character::stat into character_stat according to CleverRaven/Cataclysm-DDA#41347. Removed reference to bullet_protec
Summary
SUMMARY: None
Purpose of change
Continuing to address sources of build slowdown as revealed by #41237
Specifically, over-inclusion of game.h due to g->m, g->u, etc.
Describe the solution
Add getters for the various commonly accessed entities and use them.
Testing
Fairly straightforward refactor.
Additional Information
This depends on #41340 because they would conflict otherwise and I'm lazy.