Commit graph

96 commits

Author SHA1 Message Date
Celtic Minstrel
3ac7f8d970 NULL -> nullptr
A few cases of NULL were missed, since changing them led to errors
(Mainly instances where it was passed to a boost::function)
2016-03-31 00:42:38 -04: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
a23a368c20 Remove Akihara's recruitment and battle evaluation 2016-03-24 00:08:10 -04:00
Celtic Minstrel
6c525a9d3f Remove AI interface and fallback stage
This removes the C++ common interface intended for creating new AIs.
Anyone wishing to create a new AI written in C++ should now implement it as a custom stage instead.

This commit also removes the C++ implementation of the Idle AI (but leaves the WML definition of it, which is based on the composite AI)
and the fallback stage which was intended to fall back to other C++ AI algorithms.
2016-03-24 00:08:10 -04:00
Celtic Minstrel
bc711f5f43 Consolidate related files into subdirectories 2016-03-20 16:20:09 -04:00
Charles Dang
e1d003f488 Cleaned up inclusions of unit_types.hpp 2016-03-21 04:04:51 +11: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
Celtic Minstrel
2e412df9b9 Formula_engine: make distance_between function a core function 2016-03-18 02:17:14 -04: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
gfgtdf
7f13156c28 Revert "Rename team_name/user_team_name to team_id/team_name (old syntax still valid)"
And related commits.

This reverts commit 545253ec2b.
This reverts commit 1215f65eb8.
This reverts commit 11664f4024.
This reverts commit e948df3424.
This reverts commit 3781e7839f.

This commits were reverted to exclude them from wesnoth 1.13.2 release because:
1) We are still unsure about the best name oftthese attributes
2) This breaks multiple campaigns, including LoW and the tutorial.
Feel free to revert this revert after 1.13.2 when thse issues can be solved..
2015-12-10 21:29:52 +01:00
Charles Dang
3781e7839f Rename team_name/user_team_name to team_id/team_name (old syntax still valid) 2015-10-26 00:44:28 +11:00
Celtic Minstrel
af6d3060e2 Add new "category" and "creator" properties to map labels
- The "category" property is mainly for use by scenario designers; players will be able to hide labels based on this
- The "creator" property is meant to allow players to hide labels placed by specific other players
- Map editor allows setting the "category" property
2015-08-06 23:27:11 -04:00
gfgtdf
bb0ecd14c0 recorder writes directly into saved_game object
Previously recorder had config memaber and saved_game had a config
memeber.
And when saving a game the config was copied from recorder to saved_game
and the other way when loading a game.

Now the recorder object directly writes into the saved_game object. This
saves some copying when saving and loading data.

I also moved the pos_ variable from the recorder object to the
saved_game replay_recorder_base object, This fixes a bug where saving a
game during a replay also caused to not yet played turns to be written
into the savefile.
2015-03-06 05:19:31 +01:00
Ignacio R. Morelle
57ae45387a New Year copyright update 2015-01-01 19:07:35 -03:00
Alexander van Gessel (AI0867)
e5cb79b8e9 Move everything in src/filesystem.hpp into its own namespace
This is a chearry pick by me (gfgtdf) of 66176b1738. It differes a lot from the original becasue since there were so much merging conflics i decided to do it mostly from scratch.

Conflicts:
	src/addon/manager.cpp
	src/addon/manager_ui.cpp
	src/campaign_server/campaign_server.cpp
	src/config_cache.cpp
	src/create_engine.cpp
	src/editor/map/context_manager.cpp
	src/editor/map/map_context.cpp
	src/font.cpp
	src/game_config_manager.cpp
	src/gamestatus.cpp
	src/gui/dialogs/editor/custom_tod.cpp
	src/gui/dialogs/lobby/lobby_data.cpp
	src/gui/dialogs/mp_create_game.cpp
	src/gui/widgets/settings.cpp
	src/hotkeys.cpp
	src/image.cpp
	src/multiplayer_lobby.cpp
	src/network.cpp
	src/playcampaign.cpp
	src/preferences.cpp
	src/savegame.cpp
	src/serialization/preprocessor.cpp
	src/tests/main.cpp
	src/wesnoth.cpp
	src/widgets/button.cpp
2014-10-13 18:31:18 +02:00
Chris Beck
22cc8f7ffe fixup some ai headers 2014-06-25 00:34:00 -04:00
Chris Beck
80be563f1a refactor tod_manager::get_illuminated_tod to take unit_map as arg
Improve encapsulation, eventually remove all resources::pointers
from this object.
2014-06-12 22:19:37 -04:00
Chris Beck
a5b9489e13 refactor tod_manager::get_illuminated_tod to take map as an arg
Helps to encapsulate, and eliminate unnecessary resources::pointers.
2014-06-12 21:48:26 -04:00
Chris Beck
aab7edd88c remove resources::game_map (part 2)
This the result of executing, in folder src/, the following

find . -type f -exec sed -i 's/\*resources\:\:game_map/resources\:\:gameboard->map()/g' '{}' \;

and carefully inspecting the result.

We also had to add game_board.hpp includes in various places,
and change the arguent order of unit::is_visible_to_team --
this function was taking *resources::game_map as its default
argument, and we do not want to include game_board in unit.hpp,
as it creates cyclic dependencies. This was resolved by
eliminating this as a default value -- this is an improvement,
since usually when this function was called it was in a context
where a game_map was available already locally anyways.
2014-06-10 20:53:00 -04:00
Chris Beck
4830b8ee3c partially remove resources::game_map (part 1)
This is the result of running, in src/ directory, the following:

