1106 Commits

Author SHA1 Message Date
Mark de Wever
d4fcad4944 Avoid double promotion.
A floating point literal without a type specifier is a double and
causes the float to be promoted to double as well. It has no
advantages in these cases so avoid it. (Found with gcc
-Wdouble-promotion.)
2012-03-18 14:15:04 +00:00
Jérémy Rosen
fcc5e09153 apply patch 3176 by jamit:
fog does not recover discovered hex until end of turn
2012-03-14 21:35:03 +00:00
Ignacio R. Morelle
f281c17fc1 Convert remaining uses of utils::string_bool()...
...on config attributes to use config::attribute_value::to_bool()
2012-02-29 09:11:28 +00:00
Anonymissimus
8457d8b8ef change "Trying to recall unit failed!" error to emit useful information 2012-02-25 18:01:06 +00:00
Anonymissimus
e6d88f55d9 let a warning have more information 2012-02-25 18:00:29 +00:00
Fabian Müller
a8aa81f338 Now realy introduced the new map format. 2012-02-23 02:39:58 +00:00
Anonymissimus
6594a06918 remove deprecation for empty side= in modify_side,place*,remove_shroud
final syntax for these: all sides if neither side= nor [filter_side] are
present, all sides matching the ssf in [filter_side] if the tag is
present regardless of inline side=, and the sides matching inline side=
otherwise.

modify_side can't have inline SSF due to key conflicts. The other two
(and capture_village) already have inline SLF so it's a bad idea to
add an inline SSF. After removing filter_side in [gold] and
[modify_ai] this leaves 4 tags with possibly redundant side info
and confusing syntax (especially capture_village),
at the benefit of more backwards compatibility.
2012-02-14 21:24:31 +00:00
Anonymissimus
e605fce758 remove a done todo 2012-02-14 21:24:06 +00:00
Anonymissimus
60e18fe9c2 Introduce inline SSF support...
...in modify_ai and deprecate [modify_ai][filter_side].
2012-02-14 21:23:41 +00:00
Anonymissimus
4c22c47303 remove confusing unused parameters from game_events::get_sides_vector() 2012-02-14 21:23:23 +00:00
Ignacio R. Morelle
aaf97a7319 Implement modify_side.color attribute...
...to change a side's team color range (bug #18772)
2012-02-07 18:00:52 +00:00
Ignacio R. Morelle
683df4374e Allow WML to disable the credits at the end of a single-player campaign
This is done by implementing an end_credits attribute for use in
[endlevel], [scenario] and [campaign]. The (boolean) value is stored in
saved games and defaults to true.

Example:

  [endlevel]
      next_scenario=null
      end_credits=no
      linger_mode=no
  [/endlevel]

This will be documented later in the wiki.
2012-02-06 22:17:22 +00:00
Mark de Wever
af2ad24e4e Increase of WML random values. 2012-01-30 19:55:08 +00:00
Steven Panek
e093fc6b5c Killed 'colour'. 2012-01-30 01:40:30 +00:00
Steven Panek
5242b4ac8e Improved a couple of warnings. 2012-01-29 23:21:13 +00:00
Anonymissimus
d9e6cf4c0d remove allow_undo child being added to [set_menu_item][command] tags
It is documented to have effect only in moveto event, not menu item X
events, and this matches the occurances of allow_undo in the codebase.
2012-01-29 22:52:14 +00:00
Anonymissimus
730d514916 Introduce [set_menu_item][command]delayed_variable_substitution=yes|no
(def yes)

Allows to force a variable substitution run onto the command action wml,
just like it can be done for nested events.
2012-01-29 22:51:58 +00:00
Anonymissimus
3adb6463cb Swap order of calls in game_events::commit().
This should make it so that action wml from [set_menu_item]id=X[command]
is always executed after an [event]name=menu item X, even if
that event was added in the same event callstack as the set_menu_item
was called.
2012-01-29 22:51:34 +00:00
Anonymissimus
8fd3283156 new action tag: [clear_menu_item]
Removes a menu item from the right click menu, the according event
handler if it had a [command] tag, and from being saved in the savefile.
Does not touch manually added events of type "menu item x".
Menu items were automatically carried over between scenarios so far,
causing potential savefile bloat by accumulating over the course
of a campaign.
2012-01-29 22:51:09 +00:00
Anonymissimus
229d764a3e Let event handlers of menu item commands have an id.
Unless both the menu item and its command tag didn't have an id.

