437 Commits

Author SHA1 Message Date
J. Tyne
8c83185317 Change unit::advance_to() so that it takes a unit_type reference...
...instead of a pointer that was assumed (in many places) to be
non-NULL.
2013-01-16 12:53:45 +00:00
J. Tyne
7b0a480254 Make Lua's wesnoth.transform_unit() function preserve hit points.
This is actually simpler to implement and is more consistent with the
[transform_unit] tag.  Plus, the wiki documentation for
wesnoth.transform_unit() does not state that the hit points definitely
will be changed (it's a bit vague on that point), so this is
consistent with the existing documentation.
2013-01-05 14:53:05 +00:00
J. Tyne
e8796a8279 Have unit::advance_to() no longer change the unit's current hit points.
This was overridden more often than not anyway, and the code is
overall simpler without hit points being changed by this function.
2013-01-05 14:11:53 +00:00
Elvish_Hunter
3397a38cff Lua: added new wesnoth.get_time_stamp() function 2013-01-03 13:19:16 +00:00
Mark de Wever
43b71f2ff0 New year copyright update. 2013-01-01 09:22:03 +00:00
Mark de Wever
637436dba6 Remove an unused private field.
Issue found by Clang 3.2.
2012-12-22 13:40:15 +00:00
J. Tyne
d9e8b6db34 Preserve the undo stack in saved games.
This is necessary to have accurate vision if shroud updates are
delayed. (The alternative would be to clear the undo stack before
saving the game, which would likely surprise many players and would
require handling sighted events before actually saving.)
2012-12-22 00:37:41 +00:00
J. Tyne
317df3af99 Alphabetize and document a list.
This is for ease of seeing if a given string is in the list.

(Not many entries out of order, but the result had a long line, so I
redid the linebreaks as well.)
2012-12-21 23:21:00 +00:00
J. Tyne
b58d88c84a Expand the list of types for attribute_value's variant,
...allowing the processing overhead to be localized to the assignment
operators.

Really fixes bug #19201 (the reported example is still/again broken in
2012-12-13T03:24:23Z!jt_coding@verizon.net).  

Related bugs that I verified have not been reintroduced: #19681,
#19690, #19702.
2012-12-14 17:41:19 +00:00
J. Tyne
11a6fb368e Define attribute_value::apply_visitor().
This is for better encapsulation, leading to fewer friends.
2012-12-13 19:44:13 +00:00
J. Tyne
d17965a26c End a private data member name with an underscore. 2012-12-13 18:42:33 +00:00
J. Tyne
9db0f5edb7 Adding some anonymous namespaces to reduce the work required when linking. 2012-11-12 23:17:27 +00:00
J. Tyne
d5ccea9f8f Reorder some (Boost) includes to make it easier to tell...
...what has already been included.

(Group Boost includes together and alphabetize them.)
2012-11-12 21:52:49 +00:00
Simon Forsyth
de47fadc7d Fix bounds check on turn for Lua get_time_of_day(). Discovered by mattsc on IRC 2012-11-04 17:24:14 +00:00
Elvish_Hunter
bf8ed3df65 Lua: added new wesnoth.have_file() function 2012-10-08 18:31:58 +00:00
Boldizsár Lipka
bcaa7f4f2c Applied patch #3297 2012-09-25 17:42:18 +00:00
J. Tyne
cad139f572 Make the new parameter to unit::set_movement() optional,
...with the default to not have side-effects (not the behavior before
the parameter).
2012-09-19 13:43:05 +00:00
J. Tyne
651c127dab Do not always clear end_turn_ and hold_position_ in unit::set_movement().
This allows the function to be called without side-effects, so it can
be used as a simple setter (as the name suggests). Since the previous
behavior was to have side-effects (which is bad style for a default),
this commit introduces a non-optional parameter, ensuring that I've
looked at each place where this function is called.
2012-09-19 13:39:48 +00:00
Mark de Wever
4c02c4daa5 Strip trailing whitespace. 2012-08-31 17:58:05 +00:00
J. Tyne
724618c287 Split actions.cpp into six pieces (into a new "actions" subdirectory).
Most of the project files have also been updated, but I ran into some
difficulties trying to update VC9 and Xcode.
2012-08-25 14:06:46 +00:00
J. Tyne
b08206f291 Eliminate a parameter that was always *resources::teams.
This made the two implementations of village_owner() identical modulo an
error check, so I merged them.
2012-08-19 19:43:38 +00:00
Dmitry Kovalenko
51e818b43b LuaAI: wesnoth.debug_ai() slightly refactored,
...now provides access to the ai.* table, the Lua engine table and the
component tree
2012-08-14 07:26:58 +00:00
Dmitry Kovalenko
83d0e06ee8 AI: exposure of the component tree to the AI developers in debug mode 2012-08-06 17:22:47 +00:00
J. Tyne
f05e4ccc3f Use NULL instead of 0. 2012-08-03 01:06:07 +00:00
Mark de Wever
cb42f5bf06 Strip trailing whitespace. 2012-07-28 16:34:37 +00:00
Anja Keicher
c17d84b12f Moved in-game data to make sure it can't be accessed out of game 2012-07-26 15:18:08 +00:00
Elvish_Hunter
c8716ad799 Added new Lua function wesnoth.get_villages() 2012-07-21 09:55:26 +00:00
J. Tyne
f3631cd713 Get rid of parameters that are always...
...*resources::game_map, *resources::units.
2012-07-20 22:17:33 +00:00
Sergey Popov
6b6eafb213 Use BOOST_FOREACH directly instead of #define foreach BOOST_FOREACH
The define is extremely unreliable, will break compile with boost >=
1.50 and upstream can't fix issues with it, see
https://svn.boost.org/trac/boost/ticket/6131
2012-07-07 00:49:45 +00:00
Mark de Wever
062fb91ba2 Strip trailing whitespace. 2012-06-30 20:28:23 +00:00
Anonymissimus
9488f708a0 add operator== implementation for lua proxy units
Checks whether on-map, recall, and private ones are identical
Based on that units always have an underlying_id and that it's unique.
2012-06-29 17:34:27 +00:00
Ignacio R. Morelle
3536a15b27 lua: Implement wesnoth.view_locked() and wesnoth.lock_view()
Both are simple wrappers for display::view_locked() and
display::set_view_locked(), respectively. view_locked() returns a
boolean specifying whether the view is locked, and lock_view() takes a
boolean specifying whether to lock the view (true) or unlock it (false).
2012-06-11 23:09:43 +00:00
Ignacio R. Morelle
5beca9f7df lua: Forgot code documentation in 2012-06-11T08:50:08Z!shadowm@wesnoth.org 2012-06-11 09:37:18 +00:00
Ignacio R. Morelle
c382986454 lua: Allow wesnoth.scroll_to_tile() to instantly warp...
...to the selected location

