Project

General

Profile

Feature #1237 ยป 0048-Lua-Add-Plr-has_embassy-and-Plr-has_team_embassy.patch

Marko Lindqvist, 05/17/2025 01:53 AM

View differences:

common/scriptcore/api_game_methods.c
return Qn_(diplstate_type_name(player_diplstate_get(pplayer1, pplayer2)->type));
}
/**********************************************************************//**
Return whether player has an embassy with target player.
**************************************************************************/
bool api_methods_player_has_embassy(lua_State *L, Player *pplayer,
Player *target)
{
LUASCRIPT_CHECK_STATE(L, FALSE);
LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
LUASCRIPT_CHECK_ARG_NIL(L, target, 3, Player, FALSE);
return player_has_embassy(pplayer, target);
}
/**********************************************************************//**
Return whether player's team has an embassy with target player.
**************************************************************************/
bool api_methods_player_has_team_embassy(lua_State *L, Player *pplayer,
Player *target)
{
LUASCRIPT_CHECK_STATE(L, FALSE);
LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
LUASCRIPT_CHECK_ARG_NIL(L, target, 3, Player, FALSE);
return team_has_embassy(pplayer->team, target);
}
/**********************************************************************//**
Return if a unit can upgrade considering where it is now.
If is_free is FALSE, considers local city and the owner's treasury.
common/scriptcore/api_game_methods.h
City *api_methods_player_primary_capital(lua_State *L, Player *pplayer);
const char *api_methods_get_diplstate(lua_State *L, Player *pplayer1, Player *pplayer2);
const char *api_methods_get_diplstate(lua_State *L, Player *pplayer1,
Player *pplayer2);
bool api_methods_player_has_embassy(lua_State *L, Player *pplayer,
Player *target);
bool api_methods_player_has_team_embassy(lua_State *L, Player *pplayer,
Player *target);
/* Tech Type */
const char *api_methods_tech_type_rule_name(lua_State *L, Tech_Type *ptech);
common/scriptcore/tolua_game.pkg
*****************************************************************************/
/*****************************************************************************
ADVERTISEMENT: do not attempt to change the name of the API functions.
ADVERTISEMENT: Do not attempt to change the name of the API functions.
They may be in use in Lua scripts in savefiles, so once released, the
name and signature cannot change shape even in new major versions of
Freeciv, until the relevant save format version can no longer be loaded.
......
const char *api_methods_get_diplstate
@ diplstate(lua_State *L, Player *pplayer1, Player *pplayer2);
bool api_methods_player_has_embassy
@ has_embassy(lua_State *L, Player *pplayer, Player *target);
bool api_methods_player_has_team_embassy
@ has_team_embassy(lua_State *L, Player *pplayer, Player *target);
}
module methods_private {
    (1-1/1)