HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*
Bug #700906 » 30-26-lua-unit-by-flag-2.patch
common/scriptcore/api_game_find.c | ||
---|---|---|
}
|
||
}
|
||
/*************************************************************************//**
|
||
Return a unit type for given flag.
|
||
*****************************************************************************/
|
||
Unit_Type *api_find_flag_unit_type(lua_State *L, const char *flag_name,
|
||
Player *pplayer)
|
||
{
|
||
enum unit_type_flag_id flag;
|
||
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
LUASCRIPT_CHECK_ARG_NIL(L, flag_name, 2, string, NULL);
|
||
flag = unit_type_flag_id_by_name(flag_name, fc_strcasecmp);
|
||
if (!unit_type_flag_id_is_valid(flag)) {
|
||
return NULL;
|
||
}
|
||
if (pplayer) {
|
||
return best_role_unit_for_player(pplayer, flag);
|
||
} else if (num_role_units(flag) > 0) {
|
||
return get_role_unit(flag, 0);
|
||
} else {
|
||
return NULL;
|
||
}
|
||
}
|
||
/*****************************************************************************
|
||
Return a unit type for given role.
|
||
*****************************************************************************/
|
common/scriptcore/api_game_find.h | ||
---|---|---|
const char *name_orig);
|
||
Unit_Type *api_find_unit_type(lua_State *L, int unit_type_id);
|
||
Unit_Type *api_find_unit_type_by_name(lua_State *L, const char *name_orig);
|
||
Unit_Type *api_find_flag_unit_type(lua_State *L, const char *flag_name,
|
||
Player *pplayer);
|
||
Unit_Type *api_find_role_unit_type(lua_State *L, const char *role_name,
|
||
Player *pplayer);
|
||
Tech_Type *api_find_tech_type(lua_State *L, int tech_type_id);
|
common/scriptcore/tolua_game.pkg | ||
---|---|---|
@ unit_type (lua_State *L, const char *name_orig);
|
||
Unit_Type *api_find_unit_type
|
||
@ unit_type (lua_State *L, int unit_type_id);
|
||
Unit_Type *api_find_flag_unit_type
|
||
@ flag_unit_type (lua_State *L, const char *flag_name, Player *pplayer);
|
||
Unit_Type *api_find_role_unit_type
|
||
@ role_unit_type (lua_State *L, const char *role_name, Player *pplayer);
|
||
Tech_Type *api_find_tech_type_by_name
|
data/default/default.lua | ||
---|---|---|
-- Get new city from hut, or settlers (nomads) if terrain is poor.
|
||
function _deflua_hut_get_city(unit)
|
||
local owner = unit.owner
|
||
local settlers = find.role_unit_type('Cities', owner)
|
||
local settlers = find.flag_unit_type('Cities', owner)
|
||
if unit:is_on_possible_city_tile() then
|
||
owner:create_city(unit.tile, "")
|
- « Previous
- 1
- 2
- 3
- 4
- Next »