[Commits] [wesnoth/wesnoth] 4ae086: make unit_map::unit_map and unit_map::t_umap publi...

GitHub noreply at github.com
Mon Mar 3 23:10:32 UTC 2014


  Branch: refs/heads/refactor_fake_units
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 4ae08670ab46f252750e15a20354d15de767257e
      https://github.com/wesnoth/wesnoth/commit/4ae08670ab46f252750e15a20354d15de767257e
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-03-03 (Mon, 03 Mar 2014)

  Changed paths:
    M src/unit_map.hpp

  Log Message:
  -----------
  make unit_map::unit_map and unit_map::t_umap public types


  Commit: 71a2016924ca7771a41adfad734b9736c7eb2018
      https://github.com/wesnoth/wesnoth/commit/71a2016924ca7771a41adfad734b9736c7eb2018
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-03-03 (Mon, 03 Mar 2014)

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

  Log Message:
  -----------
  refactor game_display.fake_units_, a t_umap instead of a deque

this refactor is a first step to help with solving the double-kill bug,
as it reduces balkanization in the codebase. currently "real" units are
stored in and owned by the unit_map, and "fake" units are owned by the
game_display object. because units are large and balky, code that
needs to run fast e.g. the animation code, needs to work with pointers
rather than storing local copies.

currently we pass naked pointers to the animation code from either the
game_display or the unit_map, but this is unsafe, and can and does lead
to segfaults.

we can and should be passing some kind of smart pointer. there are
several options for what the unit_animation should be holding on to:

1) a pointer to a unit_pod
2) a unit_map::iterator
3) change unit map to hold shared_ptr's instead of unit_pods, and
make the animations hold either a shared_ptr or a weak_ptr
(debateable)

no matter what solution we end up with, this refactor is a sensible
first step, as now we wont have a separate code path for fake units
and real units in the animation code.


  Commit: 1a4ec53e9a2c968a14e228094089ecb9b9906e1d
      https://github.com/wesnoth/wesnoth/commit/1a4ec53e9a2c968a14e228094089ecb9b9906e1d
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-03-03 (Mon, 03 Mar 2014)

  Changed paths:
    M changelog

  Log Message:
  -----------
  update changelog


Compare: https://github.com/wesnoth/wesnoth/compare/4ae08670ab46^...1a4ec53e9a2c


More information about the Commits mailing list