Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
57 changed files
with
496 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.