[wesnoth-commits] [wesnoth/wesnoth] efd790: Convert help_impl's ref-counting to std::shared_ptr

Sergey Popov noreply at github.com
Wed Jul 31 12:37:18 UTC 2019


  Branch: refs/heads/1.14
  Home:   https://github.com/wesnoth/wesnoth
  Commit: efd790569d15a82f775cb6e0f02c6ab9ebcfad74
      https://github.com/wesnoth/wesnoth/commit/efd790569d15a82f775cb6e0f02c6ab9ebcfad74
  Author: Steve Cotton <steve at octalot.co.uk>
  Date:   2019-07-31 (Wed, 31 Jul 2019)

  Changed paths:
    M src/help/help_impl.cpp
    M src/help/help_impl.hpp

  Log Message:
  -----------
  Convert help_impl's ref-counting to std::shared_ptr

This is part of #4166, as topic_text wasn't consistent with
the Rule of Three.

(cherry picked from commit 469fcc9c5279635dcd4565b51e6927480fb6ebc0)


  Commit: aa9ff15a0f28229ce6041ef86e02edb6c52ec990
      https://github.com/wesnoth/wesnoth/commit/aa9ff15a0f28229ce6041ef86e02edb6c52ec990
  Author: Steve Cotton <steve at octalot.co.uk>
  Date:   2019-07-31 (Wed, 31 Jul 2019)

  Changed paths:
    A data/test/maps/test_movetype.map
    A data/test/scenarios/test_movetype.cfg
    M wml_test_schedule

  Log Message:
  -----------
  Add unit tests for movement and vision costs

Includes tests for changing the terrain costs, and aliased terrains,

(cherry picked from commit 358f564301273f32338a00508f5121063ae800b1)


  Commit: fcd0ceda37793f79ec59e76a2f621fb07af64c5b
      https://github.com/wesnoth/wesnoth/commit/fcd0ceda37793f79ec59e76a2f621fb07af64c5b
  Author: Steve Cotton <steve at octalot.co.uk>
  Date:   2019-07-31 (Wed, 31 Jul 2019)

  Changed paths:
    M src/actions/vision.cpp
    M src/actions/vision.hpp
    M src/movetype.cpp
    M src/movetype.hpp
    M src/units/types.cpp
    M src/units/unit.cpp

  Log Message:
  -----------
  Refactoring movetype and terrain_costs (#2486)

Simplify the public interface for movement, vision and jamming costs to only
the movetype class and a read-only interface called "terrain_costs".  Changes
to terrain_costs now need to be done through the movetype instance, so logic
about how movement, vision and jamming interact with each other can be handled
in movetype.  This fixes a possible dangling-pointer issue: the default
copy/move implementation in movetype::terrain_info would have copied raw
pointers, without ensuring that those pointers remained valid.

This feels too complex, but also feels like time to merge it and do any further
cleanup as a separate commit.  For example, there's only one place that calls
make_data_unique, and one place that calls make_data_shareable. Merging the
functions should make it clearer.

The terrain_info class is now a private class implementing the terrain_costs
interface, previously it was a public class with raw pointers to other
instances of itself, and a copy constructor which copied the raw-pointers
as-is. One of the raw pointers is still there, but it's only non-null when both
instances involved are owned by one instance of movetype.

Cherry-picked from 86f430c2ddf6412726989e4ff4a705fe46c19e30


  Commit: 4139b43cc900b72756f07267dbb887c469d6f4c2
      https://github.com/wesnoth/wesnoth/commit/4139b43cc900b72756f07267dbb887c469d6f4c2
  Author: loonycyborg <loonycyborg at gmail.com>
  Date:   2019-07-31 (Wed, 31 Jul 2019)

  Changed paths:
    M src/game_classification.cpp
    M src/game_classification.hpp
    M src/picture.cpp
    M src/picture.hpp
    M src/widgets/widget.cpp
    M src/widgets/widget.hpp

  Log Message:
  -----------
  Fix -Wdeprecated-copy compiler warnings with gcc 9

(partial cherry pick from commit 05d109215d71e692d2bdcd1420f8bbe065788fb8)


Compare: https://github.com/wesnoth/wesnoth/compare/98f3cf13ff9a...4139b43cc900



More information about the Commits mailing list