1218 Commits

Author SHA1 Message Date
Fabian Müller
72fc103fe9 Lifted unit drawing from game_display to display. 2012-03-31 18:16:27 +00:00
Anonymissimus
b63962cb5d remove support for [object] unit_type= and [object]unit_gender=
1. Both are covered by [object][filter].

2. They were undocumented in the wiki.

3. They are scheduled for removal since early 1.7.

(patch #3211 by brilliand)
2012-03-29 15:28:17 +00:00
Jérémy Rosen
0c28e59f83 fix bug 19563 (patch 3196 by jamit) 2012-03-28 20:31:30 +00:00
Anonymissimus
045cd30920 Introduce SSF support in [filter][filter_vision].
Deprecate viewing_side= in favor of the SSF's side=.

Semantics in case of empty filter changes from "all enemy sides"
to "all sides". If a side isn't an enemy, it can usually see
the unit anyway, and just in case the SSF has [enemy_of].
wmllint rule to come.

(patch #3194 by Brilliand)
2012-03-27 19:50:21 +00:00
Anonymissimus
ac82bdd2b7 Fix usage of invalid iterators in [effect]apply_to=remove_attacks.
Revealed (not introduced) by 2012-03-09T17:13:04Z!ai0867@gmail.com, causing the debugger to crash.
2012-03-17 16:33:19 +00:00
Mark de Wever
d773fc7990 Strip trailing whitespace. 2012-02-06 20:27:34 +00:00
Ignacio R. Morelle
6ca69b2df5 New year copyright update 2012-01-07 02:35:17 +00:00
Anonymissimus
87e5d3d790 Revert revisions of mine: 2011-11-09T00:22:25Z!anonymissimus@arcor.de, 2011-11-10T21:18:53Z!anonymissimus@arcor.de
These were the variable substitution delaying in the [object] code. It is
no longer needed due to the workaround [object]delayed_...=yes|no.

Removes repeated WML parsing. Reverts behavior to mostly what was in 1.8
If ABILITY_TELEPORT is added by an [object], or [object][effect][filter]
contains $this_unit, delayed_...=yes is required for the modifications
to work as expected.

However, if the same object wants to get variables substituted and
add ABILITY_TELEPORT to a unit, the code would have worked in 1.8
but doesn't in 1.9.
(bug #18893, bug #19225)
2012-01-02 22:12:02 +00:00
Jérémy Rosen
38ffe01416 fix for bug #18636, makes ghost units visible through fog
gabba please test and confirm that's what you want
2011-12-28 15:34:50 +00:00
Gabriel Morin
79e013e826 Whiteboard fake units can now be selected and highlighted...
...by mouseover even under fog.

This involved changing some game logic so that units belonging to the
viewing team are considered visible even under fog.
2011-12-07 10:02:56 +00:00
Fabian Müller
3bf11bd745 Don't try to add translated unit names for advancements...
...that are not a valid unit type in unit::advances_to_translated().

Fix for bug #19043
2011-11-26 15:14:58 +00:00
Anonymissimus
708a5ee132 fix most invalid messages about invalid variable accesses (bug #18893) 2011-11-10 21:18:53 +00:00
Anonymissimus
41796894d9 fix [effect][filter] not working correctly regarding locations 2011-11-09 23:55:35 +00:00
Anonymissimus
1f539b39c8 delay/add variable substitution in unit::add_modification (fix for bug #18893) 2011-11-09 00:22:25 +00:00
Alexander van Gessel
210fa9f5d2 Add [unit_type]image_icon key (FR bug #15466) 2011-11-06 21:18:50 +01:00
Anonymissimus
bb32598bae return by const ref 2011-11-06 16:32:33 +00:00
Ignacio R. Morelle
686bf9f563 Add wesnoth.unit_image_mods() function...
...and make [move_unit] use it to respect mods applied via EffectWML
2011-11-06 05:39:28 +00:00
Derek Hoagland
7022a771a8 Slowed units are now tinted to be recognizable at a glance 2011-11-01 14:47:32 +00:00
Fabian Müller
f07e96ce44 The tooltip of the unit's displayed level...
...now shows the possible advancements in the selected language.
2011-10-28 09:52:40 +00:00
Simon Forsyth
a651a6fa8e Apply default team color for side last
Fixes bug #18817
2011-10-22 21:43:12 +00:00
Anonymissimus
34d9b749d7 introduce a member variable in class unit holding filter_recall information
Simplifies code and is automatically kept upon unit advancement.
2011-10-18 23:18:48 +00:00
Anonymissimus
d71d48f510 fix variable substitution on [unit][event] and [unit][filter_recall]
The unparsed vconfig from the [unit] tag is passed to the unit
constructor and filter_recall and event tags are taken from it.
[side][unit] did already no variable substitution, wesnoth.put_unit does
it only if passed a vconfig userdata to describe the unit.
2011-10-18 23:18:05 +00:00
Ignacio R. Morelle
9e4b0f19a1 Fixed "error parsing image modifications" message...
...caused by subsequent image mod additions using the add attribute in
[effect] apply_to=image_mod
2011-10-18 01:03:25 +00:00
Anonymissimus
919d3a9333 remove unit::set_game_context
since it's no longer the only place where game context is set
2011-10-17 17:21:55 +00:00
Anonymissimus
7215ca1920 reintroduce support for [unit][event]s (fix for bug #16259)
Such events are required a non-empty id=.
2011-10-17 17:21:22 +00:00
Mark de Wever
0312529429 Remove the assert introduced in 2011-10-15T18:06:24Z!koraq@xs4all.nl.
anonymissimus found some valid cases which now assert. Changed it in a
debug warning, mainly to have hint that it might be the cause of an
issue.
2011-10-15 21:36:45 +00:00
Mark de Wever
eb948eac6b Remove whitespace. 2011-10-15 18:06:27 +00:00
Mark de Wever
af7ef732bd Harden unit_movement_resetter class.
Add a warning regarding its usage and test whether the unit exists
before assigning to it. (Still a bit experimental, but initial tests
show no regressions.)
2011-10-15 18:06:24 +00:00
Alexander van Gessel
81e0a2007f Revert token t_token commits from 2011-09-08T19:15:40Z!thonsew@yahoo.com on. 2011-10-10 03:43:29 +01:00
Fabian Müller
0750c9be49 Overload of hp_color() method.
SDL_Color hp_color(int hitpoints) const

Returns the color that represents how strong the unit will get wounded
considering the argument and the current hitpoints as base.
2011-09-29 21:03:47 +00:00
Thonsew
18dcb1a030 Fixed made sure that an attribute_value is interpreted as a t_string...
...when concatenated with a description t_string.
2011-09-29 15:55:42 +00:00
Mark de Wever
b4d927e967 Strip trailing whitespace. 2011-09-26 20:27:15 +00:00
Thonsew
6711f50f1a Fix for bug #18716 Some recruited/spawned units are slowed on creation.
Units with non-standard attributes were converting those atributes to
an integer, which the attribute_value::to_int function was converting
to 0, which unit::set_state interpreted as STATE_SLOW.  Changed it to
passing a t_token.
2011-09-24 19:03:22 +00:00
Thonsew
88b5546118 Attempt to fix static de-initialization problems.
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.
2011-09-20 21:21:31 +00:00
Thonsew
cdb129508d Fix implicit static cast...
...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
2011-09-20 21:20:54 +00:00
Mark de Wever
169df983cb remove an unused token. 2011-09-17 16:55:10 +00:00
Anonymissimus
d93c8c5c54 added support for SSF to SUF via a [filter_side] subtag 2011-09-15 19:58:33 +00:00
Thonsew
d2690e0cc6 Move anonymous namespace static const t_token...
...into function local scope in order make sure control flows over
them and initializes in the correct order.
2011-09-11 18:21:49 +00:00
Gabriel Morin
a79ba63899 Added new is_visible_to_team() method to unit,
...and refactored some methods to use it.
2011-09-11 00:35:20 +00:00
Gabriel Morin
b992db1649 Add a temporary_unit_remover struct...
...that removes a unit from the unit map and puts it back on destruction.
2011-09-11 00:35:03 +00:00
Mark de Wever
24c055cd44 Strip trailing whitespace. 2011-09-10 11:52:18 +00:00
Thonsew
593adb4b9f Fixed warning array subscript is below array bounds...
...[-Warray-bounds] by changing z_empty() to a static const local
z_empty.
2011-09-09 19:14:44 +00:00
Sergey Popov
f1eda25fd4 Converted remaining z_emptys to function calls.
This finally fixes startup segfault with my version of gcc.
2011-09-09 11:05:52 +00:00
Thonsew
622421be99 Added liminal t_token 2011-09-08 19:18:02 +00:00
Thonsew
d56fbf14fe Upgraded unit_animation and unit_frame to use t_token and t_interned.
1. Changed std::strings to t_token when used as indices.

2. Made a frame_parsed_parameters token resulting in upto 25% memory
savings if unit animations are on for a large variety of units.
2011-09-08 19:17:48 +00:00
Thonsew
7e99017fa4 Updated image.cpp to
1. Use t_token in place of std:string to save on string construction

2. Use boost::unordered_map in place of std::map as per todo by silene
2011-09-08 19:17:41 +00:00
Thonsew
3a41db7acd Updated unit_types to use t_token...
...in place of std::string and to replace std::map with
boost::unordered_map in the t_move_cost_cache, both to increase speed.
2011-09-08 19:17:31 +00:00
Thonsew
9ce82aec1a Upgraded game_events.cpp...
...and files that interacted with game_events to use t_token in place
of std::string for config objects
2011-09-08 19:16:49 +00:00
Thonsew
2f2cefad5c Changed serialization/tokenizer to use config::t_token to speed up parsing 2011-09-08 19:16:39 +00:00
Thonsew
576a3feab1 Updated parts of unit class to use t_token...
...in place of std:string in order to speed up comparisons, copies and
hashing which are 1 cycle operations.

Added z_sub t_token.

Added lru_cache unit test
2011-09-08 19:16:26 +00:00