Feature #856 ยป 0030-Lua-Add-edit.change_citizen_nationality.patch
server/scripting/api_server_edit.c | ||
---|---|---|
#include "rand.h"
|
||
/* common */
|
||
#include "citizens.h"
|
||
#include "map.h"
|
||
#include "movement.h"
|
||
#include "research.h"
|
||
... | ... | |
city_change_size(pcity, city_size_get(pcity) + change, nationality, "script");
|
||
}
|
||
/**********************************************************************//**
|
||
Change nationality of the city citizens.
|
||
**************************************************************************/
|
||
void api_edit_change_citizen_nationality(lua_State *L, City *pcity,
|
||
Player *from, Player *to, int amount)
|
||
{
|
||
LUASCRIPT_CHECK_STATE(L);
|
||
LUASCRIPT_CHECK_ARG_NIL(L, pcity, 2, City);
|
||
LUASCRIPT_CHECK_ARG_NIL(L, from, 3, Player);
|
||
LUASCRIPT_CHECK_ARG_NIL(L, to, 4, Player);
|
||
citizens_nation_move(pcity, from->slot, to->slot, amount);
|
||
}
|
server/scripting/api_server_edit.h | ||
---|---|---|
bool api_edit_create_trade_route(lua_State *L, City *from, City *to);
|
||
void api_edit_change_city_size(lua_State *L, City *pcity, int change, Player *nationality);
|
||
void api_edit_change_citizen_nationality(lua_State *L, City *pcity,
|
||
Player *from, Player *to, int amount);
|
||
#endif /* API_SERVER_EDIT_H */
|
server/scripting/tolua_server.pkg | ||
---|---|---|
void api_edit_change_city_size
|
||
@ change_city_size(lua_State *L, City *pcity, int change, Player *nationality);
|
||
void api_edit_change_citizen_nationality
|
||
@ change_citizen_nationality(lua_State *L, City *pcity,
|
||
Player *from, Player *to, int amount);
|
||
}
|
||
/* Luadata module. */
|
||
... | ... | |
edit.change_city_size(self, change, nationality)
|
||
end
|
||
function City:change_nationality(from, to, amount)
|
||
edit.change_citizen_nationality(self, from, to, amount)
|
||
end
|
||
-- Server functions for Unit module
|
||
function Unit:teleport(dest,
|
||
embark_to, allow_disembark,
|