[Commits] [wesnoth/wesnoth] 9e7dc5: unit_map, lua, team recall lists use reference cou...

GitHub noreply at github.com
Sun Jun 15 19:04:43 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 9e7dc5ba008298d823c13cff214f7477601b5efd
      https://github.com/wesnoth/wesnoth/commit/9e7dc5ba008298d823c13cff214f7477601b5efd
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-06-15 (Sun, 15 Jun 2014)

  Changed paths:
    M src/actions/create.cpp
    M src/actions/create.hpp
    M src/actions/move.cpp
    M src/actions/undo.cpp
    M src/actions/undo.hpp
    M src/ai/actions.cpp
    M src/ai/composite/engine_lua.cpp
    M src/ai/contexts.cpp
    M src/ai/contexts.hpp
    M src/ai/default/ai.cpp
    M src/ai/default/attack.cpp
    M src/ai/formula/ai.cpp
    M src/ai/lua/core.cpp
    M src/ai/recruitment/recruitment.cpp
    M src/carryover.cpp
    M src/dialogs.cpp
    M src/dialogs.hpp
    M src/game_board.cpp
    M src/game_board.hpp
    M src/game_events/action_wml.cpp
    M src/game_events/conditional_wml.cpp
    M src/game_preferences.cpp
    M src/gamestatus.cpp
    M src/gui/dialogs/gamestate_inspector.cpp
    M src/menu_events.cpp
    M src/mouse_events.cpp
    M src/scripting/lua.cpp
    M src/scripting/lua_api.cpp
    M src/scripting/lua_api.hpp
    M src/side_filter.cpp
    M src/synced_commands.cpp
    M src/team.hpp
    M src/tests/test_unit_map.cpp
    M src/tests/test_whiteboard_side_actions.cpp
    M src/unit.cpp
    M src/unit.hpp
    M src/unit_map.cpp
    M src/unit_map.hpp
    A src/unit_ptr.hpp
    M src/variable.cpp
    M src/whiteboard/action.cpp
    M src/whiteboard/action.hpp
    M src/whiteboard/highlighter.cpp
    M src/whiteboard/highlighter.hpp
    M src/whiteboard/manager.cpp
    M src/whiteboard/mapbuilder.cpp
    M src/whiteboard/move.cpp
    M src/whiteboard/move.hpp
    M src/whiteboard/recall.cpp
    M src/whiteboard/recall.hpp
    M src/whiteboard/recruit.cpp
    M src/whiteboard/recruit.hpp
    M src/whiteboard/side_actions.cpp
    M src/whiteboard/suppose_dead.cpp
    M src/whiteboard/suppose_dead.hpp
    M src/whiteboard/utility.cpp
    M src/whiteboard/utility.hpp

  Log Message:
  -----------
  unit_map, lua, team recall lists use reference counted UnitPtr

Defines a UnitPtr (boost::intrusive_ptr<unit>, after irc
discussion), which the engine will use to pass units between
different modules, and which it is planned that the animation
engine will also hold, to avoid segfaulting.

Unfortunately this commit could not really be made smaller, it is
necessary to change all of these things over at once, or specify
very complicated deletion policies for the units at the
boundaries of the modules.

The main intention of the commit is to get these three modules
using a reference counting system to hold units, even as they
are passed between the modules. Eventually the fake units and
other kinds of units will all also be held in such pointers, and
the unit_map::unit_pod object will be replaced itself with a
single smart pointer.

Finally the animations objects will hold weak pointers to units,
to fix the segfault issues.

This commit required us to change over the whiteboard, most of
the action_wml, and the AI modules, since these make use of the
recall list from the team class.

We also add the unit_ptr.hpp header file, to allow to forward
declare the UnitPtr object essentially, and it's const variation.

If we forward declare the intrusive_ptr functions, we can forward
declare the UnitPtr type and avoid including unit in a bunch of
places that we don't need to. (Good as that is a very heavy
include.)

The declaration is now in unit_ptr.hpp

