Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into renderpath_redo
Browse files Browse the repository at this point in the history
Had to do lots of manual resolution
  • Loading branch information
aginor committed Apr 20, 2016
2 parents ae16c90 + 23abf97 commit da82cbe
Show file tree
Hide file tree
Showing 919 changed files with 13,562 additions and 10,787 deletions.
70 changes: 35 additions & 35 deletions .travis.yml
Expand Up @@ -9,58 +9,58 @@ compiler:
- clang

env:
- BUILD="-O0"
- BUILD="-O2"
- BUILD="C++11 -O0"
- BUILD="translations"
- OPT=-O0 CXXSTD=11 NLS=false
- OPT=-O2 CXXSTD=11 NLS=false
- OPT=-O2 CXXSTD=1y NLS=false
- NLS=true

matrix:
exclude:
- compiler: gcc
env: BUILD="-O2"
env: OPT=-O2 CXXSTD=11 NLS=false
- compiler: gcc
env: BUILD="translations"
env: NLS=true
- compiler: clang
env: OPT=-O2 CXXSTD=1y NLS=false
allow_failures:
- env: OPT=-O2 CXXSTD=1y NLS=false

before_install:
- export TARGETS="wesnoth wesnothd campaignd test"
- export WML_TESTS=true
- export CPP_TESTS=true
- export PLAY_TEST=true
- export MP_TEST=true
- export STRICT_COMPILATION=true
- export EXTRA_FLAGS_ALL="-pipe"
- export EXTRA_FLAGS_RELEASE="-O0"
- export WML_TEST_TIME=20
- export NLS=false
- export CXX11=false
- export STRICT_COMPILATION=false
- export EXTRA_FLAGS_RELEASE=""
- export WML_TESTS=true CPP_TESTS=true PLAY_TEST=true MP_TEST=true
- export WML_TEST_TIME=15

- if [ "$BUILD" == "-O2" ]; then export STRICT_COMPILATION=false; fi
- if [ "$BUILD" == "-O2" ]; then export EXTRA_FLAGS_RELEASE=""; fi
- if [ "$BUILD" == "-O2" ]; then export WML_TEST_TIME=15; fi

- if [ "$BUILD" == "C++11 -O0" ]; then export CXX11=true; fi
- if [ "$BUILD" == "C++11 -O0" ]; then export EXTRA_FLAGS_RELEASE="-O0 -Wno-literal-suffix -Wno-deprecated-declarations"; fi
- if [[ "$BUILD" == "C++11 -O0" ]] && [[ "$CXX" == "clang++" ]]; then export EXTRA_FLAGS_RELEASE="-O0 -Wno-literal-suffix -Wno-deprecated-declarations -Wno-deprecated-register"; fi
- if [ "$BUILD" == "C++11 -O0" ]; then export PLAY_TEST=false; fi
- if [ "$BUILD" == "C++11 -O0" ]; then export MP_TEST=false; fi

- if [ "$BUILD" == "translations" ]; then export NLS=true; fi
- if [ "$BUILD" == "translations" ]; then export TARGETS="translations"; fi
- if [ "$BUILD" == "translations" ]; then export WML_TESTS=false; fi
- if [ "$BUILD" == "translations" ]; then export CPP_TESTS=false; fi
- if [ "$BUILD" == "translations" ]; then export PLAY_TEST=false; fi
- if [ "$BUILD" == "translations" ]; then export MP_TEST=false; fi
- if $NLS; then
export TARGETS="translations" CXXSTD=11;
export WML_TESTS=false CPP_TESTS=false PLAY_TEST=false MP_TEST=false;
fi
- if [ "$OPT" == "-O0" ]; then
export STRICT_COMPILATION=true;
export EXTRA_FLAGS_RELEASE="-O0 -Wno-deprecated-declarations";
export PLAY_TEST=false MP_TEST=false WML_TEST_TIME=20;
fi
- if [[ "$OPT" == "-O0" ]] && [[ "$CXX" == "clang++" ]]; then export EXTRA_FLAGS_RELEASE="-O0 -Wno-deprecated-declarations -Wno-literal-suffix -Wno-deprecated-register"; fi

