Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gunchleoc committed Feb 17, 2014
2 parents 8bdc96e + bbe4599 commit bd3061e
Show file tree
Hide file tree
Showing 627 changed files with 101,508 additions and 89,238 deletions.
40 changes: 40 additions & 0 deletions CMakeLists.txt
Expand Up @@ -303,6 +303,12 @@ if(NOT CMAKE_COMPILER_IS_GNUCXX)
)
endif(NOT CMAKE_COMPILER_IS_GNUCXX)

check_compiler_has_flag(
CXX_FLAGS_STRICT_COMPILATION
"-Wold-style-cast"
HAS_COMPILER_FLAG_WOLD_STYLE_CAST
)

check_compiler_has_flag(
CXX_FLAGS_STRICT_COMPILATION
"-Wdeprecated-register"
Expand Down Expand Up @@ -454,6 +460,40 @@ endif(X11_FOUND)

add_definitions(-DLOCALEDIR=\\\"${LOCALEDIR}\\\")

# -NDEBUG is automatically added to all release build types, so manually remove
# this define from the related variables
MESSAGE ("removing NDEBUG flag from CMAKE_CXX_FLAGS_RELEASE")
separate_arguments(CMAKE_CXX_FLAGS_RELEASE)
list(REMOVE_ITEM CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG")
string(REPLACE ";" " " CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "removed NDEBUG flag" FORCE)
MESSAGE ("removing NDEBUG flag from CMAKE_C_FLAGS_RELEASE")
separate_arguments(CMAKE_C_FLAGS_RELEASE)
list(REMOVE_ITEM CMAKE_C_FLAGS_RELEASE "-DNDEBUG")
string(REPLACE ";" " " CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "removed NDEBUG flag" FORCE)
MESSAGE ("removing NDEBUG flag from CMAKE_CXX_FLAGS_RELWITHDEBINFO")
separate_arguments(CMAKE_CXX_FLAGS_RELWITHDEBINFO)
list(REMOVE_ITEM CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG")
string(REPLACE ";" " " CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE STRING "removed NDEBUG flag" FORCE)
MESSAGE ("removing NDEBUG flag from CMAKE_C_FLAGS_RELWITHDEBINFO")
separate_arguments(CMAKE_C_FLAGS_RELWITHDEBINFO)
list(REMOVE_ITEM CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG")
string(REPLACE ";" " " CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" CACHE STRING "removed NDEBUG flag" FORCE)
MESSAGE ("removing NDEBUG flag from CMAKE_CXX_FLAGS_MINSIZEREL")
separate_arguments(CMAKE_CXX_FLAGS_MINSIZEREL)
list(REMOVE_ITEM CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG")
string(REPLACE ";" " " CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}" CACHE STRING "removed NDEBUG flag" FORCE)
MESSAGE ("removing NDEBUG flag from CMAKE_C_FLAGS_MINSIZEREL")
separate_arguments(CMAKE_C_FLAGS_MINSIZEREL)
list(REMOVE_ITEM CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG")
string(REPLACE ";" " " CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}" CACHE STRING "removed NDEBUG flag" FORCE)


# When the path starts with a / on a Unix system it's an absolute path.
# This means that on Windows the path used is always relative.
if(LOCALEDIR MATCHES "^/")
Expand Down
23 changes: 14 additions & 9 deletions RELEASE_NOTES
Expand Up @@ -14,16 +14,21 @@ The release team should empty this file after each release.
CHANGES
=======

[section="RCA (default) AI gold saving default is reverted back to 'off'"]
Based on the feedback we have gotten, we turned gold saving off by default for the RCA AI. There is no clear overall benefit to having it turned on and it would require many scenarios to be rebalanced. There are, however, individual scenarios which definitely benefit from enabling gold saving. Help with identifying such scenarios will be much appreciated.
[/section]

[section="Son of the Black Eye campaign rebalancing"]
Rebalancing of the campaign continues and is done for scenarios 1 (“End of Peace”) through 12 (“Giving Some Back”). [b]Play-testing and feedback by others would be extremely helpful at this time.[/b] The first newly rebalanced scenario of this release is “Shan Taum the Smug”, but some earlier scenarios have seen minor changes as well.
[/section]
[section="Improved WML load error reports"]
The user interface used for displaying WML errors during the content load and initialization phase (also known as “[i]Reading files and creating cache[/i]”) has received a complete makeover in this version:

[list]
[*]The list of affected add-ons in the summary is now displayed in a bulleted format when applicable, and add-ons are identified by their regular names (or approximations thereof when those are unavailable) instead of the complete paths to their [tt]_main.cfg[/tt] files.
[*]Users are encouraged to report any errors found to the add-on authors or maintainers. A new button is available above the detailed report to copy it to clipboard, e.g., for including it in a forum post without having to upload large screenshots or checking stderr.
[*]Parser implementation details (specifically, “value ‘[i]token[/i]’ at [i]location[/i]”) are no longer included in the report since they don’t really help WML authors with debugging.
[*]Error messages that point to chains of file and line locations have those displayed in separate indented lines to avoid the “text wall” effect.
[/list]

[section="Input control scheme"]
The old default has been restored again. Players who want to change how inputs work for them can assign the action supposed to be activated by left-/right-clicking in the hotkey preferences.
Additionally, the format used for logging these errors to stderr has changed:
[list]
[*]Messages for errors from multiple add-ons are now sent to stderr one by one as they happen, rather than printed all at once at the end of the loading phase.
[*]The indented format used in the UI is used in stderr now as well.
[/list]
[/section]

[section="Example section header"]
Expand Down
27 changes: 26 additions & 1 deletion changelog
@@ -1,17 +1,42 @@
Version 1.11.9+dev:
* Add-ons client:
* Fixed faulty add-on _info.cfg files causing the game to display obscure
error messages or crash to desktop.
* Campaigns:
* Eastern Invasion:
* Rewrote scenario 'Training the Ogres' and renamed it to
'Capturing the Ogres'.
* Heir to the Throne:
* Fixed Delfador clobbering whichever unit happens to be standing on
31,11 at the end of The Bay of Pearls, causing it to disappear
forever.
* S15 (The Lost General): fix bug of sighted events firing too early
* Editor:
* Fixed: Drawing the offmap area for small resolutions.
* GUI2
* Added: FAI-function handling in GUI2 widgets.
* Added: A new tooltip window.
* Language and i18n:
* Updated translations:
* User interface:
* New UI for displaying errors detected during the core and add-on WML
loading process (parser and preprocessor errors), including the
ability to copy the report to clipboard.
* Fixed bug #21584: Properly redraw the minimap when the minimap is
resized.
* Fixed: Enable blurring in the title screen.
* WML engine:
* WML loading phase errors are reported to stderr in a new indented format.
* Implemented [true] and [false] ConditionalWML tags, which describe a
condition that always yields true or false, respectively.
* Fixed: Disallow change and remove sections without an id in the ThemeWML.
* Miscellaneous and bug fixes:
* Fixed: A compilation warning with DEBUG_WINDOW_LAYOUT_GRAPHS.
* Add translatable default filename to map editor save dialog box
* Added -Wold-style-cast to the CMake strict flags.
* Made sure that cmake does not add -NDEBUG for release builds since this
flag breaks building.
* Updated screenshots used inside the ingame help and fixed description of
orbs.

Version 1.11.9:
* Add-ons client:
Expand Down
25 changes: 22 additions & 3 deletions data/ai/micro_ais/cas/ca_hang_out.lua
Expand Up @@ -59,9 +59,28 @@ function ca_hang_out:execution(ai, cfg, self)
}
--print('#locs', #locs)

-- Get map for locations to be avoided (defaults to all castle terrain)
local avoid = cfg.avoid or { terrain = 'C*,C*^*,*^C*' }
local avoid_map = LS.of_pairs(wesnoth.get_locations(avoid))
-- Get map of locations to be avoided.
-- Use [micro_ai][avoid] tag with priority over [ai][avoid].
-- If neither is given, default to all castle terrain.
-- ai.get_avoid() cannot be used as it always returns an array, even when the aspect is not set,
-- and an empty array could also mean that no hexes match the filter
local avoid_tag
if cfg.avoid then
avoid_tag = cfg.avoid
else
local ai_tag = H.get_child(wesnoth.sides[wesnoth.current.side].__cfg, 'ai')
for aspect in H.child_range(ai_tag, 'aspect') do
if (aspect.id == 'avoid') then
local facet = H.get_child(aspect, 'facet')
if facet then
avoid_tag = H.get_child(facet, 'value')
else
avoid_tag = { terrain = 'C*,C*^*,*^C*' }
end
end
end
end
local avoid_map = LS.of_pairs(wesnoth.get_locations(avoid_tag))

local best_hex, best_unit, max_rating = {}, {}, -9e99
for i,u in ipairs(units) do
Expand Down
97 changes: 97 additions & 0 deletions data/campaigns/Eastern_Invasion/ai/ca_ogres_flee.lua
@@ -0,0 +1,97 @@
local H = wesnoth.require "lua/helper.lua"
local AH = wesnoth.require "ai/lua/ai_helper.lua"
local BC = wesnoth.require "ai/lua/battle_calcs.lua"
--local LS = wesnoth.require "lua/location_set.lua"

local ca_ogres_flee = {}

function ca_ogres_flee:evaluation(ai, cfg, self)
local units = wesnoth.get_units { side = wesnoth.current.side,
formula = '$this_unit.moves > 0'
}

if (not units[1]) then return 0 end
return 110000
end

function ca_ogres_flee:execution(ai, cfg, self)
local units = wesnoth.get_units { side = wesnoth.current.side,
formula = '$this_unit.moves > 0'
}

local units_noMP = wesnoth.get_units { side = wesnoth.current.side,
formula = '$this_unit.moves = 0'
}

local width, height = wesnoth.get_map_size()

-- Need the enemy map and enemy attack map if avoid_enemies is set
local enemies = wesnoth.get_units { { "filter_side", { {"enemy_of", {side = wesnoth.current.side} } } } }
local enemy_attack_map = BC.get_attack_map(enemies)

local best_hex, best_unit, max_rating = {}, nil, -9e99
for i,u in ipairs(units) do
local reach = wesnoth.find_reach(u)

--local rating_map = LS.create()

for j,r in ipairs(reach) do
local unit_in_way = wesnoth.get_unit(r[1], r[2])

if (not unit_in_way) or (unit_in_way == u) then

-- First rating is distance from a map edge
local dist_left = r[1] - 1
local dist_right = width - r[1]
local dist_top = r[2] - 1
local dist_bottom = height - r[2]
local dist = math.min(dist_left, dist_right, dist_top, dist_bottom)

local rating = - dist

-- If we can reach the edge, we do so
if (dist == 0) then rating = rating + 1000 end

local enemy_weight = 0.5
local enemy_rating = - (enemy_attack_map.units:get(r[1], r[2]) or 0) * enemy_weight

local enemy_rating = 0
for k,e in ipairs(enemies) do
local dist = H.distance_between(r[1], r[2], e.x, e.y)
enemy_rating = enemy_rating + math.sqrt(dist)
end

rating = rating + enemy_rating

-- Also, maximize distance from own units that have already moved
local own_unit_weight = 0.5
local own_unit_rating = 0
for k,u_noMP in ipairs(units_noMP) do
local dist = H.distance_between(r[1], r[2], u_noMP.x, u_noMP.y)
own_unit_rating = own_unit_rating + math.sqrt(dist)
end

rating = rating + own_unit_rating * own_unit_weight

--rating_map:insert(r[1], r[2], rating)

if (rating > max_rating) then
best_hex = { r[1], r[2] }
best_unit = u
max_rating = rating
end
end
end

--AH.put_labels(rating_map)
end
--print(best_unit.id, best_unit.x, best_unit.y, best_hex[1], best_hex[2], max_rating)

if best_hex then
AH.movefull_outofway_stopunit(ai, best_unit, best_hex[1], best_hex[2])
else
ai.stopunit_moves(best_unit)
end
end

return ca_ogres_flee

0 comments on commit bd3061e

Please sign in to comment.