Vultraz

Untitled

Mar 20th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. so I was trying to solve the "changing display.hpp rebuilds All The Things" problem
  2. turns out the include tree is a mess...
  3. display is the parent of game_display and editor_display, so display.hpp is included in both of their headers.
  4. Now, game_display.hpp is included in mouse_events.hpp to implement a covariant overload of mouse_handler's base, mouse_handler_base.
  5. (mouse_handler is in mouse_events.hpp, FTR)
  6. Now
  7. play_controller.hpp then includes mouse_events.hpp, since it has a mouse_handler member.
  8. play_controller inherits from controller_base.
  9. controller_base is also the base of editor_controller.
  10. so the game and editor each have their own display classes (game_display and editor_display) and controller classes (play_controller and editor_controller), and each type has a base class (displayandcontroller_base`, respectively).
  11. editor_controller.hpp includes editor_display.hpp. That makes sense.
  12. But notice that play_controller.hpp didn't include game_display.hpp.
  13. March 12, 2018
  14. Vultraz - 03/12/2018
  15. Instead, it included it via the mouse_events.hpp included
  16. Since again, mouse_handler needs to implement a covariant override of a function it its own base.
  17. Here's where it gets interesting
  18. While play_controller has a mouse_handler member, editor_controller inherits from mouse_handler_base - which, again, is the base of mouse_handler.
  19. Both mouse_handler_base and controller_base declare pure virtual display reference getters.
  20. So editor_controller ends up overriding both!
  21. and the only reason play_controller doesn't do the same and only overrides the one from controller_base is that that class, for some reason, does NOT inherit from mouse_handler_base. It is instead its mouse_handler member that overrides that virtual getter
  22. Mess mess mess
  23. And the reason changing display.hpp means rebuilding so much is the direct include chain of
  24. display.hpp -> game_display.hpp -> mouse_events.hpp -> play_controller.hpp,
  25.  
  26. the last of which is included in replay_controller.hpp, hotkey_handler.hpp, and playsingle_controller.hpp. Not to mention there's playmp_controller.hpp which includes playsingle_controller.hpp.
  27.  
  28. :neutral_face:(edited)
  29. oh, and this is not counting for play_controller::hotkey_handler, which I can't find the declaration of, which on its own inherits from hotkey::command_executor_default, which has ANOTHER GODDAMN DISPLAY GETTER
  30. and is implemented by retuning a play_controller member's own override from controller_base
  31. (╯°□°)╯︵ ┻━┻
Advertisement
Add Comment
Please, Sign In to add comment