install:
- if [ "$CXXSTD" == "1y" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y; fi
- travis_wait sudo apt-get update -qq
- travis_wait sudo apt-get install -qq libboost-filesystem-dev libboost-iostreams-dev libboost-random-dev libboost-program-options-dev libboost-regex-dev libboost-system-dev libboost-test-dev libboost-locale-dev libcairo2-dev libfribidi-dev libpango1.0-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev gdb moreutils scons xvfb
- travis_wait sudo apt-get install -qq libboost-filesystem-dev libboost-iostreams-dev libboost-random-dev libboost-program-options-dev libboost-regex-dev libboost-system-dev libboost-test-dev libboost-locale-dev libboost-thread-dev libcairo2-dev libfribidi-dev libpango1.0-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev gdb moreutils scons xvfb

- if [ "$CXXSTD" == "1y" ]; then
sudo apt-get install -qq g++-5;
export CXX=g++-5;
elif [ "$CXX" == "g++" ]; then
sudo apt-get install -qq g++-4.7;
export CXX=g++-4.7;
fi

script:
- ./utils/travis/check_utf8.sh
- ./utils/travis/utf8_bom_dog.sh
- $CXX --version
- echo "*Params* --- " "cxxtool=$CXX --debug=time build=release extra_flags_release="$EXTRA_FLAGS_RELEASE" strict=$STRICT_COMPILATION $TARGETS cxx0x=$CXX11 nls=$NLS jobs=2"
- scons cxxtool=$CXX --debug=time build=release extra_flags_config="$EXTRA_FLAGS_ALL" extra_flags_release="$EXTRA_FLAGS_RELEASE" strict=$STRICT_COMPILATION $TARGETS cxx0x=$CXX11 nls=$NLS jobs=2
- scons cxxtool=$CXX --debug=time build=release extra_flags_config=-pipe extra_flags_release="$EXTRA_FLAGS_RELEASE" strict=$STRICT_COMPILATION $TARGETS cxx_std=$CXXSTD nls=$NLS jobs=2
- "export DISPLAY=:99.0"
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x24"
- if [ "$CPP_TESTS" = true ]; then ./utils/travis/test_wrapper.sh; fi
Expand Down
11 changes: 7 additions & 4 deletions CMakeLists.txt
Expand Up @@ -18,7 +18,7 @@ endif(COMMAND cmake_policy)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)

# use our own version of FindBoost.cmake and other Find* scripts
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

#
# Options
Expand Down Expand Up @@ -66,7 +66,7 @@ else (UNIX AND NOT APPLE AND NOT CYGWIN)
find_package(SDL2 2.0.4 REQUIRED)
endif (UNIX AND NOT APPLE AND NOT CYGWIN)

find_package(Boost 1.36 REQUIRED COMPONENTS iostreams program_options regex system)
find_package(Boost 1.36 REQUIRED COMPONENTS iostreams program_options regex system thread)
find_package(Boost 1.40 REQUIRED COMPONENTS random)

# no, gettext executables are not required when NLS is deactivated
Expand Down Expand Up @@ -245,13 +245,16 @@ if(MSVC AND NOT DEFINED CXX_FLAGS_MSVC)
endif(MSVC AND NOT DEFINED CXX_FLAGS_MSVC)

set(CXX_FLAGS_PROJECT)
check_compiler_has_flag(CXX_FLAGS_PROJECT "-std=c++98" HAS_COMPILER_FLAG_STD)
check_compiler_has_flag(CXX_FLAGS_PROJECT "-std=c++11" HAS_COMPILER_FLAG_STD)
check_compiler_has_flag(CXX_FLAGS_PROJECT "-W" HAS_COMPILER_FLAG_W)
# MSVC's -Wall is not like gcc's, it really enables *all* warnings which include zillions for system headers and doesn't make sense.
if(NOT MSVC)
check_compiler_has_flag(CXX_FLAGS_PROJECT "-Wall" HAS_COMPILER_FLAG_WALL)
endif(NOT MSVC)

### Set some extra var for C++11
add_definitions(-DHAVE_CXX0X)


### Set strict compiler flags.

Expand Down Expand Up @@ -703,7 +706,7 @@ install(FILES l10n-track DESTINATION ${DATADIR})
#

configure_file(
"${CMAKE_MODULE_PATH}/uninstall.cmake.in"
"${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"
IMMEDIATE @ONLY
)
Expand Down
2 changes: 2 additions & 0 deletions RELEASE_NOTES
Expand Up @@ -40,6 +40,8 @@ The Wesnoth formula language used by $(...) substitution, the formula= key in st
[*]Improved formula debugger
[/list]
The "fai" and "faiend" keywords are deprecated in favour of "wfl" and "wflend" respectively. This is part of a move to more clearly distinguish [wiki]Wesnoth Formula Language[/wiki], the language itself, from [wiki]FormulaAI[/wiki], which is just one use of the language in Wesnoth.

