Freeciv-3.1
Loading...
Searching...
No Matches
api_game_methods.h
Go to the documentation of this file.
1/*****************************************************************************
2 Freeciv - Copyright (C) 2005 - The Freeciv Project
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*****************************************************************************/
13
14#ifndef FC__API_GAME_METHODS_H
15#define FC__API_GAME_METHODS_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
21/* common/scriptcore */
22#include "luascript_types.h"
23
24struct lua_State;
25
26/* Game */
27int api_methods_game_turn(lua_State *L);
28int api_methods_game_turn_deprecated(lua_State *L);
29int api_methods_game_year(lua_State *L);
30int api_methods_game_year_fragment(lua_State *L);
31const char *api_methods_game_year_text(lua_State *L);
32const char *api_methods_game_rulesetdir(lua_State *L);
33const char *api_methods_game_ruleset_name(lua_State *L);
34
35/* Building Type */
37 Building_Type *pbuilding);
39 Building_Type *pbuilding);
41 Building_Type *pbuilding);
43 Building_Type *pbuilding);
44const char *api_methods_building_type_rule_name(lua_State *L,
45 Building_Type *pbuilding);
46const char *api_methods_building_type_name_translation(lua_State *L,
47 Building_Type *pbuilding);
48
49/* City */
50bool api_methods_city_has_building(lua_State *L, City *pcity,
51 Building_Type *building);
52int api_methods_city_map_sq_radius(lua_State *L, City *pcity);
53int api_methods_city_size_get(lua_State *L, City *pcity);
54Tile *api_methods_city_tile_get(lua_State *L, City *pcity);
55int api_methods_city_inspire_partisans(lua_State *L, City *self, Player *inspirer);
56
57int api_methods_city_culture_get(lua_State *L, City *pcity);
58
59bool api_methods_is_city_happy(lua_State *L, City *pcity);
60bool api_methods_is_city_unhappy(lua_State *L, City *pcity);
61bool api_methods_is_city_celebrating(lua_State *L, City *pcity);
62bool api_methods_is_gov_center(lua_State *L, City *pcity);
63bool api_methods_is_capital(lua_State *L, City *pcity);
64bool api_methods_is_primary_capital(lua_State *L, City *pcity);
65
66/* Government */
67const char *api_methods_government_rule_name(lua_State *L,
68 Government *pgovernment);
69const char *api_methods_government_name_translation(lua_State *L,
70 Government *pgovernment);
71
72/* Nation */
73const char *api_methods_nation_type_rule_name(lua_State *L,
74 Nation_Type *pnation);
75const char *api_methods_nation_type_name_translation(lua_State *L,
76 Nation_Type *pnation);
77const char *api_methods_nation_type_plural_translation(lua_State *L,
78 Nation_Type *pnation);
79
80/* Player */
81const char *api_methods_player_controlling_gui(lua_State *L, Player *pplayer);
82bool api_methods_player_has_wonder(lua_State *L, Player *pplayer,
83 Building_Type *building);
84int api_methods_player_number(lua_State *L, Player *pplayer);
85int api_methods_player_num_cities(lua_State *L, Player *pplayer);
86int api_methods_player_num_units(lua_State *L, Player *pplayer);
87int api_methods_player_gold(lua_State *L, Player *pplayer);
88bool api_methods_player_knows_tech(lua_State *L, Player *pplayer,
89 Tech_Type *ptech);
90bool api_methods_player_shares_research(lua_State *L, Player *pplayer,
91 Player *aplayer);
92const char *api_methods_research_rule_name(lua_State *L, Player *pplayer);
93const char *api_methods_research_name_translation(lua_State *L, Player *pplayer);
94lua_Object api_methods_private_list_players(lua_State *L);
96 Player *pplayer);
98 Player *pplayer);
99int api_methods_player_culture_get(lua_State *L, Player *pplayer);
100
101bool api_methods_player_has_flag(lua_State *L, Player *pplayer, const char *flag);
102Unit_Type *api_methods_player_can_upgrade(lua_State *L, Player *pplayer,
103 Unit_Type *utype);
104bool api_methods_player_can_build_unit_direct(lua_State *L, Player *pplayer,
105 Unit_Type *utype);
106bool api_methods_player_can_build_impr_direct(lua_State *L, Player *pplayer,
107 Building_Type *itype);
108
109/* Tech Type */
110const char *api_methods_tech_type_rule_name(lua_State *L, Tech_Type *ptech);
111const char *api_methods_tech_type_name_translation(lua_State *L, Tech_Type *ptech);
112
113/* Terrain */
114const char *api_methods_terrain_rule_name(lua_State *L, Terrain *pterrain);
115const char *api_methods_terrain_name_translation(lua_State *L, Terrain *pterrain);
116const char *api_methods_terrain_class_name(lua_State *L, Terrain *pterrain);
117
118/* Disaster */
119const char *api_methods_disaster_rule_name(lua_State *L, Disaster *pdis);
120const char *api_methods_disaster_name_translation(lua_State *L,
121 Disaster *pdis);
122
123/* Achievement */
124const char *api_methods_achievement_rule_name(lua_State *L, Achievement *pach);
125const char *api_methods_achievement_name_translation(lua_State *L,
126 Achievement *pach);
127
128/* Action */
129const char *api_methods_action_rule_name(lua_State *L, Action *pact);
130const char *api_methods_action_name_translation(lua_State *L,
131 Action *pact);
132const char *api_methods_action_target_kind(lua_State *L, Action *pact);
133
134/* Tile */
135int api_methods_tile_nat_x(lua_State *L, Tile *ptile);
136int api_methods_tile_nat_y(lua_State *L, Tile *ptile);
137int api_methods_tile_map_x(lua_State *L, Tile *ptile);
138int api_methods_tile_map_y(lua_State *L, Tile *ptile);
139City *api_methods_tile_city(lua_State *L, Tile *ptile);
141 Tile *ptile,
142 bool may_be_on_center);
143bool api_methods_tile_has_extra(lua_State *L, Tile *ptile, const char *name);
144bool api_methods_tile_has_base(lua_State *L, Tile *ptile, const char *name);
145bool api_methods_tile_has_road(lua_State *L, Tile *ptile, const char *name);
147 Tile *ptile, const char *extra_name);
148bool api_methods_enemy_tile(lua_State *L, Tile *ptile, Player *against);
149int api_methods_tile_num_units(lua_State *L, Tile *ptile);
150int api_methods_tile_sq_distance(lua_State *L, Tile *ptile1, Tile *ptile2);
151int api_methods_private_tile_next_outward_index(lua_State *L, Tile *pstart,
152 int tindex, int max_dist);
154 int tindex);
156 Tile *ptile);
157
158/* Unit */
160Tile *api_methods_unit_tile_get(lua_State *L, Unit * punit);
164 Unit *punit);
165bool api_methods_unit_can_upgrade(lua_State *L, Unit *punit, bool is_free);
166const char *api_methods_unit_transform_problem(lua_State *L, Unit *punit,
167 Unit_Type *ptype);
168
169/* Unit Type */
170bool api_methods_unit_type_has_flag(lua_State *L, Unit_Type *punit_type,
171 const char *flag);
172bool api_methods_unit_type_has_role(lua_State *L, Unit_Type *punit_type,
173 const char *role);
175 Unit_Type *punit_type,
176 Tile *ptile);
177const char *api_methods_unit_type_rule_name(lua_State *L,
178 Unit_Type *punit_type);
179const char *api_methods_unit_type_name_translation(lua_State *L,
180 Unit_Type *punit_type);
181
182/* Unit_List_Link Type */
185 Unit_List_Link *link);
186
187/* City_List_Link Type */
190 City_List_Link *link);
191
192/* Featured text */
193const char *api_methods_tile_link(lua_State *L, Tile *ptile);
194const char *api_methods_unit_link(lua_State *L, Unit *punit);
195const char *api_methods_unit_tile_link(lua_State *L, Unit *punit);
196const char *api_methods_city_link(lua_State *L, City *pcity);
197const char *api_methods_city_tile_link(lua_State *L, City *pcity);
198
199#ifdef __cplusplus
200}
201#endif /* __cplusplus */
202
203#endif /* FC__API_GAME_METHODS_H */
int api_methods_tile_nat_x(lua_State *L, Tile *ptile)
int api_methods_tile_num_units(lua_State *L, Tile *ptile)
bool api_methods_is_city_unhappy(lua_State *L, City *pcity)
bool api_methods_is_gov_center(lua_State *L, City *pcity)
const char * api_methods_game_rulesetdir(lua_State *L)
bool api_methods_unit_type_can_exist_at_tile(lua_State *L, Unit_Type *punit_type, Tile *ptile)
int api_methods_player_num_cities(lua_State *L, Player *pplayer)
bool api_methods_unit_can_upgrade(lua_State *L, Unit *punit, bool is_free)
bool api_methods_player_has_wonder(lua_State *L, Player *pplayer, Building_Type *building)
const char * api_methods_nation_type_plural_translation(lua_State *L, Nation_Type *pnation)
Unit * api_methods_unit_list_link_data(lua_State *L, Unit_List_Link *link)
const char * api_methods_disaster_name_translation(lua_State *L, Disaster *pdis)
int api_methods_tile_nat_y(lua_State *L, Tile *ptile)
City_List_Link * api_methods_city_list_next_link(lua_State *L, City_List_Link *link)
Unit_List_Link * api_methods_private_tile_unit_list_head(lua_State *L, Tile *ptile)
int api_methods_game_year_fragment(lua_State *L)
int api_methods_city_culture_get(lua_State *L, City *pcity)
const char * api_methods_unit_type_name_translation(lua_State *L, Unit_Type *punit_type)
const char * api_methods_game_ruleset_name(lua_State *L)
const char * api_methods_building_type_rule_name(lua_State *L, Building_Type *pbuilding)
const char * api_methods_unit_tile_link(lua_State *L, Unit *punit)
bool api_methods_player_can_build_impr_direct(lua_State *L, Player *pplayer, Building_Type *itype)
int api_methods_player_num_units(lua_State *L, Player *pplayer)
const char * api_methods_tech_type_rule_name(lua_State *L, Tech_Type *ptech)
int api_methods_tile_map_x(lua_State *L, Tile *ptile)
bool api_methods_is_city_happy(lua_State *L, City *pcity)
const char * api_methods_achievement_rule_name(lua_State *L, Achievement *pach)
Unit_Type * api_methods_player_can_upgrade(lua_State *L, Player *pplayer, Unit_Type *utype)
const char * api_methods_city_link(lua_State *L, City *pcity)
const char * api_methods_nation_type_name_translation(lua_State *L, Nation_Type *pnation)
const char * api_methods_government_rule_name(lua_State *L, Government *pgovernment)
const char * api_methods_terrain_rule_name(lua_State *L, Terrain *pterrain)
int api_methods_player_number(lua_State *L, Player *pplayer)
Unit_List_Link * api_methods_private_unit_cargo_list_head(lua_State *L, Unit *punit)
const char * api_methods_player_controlling_gui(lua_State *L, Player *pplayer)
const char * api_methods_action_name_translation(lua_State *L, Action *pact)
const char * api_methods_terrain_class_name(lua_State *L, Terrain *pterrain)
bool api_methods_player_shares_research(lua_State *L, Player *pplayer, Player *aplayer)
const char * api_methods_tech_type_name_translation(lua_State *L, Tech_Type *ptech)
Player * api_methods_tile_extra_owner(lua_State *L, Tile *ptile, const char *extra_name)
int api_methods_city_size_get(lua_State *L, City *pcity)
City * api_methods_city_list_link_data(lua_State *L, City_List_Link *link)
City * api_methods_tile_city(lua_State *L, Tile *ptile)
const char * api_methods_government_name_translation(lua_State *L, Government *pgovernment)
bool api_methods_tile_has_extra(lua_State *L, Tile *ptile, const char *name)
int api_methods_tile_sq_distance(lua_State *L, Tile *ptile1, Tile *ptile2)
bool api_methods_unit_type_has_role(lua_State *L, Unit_Type *punit_type, const char *role)
const char * api_methods_tile_link(lua_State *L, Tile *ptile)
int api_methods_player_culture_get(lua_State *L, Player *pplayer)
int api_methods_game_turn_deprecated(lua_State *L)
const char * api_methods_achievement_name_translation(lua_State *L, Achievement *pach)
bool api_methods_building_type_is_great_wonder(lua_State *L, Building_Type *pbuilding)
const char * api_methods_city_tile_link(lua_State *L, City *pcity)
int api_methods_private_tile_next_outward_index(lua_State *L, Tile *pstart, int tindex, int max_dist)
Tile * api_methods_unit_tile_get(lua_State *L, Unit *punit)
bool api_methods_tile_has_road(lua_State *L, Tile *ptile, const char *name)
const char * api_methods_nation_type_rule_name(lua_State *L, Nation_Type *pnation)
const Direction * api_methods_unit_orientation_get(lua_State *L, Unit *punit)
int api_methods_game_turn(lua_State *L)
bool api_methods_player_knows_tech(lua_State *L, Player *pplayer, Tech_Type *ptech)
bool api_methods_enemy_tile(lua_State *L, Tile *ptile, Player *against)
bool api_methods_building_type_is_small_wonder(lua_State *L, Building_Type *pbuilding)
int api_methods_game_year(lua_State *L)
Tile * api_methods_private_tile_for_outward_index(lua_State *L, Tile *pstart, int tindex)
const char * api_methods_game_year_text(lua_State *L)
const char * api_methods_action_rule_name(lua_State *L, Action *pact)
const char * api_methods_disaster_rule_name(lua_State *L, Disaster *pdis)
const char * api_methods_building_type_name_translation(lua_State *L, Building_Type *pbuilding)
bool api_methods_building_type_is_wonder(lua_State *L, Building_Type *pbuilding)
const char * api_methods_research_name_translation(lua_State *L, Player *pplayer)
int api_methods_city_inspire_partisans(lua_State *L, City *self, Player *inspirer)
int api_methods_city_map_sq_radius(lua_State *L, City *pcity)
bool api_methods_city_has_building(lua_State *L, City *pcity, Building_Type *building)
Unit_List_Link * api_methods_unit_list_next_link(lua_State *L, Unit_List_Link *link)
const char * api_methods_unit_transform_problem(lua_State *L, Unit *punit, Unit_Type *ptype)
bool api_methods_unit_type_has_flag(lua_State *L, Unit_Type *punit_type, const char *flag)
const char * api_methods_unit_type_rule_name(lua_State *L, Unit_Type *punit_type)
bool api_methods_building_type_is_improvement(lua_State *L, Building_Type *pbuilding)
bool api_methods_tile_city_exists_within_max_city_map(lua_State *L, Tile *ptile, bool may_be_on_center)
bool api_methods_player_has_flag(lua_State *L, Player *pplayer, const char *flag)
lua_Object api_methods_private_list_players(lua_State *L)
bool api_methods_unit_city_can_be_built_here(lua_State *L, Unit *punit)
bool api_methods_tile_has_base(lua_State *L, Tile *ptile, const char *name)
int api_methods_player_gold(lua_State *L, Player *pplayer)
const char * api_methods_research_rule_name(lua_State *L, Player *pplayer)
bool api_methods_is_primary_capital(lua_State *L, City *pcity)
int api_methods_tile_map_y(lua_State *L, Tile *ptile)
Unit_List_Link * api_methods_private_player_unit_list_head(lua_State *L, Player *pplayer)
const char * api_methods_action_target_kind(lua_State *L, Action *pact)
City_List_Link * api_methods_private_player_city_list_head(lua_State *L, Player *pplayer)
const char * api_methods_terrain_name_translation(lua_State *L, Terrain *pterrain)
Tile * api_methods_city_tile_get(lua_State *L, City *pcity)
const char * api_methods_unit_link(lua_State *L, Unit *punit)
bool api_methods_is_city_celebrating(lua_State *L, City *pcity)
bool api_methods_is_capital(lua_State *L, City *pcity)
bool api_methods_player_can_build_unit_direct(lua_State *L, Player *pplayer, Unit_Type *utype)
Unit * api_methods_unit_transporter(lua_State *L, Unit *punit)
static struct ai_type * self
Definition classicai.c:46
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:73
const char * name
Definition inputfile.c:127
const struct city_list_link City_List_Link
enum direction8 Direction
const struct unit_list_link Unit_List_Link
Definition city.h:309
Definition tile.h:49
Definition unit.h:138