Makes it possible to remove the resulting event handler
in the same way [event]remove=yes removes events.
Unless I'm badly mistaken, event handlers caused by a menu item's command
should already be unique, so no id collisions are expected.
2012-01-29 22:50:47 +00:00
Anonymissimus
6d66073f81 improve an error message (bug #19018) 2012-01-17 22:28:37 +00:00
Anonymissimus
d75e320e5a Introduce parameter allow_invalid in gamemap::read (fix for bug #19018) 2012-01-17 22:26:33 +00:00
Ignacio R. Morelle
6ca69b2df5 New year copyright update 2012-01-07 02:35:17 +00:00
Anonymissimus
9ad020eea6 accept only non-empty variable names in [set_variable(s)]...
...and wesnoth.set_variable

This supposedly common problem (value of a set variable composed
of the values of other variables which perhaps don't exist or are empty)
causes corrupted savegames and makes :inspect fail. Hard to track on
wml side; there are probably a more ways of corrupting saves via empty
key or tag names.
2012-01-04 23:06:03 +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
Anonymissimus
ebd1e2030d introduce [object]delayed_variable_substitution=yes|no (def no)
(bug #18893, bug #19225)

This isn't pretty since we are repeatedly parsing WML in the common
case...
2011-12-29 23:27:40 +00:00
Anonymissimus
68aaf39c11 Revert code-modifying revisions related to bug #19188 conflict-free,
since they break compatibility.

This reverts

2011-12-16T01:24:54Z!anonymissimus@arcor.de
2011-12-16T04:06:47Z!Majora700@gmail.com
2011-12-16T04:08:22Z!Majora700@gmail.com
2011-12-16T04:14:58Z!Majora700@gmail.com
2011-12-16T20:13:27Z!anonymissimus@arcor.de
2011-12-16T20:14:08Z!anonymissimus@arcor.de
2011-12-16T20:48:39Z!Majora700@gmail.com
2011-12-17T09:46:29Z!Majora700@gmail.com
2011-12-18 15:10:16 +00:00
Steven Panek
44cbafee63 Reverted 2011-12-16T20:13:27Z!anonymissimus@arcor.de through 2011-12-16T20:14:24Z!anonymissimus@arcor.de; redid 2011-12-16T04:06:47Z!Majora700@gmail.com right. 2011-12-16 20:48:39 +00:00
Anonymissimus
bbaa97e898 Revert 2011-12-16T04:06:47Z!Majora700@gmail.com, 2011-12-16T04:08:22Z!Majora700@gmail.com and 2011-12-16T04:14:58Z!Majora700@gmail.com.
1. The internal type is a std::string, the lua getters/setters should
reflect that like all the existing ones already do instead of making
implicit conversions.

2. It doesn't make sense to convert the already translated string
into a t_string again upon getting it.

3. The setter in team.cpp you added is redundant.

4. The attribute is apparently not really meant to be modified
by lua or wml so a tag is no good idea.
2011-12-16 20:13:27 +00:00
Steven Panek
8eaa9c2ec6 Made it so that [modify_side] is able to change...
...the current_player attribute; made the Lua stuff return the
attribute in the form of t_strings.
2011-12-16 04:06:47 +00:00
Ali El Gariani
62cd03c405 Clean get_time_of_day function names:
get_time_of_day() = global ToD

get_time_of_day(loc) = local ToD using ToD areas

get_illuminated_time_of_day(loc) = local ToD using ToD areas and illumination
2011-12-12 03:02:01 +00:00
Gabriel Morin
96f67f96dd Rename scoped real/future unit map structs,
...and add a new one which only applies future map when planning mode
is active.
2011-11-24 11:36:10 +00:00
Gabriel Morin
be87192279 Tweak the sending of notifications of game changes to the whiteboard.
This fixes invalid actions not being detected until another action is
created.
2011-11-24 11:35:52 +00:00
Gabriel Morin
c0db81e553 Addition of a lock to scoped_real_unit_map...
...to enforce the non-activation of the future unit map.

This prevents code called from WML events (drawing code, among others)
from building the future unit map.
2011-11-22 11:45:13 +00:00
Gabriel Morin
5fd7b794fa Reworked the notifications sent to the whiteboard when game state changes.
Removed a redundant assert.
2011-11-22 11:45:01 +00:00
Gabriel Morin
3b8b653860 Added asserts to ensure game events...
...and other gamestate-changing stuff never happen while future unit
map is active.
2011-11-20 08:08:48 +00:00
Anonymissimus
1f539b39c8 delay/add variable substitution in unit::add_modification (fix for bug #18893) 2011-11-09 00:22:25 +00:00
Anonymissimus
3aaeb0df3e add a warning message to [colour_adjust] 2011-11-06 00:20:46 +00:00
Alexander van Gessel
8c09e8b11f Prevent a bug if [recall] is used on a valid, but unusable location...
...and no usable location can be found.
2011-11-05 01:32:54 +01:00
Alexander van Gessel
d0e16cd4c4 Restore old [recall] behavior:
If you can't recall near a leader, and a map location is given, recall
there instead.

Fixes bug #18913
2011-11-05 01:08:50 +01:00
Anonymissimus
96c1152c23 introduce [redraw]clear_shroud=(def no), [redraw]<SSF>
(fix for bug #18879)

There was an implicit conversion config::attribute_value to int with
default 0. Strangely, this sometimes went well with my MinGw built and
also does for some time in Espreon's backtrace, but MSVC crashes early
where the resulting out-of-bounds problem occurs (actions.cpp:2366)
2011-11-04 21:13:55 +00:00
Fabian Müller
06e9f2073c Code cleanup for 2011-11-02T17:55:15Z!fabianmueller5@gmx.de. 2011-11-02 19:24:11 +00:00
Fabian Müller
d9684de4c6 Added support for [secondary_unit] SUF in [recall] action wml. 2011-11-02 17:55:15 +00:00
Fabian Müller
f10768bf75 Implemented the $second_unit being bound to the acting leader...
...in recruit/recall events.

LUA and WML connections to the feature are still missing.
2011-11-01 16:20:13 +00:00
Anonymissimus
e79533dffd limit number of executions of [endlevel] to 1 times per scenario
(fix for bug #18828)

A scenario can only be ended once. Also prevents sort-of recursion
if it appears in a victory or defeat event.
2011-10-23 22:57:52 +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
Anonymissimus
5a5606e011 use empty() instead of comparing with an empty string 2011-10-17 17:21:38 +00:00
Anonymissimus
fa8f56b63a rewrite game_events::add_events
to optionally filter by event id whether to add an event
2011-10-17 17:21:04 +00:00
Mark de Wever
d5c260c608 Strip trailing whitespace. 2011-10-15 18:06:36 +00:00
Anonymissimus
ed3cc61416 Fixed usage of a reference in a commit of mine.
According to a comment by mordante in variable.hpp, std::string& foo =
vcfg["foo"] is unsafe, and silene appears to have always used
config::attribute_value foo = vcfg["foo"] (without reference).
2011-10-15 15:52:18 +00:00