Freeciv-3.3: /fast/freeciv/nightly/main/common/scriptcore/api_game_methods.c Source File

Freeciv-3.3

Loading...
Searching...
No Matches
api_game_methods.c
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#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* utility */
19#include "deprecations.h"
20
21/* common */
22#include "achievements.h"
23#include "actions.h"
24#include "calendar.h"
25#include "citizens.h"
26#include "culture.h"
27#include "featured_text.h"
28#include "game.h"
29#include "government.h"
30#include "improvement.h"
31#include "map.h"
32#include "movement.h"
33#include "nation.h"
34#include "research.h"
35#include "tech.h"
36#include "terrain.h"
37#include "tile.h"
38#include "unitlist.h"
39#include "unittype.h"
40
41/* common/scriptcore */
42#include "luascript.h"
43
44#include "api_game_methods.h"
45
46
47/**********************************************************************/
50 int api_methods_game_turn(lua_State *L)
51{
52 LUASCRIPT_CHECK_STATE(L, 0);
53
54 return game.info.turn;
55}
56
57/**********************************************************************/
60 int api_methods_game_year(lua_State *L)
61{
62 LUASCRIPT_CHECK_STATE(L, 0);
63
64 return game.info.year;
65}
66
67/**********************************************************************/
70 int api_methods_game_year_fragment(lua_State *L)
71{
72 LUASCRIPT_CHECK_STATE(L, 0);
73
74 return game.info.fragment_count;
75}
76
77/**********************************************************************/
80 const char *api_methods_game_year_text(lua_State *L)
81{
82 LUASCRIPT_CHECK_STATE(L, NULL);
83
84 return calendar_text();
85}
86
87/**********************************************************************/
90 int api_methods_game_turn_deprecated(lua_State *L)
91{
92 LUASCRIPT_CHECK_STATE(L, 0);
93
94 log_deprecation("Deprecated: lua construct \"game:turn\", deprecated since \"3.0\", used. "
95 "Use \"game:current_turn\" instead.");
96
97 if (game.info.turn > 0) {
98 return game.info.turn - 1;
99 }
100
101 return game.info.turn;
102}
103
104/**********************************************************************/
107 const char *api_methods_game_rulesetdir(lua_State *L)
108{
109 return game.server.rulesetdir;
110}
111
112/**********************************************************************/
115 const char *api_methods_game_ruleset_name(lua_State *L)
116{
117 return game.control.name;
118}
119
120/**********************************************************************/
123 const char *api_methods_tech_cost_style(lua_State *L)
124{
125 return tech_cost_style_name(game.info.tech_cost_style);
126}
127
128/**********************************************************************/
131 const char *api_methods_tech_leakage_style(lua_State *L)
132{
133 return tech_leakage_style_name(game.info.tech_leakage);
134}
135
136/**********************************************************************/
139 bool api_methods_building_type_is_wonder(lua_State *L,
140 Building_Type *pbuilding)
141{
142 LUASCRIPT_CHECK_STATE(L, FALSE);
143 LUASCRIPT_CHECK_SELF(L, pbuilding, FALSE);
144
145 return is_wonder(pbuilding);
146}
147
148/**********************************************************************/
151 bool api_methods_building_type_is_great_wonder(lua_State *L,
152 Building_Type *pbuilding)
153{
154 LUASCRIPT_CHECK_STATE(L, FALSE);
155 LUASCRIPT_CHECK_SELF(L, pbuilding, FALSE);
156
157 return is_great_wonder(pbuilding);
158}
159
160/**********************************************************************/
163 bool api_methods_building_type_is_small_wonder(lua_State *L,
164 Building_Type *pbuilding)
165{
166 LUASCRIPT_CHECK_STATE(L, FALSE);
167 LUASCRIPT_CHECK_SELF(L, pbuilding, FALSE);
168
169 return is_small_wonder(pbuilding);
170}
171
172/**********************************************************************/
175 bool api_methods_building_type_is_improvement(lua_State *L,
176 Building_Type *pbuilding)
177{
178 LUASCRIPT_CHECK_STATE(L, FALSE);
179 LUASCRIPT_CHECK_SELF(L, pbuilding, FALSE);
180
181 return is_improvement(pbuilding);
182}
183
184/**********************************************************************/
187 const char *api_methods_building_type_rule_name(lua_State *L,
188 Building_Type *pbuilding)
189{
190 LUASCRIPT_CHECK_STATE(L, NULL);
191 LUASCRIPT_CHECK_SELF(L, pbuilding, NULL);
192
193 return improvement_rule_name(pbuilding);
194}
195
196/**********************************************************************/
199const char
200 *api_methods_building_type_name_translation(lua_State *L,
201 Building_Type *pbuilding)
202{
203 LUASCRIPT_CHECK_STATE(L, NULL);
204 LUASCRIPT_CHECK_SELF(L, pbuilding, NULL);
205
206 return improvement_name_translation(pbuilding);
207}
208
209/**********************************************************************/
212 bool api_methods_city_has_building(lua_State *L, City *pcity,
213 Building_Type *building)
214{
215 LUASCRIPT_CHECK_STATE(L, FALSE);
216 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
217 LUASCRIPT_CHECK_ARG_NIL(L, building, 3, Building_Type, FALSE);
218
219 return city_has_building(pcity, building);
220}
221
222/**********************************************************************/
225 int api_methods_city_map_sq_radius(lua_State *L, City *pcity)
226{
227 LUASCRIPT_CHECK_STATE(L, 0);
228 LUASCRIPT_CHECK_SELF(L, pcity, 0);
229
230 return city_map_radius_sq_get(pcity);
231}
232
233/**********************************************************************/
236 int api_methods_city_size_get(lua_State *L, City *pcity)
237{
238 LUASCRIPT_CHECK_STATE(L, 1);
239 LUASCRIPT_CHECK_SELF(L, pcity, 1);
240
241 return city_size_get(pcity);
242}
243
244/**********************************************************************/
247 Tile *api_methods_city_tile_get(lua_State *L, City *pcity)
248{
249 LUASCRIPT_CHECK_STATE(L, NULL);
250 LUASCRIPT_CHECK_SELF(L, pcity, NULL);
251
252 return pcity->tile;
253}
254
255/**********************************************************************/
258 int api_methods_city_inspire_partisans(lua_State *L, City *self,
259 Player *inspirer)
260{
261 bool inspired = FALSE;
262
263 if (!game.info.citizen_nationality) {
264 if (self->original == inspirer) {
265 inspired = TRUE;
266 }
267 } else {
268 if (game.info.citizen_partisans_pct > 0) {
269 if (is_server()) {
270 citizens own = citizens_nation_get(self, inspirer->slot);
271 citizens total = city_size_get(self);
272
273 if (total > 0 && (own * 100 / total) >= game.info.citizen_partisans_pct) {
274 inspired = TRUE;
275 }
276 }
277 /* else is_client() -> don't consider inspired by default. */
278 } else if (self->original == inspirer) {
279 inspired = TRUE;
280 }
281 }
282
283 if (inspired) {
284 /* Cannot use get_city_bonus() as it would use city's current owner
285 * instead of inspirer. */
286 return get_target_bonus_effects(NULL,
287 &(const struct req_context) {
288 .player = inspirer,
289 .city = self,
290 .tile = city_tile(self),
291 },
292 NULL, EFT_INSPIRE_PARTISANS);
293 }
294
295 return 0;
296}
297
298/**********************************************************************/
301 int api_methods_city_culture_get(lua_State *L, City *pcity)
302{
303 LUASCRIPT_CHECK_STATE(L, 0);
304 LUASCRIPT_CHECK_SELF(L, pcity, 0);
305
306 return city_culture(pcity);
307}
308
309/**********************************************************************/
312 const char *api_methods_counter_rule_name(lua_State *L, Counter *c)
313{
314 LUASCRIPT_CHECK_ARG_NIL(L, c, 2, Counter, NULL);
315
316 return counter_rule_name(c);
317}
318
319/**********************************************************************/
322 const char *api_methods_counter_name_translation(lua_State *L, Counter *c)
323{
324 LUASCRIPT_CHECK_ARG_NIL(L, c, 2, Counter, NULL);
325
326 return counter_name_translation(c);
327}
328
329/**********************************************************************/
332 int api_methods_counter_city_get(lua_State *L, Counter *c, City *city)
333{
334 LUASCRIPT_CHECK_ARG_NIL(L, city, 3, City, -1);
335
336 return city->counter_values[counter_index(c)];
337}
338
339/**********************************************************************/
342 bool api_methods_is_city_happy(lua_State *L, City *pcity)
343{
344 LUASCRIPT_CHECK_STATE(L, FALSE);
345 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
346
347 /* Note: if clients ever have virtual cities or sth, needs amending */
348 return is_server() ? city_happy(pcity) : pcity->client.happy;
349}
350
351/**********************************************************************/
354 bool api_methods_is_city_unhappy(lua_State *L, City *pcity)
355{
356 LUASCRIPT_CHECK_STATE(L, FALSE);
357 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
358
359 /* Note: if clients ever have virtual cities or sth, needs amending */
360 return is_server() ? city_unhappy(pcity) : pcity->client.unhappy;
361}
362
363/**********************************************************************/
366 bool api_methods_is_city_celebrating(lua_State *L, City *pcity)
367{
368 LUASCRIPT_CHECK_STATE(L, FALSE);
369 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
370
371 return city_celebrating(pcity);
372}
373
374/**********************************************************************/
377 bool api_methods_is_gov_center(lua_State *L, City *pcity)
378{
379 LUASCRIPT_CHECK_STATE(L, FALSE);
380 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
381
382 return is_gov_center(pcity);
383}
384
385/**********************************************************************/
388 bool api_methods_is_capital(lua_State *L, City *pcity)
389{
390 LUASCRIPT_CHECK_STATE(L, FALSE);
391 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
392
393 return is_capital(pcity);
394}
395
396/**********************************************************************/
399 bool api_methods_is_primary_capital(lua_State *L, City *pcity)
400{
401 LUASCRIPT_CHECK_STATE(L, FALSE);
402 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
403
404 return pcity->capital == CAPITAL_PRIMARY;
405}
406
407/**********************************************************************/
410 const char *api_methods_government_rule_name(lua_State *L,
411 Government *pgovernment)
412{
413 LUASCRIPT_CHECK_STATE(L, NULL);
414 LUASCRIPT_CHECK_SELF(L, pgovernment, NULL);
415
416 return government_rule_name(pgovernment);
417}
418
419/**********************************************************************/
422 const char *api_methods_government_name_translation(lua_State *L,
423 Government *pgovernment)
424{
425 LUASCRIPT_CHECK_STATE(L, NULL);
426 LUASCRIPT_CHECK_SELF(L, pgovernment, NULL);
427
428 return government_name_translation(pgovernment);
429}
430
431/**********************************************************************/
434 const char *api_methods_nation_type_rule_name(lua_State *L,
435 Nation_Type *pnation)
436{
437 LUASCRIPT_CHECK_STATE(L, NULL);
438 LUASCRIPT_CHECK_SELF(L, pnation, NULL);
439
440 return nation_rule_name(pnation);
441}
442
443/**********************************************************************/
446 const char *api_methods_nation_type_name_translation(lua_State *L,
447 Nation_Type *pnation)
448{
449 LUASCRIPT_CHECK_STATE(L, NULL);
450 LUASCRIPT_CHECK_SELF(L, pnation, NULL);
451
452 return nation_adjective_translation(pnation);
453}
454
455/**********************************************************************/
458 const char *api_methods_nation_type_plural_translation(lua_State *L,
459 Nation_Type *pnation)
460{
461 LUASCRIPT_CHECK_STATE(L, NULL);
462 LUASCRIPT_CHECK_SELF(L, pnation, NULL);
463
464 return nation_plural_translation(pnation);
465}
466
467/**********************************************************************/
470 const char *api_methods_player_controlling_gui(lua_State *L,
471 Player *pplayer)
472{
473 struct connection *conn = NULL;
474
475 LUASCRIPT_CHECK_STATE(L, NULL);
476 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
477
478 conn_list_iterate(pplayer->connections, pconn) {
479 if (!pconn->observer) {
480 conn = pconn;
481 break;
482 }
483 } conn_list_iterate_end;
484
485 if (conn == NULL) {
486 return "None";
487 }
488
489 return gui_type_name(conn->client_gui);
490}
491
492/**********************************************************************/
495 bool api_methods_player_has_wonder(lua_State *L, Player *pplayer,
496 Building_Type *building)
497{
498 LUASCRIPT_CHECK_STATE(L, FALSE);
499 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
500 LUASCRIPT_CHECK_ARG_NIL(L, building, 3, Building_Type, FALSE);
501
502 return wonder_is_built(pplayer, building);
503}
504
505/**********************************************************************/
508 int api_methods_player_number(lua_State *L, Player *pplayer)
509{
510 LUASCRIPT_CHECK_STATE(L, -1);
511 LUASCRIPT_CHECK_SELF(L, pplayer, -1);
512
513 return player_number(pplayer);
514}
515
516/**********************************************************************/
519 int api_methods_player_num_cities(lua_State *L, Player *pplayer)
520{
521 LUASCRIPT_CHECK_STATE(L, 0);
522 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
523
524 return city_list_size(pplayer->cities);
525}
526
527/**********************************************************************/
530 int api_methods_player_num_units(lua_State *L, Player *pplayer)
531{
532 LUASCRIPT_CHECK_STATE(L, 0);
533 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
534
535 return unit_list_size(pplayer->units);
536}
537
538/**********************************************************************/
541 int api_methods_player_gold(lua_State *L, Player *pplayer)
542{
543 LUASCRIPT_CHECK_STATE(L, 0);
544 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
545
546 return pplayer->economic.gold;
547}
548
549/**********************************************************************/
552 int api_methods_player_infrapoints(lua_State *L, Player *pplayer)
553{
554 LUASCRIPT_CHECK_STATE(L, 0);
555 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
556
557 return pplayer->economic.infra_points;
558}
559
560/**********************************************************************/
563 bool api_methods_player_knows_tech(lua_State *L, Player *pplayer,
564 Tech_Type *ptech)
565{
566 LUASCRIPT_CHECK_STATE(L, FALSE);
567 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
568 LUASCRIPT_CHECK_ARG_NIL(L, ptech, 3, Tech_Type, FALSE);
569
570 return research_invention_state(research_get(pplayer),
571 advance_number(ptech)) == TECH_KNOWN;
572}
573
574/**********************************************************************/
578 bool api_method_player_can_research(lua_State *L, Player *pplayer,
579 Tech_Type *ptech)
580{
581 LUASCRIPT_CHECK_STATE(L, FALSE);
582 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
583 LUASCRIPT_CHECK_ARG_NIL(L, ptech, 3, Tech_Type, FALSE);
584
585 return TECH_PREREQS_KNOWN
586 == research_invention_state(research_get(pplayer),
587 advance_number(ptech));
588}
589
590/**********************************************************************/
602 int api_methods_player_tech_cost(lua_State *L, Player *pplayer,
603 Tech_Type *ptech)
604{
605 LUASCRIPT_CHECK_STATE(L, 0);
606 LUASCRIPT_CHECK_ARG_NIL(L, ptech, 3, Tech_Type, 0);
607
608 if (!pplayer && TECH_COST_CIV1CIV2 == game.info.tech_cost_style) {
609 /* Avoid getting error messages and return at least something */
610 return ptech->cost * (double) game.info.sciencebox / 100.0;
611 }
612 return
613 research_total_bulbs_required(pplayer ? research_get(pplayer) : NULL,
614 advance_index(ptech), TRUE);
615}
616
617/**********************************************************************/
625 lua_Object
626api_methods_player_researching(lua_State *L, Player *pplayer)
627{
628 const struct research *presearch;
629 int rr;
630
631 LUASCRIPT_CHECK_STATE(L, 0);
632 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
633 presearch = research_get(pplayer);
634 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
635
636 rr = presearch->researching;
637
638 switch (rr) {
639 case A_FUTURE:
640 lua_pushstring(L, research_advance_name_translation(presearch, rr));
641 break;
642 case A_UNSET:
643 case A_UNKNOWN:
644 lua_pushnil(L);
645 break;
646 default:
647 /* A regular tech */
648 fc_assert(rr >= A_FIRST && rr <= A_LAST);
649 tolua_pushusertype(L, advance_by_number(rr), "Tech_Type");
650 }
651
652 return lua_gettop(L);
653}
654
655/**********************************************************************/
660 int api_methods_player_bulbs(lua_State *L, Player *pplayer)
661{
662 const struct research *presearch;
663
664 LUASCRIPT_CHECK_STATE(L, 0);
665 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
666 presearch = research_get(pplayer);
667 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
668
669 return presearch->bulbs_researched;
670}
671
672/**********************************************************************/
677 int api_methods_player_research_cost(lua_State *L, Player *pplayer)
678{
679 const struct research *presearch;
680
681 LUASCRIPT_CHECK_STATE(L, 0);
682 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
683 presearch = research_get(pplayer);
684 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
685
686 return is_server()
687 ? research_total_bulbs_required(presearch, presearch->researching, FALSE)
688 : presearch->client.researching_cost;
689}
690
691/**********************************************************************/
696 int api_methods_player_future(lua_State *L, Player *pplayer)
697{
698 const struct research *presearch;
699
700 LUASCRIPT_CHECK_STATE(L, 0);
701 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
702 presearch = research_get(pplayer);
703 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
704
705 return presearch->future_tech;
706}
707
708/**********************************************************************/
711 int api_methods_player_culture_get(lua_State *L, Player *pplayer)
712{
713 LUASCRIPT_CHECK_STATE(L, 0);
714 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
715
716 return player_culture(pplayer);
717}
718
719/**********************************************************************/
722 bool api_methods_player_has_flag(lua_State *L, Player *pplayer,
723 const char *flag)
724{
725 enum plr_flag_id flag_val;
726
727 LUASCRIPT_CHECK_STATE(L, 0);
728 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
729
730 flag_val = plr_flag_id_by_name(flag, fc_strcasecmp);
731
732 if (plr_flag_id_is_valid(flag_val)) {
733 return player_has_flag(pplayer, flag_val);
734 }
735
736 return FALSE;
737}
738
739/**********************************************************************/
743 Unit_Type *api_methods_player_can_upgrade(lua_State *L, Player *pplayer,
744 Unit_Type *utype)
745{
746 LUASCRIPT_CHECK_STATE(L, NULL);
747 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
748 LUASCRIPT_CHECK_ARG_NIL(L, utype, 3, Unit_Type, NULL);
749
750 return (Unit_Type *)can_upgrade_unittype(pplayer, utype);
751}
752
753/**********************************************************************/
757 bool api_methods_player_can_build_unit_direct(lua_State *L, Player *pplayer,
758 Unit_Type *utype)
759{
760 LUASCRIPT_CHECK_STATE(L, FALSE);
761 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
762 LUASCRIPT_CHECK_ARG_NIL(L, utype, 3, Unit_Type, FALSE);
763
764 return can_player_build_unit_direct(pplayer, utype, TRUE);
765}
766
767/**********************************************************************/
770 bool api_methods_player_can_build_impr_direct(lua_State *L, Player *pplayer,
771 Building_Type *itype)
772{
773 LUASCRIPT_CHECK_STATE(L, FALSE);
774 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
775 LUASCRIPT_CHECK_ARG_NIL(L, itype, 3, Building_Type, FALSE);
776
777 return can_player_build_improvement_direct(pplayer, itype);
778}
779
780
781/**********************************************************************/
785 bool api_methods_unit_can_upgrade(lua_State *L, Unit *punit, bool is_free)
786{
787
788 return UU_OK == unit_upgrade_test(&(wld.map), punit, is_free);
789}
790
791/**********************************************************************/
795 const char *api_methods_unit_transform_problem(lua_State *L, Unit *punit,
796 Unit_Type *ptype)
797{
798 enum unit_upgrade_result uu;
799
800 LUASCRIPT_CHECK_STATE(L, NULL);
801 LUASCRIPT_CHECK_SELF(L, punit, NULL);
802 LUASCRIPT_CHECK_ARG_NIL(L, ptype, 3, Unit_Type, NULL);
803
804 uu = unit_transform_result(&(wld.map), punit, ptype);
805 switch (uu) {
806 case UU_OK:
807 return NULL;
808 case UU_NOT_ENOUGH_ROOM:
809 return "cargo";
810 case UU_UNSUITABLE_TRANSPORT:
811 return "transport";
812 case UU_NOT_TERRAIN:
813 return "terrain";
814 case UU_NOT_ACTIVITY:
815 return "activity";
816 case UU_NO_UNITTYPE:
817 case UU_NO_MONEY:
818 case UU_NOT_IN_CITY:
819 case UU_NOT_CITY_OWNER:
820 /* should not get here */
821 break;
822 }
823
824 fc_assert_msg(FALSE, "Unexpected unit transform result %i", uu);
825
826 return "\?";
827}
828
829/**********************************************************************/
832 bool api_methods_player_shares_research(lua_State *L, Player *pplayer,
833 Player *aplayer)
834{
835 LUASCRIPT_CHECK_STATE(L, FALSE);
836 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
837 LUASCRIPT_CHECK_ARG_NIL(L, aplayer, 3, Player, FALSE);
838
839 return research_get(pplayer) == research_get(aplayer);
840}
841
842/**********************************************************************/
845 const char *api_methods_research_rule_name(lua_State *L, Player *pplayer)
846{
847 LUASCRIPT_CHECK_STATE(L, NULL);
848 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
849
850 return research_rule_name(research_get(pplayer));
851}
852
853/**********************************************************************/
856 const char *api_methods_research_name_translation(lua_State *L,
857 Player *pplayer)
858{
859 static char buf[MAX_LEN_MSG];
860
861 LUASCRIPT_CHECK_STATE(L, NULL);
862 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
863
864 (void) research_pretty_name(research_get(pplayer), buf, ARRAY_SIZE(buf));
865
866 return buf;
867}
868
869/**********************************************************************/
873 lua_Object api_methods_private_list_players(lua_State *L)
874{
875 lua_Object result = 0;
876 int i = 0;
877
878 LUASCRIPT_CHECK_STATE(L, 0);
879 lua_createtable(L, player_count(), 0);
880 result = lua_gettop(L);
881 players_iterate(pplayer) {
882 tolua_pushfieldusertype(L, result, ++i, pplayer, "Player");
883 } players_iterate_end;
884 return result;
885}
886
887/**********************************************************************/
890 Unit_List_Link *api_methods_private_player_unit_list_head(lua_State *L,
891 Player *pplayer)
892{
893 LUASCRIPT_CHECK_STATE(L, NULL);
894 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
895 return unit_list_head(pplayer->units);
896}
897
898/**********************************************************************/
901 City_List_Link *api_methods_private_player_city_list_head(lua_State *L,
902 Player *pplayer)
903{
904 LUASCRIPT_CHECK_STATE(L, NULL);
905 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
906
907 return city_list_head(pplayer->cities);
908}
909
910/**********************************************************************/
913 const char *api_methods_tech_type_rule_name(lua_State *L, Tech_Type *ptech)
914{
915 LUASCRIPT_CHECK_STATE(L, NULL);
916 LUASCRIPT_CHECK_SELF(L, ptech, NULL);
917
918 return advance_rule_name(ptech);
919}
920
921/**********************************************************************/
924 const char *api_methods_tech_type_name_translation(lua_State *L,
925 Tech_Type *ptech)
926{
927 LUASCRIPT_CHECK_STATE(L, NULL);
928 LUASCRIPT_CHECK_SELF(L, ptech, NULL);
929
930 return advance_name_translation(ptech);
931}
932
933/**********************************************************************/
936 const char *api_methods_terrain_rule_name(lua_State *L, Terrain *pterrain)
937{
938 LUASCRIPT_CHECK_STATE(L, NULL);
939 LUASCRIPT_CHECK_SELF(L, pterrain, NULL);
940
941 return terrain_rule_name(pterrain);
942}
943
944/**********************************************************************/
947 const char *api_methods_terrain_name_translation(lua_State *L,
948 Terrain *pterrain)
949{
950 LUASCRIPT_CHECK_STATE(L, NULL);
951 LUASCRIPT_CHECK_SELF(L, pterrain, NULL);
952
953 return terrain_name_translation(pterrain);
954}
955
956/**********************************************************************/
959 const char *api_methods_terrain_class_name(lua_State *L, Terrain *pterrain)
960{
961 LUASCRIPT_CHECK_STATE(L, NULL);
962 LUASCRIPT_CHECK_SELF(L, pterrain, NULL);
963
964 return terrain_class_name(terrain_type_terrain_class(pterrain));
965}
966
967/**********************************************************************/
970 const char *api_methods_disaster_rule_name(lua_State *L, Disaster *pdis)
971{
972 LUASCRIPT_CHECK_STATE(L, NULL);
973 LUASCRIPT_CHECK_SELF(L, pdis, NULL);
974
975 return disaster_rule_name(pdis);
976}
977
978/**********************************************************************/
981 const char *api_methods_disaster_name_translation(lua_State *L,
982 Disaster *pdis)
983{
984 LUASCRIPT_CHECK_STATE(L, NULL);
985 LUASCRIPT_CHECK_SELF(L, pdis, NULL);
986
987 return disaster_name_translation(pdis);
988}
989
990/**********************************************************************/
993 const char *api_methods_achievement_rule_name(lua_State *L,
994 Achievement *pach)
995{
996 LUASCRIPT_CHECK_STATE(L, NULL);
997 LUASCRIPT_CHECK_SELF(L, pach, NULL);
998
999 return achievement_rule_name(pach);
1000}
1001
1002/**********************************************************************/
1005 const char *api_methods_achievement_name_translation(lua_State *L,
1006 Achievement *pach)
1007{
1008 LUASCRIPT_CHECK_STATE(L, NULL);
1009 LUASCRIPT_CHECK_SELF(L, pach, NULL);
1010
1011 return achievement_name_translation(pach);
1012}
1013
1014/**********************************************************************/
1017 const char *api_methods_action_rule_name(lua_State *L, Action *pact)
1018{
1019 LUASCRIPT_CHECK_STATE(L, NULL);
1020 LUASCRIPT_CHECK_SELF(L, pact, NULL);
1021
1022 return action_id_rule_name(pact->id);
1023}
1024
1025/**********************************************************************/
1028 const char *api_methods_action_name_translation(lua_State *L, Action *pact)
1029{
1030 LUASCRIPT_CHECK_STATE(L, NULL);
1031 LUASCRIPT_CHECK_SELF(L, pact, NULL);
1032
1033 return action_id_name_translation(pact->id);
1034}
1035
1036/**********************************************************************/
1039 const char *api_methods_action_target_kind(lua_State *L, Action *pact)
1040{
1041 struct action *paction;
1042
1043 LUASCRIPT_CHECK_STATE(L, NULL);
1044 LUASCRIPT_CHECK_SELF(L, pact, NULL);
1045
1046 paction = action_by_number(pact->id);
1047 fc_assert_ret_val(paction, "error: no action");
1048
1049 return action_target_kind_name(action_get_target_kind(paction));
1050}
1051
1052/**********************************************************************/
1055 int api_methods_tile_nat_x(lua_State *L, Tile *ptile)
1056{
1057 LUASCRIPT_CHECK_STATE(L, -1);
1058 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1059
1060 return index_to_native_pos_x(tile_index(ptile));
1061}
1062
1063/**********************************************************************/
1066 int api_methods_tile_nat_y(lua_State *L, Tile *ptile)
1067{
1068 LUASCRIPT_CHECK_STATE(L, -1);
1069 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1070
1071 return index_to_native_pos_y(tile_index(ptile));
1072}
1073
1074/**********************************************************************/
1077 int api_methods_tile_map_x(lua_State *L, Tile *ptile)
1078{
1079 LUASCRIPT_CHECK_STATE(L, -1);
1080 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1081
1082 return index_to_map_pos_x(tile_index(ptile));
1083}
1084
1085/**********************************************************************/
1088 int api_methods_tile_map_y(lua_State *L, Tile *ptile)
1089{
1090 LUASCRIPT_CHECK_STATE(L, -1);
1091 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1092
1093 return index_to_map_pos_y(tile_index(ptile));
1094}
1095
1096/**********************************************************************/
1099 City *api_methods_tile_city(lua_State *L, Tile *ptile)
1100{
1101 LUASCRIPT_CHECK_STATE(L, NULL);
1102 LUASCRIPT_CHECK_SELF(L, ptile, NULL);
1103
1104 return tile_city(ptile);
1105}
1106
1107/**********************************************************************/
1110 bool api_methods_tile_city_exists_within_max_city_map(lua_State *L,
1111 Tile *ptile,
1112 bool may_be_on_center)
1113{
1114 LUASCRIPT_CHECK_STATE(L, FALSE);
1115 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1116
1117 return city_exists_within_max_city_map(ptile, may_be_on_center);
1118}
1119
1120/**********************************************************************/
1124 bool api_methods_tile_has_extra(lua_State *L, Tile *ptile,
1125 const char *name)
1126{
1127 LUASCRIPT_CHECK_STATE(L, FALSE);
1128 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1129
1130 if (!name) {
1131 extra_type_iterate(pextra) {
1132 if (tile_has_extra(ptile, pextra)) {
1133 return TRUE;
1134 }
1135 } extra_type_iterate_end;
1136
1137 return FALSE;
1138 } else {
1139 struct extra_type *pextra;
1140
1141 pextra = extra_type_by_rule_name(name);
1142
1143 return (NULL != pextra && tile_has_extra(ptile, pextra));
1144 }
1145}
1146
1147/**********************************************************************/
1151 bool api_methods_tile_has_base(lua_State *L, Tile *ptile, const char *name)
1152{
1153 LUASCRIPT_CHECK_STATE(L, FALSE);
1154 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1155
1156 if (!name) {
1157 extra_type_by_cause_iterate(EC_BASE, pextra) {
1158 if (tile_has_extra(ptile, pextra)) {
1159 return TRUE;
1160 }
1161 } extra_type_by_cause_iterate_end;
1162
1163 return FALSE;
1164 } else {
1165 struct extra_type *pextra;
1166
1167 pextra = extra_type_by_rule_name(name);
1168
1169 return (NULL != pextra && is_extra_caused_by(pextra, EC_BASE)
1170 && tile_has_extra(ptile, pextra));
1171 }
1172}
1173
1174/**********************************************************************/
1178 bool api_methods_tile_has_road(lua_State *L, Tile *ptile, const char *name)
1179{
1180 LUASCRIPT_CHECK_STATE(L, FALSE);
1181 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1182
1183 if (!name) {
1184 extra_type_by_cause_iterate(EC_ROAD, pextra) {
1185 if (tile_has_extra(ptile, pextra)) {
1186 return TRUE;
1187 }
1188 } extra_type_by_cause_iterate_end;
1189
1190 return FALSE;
1191 } else {
1192 struct extra_type *pextra;
1193
1194 pextra = extra_type_by_rule_name(name);
1195
1196 return (NULL != pextra && is_extra_caused_by(pextra, EC_ROAD)
1197 && tile_has_extra(ptile, pextra));
1198 }
1199}
1200
1201/**********************************************************************/
1207 Player *api_methods_tile_extra_owner(lua_State *L,
1208 Tile *ptile, const char *extra_name)
1209{
1210 LUASCRIPT_CHECK_STATE(L, NULL);
1211 LUASCRIPT_CHECK_SELF(L, ptile, NULL);
1212
1213 if (extra_name) {
1214 struct extra_type *pextra;
1215
1216 pextra = extra_type_by_rule_name(extra_name);
1217 LUASCRIPT_CHECK_ARG(L, pextra != NULL, 3, "unknown extra type", NULL);
1218
1219 if (tile_has_extra(ptile, pextra)) {
1220 /* All extras have the same owner. */
1221 return extra_owner(ptile);
1222 } else {
1223 /* The extra isn't there. */
1224 return NULL;
1225 }
1226 } else {
1227 extra_type_iterate(pextra) {
1228 if (tile_has_extra(ptile, pextra)) {
1229 /* All extras have the same owner. */
1230 return extra_owner(ptile);
1231 }
1232 } extra_type_iterate_end;
1233 return NULL;
1234 }
1235}
1236
1237/**********************************************************************/
1240 bool api_methods_enemy_tile(lua_State *L, Tile *ptile, Player *against)
1241{
1242 struct city *pcity;
1243
1244 LUASCRIPT_CHECK_STATE(L, FALSE);
1245 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1246
1247 if (is_non_allied_unit_tile(ptile, against, FALSE)) {
1248 return TRUE;
1249 }
1250
1251 pcity = tile_city(ptile);
1252 if (pcity != NULL && !pplayers_allied(against, city_owner(pcity))) {
1253 return TRUE;
1254 }
1255
1256 return FALSE;
1257}
1258
1259/**********************************************************************/
1262 int api_methods_tile_num_units(lua_State *L, Tile *ptile)
1263{
1264 LUASCRIPT_CHECK_STATE(L, 0);
1265 LUASCRIPT_CHECK_SELF(L, ptile, 0);
1266
1267 return unit_list_size(ptile->units);
1268}
1269
1270/**********************************************************************/
1273 Unit_List_Link *api_methods_private_tile_unit_list_head(lua_State *L,
1274 Tile *ptile)
1275{
1276 LUASCRIPT_CHECK_STATE(L, NULL);
1277 LUASCRIPT_CHECK_SELF(L, ptile, NULL);
1278
1279 return unit_list_head(ptile->units);
1280}
1281
1282/**********************************************************************/
1286 int api_methods_private_tile_next_outward_index(lua_State *L, Tile *pstart,
1287 int tindex, int max_dist)
1288{
1289 int dx, dy;
1290 int newx, newy;
1291 int startx, starty;
1292
1293 LUASCRIPT_CHECK_STATE(L, 0);
1294 LUASCRIPT_CHECK_SELF(L, pstart, 0);
1295
1296 if (tindex < 0) {
1297 return 0;
1298 }
1299
1300 index_to_map_pos(&startx, &starty, tile_index(pstart));
1301
1302 tindex++;
1303 while (tindex < MAP_NUM_ITERATE_OUTWARDS_INDICES) {
1304 if (MAP_ITERATE_OUTWARDS_INDICES[tindex].dist > max_dist) {
1305 return -1;
1306 }
1307 dx = MAP_ITERATE_OUTWARDS_INDICES[tindex].dx;
1308 dy = MAP_ITERATE_OUTWARDS_INDICES[tindex].dy;
1309 newx = dx + startx;
1310 newy = dy + starty;
1311
1312 if (!normalize_map_pos(&(wld.map), &newx, &newy)) {
1313 tindex++;
1314 continue;
1315 }
1316
1317 return tindex;
1318 }
1319
1320 return -1;
1321}
1322
1323/**********************************************************************/
1326 Tile *api_methods_private_tile_for_outward_index(lua_State *L,
1327 Tile *pstart, int tindex)
1328{
1329 int newx, newy;
1330
1331 LUASCRIPT_CHECK_STATE(L, NULL);
1332 LUASCRIPT_CHECK_SELF(L, pstart, NULL);
1333 LUASCRIPT_CHECK_ARG(L,
1334 tindex >= 0 && tindex < MAP_NUM_ITERATE_OUTWARDS_INDICES,
1335 3, "index out of bounds", NULL);
1336
1337 index_to_map_pos(&newx, &newy, tile_index(pstart));
1338 newx += MAP_ITERATE_OUTWARDS_INDICES[tindex].dx;
1339 newy += MAP_ITERATE_OUTWARDS_INDICES[tindex].dy;
1340
1341 if (!normalize_map_pos(&(wld.map), &newx, &newy)) {
1342 return NULL;
1343 }
1344
1345 return map_pos_to_tile(&(wld.map), newx, newy);
1346}
1347
1348/**********************************************************************/
1351 int api_methods_tile_sq_distance(lua_State *L, Tile *ptile1, Tile *ptile2)
1352{
1353 LUASCRIPT_CHECK_STATE(L, 0);
1354 LUASCRIPT_CHECK_SELF(L, ptile1, 0);
1355 LUASCRIPT_CHECK_ARG_NIL(L, ptile2, 3, Tile, 0);
1356
1357 return sq_map_distance(ptile1, ptile2);
1358}
1359
1360/**********************************************************************/
1367 bool api_methods_unit_city_can_be_built_here(lua_State *L, Unit *punit)
1368{
1369 const struct civ_map *nmap = &(wld.map);
1370
1371 LUASCRIPT_CHECK_STATE(L, FALSE);
1372 LUASCRIPT_CHECK_SELF(L, punit, FALSE);
1373
1374 return city_can_be_built_here(nmap, unit_tile(punit), punit, TRUE);
1375}
1376
1377/**********************************************************************/
1380 Tile *api_methods_unit_tile_get(lua_State *L, Unit *punit)
1381{
1382 LUASCRIPT_CHECK_STATE(L, NULL);
1383 LUASCRIPT_CHECK_SELF(L, punit, NULL);
1384
1385 return unit_tile(punit);
1386}
1387
1388/**********************************************************************/
1391 const Direction *api_methods_unit_orientation_get(lua_State *L,
1392 Unit *punit)
1393{
1394 LUASCRIPT_CHECK_STATE(L, NULL);
1395 LUASCRIPT_CHECK_ARG_NIL(L, punit, 2, Unit, NULL);
1396
1397 return luascript_dir(punit->facing);
1398}
1399
1400/**********************************************************************/
1403 Unit *api_methods_unit_transporter(lua_State *L, Unit *punit)
1404{
1405 LUASCRIPT_CHECK_STATE(L, NULL);
1406 LUASCRIPT_CHECK_SELF(L, punit, NULL);
1407
1408 return punit->transporter;
1409}
1410
1411/**********************************************************************/
1414 Unit_List_Link *api_methods_private_unit_cargo_list_head(lua_State *L,
1415 Unit *punit)
1416{
1417 LUASCRIPT_CHECK_STATE(L, NULL);
1418 LUASCRIPT_CHECK_SELF(L, punit, NULL);
1419 return unit_list_head(punit->transporting);
1420}
1421
1422/**********************************************************************/
1425 bool api_methods_unit_type_has_flag(lua_State *L, Unit_Type *punit_type,
1426 const char *flag)
1427{
1428 enum unit_type_flag_id id;
1429
1430 LUASCRIPT_CHECK_STATE(L, FALSE);
1431 LUASCRIPT_CHECK_SELF(L, punit_type, FALSE);
1432 LUASCRIPT_CHECK_ARG_NIL(L, flag, 3, string, FALSE);
1433
1434 id = unit_type_flag_id_by_name(flag, fc_strcasecmp);
1435 if (unit_type_flag_id_is_valid(id)) {
1436 return utype_has_flag(punit_type, id);
1437 } else {
1438 luascript_error(L, "Unit type flag \"%s\" does not exist", flag);
1439 return FALSE;
1440 }
1441}
1442
1443/**********************************************************************/
1446 bool api_methods_unit_type_has_role(lua_State *L, Unit_Type *punit_type,
1447 const char *role)
1448{
1449 enum unit_role_id id;
1450
1451 LUASCRIPT_CHECK_STATE(L, FALSE);
1452 LUASCRIPT_CHECK_SELF(L, punit_type, FALSE);
1453 LUASCRIPT_CHECK_ARG_NIL(L, role, 3, string, FALSE);
1454
1455 id = unit_role_id_by_name(role, fc_strcasecmp);
1456 if (unit_role_id_is_valid(id)) {
1457 return utype_has_role(punit_type, id);
1458 } else {
1459 luascript_error(L, "Unit role \"%s\" does not exist", role);
1460 return FALSE;
1461 }
1462}
1463
1464/**********************************************************************/
1467 bool api_methods_unit_type_can_exist_at_tile(lua_State *L,
1468 Unit_Type *punit_type,
1469 Tile *ptile)
1470{
1471 LUASCRIPT_CHECK_STATE(L, FALSE);
1472 LUASCRIPT_CHECK_SELF(L, punit_type, FALSE);
1473 LUASCRIPT_CHECK_ARG_NIL(L, ptile, 3, Tile, FALSE);
1474
1475 return can_exist_at_tile(&(wld.map), punit_type, ptile);
1476}
1477
1478/**********************************************************************/
1481 const char *api_methods_unit_type_rule_name(lua_State *L,
1482 Unit_Type *punit_type)
1483{
1484 LUASCRIPT_CHECK_STATE(L, NULL);
1485 LUASCRIPT_CHECK_SELF(L, punit_type, NULL);
1486
1487 return utype_rule_name(punit_type);
1488}
1489
1490/**********************************************************************/
1493 const char *api_methods_unit_type_name_translation(lua_State *L,
1494 Unit_Type *punit_type)
1495{
1496 LUASCRIPT_CHECK_STATE(L, NULL);
1497 LUASCRIPT_CHECK_SELF(L, punit_type, NULL);
1498
1499 return utype_name_translation(punit_type);
1500}
1501
1502
1503/**********************************************************************/
1506 Unit *api_methods_unit_list_link_data(lua_State *L,
1507 Unit_List_Link *ul_link)
1508{
1509 LUASCRIPT_CHECK_STATE(L, NULL);
1510
1511 return unit_list_link_data(ul_link);
1512}
1513
1514/**********************************************************************/
1517 Unit_List_Link *api_methods_unit_list_next_link(lua_State *L,
1518 Unit_List_Link *ul_link)
1519{
1520 LUASCRIPT_CHECK_STATE(L, NULL);
1521
1522 return unit_list_link_next(ul_link);
1523}
1524
1525/**********************************************************************/
1528 City *api_methods_city_list_link_data(lua_State *L,
1529 City_List_Link *cl_link)
1530{
1531 LUASCRIPT_CHECK_STATE(L, NULL);
1532
1533 return city_list_link_data(cl_link);
1534}
1535
1536/**********************************************************************/
1539 City_List_Link *api_methods_city_list_next_link(lua_State *L,
1540 City_List_Link *cl_link)
1541{
1542 LUASCRIPT_CHECK_STATE(L, NULL);
1543
1544 return city_list_link_next(cl_link);
1545}
1546
1547/**********************************************************************/
1550 const char *api_methods_tile_link(lua_State *L, Tile *ptile)
1551{
1552 LUASCRIPT_CHECK_STATE(L, NULL);
1553 LUASCRIPT_CHECK_SELF(L, ptile, NULL);
1554
1555 return tile_link(ptile);
1556}
1557
1558/**********************************************************************/
1561 const char *api_methods_unit_tile_link(lua_State *L, Unit *punit)
1562{
1563 LUASCRIPT_CHECK_STATE(L, NULL);
1564 LUASCRIPT_CHECK_SELF(L, punit, NULL);
1565
1566 return unit_tile_link(punit);
1567}
1568
1569/**********************************************************************/
1572 const char *api_methods_city_tile_link(lua_State *L, City *pcity)
1573{
1574 LUASCRIPT_CHECK_STATE(L, NULL);
1575 LUASCRIPT_CHECK_SELF(L, pcity, NULL);
1576
1577 return city_tile_link(pcity);
1578}
1579
1580/**********************************************************************/
1583 const char *api_methods_unit_link(lua_State *L, Unit *punit)
1584{
1585 LUASCRIPT_CHECK_STATE(L, NULL);
1586 LUASCRIPT_CHECK_SELF(L, punit, NULL);
1587
1588 return unit_link(punit);
1589}
1590
1591/**********************************************************************/
1594 const char *api_methods_city_link(lua_State *L, City *pcity)
1595{
1596 LUASCRIPT_CHECK_STATE(L, NULL);
1597 LUASCRIPT_CHECK_SELF(L, pcity, NULL);
1598
1599 return city_link(pcity);
1600}
achievement_rule_name
const char * achievement_rule_name(struct achievement *pach)
Definition achievements.c:114
achievement_name_translation
const char * achievement_name_translation(struct achievement *pach)
Definition achievements.c:106
achievements.h
action_id_name_translation
const char * action_id_name_translation(action_id act_id)
Definition actions.c:1225
action_id_rule_name
const char * action_id_rule_name(action_id act_id)
Definition actions.c:1214
action_get_target_kind
enum action_target_kind action_get_target_kind(const struct action *paction)
Definition actions.c:1083
actions.h
action_by_number
static struct action * action_by_number(action_id act_id)
Definition actions.h:390
api_methods_tile_nat_x
int api_methods_tile_nat_x(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1055
api_methods_tile_num_units
int api_methods_tile_num_units(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1262
api_methods_is_city_unhappy
bool api_methods_is_city_unhappy(lua_State *L, City *pcity)
Definition api_game_methods.c:354
api_methods_is_gov_center
bool api_methods_is_gov_center(lua_State *L, City *pcity)
Definition api_game_methods.c:377
api_methods_game_rulesetdir
const char * api_methods_game_rulesetdir(lua_State *L)
Definition api_game_methods.c:107
api_methods_player_future
int api_methods_player_future(lua_State *L, Player *pplayer)
Definition api_game_methods.c:696
api_methods_unit_type_can_exist_at_tile
bool api_methods_unit_type_can_exist_at_tile(lua_State *L, Unit_Type *punit_type, Tile *ptile)
Definition api_game_methods.c:1467
api_methods_player_num_cities
int api_methods_player_num_cities(lua_State *L, Player *pplayer)
Definition api_game_methods.c:519
api_methods_unit_can_upgrade
bool api_methods_unit_can_upgrade(lua_State *L, Unit *punit, bool is_free)
Definition api_game_methods.c:785
api_methods_player_has_wonder
bool api_methods_player_has_wonder(lua_State *L, Player *pplayer, Building_Type *building)
Definition api_game_methods.c:495
api_methods_unit_list_next_link
Unit_List_Link * api_methods_unit_list_next_link(lua_State *L, Unit_List_Link *ul_link)
Definition api_game_methods.c:1517
api_methods_nation_type_plural_translation
const char * api_methods_nation_type_plural_translation(lua_State *L, Nation_Type *pnation)
Definition api_game_methods.c:458
api_methods_disaster_name_translation
const char * api_methods_disaster_name_translation(lua_State *L, Disaster *pdis)
Definition api_game_methods.c:981
api_methods_unit_list_link_data
Unit * api_methods_unit_list_link_data(lua_State *L, Unit_List_Link *ul_link)
Definition api_game_methods.c:1506
api_methods_tile_nat_y
int api_methods_tile_nat_y(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1066
api_methods_private_tile_unit_list_head
Unit_List_Link * api_methods_private_tile_unit_list_head(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1273
api_methods_player_tech_cost
int api_methods_player_tech_cost(lua_State *L, Player *pplayer, Tech_Type *ptech)
Definition api_game_methods.c:602
api_methods_player_researching
lua_Object api_methods_player_researching(lua_State *L, Player *pplayer)
Definition api_game_methods.c:626
api_methods_game_year_fragment
int api_methods_game_year_fragment(lua_State *L)
Definition api_game_methods.c:70
api_methods_counter_name_translation
const char * api_methods_counter_name_translation(lua_State *L, Counter *c)
Definition api_game_methods.c:322
api_methods_city_culture_get
int api_methods_city_culture_get(lua_State *L, City *pcity)
Definition api_game_methods.c:301
api_methods_unit_type_name_translation
const char * api_methods_unit_type_name_translation(lua_State *L, Unit_Type *punit_type)
Definition api_game_methods.c:1493
api_methods_game_ruleset_name
const char * api_methods_game_ruleset_name(lua_State *L)
Definition api_game_methods.c:115
api_methods_building_type_rule_name
const char * api_methods_building_type_rule_name(lua_State *L, Building_Type *pbuilding)
Definition api_game_methods.c:187
api_methods_city_list_link_data
City * api_methods_city_list_link_data(lua_State *L, City_List_Link *cl_link)
Definition api_game_methods.c:1528
api_methods_unit_tile_link
const char * api_methods_unit_tile_link(lua_State *L, Unit *punit)
Definition api_game_methods.c:1561
api_methods_counter_rule_name
const char * api_methods_counter_rule_name(lua_State *L, Counter *c)
Definition api_game_methods.c:312
api_methods_player_can_build_impr_direct
bool api_methods_player_can_build_impr_direct(lua_State *L, Player *pplayer, Building_Type *itype)
Definition api_game_methods.c:770
api_methods_player_num_units
int api_methods_player_num_units(lua_State *L, Player *pplayer)
Definition api_game_methods.c:530
api_methods_tech_type_rule_name
const char * api_methods_tech_type_rule_name(lua_State *L, Tech_Type *ptech)
Definition api_game_methods.c:913
api_methods_tile_map_x
int api_methods_tile_map_x(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1077
api_methods_is_city_happy
bool api_methods_is_city_happy(lua_State *L, City *pcity)
Definition api_game_methods.c:342
api_methods_achievement_rule_name
const char * api_methods_achievement_rule_name(lua_State *L, Achievement *pach)
Definition api_game_methods.c:993
api_methods_player_can_upgrade
Unit_Type * api_methods_player_can_upgrade(lua_State *L, Player *pplayer, Unit_Type *utype)
Definition api_game_methods.c:743
api_methods_city_link
const char * api_methods_city_link(lua_State *L, City *pcity)
Definition api_game_methods.c:1594
api_methods_nation_type_name_translation
const char * api_methods_nation_type_name_translation(lua_State *L, Nation_Type *pnation)
Definition api_game_methods.c:446
api_methods_government_rule_name
const char * api_methods_government_rule_name(lua_State *L, Government *pgovernment)
Definition api_game_methods.c:410
api_methods_terrain_rule_name
const char * api_methods_terrain_rule_name(lua_State *L, Terrain *pterrain)
Definition api_game_methods.c:936
api_methods_player_number
int api_methods_player_number(lua_State *L, Player *pplayer)
Definition api_game_methods.c:508
api_methods_player_infrapoints
int api_methods_player_infrapoints(lua_State *L, Player *pplayer)
Definition api_game_methods.c:552
api_methods_private_unit_cargo_list_head
Unit_List_Link * api_methods_private_unit_cargo_list_head(lua_State *L, Unit *punit)
Definition api_game_methods.c:1414
api_methods_player_controlling_gui
const char * api_methods_player_controlling_gui(lua_State *L, Player *pplayer)
Definition api_game_methods.c:470
api_methods_action_name_translation
const char * api_methods_action_name_translation(lua_State *L, Action *pact)
Definition api_game_methods.c:1028
api_methods_terrain_class_name
const char * api_methods_terrain_class_name(lua_State *L, Terrain *pterrain)
Definition api_game_methods.c:959
api_methods_player_shares_research
bool api_methods_player_shares_research(lua_State *L, Player *pplayer, Player *aplayer)
Definition api_game_methods.c:832
api_methods_tech_type_name_translation
const char * api_methods_tech_type_name_translation(lua_State *L, Tech_Type *ptech)
Definition api_game_methods.c:924
api_methods_tile_extra_owner
Player * api_methods_tile_extra_owner(lua_State *L, Tile *ptile, const char *extra_name)
Definition api_game_methods.c:1207
api_methods_city_size_get
int api_methods_city_size_get(lua_State *L, City *pcity)
Definition api_game_methods.c:236
api_methods_tech_cost_style
const char * api_methods_tech_cost_style(lua_State *L)
Definition api_game_methods.c:123
api_methods_tile_city
City * api_methods_tile_city(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1099
api_methods_tech_leakage_style
const char * api_methods_tech_leakage_style(lua_State *L)
Definition api_game_methods.c:131
api_methods_government_name_translation
const char * api_methods_government_name_translation(lua_State *L, Government *pgovernment)
Definition api_game_methods.c:422
api_method_player_can_research
bool api_method_player_can_research(lua_State *L, Player *pplayer, Tech_Type *ptech)
Definition api_game_methods.c:578
api_methods_tile_has_extra
bool api_methods_tile_has_extra(lua_State *L, Tile *ptile, const char *name)
Definition api_game_methods.c:1124
api_methods_tile_sq_distance
int api_methods_tile_sq_distance(lua_State *L, Tile *ptile1, Tile *ptile2)
Definition api_game_methods.c:1351
api_methods_unit_type_has_role
bool api_methods_unit_type_has_role(lua_State *L, Unit_Type *punit_type, const char *role)
Definition api_game_methods.c:1446
api_methods_tile_link
const char * api_methods_tile_link(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1550
api_methods_player_culture_get
int api_methods_player_culture_get(lua_State *L, Player *pplayer)
Definition api_game_methods.c:711
api_methods_game_turn_deprecated
int api_methods_game_turn_deprecated(lua_State *L)
Definition api_game_methods.c:90
api_methods_player_bulbs
int api_methods_player_bulbs(lua_State *L, Player *pplayer)
Definition api_game_methods.c:660
api_methods_achievement_name_translation
const char * api_methods_achievement_name_translation(lua_State *L, Achievement *pach)
Definition api_game_methods.c:1005
api_methods_building_type_is_great_wonder
bool api_methods_building_type_is_great_wonder(lua_State *L, Building_Type *pbuilding)
Definition api_game_methods.c:151
api_methods_city_tile_link
const char * api_methods_city_tile_link(lua_State *L, City *pcity)
Definition api_game_methods.c:1572
api_methods_private_tile_next_outward_index
int api_methods_private_tile_next_outward_index(lua_State *L, Tile *pstart, int tindex, int max_dist)
Definition api_game_methods.c:1286
api_methods_unit_tile_get
Tile * api_methods_unit_tile_get(lua_State *L, Unit *punit)
Definition api_game_methods.c:1380
api_methods_tile_has_road
bool api_methods_tile_has_road(lua_State *L, Tile *ptile, const char *name)
Definition api_game_methods.c:1178
api_methods_nation_type_rule_name
const char * api_methods_nation_type_rule_name(lua_State *L, Nation_Type *pnation)
Definition api_game_methods.c:434
api_methods_unit_orientation_get
const Direction * api_methods_unit_orientation_get(lua_State *L, Unit *punit)
Definition api_game_methods.c:1391
api_methods_game_turn
int api_methods_game_turn(lua_State *L)
Definition api_game_methods.c:50
api_methods_player_knows_tech
bool api_methods_player_knows_tech(lua_State *L, Player *pplayer, Tech_Type *ptech)
Definition api_game_methods.c:563
api_methods_enemy_tile
bool api_methods_enemy_tile(lua_State *L, Tile *ptile, Player *against)
Definition api_game_methods.c:1240
api_methods_building_type_is_small_wonder
bool api_methods_building_type_is_small_wonder(lua_State *L, Building_Type *pbuilding)
Definition api_game_methods.c:163
api_methods_game_year
int api_methods_game_year(lua_State *L)
Definition api_game_methods.c:60
api_methods_private_tile_for_outward_index
Tile * api_methods_private_tile_for_outward_index(lua_State *L, Tile *pstart, int tindex)
Definition api_game_methods.c:1326
api_methods_game_year_text
const char * api_methods_game_year_text(lua_State *L)
Definition api_game_methods.c:80
api_methods_action_rule_name
const char * api_methods_action_rule_name(lua_State *L, Action *pact)
Definition api_game_methods.c:1017
api_methods_disaster_rule_name
const char * api_methods_disaster_rule_name(lua_State *L, Disaster *pdis)
Definition api_game_methods.c:970
api_methods_building_type_name_translation
const char * api_methods_building_type_name_translation(lua_State *L, Building_Type *pbuilding)
Definition api_game_methods.c:200
api_methods_building_type_is_wonder
bool api_methods_building_type_is_wonder(lua_State *L, Building_Type *pbuilding)
Definition api_game_methods.c:139
api_methods_research_name_translation
const char * api_methods_research_name_translation(lua_State *L, Player *pplayer)
Definition api_game_methods.c:856
api_methods_city_inspire_partisans
int api_methods_city_inspire_partisans(lua_State *L, City *self, Player *inspirer)
Definition api_game_methods.c:258
api_methods_city_map_sq_radius
int api_methods_city_map_sq_radius(lua_State *L, City *pcity)
Definition api_game_methods.c:225
api_methods_city_has_building
bool api_methods_city_has_building(lua_State *L, City *pcity, Building_Type *building)
Definition api_game_methods.c:212
api_methods_unit_transform_problem
const char * api_methods_unit_transform_problem(lua_State *L, Unit *punit, Unit_Type *ptype)
Definition api_game_methods.c:795
api_methods_city_list_next_link
City_List_Link * api_methods_city_list_next_link(lua_State *L, City_List_Link *cl_link)
Definition api_game_methods.c:1539
api_methods_unit_type_has_flag
bool api_methods_unit_type_has_flag(lua_State *L, Unit_Type *punit_type, const char *flag)
Definition api_game_methods.c:1425
api_methods_unit_type_rule_name
const char * api_methods_unit_type_rule_name(lua_State *L, Unit_Type *punit_type)
Definition api_game_methods.c:1481
api_methods_building_type_is_improvement
bool api_methods_building_type_is_improvement(lua_State *L, Building_Type *pbuilding)
Definition api_game_methods.c:175
api_methods_tile_city_exists_within_max_city_map
bool api_methods_tile_city_exists_within_max_city_map(lua_State *L, Tile *ptile, bool may_be_on_center)
Definition api_game_methods.c:1110
api_methods_player_has_flag
bool api_methods_player_has_flag(lua_State *L, Player *pplayer, const char *flag)
Definition api_game_methods.c:722
api_methods_private_list_players
lua_Object api_methods_private_list_players(lua_State *L)
Definition api_game_methods.c:873
api_methods_unit_city_can_be_built_here
bool api_methods_unit_city_can_be_built_here(lua_State *L, Unit *punit)
Definition api_game_methods.c:1367
api_methods_tile_has_base
bool api_methods_tile_has_base(lua_State *L, Tile *ptile, const char *name)
Definition api_game_methods.c:1151
api_methods_player_gold
int api_methods_player_gold(lua_State *L, Player *pplayer)
Definition api_game_methods.c:541
api_methods_research_rule_name
const char * api_methods_research_rule_name(lua_State *L, Player *pplayer)
Definition api_game_methods.c:845
api_methods_is_primary_capital
bool api_methods_is_primary_capital(lua_State *L, City *pcity)
Definition api_game_methods.c:399
api_methods_player_research_cost
int api_methods_player_research_cost(lua_State *L, Player *pplayer)
Definition api_game_methods.c:677
api_methods_tile_map_y
int api_methods_tile_map_y(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1088
api_methods_private_player_unit_list_head
Unit_List_Link * api_methods_private_player_unit_list_head(lua_State *L, Player *pplayer)
Definition api_game_methods.c:890
api_methods_action_target_kind
const char * api_methods_action_target_kind(lua_State *L, Action *pact)
Definition api_game_methods.c:1039
api_methods_private_player_city_list_head
City_List_Link * api_methods_private_player_city_list_head(lua_State *L, Player *pplayer)
Definition api_game_methods.c:901
api_methods_terrain_name_translation
const char * api_methods_terrain_name_translation(lua_State *L, Terrain *pterrain)
Definition api_game_methods.c:947
api_methods_city_tile_get
Tile * api_methods_city_tile_get(lua_State *L, City *pcity)
Definition api_game_methods.c:247
api_methods_unit_link
const char * api_methods_unit_link(lua_State *L, Unit *punit)
Definition api_game_methods.c:1583
api_methods_is_city_celebrating
bool api_methods_is_city_celebrating(lua_State *L, City *pcity)
Definition api_game_methods.c:366
api_methods_counter_city_get
int api_methods_counter_city_get(lua_State *L, Counter *c, City *city)
Definition api_game_methods.c:332
api_methods_is_capital
bool api_methods_is_capital(lua_State *L, City *pcity)
Definition api_game_methods.c:388
api_methods_player_can_build_unit_direct
bool api_methods_player_can_build_unit_direct(lua_State *L, Player *pplayer, Unit_Type *utype)
Definition api_game_methods.c:757
api_methods_unit_transporter
Unit * api_methods_unit_transporter(lua_State *L, Unit *punit)
Definition api_game_methods.c:1403
api_game_methods.h
calendar_text
const char * calendar_text(void)
Definition calendar.c:141
calendar.h
citizens_nation_get
citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot)
Definition citizens.c:74
citizens.h
city_exists_within_max_city_map
bool city_exists_within_max_city_map(const struct tile *ptile, bool may_be_on_center)
Definition city.c:2108
city_has_building
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1236
is_capital
bool is_capital(const struct city *pcity)
Definition city.c:1575
city_unhappy
bool city_unhappy(const struct city *pcity)
Definition city.c:1622
city_celebrating
bool city_celebrating(const struct city *pcity)
Definition city.c:1641
city_can_be_built_here
bool city_can_be_built_here(const struct civ_map *nmap, const struct tile *ptile, const struct unit *punit, bool hut_test)
Definition city.c:1483
city_happy
bool city_happy(const struct city *pcity)
Definition city.c:1610
city_map_radius_sq_get
int city_map_radius_sq_get(const struct city *pcity)
Definition city.c:137
is_gov_center
bool is_gov_center(const struct city *pcity)
Definition city.c:1583
city_tile
#define city_tile(_pcity_)
Definition city.h:564
city_size_get
static citizens city_size_get(const struct city *pcity)
Definition city.h:569
city_owner
#define city_owner(_pcity_)
Definition city.h:563
self
static struct ai_type * self
Definition classicai.c:46
incite_cost
char * incite_cost
Definition comments.c:74
MAX_LEN_MSG
#define MAX_LEN_MSG
Definition conn_types.h:37
conn_list_iterate
#define conn_list_iterate(connlist, pconn)
Definition connection.h:108
conn_list_iterate_end
#define conn_list_iterate_end
Definition connection.h:110
counter_index
int counter_index(const struct counter *pcount)
Definition counters.c:174
counter_name_translation
const char * counter_name_translation(const struct counter *counter)
Definition counters.c:157
counter_rule_name
const char * counter_rule_name(struct counter *pcount)
Definition counters.c:165
city_culture
int city_culture(const struct city *pcity)
Definition culture.c:29
player_culture
int player_culture(const struct player *plr)
Definition culture.c:49
culture.h
deprecations.h
log_deprecation
#define log_deprecation(message,...)
Definition deprecations.h:35
punit
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:74
disaster_rule_name
const char * disaster_rule_name(struct disaster_type *pdis)
Definition disaster.c:105
disaster_name_translation
const char * disaster_name_translation(struct disaster_type *pdis)
Definition disaster.c:97
id
int int id
Definition editgui_g.h:28
get_target_bonus_effects
int get_target_bonus_effects(struct effect_list *plist, const struct req_context *context, const struct req_context *other_context, enum effect_type effect_type)
Definition effects.c:744
extra_type_by_rule_name
struct extra_type * extra_type_by_rule_name(const char *name)
Definition extras.c:212
extra_owner
struct player * extra_owner(const struct tile *ptile)
Definition extras.c:1128
extra_type_iterate
#define extra_type_iterate(_p)
Definition extras.h:315
extra_type_iterate_end
#define extra_type_iterate_end
Definition extras.h:321
is_extra_caused_by
#define is_extra_caused_by(e, c)
Definition extras.h:203
extra_type_by_cause_iterate_end
#define extra_type_by_cause_iterate_end
Definition extras.h:339
extra_type_by_cause_iterate
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:333
is_server
static bool is_server(void)
Definition fc_interface.h:69
citizens
unsigned char citizens
Definition fc_types.h:392
city_tile_link
const char * city_tile_link(const struct city *pcity)
Definition featured_text.c:1093
tile_link
const char * tile_link(const struct tile *ptile)
Definition featured_text.c:1110
city_link
const char * city_link(const struct city *pcity)
Definition featured_text.c:1076
unit_link
const char * unit_link(const struct unit *punit)
Definition featured_text.c:1126
unit_tile_link
const char * unit_tile_link(const struct unit *punit)
Definition featured_text.c:1143
featured_text.h
game
struct civ_game game
Definition game.c:61
wld
struct world wld
Definition game.c:62
game.h
government_name_translation
const char * government_name_translation(const struct government *pgovern)
Definition government.c:143
government_rule_name
const char * government_rule_name(const struct government *pgovern)
Definition government.c:133
government.h
can_player_build_improvement_direct
bool can_player_build_improvement_direct(const struct player *p, const struct impr_type *pimprove)
Definition improvement.c:664
is_improvement
bool is_improvement(const struct impr_type *pimprove)
Definition improvement.c:788
wonder_is_built
bool wonder_is_built(const struct player *pplayer, const struct impr_type *pimprove)
Definition improvement.c:876
improvement_rule_name
const char * improvement_rule_name(const struct impr_type *pimprove)
Definition improvement.c:252
is_wonder
bool is_wonder(const struct impr_type *pimprove)
Definition improvement.c:343
is_great_wonder
bool is_great_wonder(const struct impr_type *pimprove)
Definition improvement.c:772
improvement_name_translation
const char * improvement_name_translation(const struct impr_type *pimprove)
Definition improvement.c:243
is_small_wonder
bool is_small_wonder(const struct impr_type *pimprove)
Definition improvement.c:780
improvement.h
name
const char * name
Definition inputfile.c:127
fc_assert_msg
#define fc_assert_msg(condition, message,...)
Definition log.h:181
fc_assert
#define fc_assert(condition)
Definition log.h:176
fc_assert_ret_val
#define fc_assert_ret_val(condition, val)
Definition log.h:194
luascript_error
int luascript_error(lua_State *L, const char *format,...)
Definition luascript.c:292
luascript_dir
const Direction * luascript_dir(enum direction8 dir)
Definition luascript.c:790
luascript.h
LUASCRIPT_CHECK_STATE
#define LUASCRIPT_CHECK_STATE(L,...)
Definition luascript.h:117
LUASCRIPT_CHECK_SELF
#define LUASCRIPT_CHECK_SELF(L, value,...)
Definition luascript.h:146
LUASCRIPT_CHECK_ARG_NIL
#define LUASCRIPT_CHECK_ARG_NIL(L, value, narg, type,...)
Definition luascript.h:138
LUASCRIPT_CHECK_ARG
#define LUASCRIPT_CHECK_ARG(L, check, narg, msg,...)
Definition luascript.h:131
LUASCRIPT_CHECK
#define LUASCRIPT_CHECK(L, check, msg,...)
Definition luascript.h:124
City_List_Link
const struct city_list_link City_List_Link
Definition luascript_types.h:72
Direction
enum direction8 Direction
Definition luascript_types.h:59
Unit_List_Link
const struct unit_list_link Unit_List_Link
Definition luascript_types.h:71
sq_map_distance
int sq_map_distance(const struct tile *tile0, const struct tile *tile1)
Definition map.c:647
map_pos_to_tile
struct tile * map_pos_to_tile(const struct civ_map *nmap, int map_x, int map_y)
Definition map.c:425
normalize_map_pos
bool normalize_map_pos(const struct civ_map *nmap, int *x, int *y)
Definition map.c:991
map.h
index_to_native_pos_y
#define index_to_native_pos_y(mindex)
Definition map.h:155
index_to_map_pos_y
static int index_to_map_pos_y(int mindex)
Definition map.h:710
index_to_map_pos_x
static int index_to_map_pos_x(int mindex)
Definition map.h:701
index_to_native_pos_x
#define index_to_native_pos_x(mindex)
Definition map.h:153
index_to_map_pos
#define index_to_map_pos(pmap_x, pmap_y, mindex)
Definition map.h:218
can_exist_at_tile
bool can_exist_at_tile(const struct civ_map *nmap, const struct unit_type *utype, const struct tile *ptile)
Definition movement.c:289
movement.h
nation_rule_name
const char * nation_rule_name(const struct nation_type *pnation)
Definition nation.c:138
nation_adjective_translation
const char * nation_adjective_translation(const struct nation_type *pnation)
Definition nation.c:149
nation_plural_translation
const char * nation_plural_translation(const struct nation_type *pnation)
Definition nation.c:159
nation.h
player_count
int player_count(void)
Definition player.c:817
player_number
int player_number(const struct player *pplayer)
Definition player.c:837
player_has_flag
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
Definition player.c:1996
pplayers_allied
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1409
players_iterate_end
#define players_iterate_end
Definition player.h:539
players_iterate
#define players_iterate(_pplayer)
Definition player.h:534
research_advance_name_translation
const char * research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
Definition research.c:273
research_total_bulbs_required
int research_total_bulbs_required(const struct research *presearch, Tech_type_id tech, bool loss_value)
Definition research.c:868
research_rule_name
const char * research_rule_name(const struct research *presearch)
Definition research.c:143
research_get
struct research * research_get(const struct player *pplayer)
Definition research.c:128
research_invention_state
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Definition research.c:619
research_pretty_name
int research_pretty_name(const struct research *presearch, char *buf, size_t buf_len)
Definition research.c:169
research.h
ARRAY_SIZE
#define ARRAY_SIZE(x)
Definition shared.h:85
achievement
Definition achievements.h:26
action
Definition actions.h:106
advance
Definition tech.h:124
city
Definition city.h:320
city::counter_values
int * counter_values
Definition city.h:408
city::capital
enum capital_type capital
Definition city.h:328
city::happy
bool happy
Definition city.h:462
city::tile
struct tile * tile
Definition city.h:322
city::unhappy
bool unhappy
Definition city.h:463
city::client
struct city::@17::@20 client
civ_game::control
struct packet_ruleset_control control
Definition game.h:83
civ_game::info
struct packet_game_info info
Definition game.h:89
civ_game::rulesetdir
char rulesetdir[MAX_LEN_NAME]
Definition game.h:239
civ_game::server
struct civ_game::@31::@35 server
civ_map
Definition map_types.h:71
connection
Definition connection.h:136
connection::client_gui
enum gui_type client_gui
Definition connection.h:179
counter
Definition counters.h:27
disaster_type
Definition disaster.h:48
extra_type
Definition extras.h:88
government
Definition government.h:52
impr_type
Definition improvement.h:50
nation_type
Definition nation.h:98
packet_game_info::citizen_partisans_pct
int citizen_partisans_pct
Definition packets_gen.h:148
packet_game_info::citizen_nationality
bool citizen_nationality
Definition packets_gen.h:144
packet_game_info::fragment_count
int fragment_count
Definition packets_gen.h:250
packet_game_info::tech_leakage
enum tech_leakage_style tech_leakage
Definition packets_gen.h:231
packet_game_info::turn
int turn
Definition packets_gen.h:245
packet_game_info::year
int year
Definition packets_gen.h:247
packet_game_info::sciencebox
int sciencebox
Definition packets_gen.h:224
packet_game_info::tech_cost_style
enum tech_cost_style tech_cost_style
Definition packets_gen.h:230
packet_ruleset_control::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1463
player_economic::infra_points
int infra_points
Definition player.h:67
player_economic::gold
int gold
Definition player.h:63
player
Definition player.h:249
player::cities
struct city_list * cities
Definition player.h:281
player::units
struct unit_list * units
Definition player.h:282
player::connections
struct conn_list * connections
Definition player.h:298
player::economic
struct player_economic economic
Definition player.h:284
req_context
Definition requirements.h:100
research
Definition research.h:39
terrain
Definition terrain.h:75
tile
Definition tile.h:50
tile::units
struct unit_list * units
Definition tile.h:58
unit_type
Definition unittype.h:507
unit
Definition unit.h:140
unit::transporting
struct unit_list * transporting
Definition unit.h:187
unit::facing
enum direction8 facing
Definition unit.h:144
unit::transporter
struct unit * transporter
Definition unit.h:186
world::map
struct civ_map map
Definition world_object.h:38
fc_strcasecmp
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:186
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
advance_by_number
struct advance * advance_by_number(const Tech_type_id atype)
Definition tech.c:107
advance_name_translation
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:300
advance_rule_name
const char * advance_rule_name(const struct advance *padvance)
Definition tech.c:309
advance_index
Tech_type_id advance_index(const struct advance *padvance)
Definition tech.c:89
advance_number
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
tech.h
A_FUTURE
#define A_FUTURE
Definition tech.h:46
A_FIRST
#define A_FIRST
Definition tech.h:44
A_UNSET
#define A_UNSET
Definition tech.h:48
A_UNKNOWN
#define A_UNKNOWN
Definition tech.h:49
A_LAST
#define A_LAST
Definition tech.h:45
terrain_name_translation
const char * terrain_name_translation(const struct terrain *pterrain)
Definition terrain.c:238
terrain_rule_name
const char * terrain_rule_name(const struct terrain *pterrain)
Definition terrain.c:247
terrain_type_terrain_class
enum terrain_class terrain_type_terrain_class(const struct terrain *pterrain)
Definition terrain.c:582
terrain.h
tile_city
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
tile.h
tile_index
#define tile_index(_pt_)
Definition tile.h:89
tile_has_extra
#define tile_has_extra(ptile, pextra)
Definition tile.h:148
unit_transform_result
enum unit_upgrade_result unit_transform_result(const struct civ_map *nmap, const struct unit *punit, const struct unit_type *to_unittype)
Definition unit.c:1994
unit_upgrade_test
enum unit_upgrade_result unit_upgrade_test(const struct civ_map *nmap, const struct unit *punit, bool is_free)
Definition unit.c:2026
unit_tile
#define unit_tile(_pu)
Definition unit.h:397
unit_upgrade_result
unit_upgrade_result
Definition unit.h:61
UU_NO_MONEY
@ UU_NO_MONEY
Definition unit.h:64
UU_NOT_IN_CITY
@ UU_NOT_IN_CITY
Definition unit.h:65
UU_NO_UNITTYPE
@ UU_NO_UNITTYPE
Definition unit.h:63
UU_NOT_TERRAIN
@ UU_NOT_TERRAIN
Definition unit.h:68
UU_UNSUITABLE_TRANSPORT
@ UU_UNSUITABLE_TRANSPORT
Definition unit.h:69
UU_NOT_CITY_OWNER
@ UU_NOT_CITY_OWNER
Definition unit.h:66
UU_NOT_ENOUGH_ROOM
@ UU_NOT_ENOUGH_ROOM
Definition unit.h:67
UU_OK
@ UU_OK
Definition unit.h:62
UU_NOT_ACTIVITY
@ UU_NOT_ACTIVITY
Definition unit.h:70
is_non_allied_unit_tile
static bool is_non_allied_unit_tile(const struct tile *ptile, const struct player *pplayer, bool everyone_non_allied)
Definition unit.h:433
unitlist.h
can_player_build_unit_direct
bool can_player_build_unit_direct(const struct player *p, const struct unit_type *punittype, bool consider_reg_impr_req)
Definition unittype.c:1968
utype_has_role
bool utype_has_role(const struct unit_type *punittype, int role)
Definition unittype.c:199
can_upgrade_unittype
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1703
utype_rule_name
const char * utype_rule_name(const struct unit_type *punittype)
Definition unittype.c:1578
utype_name_translation
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1560
unittype.h
utype_has_flag
static bool utype_has_flag(const struct unit_type *punittype, int flag)
Definition unittype.h:624
MAP_ITERATE_OUTWARDS_INDICES
#define MAP_ITERATE_OUTWARDS_INDICES
Definition world_object.h:66
MAP_NUM_ITERATE_OUTWARDS_INDICES
#define MAP_NUM_ITERATE_OUTWARDS_INDICES
Definition world_object.h:67