The attributes leader, total_movement, movement_left, and states in WFL unit variables were renamed to canrecruit, max_moves, moves, and status respectively; this was done to make them match the Lua and WML names for the same things. Also, the special attribute in WFL weapon variables is now specials. The old names will continue to work for now, but they may be removed in a future version.
[/rasection]

[rasection="Changes to the AI"]
Expand Down
12 changes: 5 additions & 7 deletions SConstruct
Expand Up @@ -103,7 +103,7 @@ opts.AddVariables(
BoolVariable('ccache', "Use ccache", False),
('ctool', 'Set c compiler command if not using standard compiler.'),
('cxxtool', 'Set c++ compiler command if not using standard compiler.'),
BoolVariable('cxx0x', 'Use C++0x features.', False),
EnumVariable('cxx_std', 'Target c++ std version', '11', ['11', '14', '1y']),
BoolVariable('openmp', 'Enable openmp use.', False),
BoolVariable("fast", "Make scons faster at cost of less precise dependency tracking.", False),
BoolVariable("lockfile", "Create a lockfile to prevent multiple instances of scons from being run at the same time on this working copy.", False),
Expand Down Expand Up @@ -410,7 +410,8 @@ if env["prereqs"]:
conf.CheckPango("cairo", require_version = "1.21.3") & \
conf.CheckPKG("fontconfig") & \
conf.CheckBoost("program_options", require_version="1.35.0") & \
conf.CheckBoost("regex", require_version = "1.35.0") \
conf.CheckBoost("thread") & \
conf.CheckBoost("regex") \
or Warning("WARN: Client prerequisites are not met. wesnoth, cutter and exploder cannot be built")

have_X = False
Expand Down Expand Up @@ -500,11 +501,8 @@ for env in [test_env, client_env, env]:
if "gcc" in env["TOOLS"]:
env.AppendUnique(CCFLAGS = Split("-W -Wall"), CFLAGS = ["-std=c99"])

if env['cxx0x']:
env.AppendUnique(CXXFLAGS = "-std=c++0x")
env.Append(CPPDEFINES = "HAVE_CXX0X")
else:
env.AppendUnique(CXXFLAGS = "-std=c++98")
env.AppendUnique(CXXFLAGS = "-std=c++" + env["cxx_std"])
env.Append(CPPDEFINES = "HAVE_CXX0X")

if env['openmp']:
env.AppendUnique(CXXFLAGS = ["-fopenmp"], LIBS = ["gomp"])
Expand Down
68 changes: 68 additions & 0 deletions changelog
@@ -1,7 +1,15 @@
Version 1.13.4+dev:
* Graphics:
* Updated generic portrait of Mermaid Initiate.
* Language and i18n:
* Updated translations:
* Removed support for SDL 1.2. SDL 2 is now the only supported version.
* Terrains:
* Changed terrain code of Desert Mountains from Mdy to Mdd.
* User Interface:
* Various design improvements to GUI2 widgets
* New simpler GUI2 loading screen
* New colored cursor graphics
* WML engine:
* Fix some issues with [foreach]
* Fix some issues with backstab-like weapon specials
Expand All @@ -14,6 +22,21 @@ Version 1.13.4+dev:
* New ~SCALE_INTO_SHARP(w,h) IPF which preserves aspect ratio, using
nearest neighbor scaling.
* Support delayed_variable_substitution= in [on_undo], [on_redo]
Note that this means $unit.x and $unit.y may not reflect the unit's
true location, so using [unstore_unit] on $unit may have unexpected effects.
This applies to $second_unit too. The $x1, $y1, $x2, $y2 variables work fine
though, so in most cases they can be used instead. Anything else in $unit
or $second_unit is also fine.
* formula= in SUF can now reference $other_unit via the formula variable "other"
* formula= now supported in location, side, and weapon filters
* Weapon filters now support number, parry, accuracy, and movement_used
* New [has_attack] in standard unit filters; supercedes has_weapon= and
uses full weapon filter.
* lua_function=var.member now works in SUF; however, 'var' still needs to
be a global variable.
* Added new keys name_generator, male_name_generator and female_name_generator
for the [race] tag to declare a context-free grammar to describe how names
are derived
* AiWML:
* Simplified aspect syntax which works for all aspects, present and future:
* All aspects with simple values can be specified as key=value
Expand Down Expand Up @@ -106,6 +129,21 @@ Version 1.13.4+dev:
(with the exception that it does not outline the hex if true is
passed as the second argument), but this name change was done to
emphasize that it acts on a unit, more than a location.
* New wesnoth.set_time_of_day function which sets the current time
of day, taken either as the time ID (eg "second_watch") or the index
of the time in the overall schedule (eg, 1 would be dawn in the default
schedule). Optional second argument takes a time area ID, to set
local instead of global time.
* New wesnoth.add_fog and wesnoth.remove_fog functions allow changing fog
on the map. The [lift_fog] and [clear_fog] tags now use this.
* New wesnoth.add_sound_source, wesnoth.remove_sound_source, and
wesnoth.get_sound_source functions to allow manipulation of sound
sources. The [sound_source] and [remove_sound_source] now use these.
* New wesnoth.log function for printing log messages. The [wml_message]
and [deprecated_message] tags now use this.
* New wesnoth.name_generator function builds a name generator and returns
it as a callable userdata. Both the original Markov chain generator
and the new context free gramamr generator are supported
* WML tables defined in Lua now accept string keys with array values
(where "array" is a table whose keys are all integers). This joins
the elements of the array with commas and produces a single string
Expand All @@ -120,6 +158,10 @@ Version 1.13.4+dev:
* abilities - list of the IDs of all abilities
* Additional fields in table returned by wesnoth.get_terrain_info:
* icon, editor_image, light
* Additional fields in unit type proxu:
* race, id, alignment
* attacks, which returns the same thing as unit.attacks
* abilities, same as unit.abilities
* LuaAI:
* The table returned by check_*() now has a "result" field which
gives a description of the action's result; similar to "status"
Expand Down Expand Up @@ -147,8 +189,27 @@ Version 1.13.4+dev:
* New wesnoth.micro_ais table contains the loaders for all Micro AIs.
New loaders can easily be installed by add-ons. See any built-in
micro AI (in ai/micro_ais/mai-defs/) for an example of how to do this.
* The attacks aspect can now be defined as a Lua aspect. The code
should return a table with keys "own" and "enemy", each of which may
be either a unit filter table or a function which takes a unit as a
parameter and returns true or false.
* Wesnoth formula engine:
* Formulas in unit filters can now access nearly all unit attributes
The following attributes were renamed (old names still work, for now):
leader -> canrecruit
total_movement -> max_moves
movement_left -> moves
states -> status
* Nearly all unit type, side, weapon, and terrain attributes available
to Lua code are now also exposed to WFL. The exceptions are mainly
translatable strings.
* Unit and side WML variables are now accessible under "wml_vars".
Since WML variables don't easily translate to formula variables, the
special attributes __all_children, __children, and __attributes provide
specialized views of the variables config as a list, string-list map,
and string-value map, respectively.
* The 'special' attribute of weapons was renamed to 'specials', and it now
contains the special IDs rather than their translateable names.
* New syntax features:
* String interpolation syntax. Within a formula string (enclosed in
'single quotes'), the syntax [some_formula] interpolates the result
Expand Down Expand Up @@ -182,6 +243,7 @@ Version 1.13.4+dev:
This counts backwards from the specified offset
A size of -1 is the same as 1.
* if() can take two arguments; returns null if the condition is false
* tolist() will now invert the effect of tomap()
* debug_print() now shows in console if debug mode is on
* New core functions:
* Trig functions tan, acos, asin, atan have been added. (Sin and cos
Expand All @@ -198,6 +260,9 @@ Version 1.13.4+dev:
* replace() replaces a sequence within a string
* type() function checks the type of a formula result
* distance_between() - this was promoted from FormulaAI to core
* pair() function that produces a key-value pair suitable for
passing to tomap() - this also means key-value pairs are now
serializable (relevant in FormulaAI)
* Bugfixes:
* Dice operator is now synced (where possible)
* Modulus (%) operator now works on decimal numbers
Expand All @@ -222,6 +287,9 @@ Version 1.13.4+dev:
* Miscellaneous and bug fixes:
* Resolve translated logo images not being used (bug #24357)
* Ported the "hexometer" tool from Bash to Python 3
* Recognize hotkey release events
* Allow changing keybindings for scrolling the map.
* Fix the move-to-targets candidate action of the default AI ignoring tunnels

Version 1.13.4:
* Language and i18n:
Expand Down
8 changes: 4 additions & 4 deletions data/ai/formula/new_recruitment.fai
Expand Up @@ -35,7 +35,7 @@ def get_important_locations(ai* )
def enemy_leaders( ai* )
sum(
map( enemies, 'enemy',
filter( units_of_side[enemy], leader )
filter( units_of_side[enemy], canrecruit )
)
);

Expand Down Expand Up @@ -123,7 +123,7 @@ def locally_normalize_to_lowest( input_map )
# Returns a List of all enemy leaders #
# (for some reason this function is defined twice) #
def enemy_leaders(ai*)
map( enemies, 'enemy_side', find(units_of_side[enemy_side], leader ) );
map( enemies, 'enemy_side', find(units_of_side[enemy_side], canrecruit ) );

# UNUSED FUNCTION #
# Returns a Map. #
Expand Down Expand Up @@ -249,7 +249,7 @@ def movement_eval(ai*, recruits_id_map)
my_recruits_movement_cost( ai ),
tomap( recruits_id_map,
map( my_recruits,
total_movement
max_moves
)
)
),
Expand Down Expand Up @@ -357,7 +357,7 @@ if( vars.side_terrain,
mark_important_locations( self,
calculate_map_ownership(
recruits_of_side,
map(filter(sum(units_of_side), leader), loc),
map(filter(sum(units_of_side), canrecruit), loc),
4, 7, 4
)
)
Expand Down
4 changes: 2 additions & 2 deletions data/ai/formula/opening.fai
Expand Up @@ -8,7 +8,7 @@ def opening(ai*)
move(loc(11,23), loc(14,22)) ],
if(turn = 2, [
move(loc(11,21),loc(13,17)),
if(unit_at(loc(11,22)).total_movement = 6,
if(unit_at(loc(11,22)).max_moves = 6,
move(loc(11,22),loc(13,18)),
move(loc(11,22),loc(15,19))),
move(loc(10,22),loc(7,19)),
Expand Down Expand Up @@ -75,7 +75,7 @@ def rate_village_capture(ai*,src,dst) village_value(ai);
def rate_village_proximity(ai*, unit, dst)
if(distance = 1,
0,
village_value(ai)/(distance/unit.total_movement + 1))
village_value(ai)/(distance/unit.max_moves + 1))
where distance = distance_to_nearest_unowned_village(dst);

def rate_move(ai*,src,dst)
Expand Down
4 changes: 2 additions & 2 deletions data/ai/formula/patrol.fai
Expand Up @@ -25,7 +25,7 @@ where desired_path = shortest_path( me.loc, me.vars.next_step );

def move_ahead(ai*, me)
if( enemy_units,
if( distance_between( closest_unit(ai, me).loc, me.loc ) > me.movement_left-1,
if( distance_between( closest_unit(ai, me).loc, me.loc ) > me.moves-1,
move_partial(
me.loc,
me.vars.next_step
Expand All @@ -50,7 +50,7 @@ def patrol_move(ai*, me)
move_ahead(ai,me)
);

if( me.movement_left = 0,
if( me.moves = 0,
end,
if(attack,
attack,
Expand Down
2 changes: 1 addition & 1 deletion data/ai/formula/poisoner_attack.fai
Expand Up @@ -8,6 +8,6 @@ def get_best_defense_loc(moves, attacker, enemy)
attack(me.loc, get_best_defense_loc(my_moves.moves, me, target), target.loc, att_weap)


where att_weap = index_of(['poison'],map(me.attacks,special))
where att_weap = index_of(['poison'],map(me.attacks,specials))

faiend
2 changes: 1 addition & 1 deletion data/ai/formula/poisoner_eval.fai
Expand Up @@ -16,7 +16,7 @@ min( map(
)
) +
#leader is always a good target! #
if( target.leader, 50, 0 ) +
if( target.canrecruit, 50, 0 ) +
# consider target abilities if needed #
if( target.abilities,
if( index_of('regenerates', target.abilities) != -1, -10, 0 ) +
Expand Down

0 comments on commit da82cbe

Please sign in to comment.