find . -type f -exec sed -i 's/resources::game_map->/resources::gameboard->map()./g' '{}' \;

and carefully inspecting the result, and adding "game_board.hpp"
2014-06-10 20:13:11 -04:00
Chris Beck
1ec273c882 move temporary unit movers to game_board, adapt slightly. 2014-06-03 15:17:54 -04:00
Chris Beck
f09d405629 cleanup previous two find and replace results
Just wanted to remove the empty strings that got created:

find . -type f -exec sed -i 's/<< "" <</<</g' '{}' \;

find . -type f -exec sed -i 's/<<"" <</<</g' '{}' \;

I also unstaged tools/schema/tags.cpp, since I don't think I changed
that.
2014-05-20 15:54:16 -04:00
Chris Beck
03a956d05c Make sure all warning logs are flushed, so travis gets the results.
This is the result of running command, in src/,

find . -type f -exec sed -i 's/\(WRN.*\)\\n\"\;/\1\" << std::endl\;/g' '{}' \;

and inspecting the results.

Also ran this subsequently:

find . -type f -exec sed -i 's/\(WARN.*\)\\n\"\;/\1\" << std::endl\;/g' '{}' \;

which only affected render.cpp
2014-05-20 15:48:36 -04:00
Chris Beck
3c9844889b Make sure all error logs flush with std::endl, so we get on travis.
This is the result of running this command in directory src/

find . -type f -exec sed -i 's/\(ERR.*\)\\n\"\;/\1\" << std::endl\;/g' '{}' \;

and carefully inspecting the results.
2014-05-20 15:37:52 -04:00
Chris Beck
c5838b9513 inline the definition map_location::null_location
If we decided it was worth it to inline map_location ==, then
surely this is also worth it to inline null_location, as the
compiler may be able to reduce tests for == null location to
"x == ... && y == ...", without having to move to a different
compilation unit.
2014-05-20 10:42:13 -04:00
Ignacio R. Morelle
a4f47a63c7 New Year copyright update 2014-01-01 02:08:52 -03:00
Alexander van Gessel
ddf57aaacb Fix a copy-paste error
Found by coverity
2013-12-09 16:32:59 +01:00
Eric S. Raymond
043c4f9fd3 Remove $Id$ cookies. 2013-03-26 21:41:37 -04:00
J. Tyne
e8d9dc33a6 Eliminate an unused parameter.
It would take more work to use this parameter, and all current uses
would have this parameter always be *resources::units anyway.
2013-02-21 22:22:05 +00:00
J. Tyne
31f1fb1be3 Eliminate a parameter that is always *resources::teams. 2013-02-21 21:37:00 +00:00
J. Tyne
cefb07f63b Eliminate a parameter that is always *resources::game_map. 2013-02-21 20:55:50 +00:00
J. Tyne
bb70a29017 Overhaul of unit_movement_type
This is a general overhaul of the class embodying movement types,
featuring:

* Better data encapsulation

* Less duplication of code between unit.cpp and unit_type.cpp

* Easier to use

* New files for the class (VC and XCode projects still need updating)

* New (shorter) name for the class

Some additional revisions will be coming.

The primary motivation for this was to get a class that embodies
movement costs (part of the data encapsulation).
2013-02-20 02:25:14 +00:00
J. Tyne
7aa7b7d05c Add the missing "Id" line. 2013-02-15 20:04:32 +00:00
J. Tyne
219fe1df0b Use a symbolic constant instead of a literal constant. 2013-02-15 19:59:57 +00:00
J. Tyne
51273aceb4 Eliminate some parameters that are always *resources::game_map. 2013-02-15 02:38:42 +00:00
J. Tyne
e066bac97e Pass the t_translation::t_terrain struct by (const) reference instead of value. 2013-02-12 23:16:43 +00:00
J. Tyne
2da6f3cd3b Change the unit constructor based on a unit_type to take a reference...
...instead of a pointer that was assumed to be (and in fact always
was) non-NULL.
2013-01-16 13:29:56 +00:00
J. Tyne
d09401df2c Check for unit types found before creating units based on them. 2013-01-16 03:19:31 +00:00
Mark de Wever
43b71f2ff0 New year copyright update. 2013-01-01 09:22:03 +00:00
Mark de Wever
e968112838 Remove an unused private field.
Issue found by Clang 3.2.
2012-12-22 13:39:43 +00:00
Mark de Wever
aa541dad6e Remove an unused variable.
Issue found by cppcheck.
2012-07-29 19:08:21 +00:00
Mark de Wever
9663f578ae Remove an unused variable.
Issue found by cppcheck.
2012-07-29 19:08:18 +00:00
Mark de Wever
8a833ddbd0 Remove an unused class member.
It was shadowed by the variable in a function.
2012-07-28 16:34:34 +00:00
Riss Aline
6c22960136 new ai formula 'aki_eval' for testing a battle evaluation 2012-07-20 15:58:34 +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
Fabian Müller
72fc103fe9 Lifted unit drawing from game_display to display. 2012-03-31 18:16:27 +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
Mark de Wever
3bd183450a A possible NULL-pointer deference.
The test in get_unit_type_function was reversed.
2012-02-18 11:54:00 +00:00
Ignacio R. Morelle
6ca69b2df5 New year copyright update 2012-01-07 02:35:17 +00:00
Mark de Wever
69663141d6 Avoid a divide by zero.
The calculate_map_ownership_function function didn't test the
boundaries. There might still be a bug lurking in the WML; fendrin
please have a look. Fixes the issue reported in [1].

[1] http://forums.wesnoth.org/viewtopic.php?f=4&t=34006
2011-06-02 11:53:09 +00:00