Removed never used argument.
This commit is contained in:
parent
8234e9604b
commit
0684992511
3 changed files with 23 additions and 23 deletions
|
@ -6,8 +6,8 @@ init = function(ai)
|
|||
--! ===========================
|
||||
|
||||
--! say hello to player via a message
|
||||
function ai:say_hello()
|
||||
wesnoth.message(string.format("Hello from Lua AI which controls side %d! It's turn %d.", self.side, wesnoth.current.turn ))
|
||||
function ai.say_hello()
|
||||
wesnoth.message(string.format("Hello from Lua AI which controls side %d! It's turn %d.", ai.side, wesnoth.current.turn))
|
||||
end
|
||||
|
||||
--! ===========================
|
||||
|
|
|
@ -206,30 +206,30 @@ local ai_stdlib = wesnoth.require('ai/lua/stdlib.lua');
|
|||
ai_stdlib.init(ai)
|
||||
|
||||
function my_ai:execute()
|
||||
ai:say_hello()
|
||||
ai.say_hello()
|
||||
self:do_moves()
|
||||
end
|
||||
|
||||
function my_ai:do_moves()
|
||||
my_leader = wesnoth.get_units( {canrecruit="yes", side=ai.side})[1]
|
||||
my_leader = wesnoth.get_units({canrecruit = true, side = ai.side})[1]
|
||||
--! move (partial move)
|
||||
ai:move(my_leader,13, 22)
|
||||
ai.move(my_leader,13, 22)
|
||||
--! full move. note that the my_leader still can be used altrough x and y are now different.
|
||||
ai:move_full(my_leader, 11, 23)
|
||||
ai.move_full(my_leader, 11, 23)
|
||||
|
||||
--! attack with auto weapon/aggression
|
||||
ai:attack(2,12,3,12)
|
||||
ai.attack(2, 12, 3, 12)
|
||||
--! attack with weapon selected
|
||||
ai:attack(3,11,3,12,1)
|
||||
ai.attack(3, 11, 3, 12, 1)
|
||||
--! attack with different aggression
|
||||
ai:attack(3,13,3,12,-1,0.9)
|
||||
ai.attack(3, 13, 3, 12, -1, 0.9)
|
||||
if wesnoth.current.turn==1 then
|
||||
--! recruit on specific location
|
||||
ai:recruit("Vampire Bat", 10, 22)
|
||||
ai.recruit("Vampire Bat", 10, 22)
|
||||
--! recruit on any suitable location
|
||||
ai:recruit("Skeleton")
|
||||
ai.recruit("Skeleton")
|
||||
--! recall on any suitable location.
|
||||
ai:recall("Kiressh")
|
||||
ai.recall("Kiressh")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2171,7 +2171,7 @@ static bool to_map_location(lua_State *L, int &index, map_location &res)
|
|||
|
||||
static int impl_ai_execute_move(lua_State *L, bool remove_movement)
|
||||
{
|
||||
int index = 2;
|
||||
int index = 1;
|
||||
if (false) {
|
||||
error_call_destructors:
|
||||
return luaL_typerror(L, index, "location (unit/integers)");
|
||||
|
@ -2200,7 +2200,7 @@ static int impl_ai_execute_move_partial(lua_State *L)
|
|||
|
||||
static int impl_ai_execute_attack(lua_State *L)
|
||||
{
|
||||
int index = 2;
|
||||
int index = 1;
|
||||
if (false) {
|
||||
error_call_destructors:
|
||||
return luaL_typerror(L, index, "location (unit/integers)");
|
||||
|
@ -2229,7 +2229,7 @@ static int impl_ai_execute_attack(lua_State *L)
|
|||
|
||||
static int impl_ai_execute_stopunit_select(lua_State *L, bool remove_movement, bool remove_attacks)
|
||||
{
|
||||
int index = 2;
|
||||
int index = 1;
|
||||
if (false) {
|
||||
error_call_destructors:
|
||||
return luaL_typerror(L, index, "location (unit/integers)");
|
||||
|
@ -2262,12 +2262,12 @@ static int impl_ai_execute_stopunit_all(lua_State *L)
|
|||
|
||||
static int impl_ai_execute_recruit(lua_State *L)
|
||||
{
|
||||
const char *unit_name = luaL_checkstring(L,2);
|
||||
const char *unit_name = luaL_checkstring(L, 1);
|
||||
int side = lua_tointeger(L,lua_upvalueindex(1));
|
||||
map_location where;
|
||||
if (!lua_isnoneornil(L, 3)) {
|
||||
where.x = lua_tonumber(L, 3) - 1;
|
||||
where.y = lua_tonumber(L, 4) - 1;
|
||||
if (!lua_isnoneornil(L, 2)) {
|
||||
where.x = lua_tonumber(L, 2) - 1;
|
||||
where.y = lua_tonumber(L, 3) - 1;
|
||||
}
|
||||
|
||||
ai::recruit_result_ptr recruit_result = ai::actions::execute_recruit_action(side,true,std::string(unit_name),where);
|
||||
|
@ -2277,12 +2277,12 @@ static int impl_ai_execute_recruit(lua_State *L)
|
|||
|
||||
static int impl_ai_execute_recall(lua_State *L)
|
||||
{
|
||||
const char *unit_id = luaL_checkstring(L,2);
|
||||
const char *unit_id = luaL_checkstring(L, 1);
|
||||
int side = lua_tointeger(L,lua_upvalueindex(1));
|
||||
map_location where;
|
||||
if (!lua_isnoneornil(L, 3)) {
|
||||
where.x = lua_tonumber(L, 3) - 1;
|
||||
where.y = lua_tonumber(L, 4) - 1;
|
||||
if (!lua_isnoneornil(L, 2)) {
|
||||
where.x = lua_tonumber(L, 2) - 1;
|
||||
where.y = lua_tonumber(L, 3) - 1;
|
||||
}
|
||||
|
||||
ai::recall_result_ptr recall_result = ai::actions::execute_recall_action(side,true,std::string(unit_id),where);
|
||||
|
|
Loading…
Add table
Reference in a new issue