[Commits] [wesnoth/wesnoth] 2ca105: convert attack_type to use shared_from_this instea...

GitHub noreply at github.com
Tue Apr 11 21:15:33 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 2ca105e14647f8622aa697a0dbeffe0cf5199cac
      https://github.com/wesnoth/wesnoth/commit/2ca105e14647f8622aa697a0dbeffe0cf5199cac
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-04-11 (Tue, 11 Apr 2017)

  Changed paths:
    M src/scripting/lua_unit_attacks.cpp
    M src/units/attack_type.cpp
    M src/units/attack_type.hpp
    M src/units/unit.cpp

  Log Message:
  -----------
  convert attack_type to use shared_from_this instead of instrusive_ptrs


  Commit: fcc0da5bd465bce4e9434f528f16bbde001b1088
      https://github.com/wesnoth/wesnoth/commit/fcc0da5bd465bce4e9434f528f16bbde001b1088
  Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
  Date:   2017-04-11 (Tue, 11 Apr 2017)

  Changed paths:
    M src/actions/attack.cpp
    M src/actions/attack.hpp
    M src/ai/default/recruitment.cpp
    M src/formula/callable_objects.cpp
    M src/formula/callable_objects.hpp
    M src/game_events/conditional_wml.cpp
    M src/gui/dialogs/attack_predictions.cpp
    M src/gui/dialogs/unit_attack.cpp
    M src/scripting/game_lua_kernel.cpp
    M src/units/abilities.cpp
    M src/units/animation.cpp
    M src/units/animation.hpp
    M src/units/animation_component.cpp
    M src/units/animation_component.hpp
    M src/units/attack_type.cpp
    M src/units/attack_type.hpp
    M src/units/ptr.hpp
    M src/units/udisplay.cpp
    M src/units/udisplay.hpp

  Log Message:
  -----------
  Some cleanup of attack_type usage for enable_shared_from_this safety
- Call shared_from_this() instead of taking the address
- Don't use raw pointers to attack_type
- Change some cases of attack_type objects that weren't owned by a shared_ptr
  (either owned by another object or allocated directly on the stack)

List of files that currently call attack_type constructors:
- game_events/conditional_wml.cpp
- gui/dialogs/unit_attack.cpp
- scripting/lua_unit_attacks.cpp
- units/types.cpp
- units/unit.cpp

Each of these has been individually considered and made safe for use with
enable_shared_from_this. (Most of them already were safe.)


Compare: https://github.com/wesnoth/wesnoth/compare/2a017b48628b...fcc0da5bd465


More information about the Commits mailing list