In the case of as_nonempty_range, the function was rewritten to remove absolute reliance on gamedata.
In the other case, we simply silently return now.
This commit still doesn't fix all of them. I decided to leave alone
cases where variables with the same name are assigned in multiple
conditions of the same if...else if...else statement, and cases where a
scope logging macro is used multiple times in the same scope. In any
case, this commit greatly reduces the warning count on MSVC2015 and makes
new warnings much easier to spot.
- config::attribute_count() now excludes blank (ie, unset) attributes
Blank attributes in the map are generally a result of the mutating
behaviour of operator[], so they're not "logically" existing attributes.
- Non-const versions of attribute iterator and all-children iterator
- Attribute iterators are now bi-directional
- vconfig all-children iterator is now a bi-directional Boost iterator range
- vconfig now has a bidirectional attribute iterator
This constitutes drop-in replacements for:
* boost::shared_ptr
* boost::scoped_ptr
* boost::weak_ptr
* boost::enable_shared_from_this
* boost::static_pointer_cast
* boost::dynamic_pointer_cast
This excludes boost::intrusive_ptr, except for stray includes. Refactoring that is more complicated.
a default constructed vconfig was previously unable to be derefereced,
Now it can be dereferenced.
The previous behaviour led to segfaults on wrong parameters to
[replace_map].
we now use const correctness to ensure that we sont change teh game
config if we just want to read values.
Also we use a new algorithm that is a little slower when parsing small
variablenames and much faster when parsing long variablenames.
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.
This is the result of running this command in directory src/
find . -type f -exec sed -i 's/\(ERR.*\)\\n\"\;/\1\" << std::endl\;/g' '{}' \;
and carefully inspecting the results.
The old management had potential, but in practice it was rarely in
a position to show off. It ended up doing little more than reference
counting; a shared_ptr can do this with less overhead.