57 Commits

Author SHA1 Message Date
Charles Dang
bc414b7264 Cleaned up a couple dozen unnecessary forward declarations 2017-12-03 09:05:39 +11:00
Charles Dang
2101353d36 Convert include guards to the shorter #pragma once
Turns out I mistook @celticminstrel's opinion that we should use include guards over pragma (737916e).
Since all major compilers support `#pragma once`, there's no reason not to use it.

For future mergability reasons, this excludes src/spirit_po and src/xBRZ. It also excludes src/boost-patched.
2017-05-09 19:41:37 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Celtic Minstrel
39e01dda3f Rename AI result enums to avoid t- prefix 2016-11-09 01:13:17 -05:00
Charles Dang
05092ba2f6 Refactor most boost pointer related stuff to use their stdlib counterparts
This constitutes drop-in replacements for:

* boost::shared_ptr
* boost::scoped_ptr
* boost::weak_ptr
* boost::enable_shared_from_this
* boost::static_pointer_cast
* boost::dynamic_pointer_cast

This excludes boost::intrusive_ptr, except for stray includes. Refactoring that is more complicated.
2016-07-25 09:28:42 +11:00
Celtic Minstrel
17ea7fac6b Reorganize the AI source files a little
This also tries to make them include everything by full paths instead of relative paths.
2016-03-24 00:08:12 -04:00
Celtic Minstrel
bc711f5f43 Consolidate related files into subdirectories 2016-03-20 16:20:09 -04:00
Charles Dang
83ee4f6087 Convert most includes to src/-relative
This excludes includes that need backtrack path specifiers in order to resolve
name clashes.
2016-03-19 19:35:17 +11:00
Chris Beck
ba51524f6e update copyright to year 2016
using this shell script:

find src -type f -print0 | xargs -0 sed -i "s|Copyright (C) \([[:digit:]]*\)\([ ]*\)-\([ ]*\)2015|Copyright (C) \1\2-\32016|g"
2016-01-02 23:59:31 -05:00
Ignacio R. Morelle
57ae45387a New Year copyright update 2015-01-01 19:07:35 -03:00
Kevin_Xi
e74e320a58 Add simulation flag and apply simulated actions to real actions 2014-08-22 23:48:12 +08:00
Kevin_Xi
0076b8ce8f Rescope move_result
The move_spectator_ held by move_result will never get out of scope while CAs which hold move_result(for example, get_healing, move_leader_to_keep) are alive. Rescope move_spectator to do_execute() so the move action will not depend on what move_unit_spectator does internally.
2014-08-22 23:48:12 +08:00
Chris Beck
97d5d14e27 fixup camel case names UnitPtr, UnitConstPtr
This commit created using sed, in directory src/:

$ find . -type f -exec sed -i 's/UnitPtr/unit_ptr/g' {} +
$ find . -type f -exec sed -i 's/UnitConstPtr/unit_const_ptr/g' {} +

and inspecting the results.
2014-06-29 11:55:48 -04:00
Chris Beck
393a16e871 favor to return a smart pointer in ai/actions recall_unit 2014-06-17 19:32:26 -04:00
Ignacio R. Morelle
a4f47a63c7 New Year copyright update 2014-01-01 02:08:52 -03:00
mattsc
3aa9cdc99c Lua AI: add new replay-safe action ai.synced_command()
This enables the execution of Lua commands from within the AI. The
commands are synced to be in the replay file as well, using a new
[command][lua_ai] tag.
Function call: ai.synced_command(command, x1, y1), where command is a
string containing the lua code and x1,y1 is an optional map location
that is the only allowed external variable used in the code string.
2013-12-04 07:30:45 -08:00
flix/Felix Bauer
29e8584738 Add new aspect 'advancements'
As part of a GSoC proposal I added a new aspect so a scenario editor can control advancements in two ways:
1. Define a aspect with a string-value like "Swordsman, Knight", so the units of interesst will always advance to this
2. Use the LUA-Engine and return a function of the form advance(x, y) which will itself return a string-value
    like "Swordsman, Knight". Everytime a ai-unit advances advance(x, y) will be called.
The corresponding wikipage (http://wiki.wesnoth.org/AiWML) is going to be updated soon.
2013-06-01 17:21:12 +03:00
Eric S. Raymond
043c4f9fd3 Remove $Id$ cookies. 2013-03-26 21:41:37 -04:00
J. Tyne
ae5c69417f Some modifications to ai::recall_result and ai::recruit_result:
1) Use check_recall/recruit_location() instead of the AI-specific
checks in do_check_before().

2) Get rid of the redundant checks in do_execute().

