[Commits] [wesnoth/wesnoth] 571899: add game_board struct to hold map, units, teams

GitHub noreply at github.com
Sun Jun 1 17:42:11 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 5718992f9a6916447aca7b7209eab22009e2a60d
      https://github.com/wesnoth/wesnoth/commit/5718992f9a6916447aca7b7209eab22009e2a60d
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-05-31 (Sat, 31 May 2014)

  Changed paths:
    M src/play_controller.cpp
    M src/play_controller.hpp
    M src/playmp_controller.cpp
    M src/playsingle_controller.cpp
    M src/replay_controller.cpp

  Log Message:
  -----------
  add game_board struct to hold map, units, teams

For now this will just help us to put code in logical places and make
the save and load process simpler. This change is invisible outside
of play_controller.

Please don't backport this to 1.12.


  Commit: 5fa083680edab0a8efd1a2baa00e48854321bf1c
      https://github.com/wesnoth/wesnoth/commit/5fa083680edab0a8efd1a2baa00e48854321bf1c
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-05-31 (Sat, 31 May 2014)

  Changed paths:
    M src/play_controller.cpp
    M src/playsingle_controller.cpp
    M src/replay_controller.cpp

  Log Message:
  -----------
  cleanup for loops made ugly in previous commit

This is a strict refactor.


  Commit: 0e7769a12c460c43ed13756c90ad10f1fd8d6e1e
      https://github.com/wesnoth/wesnoth/commit/0e7769a12c460c43ed13756c90ad10f1fd8d6e1e
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-06-01 (Sun, 01 Jun 2014)

  Changed paths:
    M src/play_controller.cpp
    M src/play_controller.hpp
    M src/playmp_controller.cpp
    M src/playsingle_controller.cpp
    M src/replay_controller.cpp

  Log Message:
  -----------
  move some functionality out of play controller to game_board

This moves some simple code which manipulates the end turn status
of the units on the map.


  Commit: 6fff2e8be26c7c8e60375aed203b45b44f65e378
      https://github.com/wesnoth/wesnoth/commit/6fff2e8be26c7c8e60375aed203b45b44f65e378
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-06-01 (Sun, 01 Jun 2014)

  Changed paths:
    M src/play_controller.cpp
    M src/play_controller.hpp

  Log Message:
  -----------
  move some of the savegame code from play_controller to game_board


  Commit: 471e7ab86543b13cfeb5790241d340b3c6cb453c
      https://github.com/wesnoth/wesnoth/commit/471e7ab86543b13cfeb5790241d340b3c6cb453c
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-06-01 (Sun, 01 Jun 2014)

  Changed paths:
    M src/replay_controller.cpp
    M src/replay_controller.hpp

  Log Message:
  -----------
  replay controller uses game_board to do resets

This is not a strict refactor -- the game map will also be reset
to the starting configuration now, when we reset the replay. It
doesn't look like this was the case in the old version, so it's
possible that if a scenario used [replace_map] or similar, the
replay could go out of sync after hitting the reset button.

Regardless of whether the old version was buggy, the new version
should be just as good if not better, and was tested.


  Commit: 2afe4f4f5af62878837ed94f3b525aed1434037c
      https://github.com/wesnoth/wesnoth/commit/2afe4f4f5af62878837ed94f3b525aed1434037c
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-06-01 (Sun, 01 Jun 2014)

  Changed paths:
    M projectfiles/CodeBlocks-SCons/wesnoth.cbp
    M projectfiles/CodeBlocks/wesnoth.cbp
    M projectfiles/CodeLite/wesnoth.project
    M projectfiles/VC9/wesnoth.vcproj
    M src/CMakeLists.txt
    M src/SConscript
    A src/game_board.cpp
    A src/game_board.hpp
    M src/play_controller.cpp
    M src/play_controller.hpp

  Log Message:
  -----------
  move game_board to its own file, update project files


  Commit: 8b6339af9be0ba12c86f3a2b17c4b93e483b1d66
      https://github.com/wesnoth/wesnoth/commit/8b6339af9be0ba12c86f3a2b17c4b93e483b1d66
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-06-01 (Sun, 01 Jun 2014)

  Changed paths:
    M src/game_preferences.cpp
    M src/game_preferences.hpp
    M src/play_controller.cpp
    M src/team.cpp
    M src/team.hpp

  Log Message:
  -----------
  move code managing preference encounters out of play controller


  Commit: d557ea51657f5a7731f46538d50b545f780a6f52
      https://github.com/wesnoth/wesnoth/commit/d557ea51657f5a7731f46538d50b545f780a6f52
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-06-01 (Sun, 01 Jun 2014)

  Changed paths:
    M src/game_board.hpp
    M src/game_preferences.cpp
    M src/game_preferences.hpp

  Log Message:
  -----------
  add access controls to game_board


  Commit: df74d891d29a07a116e27fd004d7739b33c587b6
      https://github.com/wesnoth/wesnoth/commit/df74d891d29a07a116e27fd004d7739b33c587b6
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-06-01 (Sun, 01 Jun 2014)

  Changed paths:
    M src/actions/create.cpp
    M src/actions/move.cpp
    M src/actions/vision.cpp
    M src/ai/contexts.cpp
    M src/ai/testing/ca.cpp
    M src/game_board.cpp
    M src/game_board.hpp
    M src/game_display.cpp
    M src/menu_events.cpp
    M src/mouse_events.cpp
    M src/pathfind/pathfind.cpp
    M src/play_controller.cpp
    M src/reports.cpp
    M src/resources.cpp
    M src/resources.hpp
    M src/scripting/lua.cpp
    M src/synced_commands.cpp
    M src/unit.cpp
    M src/unit.hpp
    M src/whiteboard/move.cpp
    M src/whiteboard/utility.cpp

  Log Message:
  -----------
  give global fcn's (find/get)_visible_unit a home in game_board