This adds a fourth argument (boolean) to
wesnoth.scroll_to_tile(). When true, the display code instantly warps
to the chosen location regardless of the scroll speed setting in
Preferences.
2012-06-11 08:50:08 +00:00
Dmitry Kovalenko
a72febe0e4 LuaAI: first draft of the external candidate action system,
...with on-the-fly file reloading, if you use the --debug-lua launch argument
2012-06-07 09:53:19 +00:00
Dmitry Kovalenko
57aa197583 LuaAI:
(1) Lua CA_wrapper slightly refactored, in preparation for adding CA
definitons using external files

(2) --debug_lua command line argument added. Unused at the moment, but
will be used for Lua debug mechanisms
2012-06-01 12:57:14 +00:00
Étienne Simon
97626587fe Fixed compilation errors introduced by 2012-05-01T19:04:33Z!jopadan@hush.ai when time_t is int. 2012-05-04 00:58:54 +00:00
Jon Daniel
8eea6a8b9b fix bug #19681 and #19201: 2012-05-01 19:04:33 +00:00
Silas Brill
f806b61e80 Applied patch #1381: Configurable village support
This differs from the original patch in that the minimum village
support for multiplayer is 0, not 1.
2012-04-30 21:52:38 +00:00
Dmitry Kovalenko
e810953bea Removed an unneeded function introduced in 2012-04-16T20:49:02Z!nephro.wes@gmail.com 2012-04-17 19:30:15 +00:00
Dmitry Kovalenko
f54f2b0e75 LuaAI:
(1) added wesnoth.is_debug_mode();

(2) disabled the LuaAI debug library usage for non-debug launch modes
2012-04-16 20:49:02 +00:00
Jérémy Rosen
f2d4b90a36 remove MAX_MAP_AREA patch 3195 by jamit 2012-03-31 08:29:26 +00:00
Mark de Wever
6d12f20242 Extended support for toggle_button in Lua API.
Extended support for toggle_button in wesnoth.get_dialog_value,
wesnoth.set_dialog_value, and wesnoth.set_dialog_callback to also
apply to toggle_panel. Applies patch #3091.
2012-03-18 15:21:37 +00:00
Anonymissimus
fba24f7ca0 Fix wesnoth.find_reach failing for private lua proxy units.
Modified pathfind::paths to take a unit as argument instead of its
location; updated all callers.

As observed by mattsc, the function did in its callstack
re-query the unit at the location of a passed private proxy unit,
calculating the reach for the unit in the unit_map at that
location instead of the private one.

The other pathfind bindings already work for private proxy
units. Private lua proxy units were introduced after the pathfinder
functions were already exposed in the lua API.
2012-03-18 00:19:09 +00:00
Ignacio R. Morelle
d7508852c7 lua: More header inconsistencies 2012-03-16 18:40:46 +00:00
Simon Forsyth
68dc23cd0b Mark [map] as a handled tag to avoid Lua error 2012-02-23 03:45:20 +00:00
Anonymissimus
21544198e1 Remove unused confusing parameters from wesnoth.get_sides.
These were never documented and ment to be removed.
2012-02-14 21:22:50 +00:00
Anonymissimus
3cf38b8a47 add lua setter for a side's color (now that wml can do it anyway...) 2012-02-07 23:27:00 +00:00
Anonymissimus
76bc12b77d add lua getter for game_config::mp_debug
May enable an addon to check for whether clients joining may have
debug mode enabled.
2012-02-07 23:26:44 +00:00
Anonymissimus
e2b38a0c1a remove redundant function team::map_color_to() 2012-02-07 23:26:26 +00:00