Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wesnoth/wesnoth
Browse files Browse the repository at this point in the history
  • Loading branch information
AI0867 committed Feb 28, 2014
2 parents 1c528a7 + 910f8c9 commit d3efb49
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
5 changes: 5 additions & 0 deletions changelog
@@ -1,6 +1,11 @@
Version 1.11.10+dev:
* Add-ons server:
* Filenames with whitespace in them are no longer allowed.
* AI:
* Non-default multiplayer and Micro AIs:
* Fixed bugs which could lead to the AIs being disabled for the rest of the
turn if WML events removed or changed units during the AI turn
* Improved error reporting of invalid AI actions
* Campaigns:
* Eastern Invasion:
* Updated maps for scenario 8, 11, 12, 14, 16 and 17a.
Expand Down
2 changes: 1 addition & 1 deletion data/ai/lua/generic_recruit_engine.lua
Expand Up @@ -559,7 +559,7 @@ return {
until recruit_type ~= nil

if wesnoth.unit_types[recruit_type].cost <= wesnoth.sides[wesnoth.current.side].gold then
ai.recruit(recruit_type, recruit_data.recruit.best_hex[1], recruit_data.recruit.best_hex[2])
AH.checked_recruit(ai, recruit_type, recruit_data.recruit.best_hex[1], recruit_data.recruit.best_hex[2])

-- If the recruited unit cannot reach the target hex, return it to the pool of targets
if recruit_data.recruit.target_hex ~= nil and recruit_data.recruit.target_hex[1] ~= nil then
Expand Down
8 changes: 5 additions & 3 deletions data/ai/lua/generic_rush_engine.lua
Expand Up @@ -254,7 +254,7 @@ return {
if AH.print_exec() then print_time(' Executing castle_switch CA') end
if AH.show_messages() then W.message { speaker = leader.id, message = 'Switching castles' } end

ai.move(leader, self.data.leader_target[1], self.data.leader_target[2])
AH.checked_move(ai, leader, self.data.leader_target[1], self.data.leader_target[2])
self.data.leader_target = nil
end

Expand Down Expand Up @@ -493,12 +493,14 @@ return {
local defender = wesnoth.get_unit(self.data.attack.target.x, self.data.attack.target.y)

AH.movefull_stopunit(ai, attacker, self.data.attack.dst.x, self.data.attack.dst.y)
if (not attacker) or (not attacker.valid) then return end
if (not defender) or (not defender.valid) then return end

-- Find the poison weapon
-- If several attacks have poison, this will always find the last one
local is_poisoner, poison_weapon = AH.has_weapon_special(attacker, "poison")

ai.attack(attacker, defender, poison_weapon)
AH.checked_attack(ai, attacker, defender, poison_weapon)

self.data.attack = nil
end
Expand Down Expand Up @@ -604,7 +606,7 @@ return {
if target then
local x, y = wesnoth.find_vacant_tile(target[1], target[2], unit)
local dest = AH.next_hop(unit, x, y)
ai.move(unit, dest[1], dest[2])
AH.checked_move(ai, unit, dest[1], dest[2])
end
end

Expand Down
2 changes: 1 addition & 1 deletion data/ai/lua/move_to_any_target.lua
Expand Up @@ -44,7 +44,7 @@ return {
end

function move_to_any_target:move_to_enemy_exec()
ai.move(self.data.unit, self.data.destination[1], self.data.destination[2])
AH.checked_move(ai, self.data.unit, self.data.destination[1], self.data.destination[2])
end

return move_to_any_target
Expand Down
10 changes: 5 additions & 5 deletions src/ai/configuration.cpp
Expand Up @@ -402,7 +402,7 @@ bool configuration::upgrade_side_config_from_1_07_02_to_1_07_03(side_number side


BOOST_FOREACH(const config &aitarget, aiparam.child_range("target")) {
lg::wml_error << deprecate_wml_key_warning("target", "1.12.0") << "\n";
lg::wml_error << deprecate_wml_key_warning("target", "1.13.0") << "\n";
config aigoal;
transfer_turns_and_time_of_day_data(aiparam,aigoal);

Expand All @@ -421,15 +421,15 @@ bool configuration::upgrade_side_config_from_1_07_02_to_1_07_03(side_number side


BOOST_FOREACH(config &ai_protect_unit, aiparam.child_range("protect_unit")) {
lg::wml_error << deprecate_wml_key_warning("protect_unit", "1.12.0") << "\n";
lg::wml_error << deprecate_wml_key_warning("protect_unit", "1.13.0") << "\n";
transfer_turns_and_time_of_day_data(aiparam,ai_protect_unit);
upgrade_protect_goal_config_from_1_07_02_to_1_07_03(side,ai_protect_unit,parsed_cfg,true);
}
aiparam.clear_children("protect_unit");


BOOST_FOREACH(config &ai_protect_location, aiparam.child_range("protect_location")) {
lg::wml_error << deprecate_wml_key_warning("protect_location", "1.12.0") << "\n";
lg::wml_error << deprecate_wml_key_warning("protect_location", "1.13.0") << "\n";
transfer_turns_and_time_of_day_data(aiparam,ai_protect_location);
upgrade_protect_goal_config_from_1_07_02_to_1_07_03(side,ai_protect_location,parsed_cfg,false);
}
Expand All @@ -438,14 +438,14 @@ bool configuration::upgrade_side_config_from_1_07_02_to_1_07_03(side_number side

if (const config::attribute_value *v = aiparam.get("protect_leader"))
{
lg::wml_error << deprecate_wml_key_warning("protect_leader", "1.12.0") << "\n";
lg::wml_error << deprecate_wml_key_warning("protect_leader", "1.13.0") << "\n";
config c;
c["value"] = *v;
c["canrecruit"] = true;
c["side_number"] = side;
transfer_turns_and_time_of_day_data(aiparam,c);
if (const config::attribute_value *v = aiparam.get("protect_leader_radius")) {
lg::wml_error << deprecate_wml_key_warning("protect_leader_radius", "1.12.0") << "\n";
lg::wml_error << deprecate_wml_key_warning("protect_leader_radius", "1.13.0") << "\n";
c["radius"] = *v;
}

Expand Down

0 comments on commit d3efb49

Please sign in to comment.