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.
Remove duplicate storing, which was clearing the already stored
unit from the gamestate variables again. Silene forgot to delete
the line in 2010-08-06T17:31:14Z!guillaume.melquiond@gmail.com.
The problem was when the cleared index was 0 the entire array was
cleared. The fix was to correctly set explicit_index_ to true even
when the index is 0.
If the variable index is absent it now defaults to 0.
This fixes bug #18728. It might also fix all FOREACH and lua while
loops as Gambit described but I need to double check.
Some compilers are calling destructors for static objects before other
static objects use them in their destructors. This patch initializes
static t_interned objects with new and intentionally doesn't call
delete in order to guarrantee their existence throughout the static
de-initialization phase. It creates a new function
generate_safe_static_const_t_interned for this purpose. It might
address bug #18666, although I can not duplicate the crash with gcc on
fedora 15.
...of config::attribute_value & to tstring & or t_token reference
causes crashes. Some compilers were generating a temporary object and
binding a reference to the temporary when creating an implicit cast to
an attribute value. I removed the implicit cast and replaced all (I
think) instances of the implicit cast with explicit 2 step operation.
This fixes bugs like bug #18663, bug #18684
thonsew: You are sure it's a gooc idea to throw such a lot from here ?
Since that line is clearly not the only one which gets
skipped. WRN_NGs are emitted to the console in any case, even in
normal play without debug mode or log domains set.
1. Fixed some Mandatory WML child missing errors due to parsing errors
when new t_token parsing was added to variable_info.
2. Upgraded all WML errors to console errors to increase their visibility.
Changed assertion to a wml_syntax_exception that provides an error to
user informing them of invalid wml syntax and then continues with the
variable marked as invalid.