Project

General

Profile

Feature #591 ยป 0090-Lua-Add-edit.unit_add_movepoints.patch

Marko Lindqvist, 05/13/2024 01:22 AM

View differences:

server/scripting/api_server_edit.c
return TRUE;
}
/**********************************************************************//**
Change unit move points.
**************************************************************************/
void api_edit_unit_movepoints(lua_State *L, Unit *self, int change)
{
bool was_exhausted = FALSE;
LUASCRIPT_CHECK_STATE(L);
LUASCRIPT_CHECK_ARG_NIL(L, self, 2, Unit);
if (self->moves_left == 0 && self->done_moving) {
was_exhausted = TRUE;
}
self->moves_left += change;
if (self->moves_left <= 0) {
self->moves_left = 0;
} else if (was_exhausted && !unit_has_orders(self)) {
/* Unit has regained ability to move. */
self->done_moving = FALSE;
}
send_unit_info(NULL, self);
}
/**********************************************************************//**
Change terrain on tile
**************************************************************************/
server/scripting/api_server_edit.h
Player *killer);
bool api_edit_unit_hitpoints(lua_State *L, Unit *self, int change,
const char *reason, Player *killer);
void api_edit_unit_movepoints(lua_State *L, Unit *self, int change);
bool api_edit_change_terrain(lua_State *L, Tile *ptile, Terrain *pterr);
server/scripting/tolua_server.pkg
bool api_edit_unit_hitpoints
@ unit_add_hitpoints(lua_State *L, Unit *self, int change,
const char *reason, Player *killer);
void api_edit_unit_movepoints
@ unit_add_movepoints(lua_State *L, Unit *self, int change);
bool api_edit_change_terrain
@ change_terrain(lua_State *L, Tile *ptile, Terrain *pterr);
bool api_edit_create_city
    (1-1/1)