Unit tested and playtested after moving the functions decalarations,
and definitions, adding links to play_controller::game_board from
resources.?pp, and executing find and replace commands:

git grep -lz 'find_visible_unit(' | xargs -0 perl -i'' -pE "s/find_visible_unit\(/resources::gameboard->find_visible_unit\(/g"
git grep -lz 'get_visible_unit(' | xargs -0 perl -i'' -pE "s/get_visible_unit\(/resources::gameboard->get_visible_unit\(/g"


  Commit: 2d2385b9522ca255e117f394fd710bd577edf5da
      https://github.com/wesnoth/wesnoth/commit/2d2385b9522ca255e117f394fd710bd577edf5da
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-06-01 (Sun, 01 Jun 2014)

  Changed paths:
    M src/game_board.hpp
    M src/mouse_events.cpp
    M src/mouse_events.hpp
    M src/play_controller.cpp

  Log Message:
  -----------
  integrate game_board into mouse_handler


  Commit: 096cb97cc17740ffb0c03898ecfaa48e9bbd4dad
      https://github.com/wesnoth/wesnoth/commit/096cb97cc17740ffb0c03898ecfaa48e9bbd4dad
  Author: Chris Beck <beck.ct at gmail.com>
  Date:   2014-06-01 (Sun, 01 Jun 2014)

  Changed paths:
    M projectfiles/CodeBlocks-SCons/wesnoth.cbp
    M projectfiles/CodeBlocks/wesnoth.cbp
    M projectfiles/CodeLite/wesnoth.project
    M projectfiles/VC9/wesnoth.vcproj
    M src/CMakeLists.txt
    M src/SConscript
    M src/actions/create.cpp
    M src/actions/move.cpp
    M src/actions/vision.cpp
    M src/ai/contexts.cpp
    M src/ai/testing/ca.cpp
    A src/game_board.cpp
    A src/game_board.hpp
    M src/game_display.cpp
    M src/game_preferences.cpp
    M src/game_preferences.hpp
    M src/menu_events.cpp
    M src/mouse_events.cpp
    M src/mouse_events.hpp
    M src/pathfind/pathfind.cpp
    M src/play_controller.cpp
    M src/play_controller.hpp
    M src/playmp_controller.cpp
    M src/playsingle_controller.cpp
    M src/replay_controller.cpp
    M src/replay_controller.hpp
    M src/reports.cpp
    M src/resources.cpp
    M src/resources.hpp
    M src/scripting/lua.cpp
    M src/synced_commands.cpp
    M src/team.cpp
    M src/team.hpp
    M src/unit.cpp
    M src/unit.hpp
    M src/whiteboard/move.cpp
    M src/whiteboard/utility.cpp

  Log Message:
  -----------
  Merge pull request #180 from cbeck88/add_game_board_struct_alternate

This is a refactor to introduce an object encapsulating the unit map, the game map, and the list of teams. Introducing this object permits us to move a substantial amount of code out of the play_controller object, and also to give a home to some helper functions in unit.?pp that previously sat in the global namespace. It also allows us to simplify the construction of some of the clients of play_controller.

This refactor is ongoing WIP. The goals are

(1) better organize the architecture of the engine, to make saving and reloading easier.
(2) Facilitate the introduction of an improved pathfinding mechanism, which will need to sit between most of the other engine modules and the unit map / game map.
(3) Refactoring clarifies what the existing code is doing, therefore it may help us to find bugs in the current system, which may be fixed independently of the refactor in 1.12.


Compare: https://github.com/wesnoth/wesnoth/compare/9ddce3185403...096cb97cc177


More information about the Commits mailing list