-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Refactor: Remove unnecessary parameter avatar
and map
#76617
Conversation
0fb3456
to
b8ac797
Compare
b8ac797
to
85d795b
Compare
I haven't looked at the changes themselves,only the description, but I have misgivings. Based on the commit texts, most of the removals are from avatar_action, where it should be a reasonable assumption that the target is actually the avatar/PC (if that is to be generalized in the future, the operations should be moved to something with a suitable new name, at which time the character can again be made a parameter). |
It can have nice decoupling effects.
These changes are simple. There is some recursion somewhere, but the change is from passing ref to avatar/map through function parameters to passing ref through get_avatar/get_map in the implementation. It is not likely anything like what you describe can occur. Or can it? Can you source the issue? I would like to learn, sounds interesting.
I agree, the refactoring would be a bit harder. You need to add the parameter back. But from the perspective of the user, it makes more sense to me. If there is an When I encountered the
I am not sure if all are tied to the UI. But they do only allow the avatar at the moment... When changing When changing I did avoid removing a |
The recursion issue I referenced was handled by #74315, which in turn was revealed by #74287 (by fixing a coordinate bug so coordinates weren't treated as always being out of bounds, and then starting to actually find the cache to be dirty in the dirty cache handling call chain, causing the handling to be called recursively). Can't say the solution is pretty, but at least it works to break the recursion. A case of the map not always desired to be the reality bubble map is #75567. I personally think we need to eventually support multiple reality bubbles (that PR only uses another one temporarily), although "eventually" may well be a fair number of years into the future. Another case of desiring/needing to use a different map was #75020 (although that was just a tinymap). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, "it can have nice decoupling effects" is not sufficient justification for all this churn, and "cleaner interface" is definitely not it because the interface just exists and you're obscuring it.
I want to see TANGIBLE benefits for this much code change, and there's been nothing forthcoming, so this is turning into a pretty hard no from me.
85d795b
to
5958791
Compare
resolving merge conflict |
I hear ya. I will look into whether I can split the files into more files so that the |
5958791
to
ce9b7d0
Compare
|
The thing to keep in mind here is that every time you split a file, you re making a new copy of all its headers, so yes huge files are problematic because they led to gigantic code modules, but if the way you fix that is by splitting the file 10 ways so that some of them no longer have some mega header in them, you've actually made things worse. Fundamentally if you have a chunk of code where it dereferences some object, it will always need to include the matching header, there's no way around that, and if it doesn't dereference the object, for example because all it does is forward a pointer or reference to said object, then you already don't need the header, just a forward declaration of the class. |
I no longer believe this is beneficial in its current form and I will not pursue finding how it would become beneficial now. Closing then. |
Summary
Infrastructure "Refactor: Remove unnecessary parameter
avatar
andmap
"Purpose of change
avatar
#76498Describe the solution
Removed all mentions of
avatar
andmap
fromsrc/ranged.h
andsrc/avatar_action.h
. Replaced withget_avatar()
andget_map()
in implementations.Describe alternatives you've considered
Remove more.
Testing
If it compiles, it should be good.
Additional context
.h
#76789