An advantage of #1 is that the AI better supports sides with multiple
leaders, along with leader-specific recruit lists and recall filters
(not full support, but better support).
2013-02-08 21:31:59 +00:00
Mark de Wever
43b71f2ff0 New year copyright update. 2013-01-01 09:22:03 +00:00
J. Tyne
1ded6ceeab Rename namespace action back to "actions".
This is to avoid potential name clashes with any classses named
"action", like what shadowm found in the test suite. (The quick fix of
2012-12-31T05:35:28Z!jt_coding@verizon.net is now reverted in favor of this fix.)  One complication
is that there is already an "ai:actions" namespace, so within the "ai"
namespace, the renamed namespace is qualified as "::actions".
2012-12-31 20:50:57 +00:00
J. Tyne
e0d4378c88 Expanding the "action" namespace. 2012-12-31 01:31:13 +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
Ignacio R. Morelle
6ca69b2df5 New year copyright update 2012-01-07 02:35:17 +00:00
Mark de Wever
6384943776 Fixes compilation with clang 3.0 in C++11 mode.
The actual problem was in the linking phase. Anonymissimus had a similar
problem in MSVC in C++11 mode, this change might fix that as well.
2011-12-09 19:07:23 +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
Mark de Wever
24c055cd44 Strip trailing whitespace. 2011-09-10 11:52:18 +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
Iurii Chernyi
41cc607f65 fixed bug #16117: added a way to supress E_NOT_REACHED_DESTINATION...
...to lua api via an optional boolean parameter -
ai.move_full(from,to_x,to_y,true) - this allows to steal units in
custom moveto events without the AI complaining that something is
wrong
2011-08-10 21:35:16 +00:00
Mark de Wever
ecbabea838 New year copyright update. 2011-01-01 15:57:50 +00:00
Mark de Wever
dc227e4962 Remove unneeded includes. 2010-11-21 13:57:12 +00:00
Guillaume Melquiond
eeb047de55 Fixed file headers so that they match the content of the COPYING file. 2010-09-01 21:12:38 +00:00
Mark de Wever
865168f295 Remove an unused function.
Issue found by cppcheck.
2010-08-29 20:13:07 +00:00
Mark de Wever
a99c78e0d8 Update doxygen comment.
The filename after the @file comment is optional (spotted by alink).
2010-07-26 21:32:18 +00:00
Ali El Gariani
c7c222380d Clean the use of @todo for Doxygen
Use ///@todo bla   or  /** @todo bla */ 
with lowercase and no colon after todo
2010-07-26 00:31:55 +00:00
Iurii Chernyi
01d4d38303 refactor src/ai/actions.?pp to use resources:: instead of ai::game_info 2010-06-15 19:18:53 +00:00
Iurii Chernyi
f6953c07ac reduce AI header dependencies 2010-04-29 23:25:32 +00:00
Iurii Chernyi
31ffceb09c reduce ai header dependencies 2010-04-28 23:43:31 +00:00
Mark de Wever
e4a608b29a Make a member function a const member function.
Issue found by cppcheck.
2010-03-30 21:56:41 +00:00
Iurii Chernyi
e18a65f49b add a human-readable error name when ai action results in an error,
...like 'error ai/actions: Error #2002 (move_result::E_NO_UNIT) in
full move by side 1 from location 14,6 to location 17,6'
2010-01-31 12:34:14 +00:00
Eric S. Raymond
e5d39639e2 Move pathfinding code into a pathfind namespace. No logic changes.
This is a step towards merging fendrin's [tunnel] code.
2010-01-25 15:37:35 +00:00
Eric S. Raymond
9574de26d9 Move the pathfinding code into a subdirectory.
This is preparation for merging fendrin's pathfinding patch.  No code
changes.
2010-01-25 12:21:06 +00:00
Mark de Wever
92f5f92ce5 New year copyright update. 2010-01-01 13:16:49 +00:00
Iurii Chernyi
3da97843d4 reschedule todo items, mark todo items important before 1.8 release 2009-12-25 12:15:43 +00:00
Ali El Gariani
6e875ac3ba clean some includes 2009-12-05 04:34:45 +00:00
Iurii Chernyi
3c6366602d AI recall action and recall() formula ai function.
This allows ai to recall units. (note: at this point, it doesn't do
that, unless instructed via formula ai)
2009-09-16 23:10:56 +00:00
Iurii Chernyi
afcb29c338 reworked AI macros, added support for moving leader to goal...
...as a candidate action, fixed some bugs, changed modify_ai syntax to
make it more resilient to bugs and to allow reuse of subtags
2009-09-03 23:23:37 +00:00
Iurii Chernyi
80626b67f5 Made 'unit move failed due to ambush' log via --log-info,
...not --log-error, to avoid cluttering the logs with error messages
due to normal situations'
2009-09-03 10:55:58 +00:00
Ali El Gariani
0984328cb0 Move some simple common map_location functions from pathutils.hpp...
...to map_location.hpp where they more clearly belongs. Allow to
simplify some includes.
2009-08-31 12:59:22 +00:00
Iurii Chernyi
02d46b4419 remove some opportunities for ai infinite loops;...
...fix a bug with 'ai turn' event being called at the wrong time;
definitly fixes bug #14157 and bug #14161, and might fix bug #14167
(this one might had been fixed earlier); might cause the AI to stop
its turns prematurely - report this, if it happens
2009-08-22 18:19:35 +00:00