[wesnoth-commits] [wesnoth/wesnoth] a4b749: Cleaned up ridiculously excessive passing around o...

Charles Dang noreply at github.com
Sat Jan 2 06:06:56 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: a4b749524b37ab03bdac33be41a8d39d033e2d88
      https://github.com/wesnoth/wesnoth/commit/a4b749524b37ab03bdac33be41a8d39d033e2d88
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M src/game_board.cpp
    M src/game_board.hpp
    M src/game_config_manager.hpp
    M src/game_initialization/multiplayer.cpp
    M src/game_initialization/playcampaign.cpp
    M src/game_initialization/playcampaign.hpp
    M src/game_launcher.cpp
    M src/game_state.cpp
    M src/game_state.hpp
    M src/gui/widgets/unit_preview_pane.cpp
    M src/help/help_impl.cpp
    M src/help/help_impl.hpp
    M src/help/help_topic_generators.cpp
    M src/map/map.cpp
    M src/map/map.hpp
    M src/movetype.cpp
    M src/play_controller.cpp
    M src/play_controller.hpp
    M src/playmp_controller.cpp
    M src/playmp_controller.hpp
    M src/playsingle_controller.cpp
    M src/playsingle_controller.hpp
    M src/terrain/type_data.hpp

  Log Message:
  -----------
  Cleaned up ridiculously excessive passing around of terrain data cache

Keep in mind ter_data_cache is simply a shared_ptr, and in all call locations it was grabbed from game_config_manager::terrain_types().

1. campaign_controller took and kept a member, which was passed to either...
2. playsingle_controller or playmp_controller, which passed it to their parent class...
3. play_controller, which kept a member to initialize...
4. game_state, which passed it on to...
5. game_board, which passed it on to...
6. gamemap, where it was *finally* actually needed.

This entire chain has been replaced with a single call to game_config_manager::terrain_types() in the game_board constructor.
gamemap retains its ctor parameter since editor_map passes in its own object.

The ter_data_cache alias has also been removed. It was just confusing.


  Commit: 4338b266e0bf5ec28b5c157a0003e67bddb6e6d0
      https://github.com/wesnoth/wesnoth/commit/4338b266e0bf5ec28b5c157a0003e67bddb6e6d0
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M src/units/types.hpp

  Log Message:
  -----------
  Fixup 3dba789 (assignment should return a reference)


Compare: https://github.com/wesnoth/wesnoth/compare/bd8b5be3fe9e...4338b266e0bf



More information about the Commits mailing list