Feature #1514 ยป 0092-api_game_methods.c-Replace-NULL-with-nullptr.patch
| common/scriptcore/api_game_methods.c | ||
|---|---|---|
|
**************************************************************************/
|
||
|
const char *api_methods_game_year_text(lua_State *L)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
return calendar_text();
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_building_type_rule_name(lua_State *L,
|
||
|
Building_Type *pbuilding)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pbuilding, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pbuilding, nullptr);
|
||
|
return improvement_rule_name(pbuilding);
|
||
|
}
|
||
| ... | ... | |
|
*api_methods_building_type_name_translation(lua_State *L,
|
||
|
Building_Type *pbuilding)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pbuilding, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pbuilding, nullptr);
|
||
|
return improvement_name_translation(pbuilding);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
Tile *api_methods_city_tile_get(lua_State *L, City *pcity)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pcity, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pcity, nullptr);
|
||
|
return pcity->tile;
|
||
|
}
|
||
| ... | ... | |
|
if (inspired) {
|
||
|
/* Cannot use get_city_bonus() as it would use city's current owner
|
||
|
* instead of inspirer. */
|
||
|
return get_target_bonus_effects(NULL,
|
||
|
return get_target_bonus_effects(nullptr,
|
||
|
&(const struct req_context) {
|
||
|
.player = inspirer,
|
||
|
.city = self,
|
||
|
.tile = city_tile(self),
|
||
|
},
|
||
|
NULL, EFT_INSPIRE_PARTISANS);
|
||
|
nullptr, EFT_INSPIRE_PARTISANS);
|
||
|
}
|
||
|
return 0;
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_counter_rule_name(lua_State *L, Counter *c)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, c, 2, Counter, NULL);
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, c, 2, Counter, nullptr);
|
||
|
return counter_rule_name(c);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_counter_name_translation(lua_State *L, Counter *c)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, c, 2, Counter, NULL);
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, c, 2, Counter, nullptr);
|
||
|
return counter_name_translation(c);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_government_rule_name(lua_State *L,
|
||
|
Government *pgovernment)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pgovernment, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pgovernment, nullptr);
|
||
|
return government_rule_name(pgovernment);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_government_name_translation(lua_State *L,
|
||
|
Government *pgovernment)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pgovernment, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pgovernment, nullptr);
|
||
|
return government_name_translation(pgovernment);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_nation_type_rule_name(lua_State *L,
|
||
|
Nation_Type *pnation)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pnation, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pnation, nullptr);
|
||
|
return nation_rule_name(pnation);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_nation_type_name_translation(lua_State *L,
|
||
|
Nation_Type *pnation)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pnation, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pnation, nullptr);
|
||
|
return nation_adjective_translation(pnation);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_nation_type_plural_translation(lua_State *L,
|
||
|
Nation_Type *pnation)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pnation, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pnation, nullptr);
|
||
|
return nation_plural_translation(pnation);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_player_controlling_gui(lua_State *L,
|
||
|
Player *pplayer)
|
||
|
{
|
||
|
struct connection *conn = NULL;
|
||
|
struct connection *conn = nullptr;
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
|
||
|
conn_list_iterate(pplayer->connections, pconn) {
|
||
|
if (!pconn->observer) {
|
||
| ... | ... | |
|
}
|
||
|
} conn_list_iterate_end;
|
||
|
if (conn == NULL) {
|
||
|
if (conn == nullptr) {
|
||
|
return "None";
|
||
|
}
|
||
| ... | ... | |
|
return ptech->cost * (double) game.info.sciencebox / 100.0;
|
||
|
}
|
||
|
return
|
||
|
research_total_bulbs_required(pplayer ? research_get(pplayer) : NULL,
|
||
|
research_total_bulbs_required(pplayer
|
||
|
? research_get(pplayer) : nullptr,
|
||
|
advance_index(ptech), TRUE);
|
||
|
}
|
||
| ... | ... | |
|
Unit_Type *api_methods_player_can_upgrade(lua_State *L, Player *pplayer,
|
||
|
Unit_Type *utype)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, utype, 3, Unit_Type, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, utype, 3, Unit_Type, nullptr);
|
||
|
return (Unit_Type *)can_upgrade_unittype(pplayer, utype);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
City *api_methods_player_primary_capital(lua_State *L, Player *pplayer)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
|
||
|
return player_primary_capital(pplayer);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_get_diplstate(lua_State *L, Player *pplayer1,
|
||
|
Player *pplayer2)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer1, NULL);
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, pplayer2, 3, Player, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer1, nullptr);
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, pplayer2, 3, Player, nullptr);
|
||
|
if (pplayer1 == pplayer2) {
|
||
|
return "Self";
|
||
| ... | ... | |
|
{
|
||
|
enum unit_upgrade_result uu;
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, NULL);
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, ptype, 3, Unit_Type, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, nullptr);
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, ptype, 3, Unit_Type, nullptr);
|
||
|
uu = unit_transform_result(&(wld.map), punit, ptype);
|
||
|
switch (uu) {
|
||
|
case UU_OK:
|
||
|
return NULL;
|
||
|
return nullptr;
|
||
|
case UU_NOT_ENOUGH_ROOM:
|
||
|
return "cargo";
|
||
|
case UU_UNSUITABLE_TRANSPORT:
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_research_rule_name(lua_State *L, Player *pplayer)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
|
||
|
return research_rule_name(research_get(pplayer));
|
||
|
}
|
||
| ... | ... | |
|
{
|
||
|
static char buf[MAX_LEN_MSG];
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
|
||
|
(void) research_pretty_name(research_get(pplayer), buf, ARRAY_SIZE(buf));
|
||
| ... | ... | |
|
Unit_List_Link *api_methods_private_player_unit_list_head(lua_State *L,
|
||
|
Player *pplayer)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
|
||
|
return unit_list_head(pplayer->units);
|
||
|
}
|
||
| ... | ... | |
|
City_List_Link *api_methods_private_player_city_list_head(lua_State *L,
|
||
|
Player *pplayer)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
|
||
|
return city_list_head(pplayer->cities);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_tech_type_rule_name(lua_State *L, Tech_Type *ptech)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptech, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptech, nullptr);
|
||
|
return advance_rule_name(ptech);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_tech_type_name_translation(lua_State *L,
|
||
|
Tech_Type *ptech)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptech, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptech, nullptr);
|
||
|
return advance_name_translation(ptech);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_terrain_rule_name(lua_State *L, Terrain *pterrain)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pterrain, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pterrain, nullptr);
|
||
|
return terrain_rule_name(pterrain);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_terrain_name_translation(lua_State *L,
|
||
|
Terrain *pterrain)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pterrain, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pterrain, nullptr);
|
||
|
return terrain_name_translation(pterrain);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_terrain_class_name(lua_State *L, Terrain *pterrain)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pterrain, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pterrain, nullptr);
|
||
|
return terrain_class_name(terrain_type_terrain_class(pterrain));
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_disaster_rule_name(lua_State *L, Disaster *pdis)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pdis, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pdis, nullptr);
|
||
|
return disaster_rule_name(pdis);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_disaster_name_translation(lua_State *L,
|
||
|
Disaster *pdis)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pdis, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pdis, nullptr);
|
||
|
return disaster_name_translation(pdis);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_achievement_rule_name(lua_State *L,
|
||
|
Achievement *pach)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pach, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pach, nullptr);
|
||
|
return achievement_rule_name(pach);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_achievement_name_translation(lua_State *L,
|
||
|
Achievement *pach)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pach, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pach, nullptr);
|
||
|
return achievement_name_translation(pach);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_action_rule_name(lua_State *L, Action *pact)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pact, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pact, nullptr);
|
||
|
return action_id_rule_name(pact->id);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_action_name_translation(lua_State *L, Action *pact)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pact, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pact, nullptr);
|
||
|
return action_id_name_translation(pact->id);
|
||
|
}
|
||
| ... | ... | |
|
{
|
||
|
struct action *paction;
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pact, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pact, nullptr);
|
||
|
paction = action_by_number(pact->id);
|
||
|
fc_assert_ret_val(paction, "error: no action");
|
||
| ... | ... | |
|
}
|
||
|
/**********************************************************************//**
|
||
|
Return City on ptile, else NULL
|
||
|
Return City on ptile, else nullptr
|
||
|
**************************************************************************/
|
||
|
City *api_methods_tile_city(lua_State *L, Tile *ptile)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptile, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptile, nullptr);
|
||
|
return tile_city(ptile);
|
||
|
}
|
||
| ... | ... | |
|
pextra = extra_type_by_rule_name(name);
|
||
|
return (NULL != pextra && tile_has_extra(ptile, pextra));
|
||
|
return (pextra != nullptr && tile_has_extra(ptile, pextra));
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
pextra = extra_type_by_rule_name(name);
|
||
|
return (NULL != pextra && is_extra_caused_by(pextra, EC_BASE)
|
||
|
return (pextra != nullptr && is_extra_caused_by(pextra, EC_BASE)
|
||
|
&& tile_has_extra(ptile, pextra));
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
pextra = extra_type_by_rule_name(name);
|
||
|
return (NULL != pextra && is_extra_caused_by(pextra, EC_ROAD)
|
||
|
return (pextra != nullptr && is_extra_caused_by(pextra, EC_ROAD)
|
||
|
&& tile_has_extra(ptile, pextra));
|
||
|
}
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Return the extra owner for the specified extra on ptile or NULL if the
|
||
|
extra isn't there.
|
||
|
Return the extra owner for the specified extra on ptile or nullptr if
|
||
|
the extra isn't there.
|
||
|
If no name is specified the owner of the first owned extra at the tile
|
||
|
is returned.
|
||
|
**************************************************************************/
|
||
|
Player *api_methods_tile_extra_owner(lua_State *L,
|
||
|
Tile *ptile, const char *extra_name)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptile, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptile, nullptr);
|
||
|
if (extra_name) {
|
||
|
struct extra_type *pextra;
|
||
|
pextra = extra_type_by_rule_name(extra_name);
|
||
|
LUASCRIPT_CHECK_ARG(L, pextra != NULL, 3, "unknown extra type", NULL);
|
||
|
LUASCRIPT_CHECK_ARG(L, pextra != nullptr, 3,
|
||
|
"unknown extra type", nullptr);
|
||
|
if (tile_has_extra(ptile, pextra)) {
|
||
|
/* All extras have the same owner. */
|
||
|
return extra_owner(ptile);
|
||
|
} else {
|
||
|
/* The extra isn't there. */
|
||
|
return NULL;
|
||
|
return nullptr;
|
||
|
}
|
||
|
} else {
|
||
|
extra_type_iterate(pextra) {
|
||
| ... | ... | |
|
return extra_owner(ptile);
|
||
|
}
|
||
|
} extra_type_iterate_end;
|
||
|
return NULL;
|
||
|
return nullptr;
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
}
|
||
|
pcity = tile_city(ptile);
|
||
|
if (pcity != NULL && !pplayers_allied(against, city_owner(pcity))) {
|
||
|
if (pcity != nullptr && !pplayers_allied(against, city_owner(pcity))) {
|
||
|
return TRUE;
|
||
|
}
|
||
| ... | ... | |
|
Unit_List_Link *api_methods_private_tile_unit_list_head(lua_State *L,
|
||
|
Tile *ptile)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptile, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptile, nullptr);
|
||
|
return unit_list_head(ptile->units);
|
||
|
}
|
||
| ... | ... | |
|
{
|
||
|
int newx, newy;
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pstart, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pstart, nullptr);
|
||
|
LUASCRIPT_CHECK_ARG(L,
|
||
|
tindex >= 0 && tindex < MAP_NUM_ITERATE_OUTWARDS_INDICES,
|
||
|
3, "index out of bounds", NULL);
|
||
|
3, "index out of bounds", nullptr);
|
||
|
index_to_map_pos(&newx, &newy, tile_index(pstart));
|
||
|
newx += MAP_ITERATE_OUTWARDS_INDICES[tindex].dx;
|
||
|
newy += MAP_ITERATE_OUTWARDS_INDICES[tindex].dy;
|
||
|
if (!normalize_map_pos(&(wld.map), &newx, &newy)) {
|
||
|
return NULL;
|
||
|
return nullptr;
|
||
|
}
|
||
|
return map_pos_to_tile(&(wld.map), newx, newy);
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
Tile *api_methods_unit_tile_get(lua_State *L, Unit *punit)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, nullptr);
|
||
|
return unit_tile(punit);
|
||
|
}
|
||
| ... | ... | |
|
const Direction *api_methods_unit_orientation_get(lua_State *L,
|
||
|
Unit *punit)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, punit, 2, Unit, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_ARG_NIL(L, punit, 2, Unit, nullptr);
|
||
|
return luascript_dir(punit->facing);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
Unit *api_methods_unit_transporter(lua_State *L, Unit *punit)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, nullptr);
|
||
|
return punit->transporter;
|
||
|
}
|
||
| ... | ... | |
|
Unit_List_Link *api_methods_private_unit_cargo_list_head(lua_State *L,
|
||
|
Unit *punit)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, nullptr);
|
||
|
return unit_list_head(punit->transporting);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_unit_type_rule_name(lua_State *L,
|
||
|
Unit_Type *punit_type)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit_type, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit_type, nullptr);
|
||
|
return utype_rule_name(punit_type);
|
||
|
}
|
||
| ... | ... | |
|
const char *api_methods_unit_type_name_translation(lua_State *L,
|
||
|
Unit_Type *punit_type)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit_type, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit_type, nullptr);
|
||
|
return utype_name_translation(punit_type);
|
||
|
}
|
||
| ... | ... | |
|
Unit *api_methods_unit_list_link_data(lua_State *L,
|
||
|
Unit_List_Link *ul_link)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
return unit_list_link_data(ul_link);
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Return next list link or NULL when link is the last link
|
||
|
Return next list link or nullptr when link is the last link
|
||
|
**************************************************************************/
|
||
|
Unit_List_Link *api_methods_unit_list_next_link(lua_State *L,
|
||
|
Unit_List_Link *ul_link)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
return unit_list_link_next(ul_link);
|
||
|
}
|
||
| ... | ... | |
|
City *api_methods_city_list_link_data(lua_State *L,
|
||
|
City_List_Link *cl_link)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
return city_list_link_data(cl_link);
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Return next list link or NULL when link is the last link
|
||
|
Return next list link or nullptr when link is the last link
|
||
|
**************************************************************************/
|
||
|
City_List_Link *api_methods_city_list_next_link(lua_State *L,
|
||
|
City_List_Link *cl_link)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
return city_list_link_next(cl_link);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_tile_link(lua_State *L, Tile *ptile)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptile, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, ptile, nullptr);
|
||
|
return tile_link(ptile);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_unit_tile_link(lua_State *L, Unit *punit)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, nullptr);
|
||
|
return unit_tile_link(punit);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_city_tile_link(lua_State *L, City *pcity)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pcity, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pcity, nullptr);
|
||
|
return city_tile_link(pcity);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_unit_link(lua_State *L, Unit *punit)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, punit, nullptr);
|
||
|
return unit_link(punit);
|
||
|
}
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
const char *api_methods_city_link(lua_State *L, City *pcity)
|
||
|
{
|
||
|
LUASCRIPT_CHECK_STATE(L, NULL);
|
||
|
LUASCRIPT_CHECK_SELF(L, pcity, NULL);
|
||
|
LUASCRIPT_CHECK_STATE(L, nullptr);
|
||
|
LUASCRIPT_CHECK_SELF(L, pcity, nullptr);
|
||
|
return city_link(pcity);
|
||
|
}
|
||