Since we can't forward declare inheritance, the easiest way to
resolve linker problems is to not derive unit from the
reference_counted_object class and just include the intrusive_ptr
boilerplate as usual instead.


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

  Changed paths:
    M src/about.cpp
    M src/ai/composite/component.cpp
    M src/ai/composite/engine_fai.cpp
    M src/ai/contexts.cpp
    M src/ai/default/ai.cpp
    M src/ai/default/attack.cpp
    M src/ai/default/contexts.cpp
    M src/ai/testing.cpp
    M src/ai/testing/ca.cpp
    M src/ai/testing/ca_testing_move_to_targets.cpp
    M src/ai/testing/ca_testing_recruitment.cpp
    M src/callable_objects.hpp
    M src/carryover.cpp
    M src/construct_dialog.cpp
    M src/display.hpp
    M src/editor/editor_display.cpp
    M src/editor/map/map_context.cpp
    M src/editor/palette/editor_palettes.cpp
    M src/editor/palette/terrain_palettes.cpp
    M src/editor/palette/unit_palette.hpp
    M src/game_display.hpp
    M src/gui/dialogs/gamestate_inspector.cpp
    M src/leader_scroll_dialog.cpp
    M src/side_filter.cpp
    M src/team.hpp
    M src/terrain_filter.cpp

  Log Message:
  -----------
  remove unit.hpp include from team.hpp


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

  Changed paths:
    M src/about.cpp
    M src/actions/create.cpp
    M src/actions/create.hpp
    M src/actions/move.cpp
    M src/actions/undo.cpp
    M src/actions/undo.hpp
    M src/ai/actions.cpp
    M src/ai/composite/component.cpp
    M src/ai/composite/engine_fai.cpp
    M src/ai/composite/engine_lua.cpp
    M src/ai/contexts.cpp
    M src/ai/contexts.hpp
    M src/ai/default/ai.cpp
    M src/ai/default/attack.cpp
    M src/ai/default/contexts.cpp
    M src/ai/formula/ai.cpp
    M src/ai/lua/core.cpp
    M src/ai/recruitment/recruitment.cpp
    M src/ai/testing.cpp
    M src/ai/testing/ca.cpp
    M src/ai/testing/ca_testing_move_to_targets.cpp
    M src/ai/testing/ca_testing_recruitment.cpp
    M src/callable_objects.hpp
    M src/carryover.cpp
    M src/construct_dialog.cpp
    M src/dialogs.cpp
    M src/dialogs.hpp
    M src/display.hpp
    M src/editor/editor_display.cpp
    M src/editor/map/map_context.cpp
    M src/editor/palette/editor_palettes.cpp
    M src/editor/palette/terrain_palettes.cpp
    M src/editor/palette/unit_palette.hpp
    M src/game_board.cpp
    M src/game_board.hpp
    M src/game_display.hpp
    M src/game_events/action_wml.cpp
    M src/game_events/conditional_wml.cpp
    M src/game_preferences.cpp
    M src/gamestatus.cpp
    M src/gui/dialogs/gamestate_inspector.cpp
    M src/leader_scroll_dialog.cpp
    M src/menu_events.cpp
    M src/mouse_events.cpp
    M src/scripting/lua.cpp
    M src/scripting/lua_api.cpp
    M src/scripting/lua_api.hpp
    M src/side_filter.cpp
    M src/synced_commands.cpp
    M src/team.hpp
    M src/terrain_filter.cpp
    M src/tests/test_unit_map.cpp
    M src/tests/test_whiteboard_side_actions.cpp
    M src/unit.cpp
    M src/unit.hpp
    M src/unit_map.cpp
    M src/unit_map.hpp
    A src/unit_ptr.hpp
    M src/variable.cpp
    M src/whiteboard/action.cpp
    M src/whiteboard/action.hpp
    M src/whiteboard/highlighter.cpp
    M src/whiteboard/highlighter.hpp
    M src/whiteboard/manager.cpp
    M src/whiteboard/mapbuilder.cpp
    M src/whiteboard/move.cpp
    M src/whiteboard/move.hpp
    M src/whiteboard/recall.cpp
    M src/whiteboard/recall.hpp
    M src/whiteboard/recruit.cpp
    M src/whiteboard/recruit.hpp
    M src/whiteboard/side_actions.cpp
    M src/whiteboard/suppose_dead.cpp
    M src/whiteboard/suppose_dead.hpp
    M src/whiteboard/utility.cpp
    M src/whiteboard/utility.hpp

  Log Message:
  -----------
  Merge branch 'reference_count_units'


Compare: https://github.com/wesnoth/wesnoth/compare/ded53dd3322b...35180b82d1ae


More information about the Commits mailing list