Moved [capture_village] to lua and added support for SLF.

This commit is contained in:
Anonymissimus 2010-09-20 19:01:10 +00:00
parent 4a3bdd4972
commit 6ac2bf0f5e
2 changed files with 10 additions and 11 deletions

View File

@ -497,3 +497,13 @@ function wml_actions.move_unit(cfg)
end
end
end
function wml_actions.capture_village(cfg)
local side = cfg.side
if side then side = tonumber(side) or helper.wml_error("invalid side in [capture_village]") end
local locs = wesnoth.get_locations(cfg)
for i, loc in ipairs(locs) do
wesnoth.set_village_owner(loc[1], loc[2], side)
end
end

View File

@ -2189,17 +2189,6 @@ WML_HANDLER_FUNCTION(store_villages, /*event_info*/, cfg)
varinfo.vars->append(to_store);
}
// Command to take control of a village for a certain side
WML_HANDLER_FUNCTION(capture_village, /*event_info*/, cfg)
{
int side_num = cfg["side"].to_int();
foreach (const map_location &loc, parse_location_range(cfg["x"], cfg["y"])) {
if (resources::game_map->is_village(loc)) {
get_village(loc, side_num);
}
}
}
WML_HANDLER_FUNCTION(end_turn, /*event_info*/, /*cfg*/)
{
resources::controller->force_end_turn();