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 bool api_methods_building_type_is_wonder(lua_State *L,
124 Building_Type *pbuilding)
125{
126 LUASCRIPT_CHECK_STATE(L, FALSE);
127 LUASCRIPT_CHECK_SELF(L, pbuilding, FALSE);
128
129 return is_wonder(pbuilding);
130}
131
132/**********************************************************************/
135 bool api_methods_building_type_is_great_wonder(lua_State *L,
136 Building_Type *pbuilding)
137{
138 LUASCRIPT_CHECK_STATE(L, FALSE);
139 LUASCRIPT_CHECK_SELF(L, pbuilding, FALSE);
140
141 return is_great_wonder(pbuilding);
142}
143
144/**********************************************************************/
147 bool api_methods_building_type_is_small_wonder(lua_State *L,
148 Building_Type *pbuilding)
149{
150 LUASCRIPT_CHECK_STATE(L, FALSE);
151 LUASCRIPT_CHECK_SELF(L, pbuilding, FALSE);
152
153 return is_small_wonder(pbuilding);
154}
155
156/**********************************************************************/
159 bool api_methods_building_type_is_improvement(lua_State *L,
160 Building_Type *pbuilding)
161{
162 LUASCRIPT_CHECK_STATE(L, FALSE);
163 LUASCRIPT_CHECK_SELF(L, pbuilding, FALSE);
164
165 return is_improvement(pbuilding);
166}
167
168/**********************************************************************/
171 const char *api_methods_building_type_rule_name(lua_State *L,
172 Building_Type *pbuilding)
173{
174 LUASCRIPT_CHECK_STATE(L, NULL);
175 LUASCRIPT_CHECK_SELF(L, pbuilding, NULL);
176
177 return improvement_rule_name(pbuilding);
178}
179
180/**********************************************************************/
183const char
184 *api_methods_building_type_name_translation(lua_State *L,
185 Building_Type *pbuilding)
186{
187 LUASCRIPT_CHECK_STATE(L, NULL);
188 LUASCRIPT_CHECK_SELF(L, pbuilding, NULL);
189
190 return improvement_name_translation(pbuilding);
191}
192
193/**********************************************************************/
196 bool api_methods_city_has_building(lua_State *L, City *pcity,
197 Building_Type *building)
198{
199 LUASCRIPT_CHECK_STATE(L, FALSE);
200 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
201 LUASCRIPT_CHECK_ARG_NIL(L, building, 3, Building_Type, FALSE);
202
203 return city_has_building(pcity, building);
204}
205
206/**********************************************************************/
209 int api_methods_city_map_sq_radius(lua_State *L, City *pcity)
210{
211 LUASCRIPT_CHECK_STATE(L, 0);
212 LUASCRIPT_CHECK_SELF(L, pcity, 0);
213
214 return city_map_radius_sq_get(pcity);
215}
216
217/**********************************************************************/
220 int api_methods_city_size_get(lua_State *L, City *pcity)
221{
222 LUASCRIPT_CHECK_STATE(L, 1);
223 LUASCRIPT_CHECK_SELF(L, pcity, 1);
224
225 return city_size_get(pcity);
226}
227
228/**********************************************************************/
231 Tile *api_methods_city_tile_get(lua_State *L, City *pcity)
232{
233 LUASCRIPT_CHECK_STATE(L, NULL);
234 LUASCRIPT_CHECK_SELF(L, pcity, NULL);
235
236 return pcity->tile;
237}
238
239/**********************************************************************/
242 int api_methods_city_inspire_partisans(lua_State *L, City *self,
243 Player *inspirer)
244{
245 bool inspired = FALSE;
246
247 if (!game.info.citizen_nationality) {
248 if (self->original == inspirer) {
249 inspired = TRUE;
250 }
251 } else {
252 if (game.info.citizen_partisans_pct > 0) {
253 if (is_server()) {
254 citizens own = citizens_nation_get(self, inspirer->slot);
255 citizens total = city_size_get(self);
256
257 if (total > 0 && (own * 100 / total) >= game.info.citizen_partisans_pct) {
258 inspired = TRUE;
259 }
260 }
261 /* else is_client() -> don't consider inspired by default. */
262 } else if (self->original == inspirer) {
263 inspired = TRUE;
264 }
265 }
266
267 if (inspired) {
268 /* Cannot use get_city_bonus() as it would use city's current owner
269 * instead of inspirer. */
270 return get_target_bonus_effects(NULL,
271 &(const struct req_context) {
272 .player = inspirer,
273 .city = self,
274 .tile = city_tile(self),
275 },
276 NULL, EFT_INSPIRE_PARTISANS);
277 }
278
279 return 0;
280}
281
282/**********************************************************************/
285 int api_methods_city_culture_get(lua_State *L, City *pcity)
286{
287 LUASCRIPT_CHECK_STATE(L, 0);
288 LUASCRIPT_CHECK_SELF(L, pcity, 0);
289
290 return city_culture(pcity);
291}
292
293/**********************************************************************/
296 const char *api_methods_counter_rule_name(lua_State *L, Counter *c)
297{
298 LUASCRIPT_CHECK_ARG_NIL(L, c, 2, Counter, NULL);
299
300 return counter_rule_name(c);
301}
302
303/**********************************************************************/
306 const char *api_methods_counter_name_translation(lua_State *L, Counter *c)
307{
308 LUASCRIPT_CHECK_ARG_NIL(L, c, 2, Counter, NULL);
309
310 return counter_name_translation(c);
311}
312
313/**********************************************************************/
316 int api_methods_counter_city_get(lua_State *L, Counter *c, City *city)
317{
318 LUASCRIPT_CHECK_ARG_NIL(L, city, 3, City, -1);
319
320 return city->counter_values[counter_index(c)];
321}
322
323/**********************************************************************/
326 bool api_methods_is_city_happy(lua_State *L, City *pcity)
327{
328 LUASCRIPT_CHECK_STATE(L, FALSE);
329 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
330
331 /* Note: if clients ever have virtual cities or sth, needs amending */
332 return is_server() ? city_happy(pcity) : pcity->client.happy;
333}
334
335/**********************************************************************/
338 bool api_methods_is_city_unhappy(lua_State *L, City *pcity)
339{
340 LUASCRIPT_CHECK_STATE(L, FALSE);
341 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
342
343 /* Note: if clients ever have virtual cities or sth, needs amending */
344 return is_server() ? city_unhappy(pcity) : pcity->client.unhappy;
345}
346
347/**********************************************************************/
350 bool api_methods_is_city_celebrating(lua_State *L, City *pcity)
351{
352 LUASCRIPT_CHECK_STATE(L, FALSE);
353 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
354
355 return city_celebrating(pcity);
356}
357
358/**********************************************************************/
361 bool api_methods_is_gov_center(lua_State *L, City *pcity)
362{
363 LUASCRIPT_CHECK_STATE(L, FALSE);
364 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
365
366 return is_gov_center(pcity);
367}
368
369/**********************************************************************/
372 bool api_methods_is_capital(lua_State *L, City *pcity)
373{
374 LUASCRIPT_CHECK_STATE(L, FALSE);
375 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
376
377 return is_capital(pcity);
378}
379
380/**********************************************************************/
383 bool api_methods_is_primary_capital(lua_State *L, City *pcity)
384{
385 LUASCRIPT_CHECK_STATE(L, FALSE);
386 LUASCRIPT_CHECK_SELF(L, pcity, FALSE);
387
388 return pcity->capital == CAPITAL_PRIMARY;
389}
390
391/**********************************************************************/
394 const char *api_methods_government_rule_name(lua_State *L,
395 Government *pgovernment)
396{
397 LUASCRIPT_CHECK_STATE(L, NULL);
398 LUASCRIPT_CHECK_SELF(L, pgovernment, NULL);
399
400 return government_rule_name(pgovernment);
401}
402
403/**********************************************************************/
406 const char *api_methods_government_name_translation(lua_State *L,
407 Government *pgovernment)
408{
409 LUASCRIPT_CHECK_STATE(L, NULL);
410 LUASCRIPT_CHECK_SELF(L, pgovernment, NULL);
411
412 return government_name_translation(pgovernment);
413}
414
415/**********************************************************************/
418 const char *api_methods_nation_type_rule_name(lua_State *L,
419 Nation_Type *pnation)
420{
421 LUASCRIPT_CHECK_STATE(L, NULL);
422 LUASCRIPT_CHECK_SELF(L, pnation, NULL);
423
424 return nation_rule_name(pnation);
425}
426
427/**********************************************************************/
430 const char *api_methods_nation_type_name_translation(lua_State *L,
431 Nation_Type *pnation)
432{
433 LUASCRIPT_CHECK_STATE(L, NULL);
434 LUASCRIPT_CHECK_SELF(L, pnation, NULL);
435
436 return nation_adjective_translation(pnation);
437}
438
439/**********************************************************************/
442 const char *api_methods_nation_type_plural_translation(lua_State *L,
443 Nation_Type *pnation)
444{
445 LUASCRIPT_CHECK_STATE(L, NULL);
446 LUASCRIPT_CHECK_SELF(L, pnation, NULL);
447
448 return nation_plural_translation(pnation);
449}
450
451/**********************************************************************/
454 const char *api_methods_player_controlling_gui(lua_State *L,
455 Player *pplayer)
456{
457 struct connection *conn = NULL;
458
459 LUASCRIPT_CHECK_STATE(L, NULL);
460 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
461
462 conn_list_iterate(pplayer->connections, pconn) {
463 if (!pconn->observer) {
464 conn = pconn;
465 break;
466 }
467 } conn_list_iterate_end;
468
469 if (conn == NULL) {
470 return "None";
471 }
472
473 return gui_type_name(conn->client_gui);
474}
475
476/**********************************************************************/
479 bool api_methods_player_has_wonder(lua_State *L, Player *pplayer,
480 Building_Type *building)
481{
482 LUASCRIPT_CHECK_STATE(L, FALSE);
483 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
484 LUASCRIPT_CHECK_ARG_NIL(L, building, 3, Building_Type, FALSE);
485
486 return wonder_is_built(pplayer, building);
487}
488
489/**********************************************************************/
492 int api_methods_player_number(lua_State *L, Player *pplayer)
493{
494 LUASCRIPT_CHECK_STATE(L, -1);
495 LUASCRIPT_CHECK_SELF(L, pplayer, -1);
496
497 return player_number(pplayer);
498}
499
500/**********************************************************************/
503 int api_methods_player_num_cities(lua_State *L, Player *pplayer)
504{
505 LUASCRIPT_CHECK_STATE(L, 0);
506 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
507
508 return city_list_size(pplayer->cities);
509}
510
511/**********************************************************************/
514 int api_methods_player_num_units(lua_State *L, Player *pplayer)
515{
516 LUASCRIPT_CHECK_STATE(L, 0);
517 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
518
519 return unit_list_size(pplayer->units);
520}
521
522/**********************************************************************/
525 int api_methods_player_gold(lua_State *L, Player *pplayer)
526{
527 LUASCRIPT_CHECK_STATE(L, 0);
528 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
529
530 return pplayer->economic.gold;
531}
532
533/**********************************************************************/
536 int api_methods_player_infrapoints(lua_State *L, Player *pplayer)
537{
538 LUASCRIPT_CHECK_STATE(L, 0);
539 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
540
541 return pplayer->economic.infra_points;
542}
543
544/**********************************************************************/
547 bool api_methods_player_knows_tech(lua_State *L, Player *pplayer,
548 Tech_Type *ptech)
549{
550 LUASCRIPT_CHECK_STATE(L, FALSE);
551 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
552 LUASCRIPT_CHECK_ARG_NIL(L, ptech, 3, Tech_Type, FALSE);
553
554 return research_invention_state(research_get(pplayer),
555 advance_number(ptech)) == TECH_KNOWN;
556}
557
558/**********************************************************************/
562 bool api_method_player_can_research(lua_State *L, Player *pplayer,
563 Tech_Type *ptech)
564{
565 LUASCRIPT_CHECK_STATE(L, FALSE);
566 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
567 LUASCRIPT_CHECK_ARG_NIL(L, ptech, 3, Tech_Type, FALSE);
568
569 return TECH_PREREQS_KNOWN
570 == research_invention_state(research_get(pplayer),
571 advance_number(ptech));
572}
573
574/**********************************************************************/
586 int api_methods_player_tech_cost(lua_State *L, Player *pplayer,
587 Tech_Type *ptech)
588{
589 LUASCRIPT_CHECK_STATE(L, 0);
590 LUASCRIPT_CHECK_ARG_NIL(L, ptech, 3, Tech_Type, 0);
591
592 if (!pplayer && TECH_COST_CIV1CIV2 == game.info.tech_cost_style) {
593 /* Avoid getting error messages and return at least something */
594 return ptech->cost * (double) game.info.sciencebox / 100.0;
595 }
596 return
597 research_total_bulbs_required(pplayer ? research_get(pplayer) : NULL,
598 advance_index(ptech), TRUE);
599}
600
601/**********************************************************************/
609 lua_Object
610api_methods_player_researching(lua_State *L, Player *pplayer)
611{
612 const struct research *presearch;
613 int rr;
614
615 LUASCRIPT_CHECK_STATE(L, 0);
616 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
617 presearch = research_get(pplayer);
618 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
619
620 rr = presearch->researching;
621
622 switch (rr) {
623 case A_FUTURE:
624 lua_pushstring(L, research_advance_name_translation(presearch, rr));
625 break;
626 case A_UNSET:
627 case A_UNKNOWN:
628 lua_pushnil(L);
629 break;
630 default:
631 /* A regular tech */
632 fc_assert(rr >= A_FIRST && rr <= A_LAST);
633 tolua_pushusertype(L, advance_by_number(rr), "Tech_Type");
634 }
635
636 return lua_gettop(L);
637}
638
639/**********************************************************************/
644 int api_methods_player_bulbs(lua_State *L, Player *pplayer)
645{
646 const struct research *presearch;
647
648 LUASCRIPT_CHECK_STATE(L, 0);
649 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
650 presearch = research_get(pplayer);
651 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
652
653 return presearch->bulbs_researched;
654}
655
656/**********************************************************************/
661 int api_methods_player_research_cost(lua_State *L, Player *pplayer)
662{
663 const struct research *presearch;
664
665 LUASCRIPT_CHECK_STATE(L, 0);
666 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
667 presearch = research_get(pplayer);
668 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
669
670 return is_server()
671 ? research_total_bulbs_required(presearch, presearch->researching, FALSE)
672 : presearch->client.researching_cost;
673}
674
675/**********************************************************************/
680 int api_methods_player_future(lua_State *L, Player *pplayer)
681{
682 const struct research *presearch;
683
684 LUASCRIPT_CHECK_STATE(L, 0);
685 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
686 presearch = research_get(pplayer);
687 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
688
689 return presearch->future_tech;
690}
691
692/**********************************************************************/
695 int api_methods_player_culture_get(lua_State *L, Player *pplayer)
696{
697 LUASCRIPT_CHECK_STATE(L, 0);
698 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
699
700 return player_culture(pplayer);
701}
702
703/**********************************************************************/
706 bool api_methods_player_has_flag(lua_State *L, Player *pplayer,
707 const char *flag)
708{
709 enum plr_flag_id flag_val;
710
711 LUASCRIPT_CHECK_STATE(L, 0);
712 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
713
714 flag_val = plr_flag_id_by_name(flag, fc_strcasecmp);
715
716 if (plr_flag_id_is_valid(flag_val)) {
717 return player_has_flag(pplayer, flag_val);
718 }
719
720 return FALSE;
721}
722
723/**********************************************************************/
727 Unit_Type *api_methods_player_can_upgrade(lua_State *L, Player *pplayer,
728 Unit_Type *utype)
729{
730 LUASCRIPT_CHECK_STATE(L, NULL);
731 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
732 LUASCRIPT_CHECK_ARG_NIL(L, utype, 3, Unit_Type, NULL);
733
734 return (Unit_Type *)can_upgrade_unittype(pplayer, utype);
735}
736
737/**********************************************************************/
741 bool api_methods_player_can_build_unit_direct(lua_State *L, Player *pplayer,
742 Unit_Type *utype)
743{
744 LUASCRIPT_CHECK_STATE(L, FALSE);
745 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
746 LUASCRIPT_CHECK_ARG_NIL(L, utype, 3, Unit_Type, FALSE);
747
748 return can_player_build_unit_direct(pplayer, utype, TRUE);
749}
750
751/**********************************************************************/
754 bool api_methods_player_can_build_impr_direct(lua_State *L, Player *pplayer,
755 Building_Type *itype)
756{
757 LUASCRIPT_CHECK_STATE(L, FALSE);
758 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
759 LUASCRIPT_CHECK_ARG_NIL(L, itype, 3, Building_Type, FALSE);
760
761 return can_player_build_improvement_direct(pplayer, itype);
762}
763
764
765/**********************************************************************/
769 bool api_methods_unit_can_upgrade(lua_State *L, Unit *punit, bool is_free)
770{
771
772 return UU_OK == unit_upgrade_test(&(wld.map), punit, is_free);
773}
774
775/**********************************************************************/
779 const char *api_methods_unit_transform_problem(lua_State *L, Unit *punit,
780 Unit_Type *ptype)
781{
782 enum unit_upgrade_result uu;
783
784 LUASCRIPT_CHECK_STATE(L, NULL);
785 LUASCRIPT_CHECK_SELF(L, punit, NULL);
786 LUASCRIPT_CHECK_ARG_NIL(L, ptype, 3, Unit_Type, NULL);
787
788 uu = unit_transform_result(&(wld.map), punit, ptype);
789 switch (uu) {
790 case UU_OK:
791 return NULL;
792 case UU_NOT_ENOUGH_ROOM:
793 return "cargo";
794 case UU_UNSUITABLE_TRANSPORT:
795 return "transport";
796 case UU_NOT_TERRAIN:
797 return "terrain";
798 case UU_NOT_ACTIVITY:
799 return "activity";
800 case UU_NO_UNITTYPE:
801 case UU_NO_MONEY:
802 case UU_NOT_IN_CITY:
803 case UU_NOT_CITY_OWNER:
804 /* should not get here */
805 break;
806 }
807
808 fc_assert_msg(FALSE, "Unexpected unit transform result %i", uu);
809
810 return "\?";
811}
812
813/**********************************************************************/
816 bool api_methods_player_shares_research(lua_State *L, Player *pplayer,
817 Player *aplayer)
818{
819 LUASCRIPT_CHECK_STATE(L, FALSE);
820 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
821 LUASCRIPT_CHECK_ARG_NIL(L, aplayer, 3, Player, FALSE);
822
823 return research_get(pplayer) == research_get(aplayer);
824}
825
826/**********************************************************************/
829 const char *api_methods_research_rule_name(lua_State *L, Player *pplayer)
830{
831 LUASCRIPT_CHECK_STATE(L, NULL);
832 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
833
834 return research_rule_name(research_get(pplayer));
835}
836
837/**********************************************************************/
840 const char *api_methods_research_name_translation(lua_State *L,
841 Player *pplayer)
842{
843 static char buf[MAX_LEN_MSG];
844
845 LUASCRIPT_CHECK_STATE(L, NULL);
846 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
847
848 (void) research_pretty_name(research_get(pplayer), buf, ARRAY_SIZE(buf));
849
850 return buf;
851}
852
853/**********************************************************************/
857 lua_Object api_methods_private_list_players(lua_State *L)
858{
859 lua_Object result = 0;
860 int i = 0;
861
862 LUASCRIPT_CHECK_STATE(L, 0);
863 lua_createtable(L, player_count(), 0);
864 result = lua_gettop(L);
865 players_iterate(pplayer) {
866 tolua_pushfieldusertype(L, result, ++i, pplayer, "Player");
867 } players_iterate_end;
868 return result;
869}
870
871/**********************************************************************/
874 Unit_List_Link *api_methods_private_player_unit_list_head(lua_State *L,
875 Player *pplayer)
876{
877 LUASCRIPT_CHECK_STATE(L, NULL);
878 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
879 return unit_list_head(pplayer->units);
880}
881
882/**********************************************************************/
885 City_List_Link *api_methods_private_player_city_list_head(lua_State *L,
886 Player *pplayer)
887{
888 LUASCRIPT_CHECK_STATE(L, NULL);
889 LUASCRIPT_CHECK_SELF(L, pplayer, NULL);
890
891 return city_list_head(pplayer->cities);
892}
893
894/**********************************************************************/
897 const char *api_methods_tech_type_rule_name(lua_State *L, Tech_Type *ptech)
898{
899 LUASCRIPT_CHECK_STATE(L, NULL);
900 LUASCRIPT_CHECK_SELF(L, ptech, NULL);
901
902 return advance_rule_name(ptech);
903}
904
905/**********************************************************************/
908 const char *api_methods_tech_type_name_translation(lua_State *L,
909 Tech_Type *ptech)
910{
911 LUASCRIPT_CHECK_STATE(L, NULL);
912 LUASCRIPT_CHECK_SELF(L, ptech, NULL);
913
914 return advance_name_translation(ptech);
915}
916
917/**********************************************************************/
920 const char *api_methods_terrain_rule_name(lua_State *L, Terrain *pterrain)
921{
922 LUASCRIPT_CHECK_STATE(L, NULL);
923 LUASCRIPT_CHECK_SELF(L, pterrain, NULL);
924
925 return terrain_rule_name(pterrain);
926}
927
928/**********************************************************************/
931 const char *api_methods_terrain_name_translation(lua_State *L,
932 Terrain *pterrain)
933{
934 LUASCRIPT_CHECK_STATE(L, NULL);
935 LUASCRIPT_CHECK_SELF(L, pterrain, NULL);
936
937 return terrain_name_translation(pterrain);
938}
939
940/**********************************************************************/
943 const char *api_methods_terrain_class_name(lua_State *L, Terrain *pterrain)
944{
945 LUASCRIPT_CHECK_STATE(L, NULL);
946 LUASCRIPT_CHECK_SELF(L, pterrain, NULL);
947
948 return terrain_class_name(terrain_type_terrain_class(pterrain));
949}
950
951/**********************************************************************/
954 const char *api_methods_disaster_rule_name(lua_State *L, Disaster *pdis)
955{
956 LUASCRIPT_CHECK_STATE(L, NULL);
957 LUASCRIPT_CHECK_SELF(L, pdis, NULL);
958
959 return disaster_rule_name(pdis);
960}
961
962/**********************************************************************/
965 const char *api_methods_disaster_name_translation(lua_State *L,
966 Disaster *pdis)
967{
968 LUASCRIPT_CHECK_STATE(L, NULL);
969 LUASCRIPT_CHECK_SELF(L, pdis, NULL);
970
971 return disaster_name_translation(pdis);
972}
973
974/**********************************************************************/
977 const char *api_methods_achievement_rule_name(lua_State *L,
978 Achievement *pach)
979{
980 LUASCRIPT_CHECK_STATE(L, NULL);
981 LUASCRIPT_CHECK_SELF(L, pach, NULL);
982
983 return achievement_rule_name(pach);
984}
985
986/**********************************************************************/
989 const char *api_methods_achievement_name_translation(lua_State *L,
990 Achievement *pach)
991{
992 LUASCRIPT_CHECK_STATE(L, NULL);
993 LUASCRIPT_CHECK_SELF(L, pach, NULL);
994
995 return achievement_name_translation(pach);
996}
997
998/**********************************************************************/
1001 const char *api_methods_action_rule_name(lua_State *L, Action *pact)
1002{
1003 LUASCRIPT_CHECK_STATE(L, NULL);
1004 LUASCRIPT_CHECK_SELF(L, pact, NULL);
1005
1006 return action_id_rule_name(pact->id);
1007}
1008
1009/**********************************************************************/
1012 const char *api_methods_action_name_translation(lua_State *L, Action *pact)
1013{
1014 LUASCRIPT_CHECK_STATE(L, NULL);
1015 LUASCRIPT_CHECK_SELF(L, pact, NULL);
1016
1017 return action_id_name_translation(pact->id);
1018}
1019
1020/**********************************************************************/
1023 const char *api_methods_action_target_kind(lua_State *L, Action *pact)
1024{
1025 struct action *paction;
1026
1027 LUASCRIPT_CHECK_STATE(L, NULL);
1028 LUASCRIPT_CHECK_SELF(L, pact, NULL);
1029
1030 paction = action_by_number(pact->id);
1031 fc_assert_ret_val(paction, "error: no action");
1032
1033 return action_target_kind_name(action_get_target_kind(paction));
1034}
1035
1036/**********************************************************************/
1039 int api_methods_tile_nat_x(lua_State *L, Tile *ptile)
1040{
1041 LUASCRIPT_CHECK_STATE(L, -1);
1042 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1043
1044 return index_to_native_pos_x(tile_index(ptile));
1045}
1046
1047/**********************************************************************/
1050 int api_methods_tile_nat_y(lua_State *L, Tile *ptile)
1051{
1052 LUASCRIPT_CHECK_STATE(L, -1);
1053 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1054
1055 return index_to_native_pos_y(tile_index(ptile));
1056}
1057
1058/**********************************************************************/
1061 int api_methods_tile_map_x(lua_State *L, Tile *ptile)
1062{
1063 LUASCRIPT_CHECK_STATE(L, -1);
1064 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1065
1066 return index_to_map_pos_x(tile_index(ptile));
1067}
1068
1069/**********************************************************************/
1072 int api_methods_tile_map_y(lua_State *L, Tile *ptile)
1073{
1074 LUASCRIPT_CHECK_STATE(L, -1);
1075 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1076
1077 return index_to_map_pos_y(tile_index(ptile));
1078}
1079
1080/**********************************************************************/
1083 City *api_methods_tile_city(lua_State *L, Tile *ptile)
1084{
1085 LUASCRIPT_CHECK_STATE(L, NULL);
1086 LUASCRIPT_CHECK_SELF(L, ptile, NULL);
1087
1088 return tile_city(ptile);
1089}
1090
1091/**********************************************************************/
1094 bool api_methods_tile_city_exists_within_max_city_map(lua_State *L,
1095 Tile *ptile,
1096 bool may_be_on_center)
1097{
1098 LUASCRIPT_CHECK_STATE(L, FALSE);
1099 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1100
1101 return city_exists_within_max_city_map(ptile, may_be_on_center);
1102}
1103
1104/**********************************************************************/
1108 bool api_methods_tile_has_extra(lua_State *L, Tile *ptile,
1109 const char *name)
1110{
1111 LUASCRIPT_CHECK_STATE(L, FALSE);
1112 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1113
1114 if (!name) {
1115 extra_type_iterate(pextra) {
1116 if (tile_has_extra(ptile, pextra)) {
1117 return TRUE;
1118 }
1119 } extra_type_iterate_end;
1120
1121 return FALSE;
1122 } else {
1123 struct extra_type *pextra;
1124
1125 pextra = extra_type_by_rule_name(name);
1126
1127 return (NULL != pextra && tile_has_extra(ptile, pextra));
1128 }
1129}
1130
1131/**********************************************************************/
1135 bool api_methods_tile_has_base(lua_State *L, Tile *ptile, const char *name)
1136{
1137 LUASCRIPT_CHECK_STATE(L, FALSE);
1138 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1139
1140 if (!name) {
1141 extra_type_by_cause_iterate(EC_BASE, pextra) {
1142 if (tile_has_extra(ptile, pextra)) {
1143 return TRUE;
1144 }
1145 } extra_type_by_cause_iterate_end;
1146
1147 return FALSE;
1148 } else {
1149 struct extra_type *pextra;
1150
1151 pextra = extra_type_by_rule_name(name);
1152
1153 return (NULL != pextra && is_extra_caused_by(pextra, EC_BASE)
1154 && tile_has_extra(ptile, pextra));
1155 }
1156}
1157
1158/**********************************************************************/
1162 bool api_methods_tile_has_road(lua_State *L, Tile *ptile, const char *name)
1163{
1164 LUASCRIPT_CHECK_STATE(L, FALSE);
1165 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1166
1167 if (!name) {
1168 extra_type_by_cause_iterate(EC_ROAD, pextra) {
1169 if (tile_has_extra(ptile, pextra)) {
1170 return TRUE;
1171 }
1172 } extra_type_by_cause_iterate_end;
1173
1174 return FALSE;
1175 } else {
1176 struct extra_type *pextra;
1177
1178 pextra = extra_type_by_rule_name(name);
1179
1180 return (NULL != pextra && is_extra_caused_by(pextra, EC_ROAD)
1181 && tile_has_extra(ptile, pextra));
1182 }
1183}
1184
1185/**********************************************************************/
1191 Player *api_methods_tile_extra_owner(lua_State *L,
1192 Tile *ptile, const char *extra_name)
1193{
1194 LUASCRIPT_CHECK_STATE(L, NULL);
1195 LUASCRIPT_CHECK_SELF(L, ptile, NULL);
1196
1197 if (extra_name) {
1198 struct extra_type *pextra;
1199
1200 pextra = extra_type_by_rule_name(extra_name);
1201 LUASCRIPT_CHECK_ARG(L, pextra != NULL, 3, "unknown extra type", NULL);
1202
1203 if (tile_has_extra(ptile, pextra)) {
1204 /* All extras have the same owner. */
1205 return extra_owner(ptile);
1206 } else {
1207 /* The extra isn't there. */
1208 return NULL;
1209 }
1210 } else {
1211 extra_type_iterate(pextra) {
1212 if (tile_has_extra(ptile, pextra)) {
1213 /* All extras have the same owner. */
1214 return extra_owner(ptile);
1215 }
1216 } extra_type_iterate_end;
1217 return NULL;
1218 }
1219}
1220
1221/**********************************************************************/
1224 bool api_methods_enemy_tile(lua_State *L, Tile *ptile, Player *against)
1225{
1226 struct city *pcity;
1227
1228 LUASCRIPT_CHECK_STATE(L, FALSE);
1229 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1230
1231 if (is_non_allied_unit_tile(ptile, against, FALSE)) {
1232 return TRUE;
1233 }
1234
1235 pcity = tile_city(ptile);
1236 if (pcity != NULL && !pplayers_allied(against, city_owner(pcity))) {
1237 return TRUE;
1238 }
1239
1240 return FALSE;
1241}
1242
1243/**********************************************************************/
1246 int api_methods_tile_num_units(lua_State *L, Tile *ptile)
1247{
1248 LUASCRIPT_CHECK_STATE(L, 0);
1249 LUASCRIPT_CHECK_SELF(L, ptile, 0);
1250
1251 return unit_list_size(ptile->units);
1252}
1253
1254/**********************************************************************/
1257 Unit_List_Link *api_methods_private_tile_unit_list_head(lua_State *L,
1258 Tile *ptile)
1259{
1260 LUASCRIPT_CHECK_STATE(L, NULL);
1261 LUASCRIPT_CHECK_SELF(L, ptile, NULL);
1262
1263 return unit_list_head(ptile->units);
1264}
1265
1266/**********************************************************************/
1270 int api_methods_private_tile_next_outward_index(lua_State *L, Tile *pstart,
1271 int tindex, int max_dist)
1272{
1273 int dx, dy;
1274 int newx, newy;
1275 int startx, starty;
1276
1277 LUASCRIPT_CHECK_STATE(L, 0);
1278 LUASCRIPT_CHECK_SELF(L, pstart, 0);
1279
1280 if (tindex < 0) {
1281 return 0;
1282 }
1283
1284 index_to_map_pos(&startx, &starty, tile_index(pstart));
1285
1286 tindex++;
1287 while (tindex < MAP_NUM_ITERATE_OUTWARDS_INDICES) {
1288 if (MAP_ITERATE_OUTWARDS_INDICES[tindex].dist > max_dist) {
1289 return -1;
1290 }
1291 dx = MAP_ITERATE_OUTWARDS_INDICES[tindex].dx;
1292 dy = MAP_ITERATE_OUTWARDS_INDICES[tindex].dy;
1293 newx = dx + startx;
1294 newy = dy + starty;
1295
1296 if (!normalize_map_pos(&(wld.map), &newx, &newy)) {
1297 tindex++;
1298 continue;
1299 }
1300
1301 return tindex;
1302 }
1303
1304 return -1;
1305}
1306
1307/**********************************************************************/
1310 Tile *api_methods_private_tile_for_outward_index(lua_State *L,
1311 Tile *pstart, int tindex)
1312{
1313 int newx, newy;
1314
1315 LUASCRIPT_CHECK_STATE(L, NULL);
1316 LUASCRIPT_CHECK_SELF(L, pstart, NULL);
1317 LUASCRIPT_CHECK_ARG(L,
1318 tindex >= 0 && tindex < MAP_NUM_ITERATE_OUTWARDS_INDICES,
1319 3, "index out of bounds", NULL);
1320
1321 index_to_map_pos(&newx, &newy, tile_index(pstart));
1322 newx += MAP_ITERATE_OUTWARDS_INDICES[tindex].dx;
1323 newy += MAP_ITERATE_OUTWARDS_INDICES[tindex].dy;
1324
1325 if (!normalize_map_pos(&(wld.map), &newx, &newy)) {
1326 return NULL;
1327 }
1328
1329 return map_pos_to_tile(&(wld.map), newx, newy);
1330}
1331
1332/**********************************************************************/
1335 int api_methods_tile_sq_distance(lua_State *L, Tile *ptile1, Tile *ptile2)
1336{
1337 LUASCRIPT_CHECK_STATE(L, 0);
1338 LUASCRIPT_CHECK_SELF(L, ptile1, 0);
1339 LUASCRIPT_CHECK_ARG_NIL(L, ptile2, 3, Tile, 0);
1340
1341 return sq_map_distance(ptile1, ptile2);
1342}
1343
1344/**********************************************************************/
1351 bool api_methods_unit_city_can_be_built_here(lua_State *L, Unit *punit)
1352{
1353 LUASCRIPT_CHECK_STATE(L, FALSE);
1354 LUASCRIPT_CHECK_SELF(L, punit, FALSE);
1355
1356 return city_can_be_built_here(unit_tile(punit), punit, TRUE);
1357}
1358
1359/**********************************************************************/
1362 Tile *api_methods_unit_tile_get(lua_State *L, Unit *punit)
1363{
1364 LUASCRIPT_CHECK_STATE(L, NULL);
1365 LUASCRIPT_CHECK_SELF(L, punit, NULL);
1366
1367 return unit_tile(punit);
1368}
1369
1370/**********************************************************************/
1373 const Direction *api_methods_unit_orientation_get(lua_State *L,
1374 Unit *punit)
1375{
1376 LUASCRIPT_CHECK_STATE(L, NULL);
1377 LUASCRIPT_CHECK_ARG_NIL(L, punit, 2, Unit, NULL);
1378
1379 return luascript_dir(punit->facing);
1380}
1381
1382/**********************************************************************/
1385 Unit *api_methods_unit_transporter(lua_State *L, Unit *punit)
1386{
1387 LUASCRIPT_CHECK_STATE(L, NULL);
1388 LUASCRIPT_CHECK_SELF(L, punit, NULL);
1389
1390 return punit->transporter;
1391}
1392
1393/**********************************************************************/
1396 Unit_List_Link *api_methods_private_unit_cargo_list_head(lua_State *L,
1397 Unit *punit)
1398{
1399 LUASCRIPT_CHECK_STATE(L, NULL);
1400 LUASCRIPT_CHECK_SELF(L, punit, NULL);
1401 return unit_list_head(punit->transporting);
1402}
1403
1404/**********************************************************************/
1407 bool api_methods_unit_type_has_flag(lua_State *L, Unit_Type *punit_type,
1408 const char *flag)
1409{
1410 enum unit_type_flag_id id;
1411
1412 LUASCRIPT_CHECK_STATE(L, FALSE);
1413 LUASCRIPT_CHECK_SELF(L, punit_type, FALSE);
1414 LUASCRIPT_CHECK_ARG_NIL(L, flag, 3, string, FALSE);
1415
1416 id = unit_type_flag_id_by_name(flag, fc_strcasecmp);
1417 if (unit_type_flag_id_is_valid(id)) {
1418 return utype_has_flag(punit_type, id);
1419 } else {
1420 luascript_error(L, "Unit type flag \"%s\" does not exist", flag);
1421 return FALSE;
1422 }
1423}
1424
1425/**********************************************************************/
1428 bool api_methods_unit_type_has_role(lua_State *L, Unit_Type *punit_type,
1429 const char *role)
1430{
1431 enum unit_role_id id;
1432
1433 LUASCRIPT_CHECK_STATE(L, FALSE);
1434 LUASCRIPT_CHECK_SELF(L, punit_type, FALSE);
1435 LUASCRIPT_CHECK_ARG_NIL(L, role, 3, string, FALSE);
1436
1437 id = unit_role_id_by_name(role, fc_strcasecmp);
1438 if (unit_role_id_is_valid(id)) {
1439 return utype_has_role(punit_type, id);
1440 } else {
1441 luascript_error(L, "Unit role \"%s\" does not exist", role);
1442 return FALSE;
1443 }
1444}
1445
1446/**********************************************************************/
1449 bool api_methods_unit_type_can_exist_at_tile(lua_State *L,
1450 Unit_Type *punit_type,
1451 Tile *ptile)
1452{
1453 LUASCRIPT_CHECK_STATE(L, FALSE);
1454 LUASCRIPT_CHECK_SELF(L, punit_type, FALSE);
1455 LUASCRIPT_CHECK_ARG_NIL(L, ptile, 3, Tile, FALSE);
1456
1457 return can_exist_at_tile(&(wld.map), punit_type, ptile);
1458}
1459
1460/**********************************************************************/
1463 const char *api_methods_unit_type_rule_name(lua_State *L,
1464 Unit_Type *punit_type)
1465{
1466 LUASCRIPT_CHECK_STATE(L, NULL);
1467 LUASCRIPT_CHECK_SELF(L, punit_type, NULL);
1468
1469 return utype_rule_name(punit_type);
1470}
1471
1472/**********************************************************************/
1475 const char *api_methods_unit_type_name_translation(lua_State *L,
1476 Unit_Type *punit_type)
1477{
1478 LUASCRIPT_CHECK_STATE(L, NULL);
1479 LUASCRIPT_CHECK_SELF(L, punit_type, NULL);
1480
1481 return utype_name_translation(punit_type);
1482}
1483
1484
1485/**********************************************************************/
1488 Unit *api_methods_unit_list_link_data(lua_State *L,
1489 Unit_List_Link *ul_link)
1490{
1491 LUASCRIPT_CHECK_STATE(L, NULL);
1492
1493 return unit_list_link_data(ul_link);
1494}
1495
1496/**********************************************************************/
1499 Unit_List_Link *api_methods_unit_list_next_link(lua_State *L,
1500 Unit_List_Link *ul_link)
1501{
1502 LUASCRIPT_CHECK_STATE(L, NULL);
1503
1504 return unit_list_link_next(ul_link);
1505}
1506
1507/**********************************************************************/
1510 City *api_methods_city_list_link_data(lua_State *L,
1511 City_List_Link *cl_link)
1512{
1513 LUASCRIPT_CHECK_STATE(L, NULL);
1514
1515 return city_list_link_data(cl_link);
1516}
1517
1518/**********************************************************************/
1521 City_List_Link *api_methods_city_list_next_link(lua_State *L,
1522 City_List_Link *cl_link)
1523{
1524 LUASCRIPT_CHECK_STATE(L, NULL);
1525
1526 return city_list_link_next(cl_link);
1527}
1528
1529/**********************************************************************/
1532 const char *api_methods_tile_link(lua_State *L, Tile *ptile)
1533{
1534 LUASCRIPT_CHECK_STATE(L, NULL);
1535 LUASCRIPT_CHECK_SELF(L, ptile, NULL);
1536
1537 return tile_link(ptile);
1538}
1539
1540/**********************************************************************/
1543 const char *api_methods_unit_tile_link(lua_State *L, Unit *punit)
1544{
1545 LUASCRIPT_CHECK_STATE(L, NULL);
1546 LUASCRIPT_CHECK_SELF(L, punit, NULL);
1547
1548 return unit_tile_link(punit);
1549}
1550
1551/**********************************************************************/
1554 const char *api_methods_city_tile_link(lua_State *L, City *pcity)
1555{
1556 LUASCRIPT_CHECK_STATE(L, NULL);
1557 LUASCRIPT_CHECK_SELF(L, pcity, NULL);
1558
1559 return city_tile_link(pcity);
1560}
1561
1562/**********************************************************************/
1565 const char *api_methods_unit_link(lua_State *L, Unit *punit)
1566{
1567 LUASCRIPT_CHECK_STATE(L, NULL);
1568 LUASCRIPT_CHECK_SELF(L, punit, NULL);
1569
1570 return unit_link(punit);
1571}
1572
1573/**********************************************************************/
1576 const char *api_methods_city_link(lua_State *L, City *pcity)
1577{
1578 LUASCRIPT_CHECK_STATE(L, NULL);
1579 LUASCRIPT_CHECK_SELF(L, pcity, NULL);
1580
1581 return city_link(pcity);
1582}
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:1215
action_id_rule_name
const char * action_id_rule_name(action_id act_id)
Definition actions.c:1204
action_get_target_kind
enum action_target_kind action_get_target_kind(const struct action *paction)
Definition actions.c:1073
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:1039
api_methods_tile_num_units
int api_methods_tile_num_units(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1246
api_methods_is_city_unhappy
bool api_methods_is_city_unhappy(lua_State *L, City *pcity)
Definition api_game_methods.c:338
api_methods_is_gov_center
bool api_methods_is_gov_center(lua_State *L, City *pcity)
Definition api_game_methods.c:361
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:680
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:1449
api_methods_player_num_cities
int api_methods_player_num_cities(lua_State *L, Player *pplayer)
Definition api_game_methods.c:503
api_methods_unit_can_upgrade
bool api_methods_unit_can_upgrade(lua_State *L, Unit *punit, bool is_free)
Definition api_game_methods.c:769
api_methods_player_has_wonder
bool api_methods_player_has_wonder(lua_State *L, Player *pplayer, Building_Type *building)
Definition api_game_methods.c:479
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:1499
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:442
api_methods_disaster_name_translation
const char * api_methods_disaster_name_translation(lua_State *L, Disaster *pdis)
Definition api_game_methods.c:965
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:1488
api_methods_tile_nat_y
int api_methods_tile_nat_y(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1050
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:1257
api_methods_player_tech_cost
int api_methods_player_tech_cost(lua_State *L, Player *pplayer, Tech_Type *ptech)
Definition api_game_methods.c:586
api_methods_player_researching
lua_Object api_methods_player_researching(lua_State *L, Player *pplayer)
Definition api_game_methods.c:610
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:306
api_methods_city_culture_get
int api_methods_city_culture_get(lua_State *L, City *pcity)
Definition api_game_methods.c:285
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:1475
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:171
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:1510
api_methods_unit_tile_link
const char * api_methods_unit_tile_link(lua_State *L, Unit *punit)
Definition api_game_methods.c:1543
api_methods_counter_rule_name
const char * api_methods_counter_rule_name(lua_State *L, Counter *c)
Definition api_game_methods.c:296
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:754
api_methods_player_num_units
int api_methods_player_num_units(lua_State *L, Player *pplayer)
Definition api_game_methods.c:514
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:897
api_methods_tile_map_x
int api_methods_tile_map_x(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1061
api_methods_is_city_happy
bool api_methods_is_city_happy(lua_State *L, City *pcity)
Definition api_game_methods.c:326
api_methods_achievement_rule_name
const char * api_methods_achievement_rule_name(lua_State *L, Achievement *pach)
Definition api_game_methods.c:977
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:727
api_methods_city_link
const char * api_methods_city_link(lua_State *L, City *pcity)
Definition api_game_methods.c:1576
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:430
api_methods_government_rule_name
const char * api_methods_government_rule_name(lua_State *L, Government *pgovernment)
Definition api_game_methods.c:394
api_methods_terrain_rule_name
const char * api_methods_terrain_rule_name(lua_State *L, Terrain *pterrain)
Definition api_game_methods.c:920
api_methods_player_number
int api_methods_player_number(lua_State *L, Player *pplayer)
Definition api_game_methods.c:492
api_methods_player_infrapoints
int api_methods_player_infrapoints(lua_State *L, Player *pplayer)
Definition api_game_methods.c:536
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:1396
api_methods_player_controlling_gui
const char * api_methods_player_controlling_gui(lua_State *L, Player *pplayer)
Definition api_game_methods.c:454
api_methods_action_name_translation
const char * api_methods_action_name_translation(lua_State *L, Action *pact)
Definition api_game_methods.c:1012
api_methods_terrain_class_name
const char * api_methods_terrain_class_name(lua_State *L, Terrain *pterrain)
Definition api_game_methods.c:943
api_methods_player_shares_research
bool api_methods_player_shares_research(lua_State *L, Player *pplayer, Player *aplayer)
Definition api_game_methods.c:816
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:908
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:1191
api_methods_city_size_get
int api_methods_city_size_get(lua_State *L, City *pcity)
Definition api_game_methods.c:220
api_methods_tile_city
City * api_methods_tile_city(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1083
api_methods_government_name_translation
const char * api_methods_government_name_translation(lua_State *L, Government *pgovernment)
Definition api_game_methods.c:406
api_method_player_can_research
bool api_method_player_can_research(lua_State *L, Player *pplayer, Tech_Type *ptech)
Definition api_game_methods.c:562
api_methods_tile_has_extra
bool api_methods_tile_has_extra(lua_State *L, Tile *ptile, const char *name)
Definition api_game_methods.c:1108
api_methods_tile_sq_distance
int api_methods_tile_sq_distance(lua_State *L, Tile *ptile1, Tile *ptile2)
Definition api_game_methods.c:1335
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:1428
api_methods_tile_link
const char * api_methods_tile_link(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1532
api_methods_player_culture_get
int api_methods_player_culture_get(lua_State *L, Player *pplayer)
Definition api_game_methods.c:695
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:644
api_methods_achievement_name_translation
const char * api_methods_achievement_name_translation(lua_State *L, Achievement *pach)
Definition api_game_methods.c:989
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:135
api_methods_city_tile_link
const char * api_methods_city_tile_link(lua_State *L, City *pcity)
Definition api_game_methods.c:1554
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:1270
api_methods_unit_tile_get
Tile * api_methods_unit_tile_get(lua_State *L, Unit *punit)
Definition api_game_methods.c:1362
api_methods_tile_has_road
bool api_methods_tile_has_road(lua_State *L, Tile *ptile, const char *name)
Definition api_game_methods.c:1162
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:418
api_methods_unit_orientation_get
const Direction * api_methods_unit_orientation_get(lua_State *L, Unit *punit)
Definition api_game_methods.c:1373
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:547
api_methods_enemy_tile
bool api_methods_enemy_tile(lua_State *L, Tile *ptile, Player *against)
Definition api_game_methods.c:1224
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:147
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:1310
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:1001
api_methods_disaster_rule_name
const char * api_methods_disaster_rule_name(lua_State *L, Disaster *pdis)
Definition api_game_methods.c:954
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:184
api_methods_building_type_is_wonder
bool api_methods_building_type_is_wonder(lua_State *L, Building_Type *pbuilding)
Definition api_game_methods.c:123
api_methods_research_name_translation
const char * api_methods_research_name_translation(lua_State *L, Player *pplayer)
Definition api_game_methods.c:840
api_methods_city_inspire_partisans
int api_methods_city_inspire_partisans(lua_State *L, City *self, Player *inspirer)
Definition api_game_methods.c:242
api_methods_city_map_sq_radius
int api_methods_city_map_sq_radius(lua_State *L, City *pcity)
Definition api_game_methods.c:209
api_methods_city_has_building
bool api_methods_city_has_building(lua_State *L, City *pcity, Building_Type *building)
Definition api_game_methods.c:196
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:779
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:1521
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:1407
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:1463
api_methods_building_type_is_improvement
bool api_methods_building_type_is_improvement(lua_State *L, Building_Type *pbuilding)
Definition api_game_methods.c:159
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:1094
api_methods_player_has_flag
bool api_methods_player_has_flag(lua_State *L, Player *pplayer, const char *flag)
Definition api_game_methods.c:706
api_methods_private_list_players
lua_Object api_methods_private_list_players(lua_State *L)
Definition api_game_methods.c:857
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:1351
api_methods_tile_has_base
bool api_methods_tile_has_base(lua_State *L, Tile *ptile, const char *name)
Definition api_game_methods.c:1135
api_methods_player_gold
int api_methods_player_gold(lua_State *L, Player *pplayer)
Definition api_game_methods.c:525
api_methods_research_rule_name
const char * api_methods_research_rule_name(lua_State *L, Player *pplayer)
Definition api_game_methods.c:829
api_methods_is_primary_capital
bool api_methods_is_primary_capital(lua_State *L, City *pcity)
Definition api_game_methods.c:383
api_methods_player_research_cost
int api_methods_player_research_cost(lua_State *L, Player *pplayer)
Definition api_game_methods.c:661
api_methods_tile_map_y
int api_methods_tile_map_y(lua_State *L, Tile *ptile)
Definition api_game_methods.c:1072
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:874
api_methods_action_target_kind
const char * api_methods_action_target_kind(lua_State *L, Action *pact)
Definition api_game_methods.c:1023
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:885
api_methods_terrain_name_translation
const char * api_methods_terrain_name_translation(lua_State *L, Terrain *pterrain)
Definition api_game_methods.c:931
api_methods_city_tile_get
Tile * api_methods_city_tile_get(lua_State *L, City *pcity)
Definition api_game_methods.c:231
api_methods_unit_link
const char * api_methods_unit_link(lua_State *L, Unit *punit)
Definition api_game_methods.c:1565
api_methods_is_city_celebrating
bool api_methods_is_city_celebrating(lua_State *L, City *pcity)
Definition api_game_methods.c:350
api_methods_counter_city_get
int api_methods_counter_city_get(lua_State *L, Counter *c, City *city)
Definition api_game_methods.c:316
api_methods_is_capital
bool api_methods_is_capital(lua_State *L, City *pcity)
Definition api_game_methods.c:372
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:741
api_methods_unit_transporter
Unit * api_methods_unit_transporter(lua_State *L, Unit *punit)
Definition api_game_methods.c:1385
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:2102
city_has_building
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1231
is_capital
bool is_capital(const struct city *pcity)
Definition city.c:1571
city_can_be_built_here
bool city_can_be_built_here(const struct tile *ptile, const struct unit *punit, bool hut_test)
Definition city.c:1478
city_unhappy
bool city_unhappy(const struct city *pcity)
Definition city.c:1618
city_celebrating
bool city_celebrating(const struct city *pcity)
Definition city.c:1637
city_happy
bool city_happy(const struct city *pcity)
Definition city.c:1606
city_map_radius_sq_get
int city_map_radius_sq_get(const struct city *pcity)
Definition city.c:136
is_gov_center
bool is_gov_center(const struct city *pcity)
Definition city.c:1579
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 player *other_player, enum effect_type effect_type)
Definition effects.c:748
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:1114
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:62
wld
struct world wld
Definition game.c:63
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:1994
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
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:150
packet_game_info::citizen_nationality
bool citizen_nationality
Definition packets_gen.h:146
packet_game_info::fragment_count
int fragment_count
Definition packets_gen.h:252
packet_game_info::turn
int turn
Definition packets_gen.h:247
packet_game_info::year
int year
Definition packets_gen.h:249
packet_game_info::sciencebox
int sciencebox
Definition packets_gen.h:226
packet_game_info::tech_cost_style
enum tech_cost_style tech_cost_style
Definition packets_gen.h:232
packet_ruleset_control::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1484
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:1989
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:2021
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