86 qCWarning(deprecations_category,
87 "Deprecated: lua construct \"game:turn\", deprecated "
88 "since \"3.0\", used. "
89 "Use \"game:current_turn\" instead.");
242 bool inspired =
false;
244 if (!
game.
info.citizen_nationality) {
245 if (
self->original == inspirer) {
249 if (
game.
info.citizen_partisans_pct > 0) {
260 && ((own * 100 / total) >=
game.
info.citizen_partisans_pct)) {
265 }
else if (
self->original == inspirer) {
274 nullptr, inspirer,
nullptr,
self,
nullptr,
city_tile(
self),
nullptr,
275 nullptr,
nullptr,
nullptr,
nullptr, EFT_INSPIRE_PARTISANS);
414 static bool warned =
false;
416 qWarning() <<
"player:controlling_gui is deprecated";
454 return city_list_size(pplayer->
cities);
465 return unit_list_size(pplayer->
units);
511 enum plr_flag_id flag_val;
518 if (plr_flag_id_is_valid(flag_val)) {
573 return unit_list_head(pplayer->
units);
585 return city_list_head(pplayer->
cities);
774 bool may_be_on_center)
894 return unit_list_size(ptile->
units);
906 return unit_list_head(ptile->
units);
914 int tindex,
int max_dist)
961 "index out of bounds",
nullptr);
1047 enum unit_type_flag_id
id;
1054 if (unit_type_flag_id_is_valid(
id)) {
1068 enum unit_role_id
id;
1075 if (unit_role_id_is_valid(
id)) {
1128 return unit_list_link_data(ul_link);
1139 return unit_list_link_next(ul_link);
1149 return city_list_link_data(cl_link);
1160 return city_list_link_next(cl_link);
const char * achievement_rule_name(struct achievement *pach)
Return untranslated name of this achievement type.
const char * achievement_name_translation(struct achievement *pach)
Return translated name of this achievement type.
const QString action_id_name_translation(action_id act_id)
Get the action name used when displaying the action in the UI.
const char * action_id_rule_name(action_id act_id)
Get the rule name of the action.
const char * api_methods_unit_type_rule_name(lua_State *L, Unit_Type *punit_type)
Return rule name for Unit_Type.
int api_methods_tile_nat_x(lua_State *L, Tile *ptile)
Return the native x coordinate of the tile.
int api_methods_tile_num_units(lua_State *L, Tile *ptile)
Return number of units on tile.
bool api_methods_is_city_unhappy(lua_State *L, City *pcity)
Return TRUE iff city is unhappy.
bool api_methods_is_gov_center(lua_State *L, City *pcity)
Return TRUE iff city is government center.
bool api_methods_unit_type_can_exist_at_tile(lua_State *L, Unit_Type *punit_type, Tile *ptile)
Return TRUE iff the unit type can exist on the tile.
int api_methods_player_num_cities(lua_State *L, Player *pplayer)
Return the number of cities pplayer has.
City * api_methods_city_list_link_data(lua_State *L, City_List_Link *cl_link)
Return City for list link.
const char * api_methods_nation_type_name_translation(lua_State *L, Nation_Type *pnation)
Return translated adjective for Nation_Type.
const char * api_methods_achievement_rule_name(lua_State *L, Achievement *pach)
Return rule name for Achievement.
bool api_methods_player_has_wonder(lua_State *L, Player *pplayer, Building_Type *building)
Return TRUE iff player has wonder.
const char * api_methods_terrain_rule_name(lua_State *L, Terrain *pterrain)
Return rule name for Terrain.
Tile * api_methods_unit_tile_get(lua_State *L, Unit *punit)
Return the tile of the unit.
City_List_Link * api_methods_private_player_city_list_head(lua_State *L, Player *pplayer)
Return list head for city list for Player.
const char * api_methods_disaster_rule_name(lua_State *L, Disaster *pdis)
Return rule name for Disaster.
City_List_Link * api_methods_city_list_next_link(lua_State *L, City_List_Link *cl_link)
Return next list link or nullptr when link is the last link.
Unit * api_methods_unit_list_link_data(lua_State *L, Unit_List_Link *ul_link)
Return Unit for list link.
int api_methods_tile_nat_y(lua_State *L, Tile *ptile)
Return the native y coordinate of the tile.
int api_methods_game_year_fragment(lua_State *L)
Return the current year fragment.
int api_methods_city_culture_get(lua_State *L, City *pcity)
How much culture city has?
const char * api_methods_action_rule_name(lua_State *L, Action *pact)
Return rule name for Action.
const char * api_methods_unit_type_name_translation(lua_State *L, Unit_Type *punit_type)
Return translated name for Unit_Type.
Unit_List_Link * api_methods_private_player_unit_list_head(lua_State *L, Player *pplayer)
Return list head for unit list for Player.
int api_methods_player_num_units(lua_State *L, Player *pplayer)
Return the number of units pplayer has.
int api_methods_tile_map_x(lua_State *L, Tile *ptile)
Return the map x coordinate of the tile.
bool api_methods_is_city_happy(lua_State *L, City *pcity)
Return TRUE iff city happy.
City * api_methods_tile_city(lua_State *L, Tile *ptile)
Return City on ptile, else nullptr.
Tile * api_methods_city_tile_get(lua_State *L, City *pcity)
Return the tile of the city.
int api_methods_player_number(lua_State *L, Player *pplayer)
Return player number.
const char * api_methods_government_name_translation(lua_State *L, Government *pgovernment)
Return translated name for Government.
const char * api_methods_government_rule_name(lua_State *L, Government *pgovernment)
Return rule name for Government.
bool api_methods_player_shares_research(lua_State *L, Player *pplayer, Player *aplayer)
Return TRUE if players share research.
int api_methods_city_size_get(lua_State *L, City *pcity)
Return the size of the city.
const char * api_methods_nation_type_plural_translation(lua_State *L, Nation_Type *pnation)
Return translated plural noun for Nation_Type.
Tile * api_methods_private_tile_for_outward_index(lua_State *L, Tile *pstart, int tindex)
Return tile for nth iteration index (for internal use)
bool api_methods_tile_has_extra(lua_State *L, Tile *ptile, const char *name)
Return TRUE if there is a extra with rule name name on ptile.
int api_methods_tile_sq_distance(lua_State *L, Tile *ptile1, Tile *ptile2)
Return squared distance between tiles 1 and 2.
bool api_methods_unit_type_has_role(lua_State *L, Unit_Type *punit_type, const char *role)
Return TRUE if punit_type has role.
const char * api_methods_research_rule_name(lua_State *L, Player *pplayer)
Return name of the research group player belongs to.
const char * api_methods_disaster_name_translation(lua_State *L, Disaster *pdis)
Return translated name for Disaster.
const char * api_methods_research_name_translation(lua_State *L, Player *pplayer)
Return name of the research group player belongs to.
int api_methods_player_culture_get(lua_State *L, Player *pplayer)
How much culture player has?
const char * api_methods_tech_type_rule_name(lua_State *L, Tech_Type *ptech)
Return rule name for Tech_Type.
int api_methods_game_turn_deprecated(lua_State *L)
Return the current turn, as if real turns started from 0.
const char * api_methods_action_name_translation(lua_State *L, Action *pact)
Return translated name for Action.
const char * api_methods_terrain_name_translation(lua_State *L, Terrain *pterrain)
Return translated name for Terrain.
bool api_methods_building_type_is_great_wonder(lua_State *L, Building_Type *pbuilding)
Return TRUE if pbuilding is a great wonder.
int api_methods_private_tile_next_outward_index(lua_State *L, Tile *pstart, int tindex, int max_dist)
Return nth tile iteration index (for internal use) Will return the next index, or an index < 0 when d...
bool api_methods_tile_has_road(lua_State *L, Tile *ptile, const char *name)
Return TRUE if there is a road with rule name name on ptile.
int api_methods_game_turn(lua_State *L)
Return the current turn.
bool api_methods_player_knows_tech(lua_State *L, Player *pplayer, Tech_Type *ptech)
Return TRUE if Player knows advance ptech.
bool api_methods_enemy_tile(lua_State *L, Tile *ptile, Player *against)
Is tile occupied by enemies.
bool api_methods_building_type_is_small_wonder(lua_State *L, Building_Type *pbuilding)
Return TRUE if pbuilding is a small wonder.
int api_methods_game_year(lua_State *L)
Return the current year.
const char * api_methods_building_type_name_translation(lua_State *L, Building_Type *pbuilding)
Return translated name for Building_Type.
bool api_methods_building_type_is_wonder(lua_State *L, Building_Type *pbuilding)
Return TRUE if pbuilding is a wonder.
int api_methods_city_inspire_partisans(lua_State *L, City *self, Player *inspirer)
How much city inspires partisans for a player.
int api_methods_city_map_sq_radius(lua_State *L, City *pcity)
Return the square raduis of the city map.
bool api_methods_city_has_building(lua_State *L, City *pcity, Building_Type *building)
Return TRUE iff city has building.
const char * api_methods_achievement_name_translation(lua_State *L, Achievement *pach)
Return translated name for Achievement.
Unit_List_Link * api_methods_private_unit_cargo_list_head(lua_State *L, Unit *punit)
Return list head for cargo list for Unit.
const char * api_methods_game_ruleset_name(lua_State *L)
Return name of the current ruleset.
bool api_methods_unit_type_has_flag(lua_State *L, Unit_Type *punit_type, const char *flag)
Return TRUE if punit_type has flag.
bool api_methods_building_type_is_improvement(lua_State *L, Building_Type *pbuilding)
Return TRUE if pbuilding is a building.
bool api_methods_tile_city_exists_within_max_city_map(lua_State *L, Tile *ptile, bool may_be_on_center)
Return TRUE if there is a city inside the maximum city radius from ptile.
Unit_List_Link * api_methods_unit_list_next_link(lua_State *L, Unit_List_Link *ul_link)
Return next list link or nullptr when link is the last link.
bool api_methods_player_has_flag(lua_State *L, Player *pplayer, const char *flag)
Does player have flag set?
const Direction * api_methods_unit_orientation_get(lua_State *L, Unit *punit)
Get unit orientation.
bool api_methods_unit_city_can_be_built_here(lua_State *L, Unit *punit)
Can punit found a city on its tile?
Unit_List_Link * api_methods_private_tile_unit_list_head(lua_State *L, Tile *ptile)
Return list head for unit list for Tile.
const char * api_methods_game_year_text(lua_State *L)
Return the current year fragment.
bool api_methods_tile_has_base(lua_State *L, Tile *ptile, const char *name)
Return TRUE if there is a base with rule name name on ptile.
const char * api_methods_game_rulesetdir(lua_State *L)
Return name of the current ruleset.
int api_methods_player_gold(lua_State *L, Player *pplayer)
Return gold for Player.
const char * api_methods_building_type_rule_name(lua_State *L, Building_Type *pbuilding)
Return rule name for Building_Type.
const char * api_methods_player_controlling_gui(lua_State *L, Player *pplayer)
Return gui type string of the controlling connection.
const char * api_methods_tech_type_name_translation(lua_State *L, Tech_Type *ptech)
Return translated name for Tech_Type.
int api_methods_tile_map_y(lua_State *L, Tile *ptile)
Return the map y coordinate of the tile.
Unit * api_methods_unit_transporter(lua_State *L, Unit *punit)
Return Unit that transports punit, if any.
const char * api_methods_nation_type_rule_name(lua_State *L, Nation_Type *pnation)
Return rule name for Nation_Type.
const char * api_methods_terrain_class_name(lua_State *L, Terrain *pterrain)
Return name of the terrain's class.
bool api_methods_is_city_celebrating(lua_State *L, City *pcity)
Return TRUE iff city is celebrating.
bool api_methods_is_capital(lua_State *L, City *pcity)
Return TRUE if city is capital.
const char * calendar_text()
Produce a statically allocated textual representation of the current calendar time.
citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot)
Get the number of citizens with the given nationality.
#define citizens_iterate_end
#define citizens_iterate(_pcity, _pslot, _nationality)
bool city_exists_within_max_city_map(const struct tile *ptile, bool may_be_on_center)
Return TRUE iff a city exists within a city radius of the given location.
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Return TRUE iff the city has this building in it.
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
bool is_capital(const struct city *pcity)
Return TRUE iff this city is its nation's capital.
struct tile * city_tile(const struct city *pcity)
Return the tile location of the city.
bool city_can_be_built_here(const struct tile *ptile, const struct unit *punit)
Returns TRUE if the given unit can build a city at the given map coordinates.
bool city_unhappy(const struct city *pcity)
Return TRUE iff the city is unhappy.
bool city_celebrating(const struct city *pcity)
cities celebrate only after consecutive happy turns
bool city_happy(const struct city *pcity)
Return TRUE iff the city is happy.
int city_map_radius_sq_get(const struct city *pcity)
Returns the current squared radius of the city.
bool is_gov_center(const struct city *pcity)
Return TRUE iff this city is governmental center.
citizens city_size_get(const struct city *pcity)
Get the city size.
static struct ai_type * self
int city_culture(const struct city *pcity)
Return current culture score of the city.
int player_culture(const struct player *plr)
Return current culture score of the player.
const char * disaster_rule_name(struct disaster_type *pdis)
Return untranslated name of this disaster type.
const char * disaster_name_translation(struct disaster_type *pdis)
Return translated name of this disaster type.
int get_target_bonus_effects(struct effect_list *plist, const struct player *target_player, const struct player *other_player, const struct city *target_city, const struct impr_type *target_building, const struct tile *target_tile, const struct unit *target_unit, const struct unit_type *target_unittype, const struct output_type *target_output, const struct specialist *target_specialist, const struct action *target_action, enum effect_type effect_type, enum vision_layer vision_layer, enum national_intelligence nintel)
Returns the effect bonus of a given type for any target.
bool is_server()
Is program type server?
const char * government_rule_name(const struct government *pgovern)
Return the (untranslated) rule name of the government.
const char * government_name_translation(const struct government *pgovern)
Return the (translated) name of the given government.
const char * improvement_rule_name(const struct impr_type *pimprove)
Return the (untranslated) rule name of the improvement.
bool is_improvement(const struct impr_type *pimprove)
Is this building a regular improvement?
bool wonder_is_built(const struct player *pplayer, const struct impr_type *pimprove)
Returns whether the player is currently in possession of this wonder (small or great) and it hasn't b...
bool is_wonder(const struct impr_type *pimprove)
Returns whether improvement is some kind of wonder.
bool is_great_wonder(const struct impr_type *pimprove)
Is this building a great wonder?
const char * improvement_name_translation(const struct impr_type *pimprove)
Return the (translated) name of the given improvement.
bool is_small_wonder(const struct impr_type *pimprove)
Is this building a small wonder?
const Direction * luascript_dir(enum direction8 dir)
Returns a pointer to a given value of enum direction8 (always the same address for the same value),...
int luascript_error(lua_State *L, const char *format,...)
Internal api error function - varg version.
#define LUASCRIPT_CHECK_STATE(L,...)
#define LUASCRIPT_CHECK_SELF(L, value,...)
#define LUASCRIPT_CHECK_ARG_NIL(L, value, narg, type,...)
#define LUASCRIPT_CHECK_ARG(L, check, narg, msg,...)
const struct city_list_link City_List_Link
enum direction8 Direction
const struct unit_list_link Unit_List_Link
int sq_map_distance(const struct tile *tile0, const struct tile *tile1)
Return squared distance between two tiles.
struct tile * map_pos_to_tile(const struct civ_map *nmap, int map_x, int map_y)
Return the tile for the given cartesian (map) position.
bool normalize_map_pos(const struct civ_map *nmap, int *x, int *y)
If the position is real, it will be normalized and TRUE will be returned.
#define index_to_native_pos_y(mindex)
static int index_to_map_pos_y(int mindex)
static int index_to_map_pos_x(int mindex)
#define index_to_native_pos_x(mindex)
#define index_to_map_pos(pmap_x, pmap_y, mindex)
bool can_exist_at_tile(const struct civ_map *nmap, const struct unit_type *utype, const struct tile *ptile)
Return TRUE iff a unit of the given unit type can "exist" at this location.
const char * nation_rule_name(const struct nation_type *pnation)
Return the (untranslated) rule name of the nation (adjective form).
const char * nation_adjective_translation(const struct nation_type *pnation)
Return the (translated) adjective for the given nation.
const char * nation_plural_translation(const struct nation_type *pnation)
Return the (translated) plural noun of the given nation.
int player_number(const struct player *pplayer)
Return the player index/number/id.
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
Check if player has given flag.
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Returns true iff players are allied.
struct research * research_get(const struct player *pplayer)
Returns the research structure associated with the player.
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Returns state of the tech for current research.
const char * research_rule_name(const struct research *presearch)
Returns the name of the research owner: a player name or a team name.
int research_pretty_name(const struct research *presearch, char *buf, size_t buf_len)
Set in 'buf' the name of the research owner.
struct city::@15::@18 client
struct civ_game::@28::@32 server
struct packet_ruleset_control control
struct packet_game_info info
int num_iterate_outwards_indices
struct iter_index * iterate_outwards_indices
struct city_list * cities
struct player_economic economic
struct player_slot * slot
struct unit_list * transporting
struct unit * transporter
int fc_strcasecmp(const char *str0, const char *str1)
Compare strings like strcmp(), but ignoring case.
const char * advance_rule_name(const struct advance *padvance)
Return the (untranslated) rule name of the advance/technology.
Tech_type_id advance_number(const struct advance *padvance)
Return the advance index.
const char * advance_name_translation(const struct advance *padvance)
Return the (translated) name of the given advance/technology.
const char * terrain_rule_name(const struct terrain *pterrain)
Return the (untranslated) rule name of the terrain.
enum terrain_class terrain_type_terrain_class(const struct terrain *pterrain)
What terrain class terrain type belongs to.
const char * terrain_name_translation(const struct terrain *pterrain)
Return the (translated) name of the terrain.
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
#define tile_has_extra(ptile, pextra)
struct unit * is_non_allied_unit_tile(const struct tile *ptile, const struct player *pplayer)
Is there an non-allied unit on this tile?
const char * utype_rule_name(const struct unit_type *punittype)
Return the (untranslated) rule name of the unit type.
bool utype_has_role(const struct unit_type *punittype, int role)
Return whether the given unit type has the role.
const char * utype_name_translation(const struct unit_type *punittype)
Return the (translated) name of the unit type.
static bool utype_has_flag(const struct unit_type *punittype, int flag)