The variadic form now uses a variadic template, and a vector form has been added.
Since the nullptr sentinel argument is no longer required, it has been removed from all calls.
This commit removes the utility srt_cast() function and replaces its calls,
along with calls to lexical_cast<std::string>() (and its boost variant),
with std::to_string().
In a few cases where the input type isn't compatible with to_string,
lexical_cast<std::string> is still used.
In other cases where lexical_cast was operating on MAKE_ENUM enums, the
call has been replaced with ENUM::enum_to_string, which is faster.
This attempts to implement http://gna.org/bugs/?22635 and also allows
users to implement a 'queries a location from the user' (as suggested
from the easycosing page) in lua.
Several header files used the .tpp extension, which means that they are not correctly detected as C++ (though this can be overridden and has been for one case in the XCode project). The .tpp extension is one of several intended for private template instantiations, but these headers were topleve headers included in many places.
Several keys were either missing or misnamed in the formula view.
These have been changed to match the Lua and WML names for the keys.
This affects canrecruit, moves, and max_moves, as well as status.
In addition, a large number of keys were missing entirely from the formula view.
Most of these keys have now been added and can be accessed from formulas.
A few that have little use in filters (such as image_mods or profile) are still missing.
The Lua view missed a few keys that the formula view did provide.
Although these could in principle have been obtained by using the special __cfg key,
they have now been added to the Lua view anyway.
This also changes nearly all API functions taking locations to use the new functions.
As a result, these functions can now accept their location arguments in any of three formats:
- An array of two integers
- A table with x and y keys
- Two separate, consecutive integer arguments
Functions that return locations mostly still use whatever format they used before.
This is because changing return values is a more compatibility-breaking change.
This temporarily breaks compatibiliy for the following AI functions:
- ai.get_targets()
- ai.get_avoid()
- ai.get_attacks()
This also adds a 'color' parameter to wesnoth.float_label. It was already
previously possible to set a labels color using pango markup, but to
implement [unstore_unit] i need to support the color= syntax as given
by [unstore_unit]
This also adds a 'fire_event' parameter to wesnoth.put_unit to specify
whether the 'unit_placed' event is fired, this is needed to implement
fire_events=yes/no in [unstore_unit] but its also generally useful
for the same reason why [unstore_unit] has this parameter.
wesnoth.select_hex has problems with simply highlighting units without displaying
their movement range. If you set its third argument to false, the unit gets
selected, but no hex cursors appears around it. Using this allows us to simply
highlight a location with the hex cursor, independent of unit presence (select_hex
works funny if no unit is present).
i moved the 'description', 'usage', 'halo', 'ellipse', 'random_traits',
'generate_name' and 'upkeep' from cfg_ into unit member variables.
This main advantage is that its now clearer which unit type attributes
exist, also it is a little faster becasue it doesn't need string lookps
when accesing those attributes.
I used scoped_ptr<string> instead of just string to store 'usage',
'halo' and 'ellipse' because that is closer to the previous memory
layout.
name= has no effect but can be used to delete the item. I also changed
[item] to automatically create an id (in case no id was given) and
return that (only usable if called from lua).
I used the id= field from overlay class for this, it was previously only
used by the editor. Not sure if it is a good idea to reuse the id field.
the cfg_ field of the unit class now doesn’t store the advancements and
the abilities anymore. Instead they are stored in separate fields.
I used boost::ptr_vector<config> because that’s similar to how config
objects store their child values internally. Unfortunately
boost::ptr_vector defines ptr_vector::value_type in a bad way so that it
cannot be used for BOOST_FOREACH loops value types, so i had to
change lua's push_check file to use T::reference to be compatible
with ptr_vector
This commit removes all child tags of the unit cfg_ because the only
tags that are now left in cfg_ are [variation] and [advancefrom] from
[unit_type], which werent used in [unit] and only caused the savefiles
to bloat.