Freeciv-3.4
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/**********************************************************************/
56
57/**********************************************************************/
66
67/**********************************************************************/
76
77/**********************************************************************/
81{
82 LUASCRIPT_CHECK_STATE(L, nullptr);
83
84 return calendar_text();
85}
86
87/**********************************************************************/
91{
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/**********************************************************************/
108{
109 return game.server.rulesetdir;
110}
111
112/**********************************************************************/
116{
117 return game.control.name;
118}
119
120/**********************************************************************/
127
128/**********************************************************************/
135
136/**********************************************************************/
147
148/**********************************************************************/
159
160/**********************************************************************/
171
172/**********************************************************************/
183
184/**********************************************************************/
195
196/**********************************************************************/
199const char
208
209/**********************************************************************/
221
222/**********************************************************************/
232
233/**********************************************************************/
243
244/**********************************************************************/
248{
249 LUASCRIPT_CHECK_STATE(L, nullptr);
250 LUASCRIPT_CHECK_SELF(L, pcity, nullptr);
251
252 return pcity->tile;
253}
254
255/**********************************************************************/
260{
261 bool inspired = FALSE;
262
264 if (self->original == inspirer) {
265 inspired = TRUE;
266 }
267 } else {
269 if (is_server()) {
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(nullptr,
287 &(const struct req_context) {
288 .player = inspirer,
289 .city = self,
290 .tile = city_tile(self),
291 },
292 nullptr, EFT_INSPIRE_PARTISANS);
293 }
294
295 return 0;
296}
297
298/**********************************************************************/
308
309/**********************************************************************/
313{
314 LUASCRIPT_CHECK_ARG_NIL(L, c, 2, Counter, nullptr);
315
316 return counter_rule_name(c);
317}
318
319/**********************************************************************/
323{
324 LUASCRIPT_CHECK_ARG_NIL(L, c, 2, Counter, nullptr);
325
326 return counter_name_translation(c);
327}
328
329/**********************************************************************/
338
339/**********************************************************************/
343{
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/**********************************************************************/
355{
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/**********************************************************************/
373
374/**********************************************************************/
384
385/**********************************************************************/
395
396/**********************************************************************/
406
407/**********************************************************************/
411 Player *nationality)
412{
415
416 return citizens_nation_get(pcity, nationality->slot);
417}
418
419/**********************************************************************/
424 Specialist *s)
425{
428
429 if (nullptr != s) {
430 return pcity->specialists[specialist_index(s)];
431 } else {
432 return city_specialists(pcity);
433 }
434}
435
436/**********************************************************************/
447
448/**********************************************************************/
459
460/**********************************************************************/
471
472/**********************************************************************/
476 Nation_Type *pnation)
477{
478 LUASCRIPT_CHECK_STATE(L, nullptr);
479 LUASCRIPT_CHECK_SELF(L, pnation, nullptr);
480
481 return nation_rule_name(pnation);
482}
483
484/**********************************************************************/
488 Nation_Type *pnation)
489{
490 LUASCRIPT_CHECK_STATE(L, nullptr);
491 LUASCRIPT_CHECK_SELF(L, pnation, nullptr);
492
493 return nation_adjective_translation(pnation);
494}
495
496/**********************************************************************/
500 Nation_Type *pnation)
501{
502 LUASCRIPT_CHECK_STATE(L, nullptr);
503 LUASCRIPT_CHECK_SELF(L, pnation, nullptr);
504
505 return nation_plural_translation(pnation);
506}
507
508/**********************************************************************/
512 Player *pplayer)
513{
514 struct connection *conn = nullptr;
515
516 LUASCRIPT_CHECK_STATE(L, nullptr);
517 LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
518
520 if (!pconn->observer) {
521 conn = pconn;
522 break;
523 }
525
526 if (conn == nullptr) {
527 return "None";
528 }
529
530 return gui_type_name(conn->client_gui);
531}
532
533/**********************************************************************/
537 Building_Type *building)
538{
540 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
542
543 return wonder_is_built(pplayer, building);
544}
545
546/**********************************************************************/
550{
552 LUASCRIPT_CHECK_SELF(L, pplayer, -1);
553
554 return player_number(pplayer);
555}
556
557/**********************************************************************/
561{
563 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
564
565 return city_list_size(pplayer->cities);
566}
567
568/**********************************************************************/
572{
574 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
575
576 return unit_list_size(pplayer->units);
577}
578
579/**********************************************************************/
583{
585 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
586
587 return pplayer->economic.gold;
588}
589
590/**********************************************************************/
594{
596 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
597
598 return pplayer->economic.infra_points;
599}
600
601/**********************************************************************/
614
615/**********************************************************************/
630
631/**********************************************************************/
645{
648
649 if (!pplayer && TECH_COST_CIV1CIV2 == game.info.tech_cost_style) {
650 /* Avoid getting error messages and return at least something */
651 return ptech->cost * (double) game.info.sciencebox / 100.0;
652 }
653 return
655 ? research_get(pplayer) : nullptr,
657}
658
659/**********************************************************************/
669{
670 const struct research *presearch;
671 int rr;
672
674 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
675 presearch = research_get(pplayer);
676 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
677
678 rr = presearch->researching;
679
680 switch (rr) {
681 case A_FUTURE:
683 break;
684 case A_UNSET:
685 case A_UNKNOWN:
686 lua_pushnil(L);
687 break;
688 default:
689 /* A regular tech */
690 fc_assert(rr >= A_FIRST && rr <= A_LAST);
692 }
693
694 return lua_gettop(L);
695}
696
697/**********************************************************************/
703{
704 const struct research *presearch;
705
707 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
708 presearch = research_get(pplayer);
709 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
710
711 return presearch->bulbs_researched;
712}
713
714/**********************************************************************/
720{
721 const struct research *presearch;
722
724 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
725 presearch = research_get(pplayer);
726 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
727
728 return is_server()
730 : presearch->client.researching_cost;
731}
732
733/**********************************************************************/
739{
740 const struct research *presearch;
741
743 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
744 presearch = research_get(pplayer);
745 LUASCRIPT_CHECK(L, presearch, "player's research not set", 0);
746
747 return presearch->future_tech;
748}
749
750/**********************************************************************/
754{
756 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
757
758 return player_culture(pplayer);
759}
760
761/**********************************************************************/
765 const char *flag)
766{
768
770 LUASCRIPT_CHECK_SELF(L, pplayer, 0);
771
773
775 return player_has_flag(pplayer, flag_val);
776 }
777
778 return FALSE;
779}
780
781/**********************************************************************/
786 Unit_Type *utype)
787{
788 LUASCRIPT_CHECK_STATE(L, nullptr);
789 LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
790 LUASCRIPT_CHECK_ARG_NIL(L, utype, 3, Unit_Type, nullptr);
791
792 return (Unit_Type *)can_upgrade_unittype(pplayer, utype);
793}
794
795/**********************************************************************/
800 Unit_Type *utype)
801{
803 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
805
806 return can_player_build_unit_direct(pplayer, utype, TRUE);
807}
808
809/**********************************************************************/
821
822/**********************************************************************/
826 Specialist *s)
827{
829 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
831
832 return
834 &(const struct req_context) {
835 .player = pplayer,
836 }, nullptr, &s->reqs, RPT_POSSIBLE);
837}
838
839/**********************************************************************/
843{
844 LUASCRIPT_CHECK_STATE(L, nullptr);
845 LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
846
847 return player_primary_capital(pplayer);
848}
849
850/**********************************************************************/
855{
856 LUASCRIPT_CHECK_STATE(L, nullptr);
859
860 if (pplayer1 == pplayer2) {
861 return "Self";
862 }
863
865}
866
867/**********************************************************************/
871 Player *target)
872{
874 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
876
877 return player_has_embassy(pplayer, target);
878}
879
880/**********************************************************************/
884 Player *target)
885{
887 LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
889
890 return team_has_embassy(pplayer->team, target);
891}
892
893/**********************************************************************/
902
903/**********************************************************************/
909{
911
912 LUASCRIPT_CHECK_STATE(L, nullptr);
913 LUASCRIPT_CHECK_SELF(L, punit, nullptr);
915
917 switch (uu) {
918 case UU_OK:
919 return nullptr;
921 return "cargo";
923 return "transport";
924 case UU_NOT_TERRAIN:
925 return "terrain";
926 case UU_NOT_ACTIVITY:
927 return "activity";
928 case UU_NO_UNITTYPE:
929 case UU_NO_MONEY:
930 case UU_NOT_IN_CITY:
932 /* should not get here */
933 break;
934 }
935
936 fc_assert_msg(FALSE, "Unexpected unit transform result %i", uu);
937
938 return "\?";
939}
940
941/**********************************************************************/
952
953/**********************************************************************/
965
966/**********************************************************************/
970{
971 LUASCRIPT_CHECK_STATE(L, nullptr);
972 LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
973
974 return research_rule_name(research_get(pplayer));
975}
976
977/**********************************************************************/
981 Player *pplayer)
982{
983 static char buf[MAX_LEN_MSG];
984
985 LUASCRIPT_CHECK_STATE(L, nullptr);
986 LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
987
989
990 return buf;
991}
992
993/**********************************************************************/
998{
999 lua_Object result = 0;
1000 int i = 0;
1001
1004 result = lua_gettop(L);
1005 players_iterate(pplayer) {
1006 tolua_pushfieldusertype(L, result, ++i, pplayer, "Player");
1008 return result;
1009}
1010
1011/**********************************************************************/
1015 Player *pplayer)
1016{
1017 LUASCRIPT_CHECK_STATE(L, nullptr);
1018 LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
1019 return unit_list_head(pplayer->units);
1020}
1021
1022/**********************************************************************/
1026 Player *pplayer)
1027{
1028 LUASCRIPT_CHECK_STATE(L, nullptr);
1029 LUASCRIPT_CHECK_SELF(L, pplayer, nullptr);
1030
1031 return city_list_head(pplayer->cities);
1032}
1033
1034/**********************************************************************/
1038{
1039 LUASCRIPT_CHECK_STATE(L, nullptr);
1040 LUASCRIPT_CHECK_SELF(L, ptech, nullptr);
1041
1042 return advance_rule_name(ptech);
1043}
1044
1045/**********************************************************************/
1050{
1051 LUASCRIPT_CHECK_STATE(L, nullptr);
1052 LUASCRIPT_CHECK_SELF(L, ptech, nullptr);
1053
1055}
1056
1057/**********************************************************************/
1061{
1062 LUASCRIPT_CHECK_STATE(L, nullptr);
1063 LUASCRIPT_CHECK_SELF(L, pterrain, nullptr);
1064
1065 return terrain_rule_name(pterrain);
1066}
1067
1068/**********************************************************************/
1072 Terrain *pterrain)
1073{
1074 LUASCRIPT_CHECK_STATE(L, nullptr);
1075 LUASCRIPT_CHECK_SELF(L, pterrain, nullptr);
1076
1077 return terrain_name_translation(pterrain);
1078}
1079
1080/**********************************************************************/
1084{
1085 LUASCRIPT_CHECK_STATE(L, nullptr);
1086 LUASCRIPT_CHECK_SELF(L, pterrain, nullptr);
1087
1089}
1090
1091/**********************************************************************/
1095{
1096 LUASCRIPT_CHECK_STATE(L, nullptr);
1097 LUASCRIPT_CHECK_SELF(L, pdis, nullptr);
1098
1099 return disaster_rule_name(pdis);
1100}
1101
1102/**********************************************************************/
1106 Disaster *pdis)
1107{
1108 LUASCRIPT_CHECK_STATE(L, nullptr);
1109 LUASCRIPT_CHECK_SELF(L, pdis, nullptr);
1110
1112}
1113
1114/**********************************************************************/
1119{
1120 LUASCRIPT_CHECK_STATE(L, nullptr);
1121 LUASCRIPT_CHECK_SELF(L, pach, nullptr);
1122
1124}
1125
1126/**********************************************************************/
1137
1138/**********************************************************************/
1142{
1143 LUASCRIPT_CHECK_STATE(L, nullptr);
1144 LUASCRIPT_CHECK_SELF(L, pact, nullptr);
1145
1146 return action_id_rule_name(pact->id);
1147}
1148
1149/**********************************************************************/
1153{
1154 LUASCRIPT_CHECK_STATE(L, nullptr);
1155 LUASCRIPT_CHECK_SELF(L, pact, nullptr);
1156
1157 return action_id_name_translation(pact->id);
1158}
1159
1160/**********************************************************************/
1164{
1165 struct action *paction;
1166
1167 LUASCRIPT_CHECK_STATE(L, nullptr);
1168 LUASCRIPT_CHECK_SELF(L, pact, nullptr);
1169
1171 fc_assert_ret_val(paction, "error: no action");
1172
1174}
1175
1176/**********************************************************************/
1180{
1181 LUASCRIPT_CHECK_STATE(L, nullptr);
1182 LUASCRIPT_CHECK_SELF(L, s, nullptr);
1183
1184 return specialist_rule_name(s);
1185}
1186
1187/**********************************************************************/
1191 Specialist *s)
1192{
1193 LUASCRIPT_CHECK_STATE(L, nullptr);
1194 LUASCRIPT_CHECK_SELF(L, s, nullptr);
1195
1197}
1198
1199/**********************************************************************/
1209
1210/**********************************************************************/
1214{
1216 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1217
1218 return index_to_native_pos_x(tile_index(ptile));
1219}
1220
1221/**********************************************************************/
1225{
1227 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1228
1229 return index_to_native_pos_y(tile_index(ptile));
1230}
1231
1232/**********************************************************************/
1236{
1238 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1239
1240 return index_to_map_pos_x(tile_index(ptile));
1241}
1242
1243/**********************************************************************/
1247{
1249 LUASCRIPT_CHECK_SELF(L, ptile, -1);
1250
1251 return index_to_map_pos_y(tile_index(ptile));
1252}
1253
1254/**********************************************************************/
1258{
1259 LUASCRIPT_CHECK_STATE(L, nullptr);
1260 LUASCRIPT_CHECK_SELF(L, ptile, nullptr);
1261
1262 return tile_city(ptile);
1263}
1264
1265/**********************************************************************/
1277
1278/**********************************************************************/
1283 const char *name)
1284{
1286 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1287
1288 if (!name) {
1289 extra_type_iterate(pextra) {
1290 if (tile_has_extra(ptile, pextra)) {
1291 return TRUE;
1292 }
1294
1295 return FALSE;
1296 } else {
1297 struct extra_type *pextra;
1298
1299 pextra = extra_type_by_rule_name(name);
1300
1301 return (pextra != nullptr && tile_has_extra(ptile, pextra));
1302 }
1303}
1304
1305/**********************************************************************/
1309bool api_methods_tile_has_base(lua_State *L, Tile *ptile, const char *name)
1310{
1312 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1313
1314 if (!name) {
1316 if (tile_has_extra(ptile, pextra)) {
1317 return TRUE;
1318 }
1320
1321 return FALSE;
1322 } else {
1323 struct extra_type *pextra;
1324
1325 pextra = extra_type_by_rule_name(name);
1326
1327 return (pextra != nullptr && is_extra_caused_by(pextra, EC_BASE)
1328 && tile_has_extra(ptile, pextra));
1329 }
1330}
1331
1332/**********************************************************************/
1336bool api_methods_tile_has_road(lua_State *L, Tile *ptile, const char *name)
1337{
1339 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1340
1341 if (!name) {
1343 if (tile_has_extra(ptile, pextra)) {
1344 return TRUE;
1345 }
1347
1348 return FALSE;
1349 } else {
1350 struct extra_type *pextra;
1351
1352 pextra = extra_type_by_rule_name(name);
1353
1354 return (pextra != nullptr && is_extra_caused_by(pextra, EC_ROAD)
1355 && tile_has_extra(ptile, pextra));
1356 }
1357}
1358
1359/**********************************************************************/
1366 Tile *ptile, const char *extra_name)
1367{
1368 LUASCRIPT_CHECK_STATE(L, nullptr);
1369 LUASCRIPT_CHECK_SELF(L, ptile, nullptr);
1370
1371 if (extra_name) {
1372 struct extra_type *pextra;
1373
1375 LUASCRIPT_CHECK_ARG(L, pextra != nullptr, 3,
1376 "unknown extra type", nullptr);
1377
1378 if (tile_has_extra(ptile, pextra)) {
1379 /* All extras have the same owner. */
1380 return extra_owner(ptile);
1381 } else {
1382 /* The extra isn't there. */
1383 return nullptr;
1384 }
1385 } else {
1386 extra_type_iterate(pextra) {
1387 if (tile_has_extra(ptile, pextra)) {
1388 /* All extras have the same owner. */
1389 return extra_owner(ptile);
1390 }
1392
1393 return nullptr;
1394 }
1395}
1396
1397/**********************************************************************/
1401{
1402 struct city *pcity;
1403
1405 LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
1406
1407 if (is_non_allied_unit_tile(ptile, against, FALSE)) {
1408 return TRUE;
1409 }
1410
1411 pcity = tile_city(ptile);
1412 if (pcity != nullptr && !pplayers_allied(against, city_owner(pcity))) {
1413 return TRUE;
1414 }
1415
1416 return FALSE;
1417}
1418
1419/**********************************************************************/
1423{
1425 LUASCRIPT_CHECK_SELF(L, ptile, 0);
1426
1427 return unit_list_size(ptile->units);
1428}
1429
1430/**********************************************************************/
1434 Tile *ptile)
1435{
1436 LUASCRIPT_CHECK_STATE(L, nullptr);
1437 LUASCRIPT_CHECK_SELF(L, ptile, nullptr);
1438
1439 return unit_list_head(ptile->units);
1440}
1441
1442/**********************************************************************/
1447 int tindex, int max_dist)
1448{
1449 int dx, dy;
1450 int newx, newy;
1451 int startx, starty;
1452
1455
1456 if (tindex < 0) {
1457 return 0;
1458 }
1459
1461
1462 tindex++;
1463 while (tindex < MAP_NUM_ITERATE_OUTWARDS_INDICES) {
1464 if (MAP_ITERATE_OUTWARDS_INDICES[tindex].dist > max_dist) {
1465 return -1;
1466 }
1467 dx = MAP_ITERATE_OUTWARDS_INDICES[tindex].dx;
1468 dy = MAP_ITERATE_OUTWARDS_INDICES[tindex].dy;
1469 newx = dx + startx;
1470 newy = dy + starty;
1471
1472 if (!normalize_map_pos(&(wld.map), &newx, &newy)) {
1473 tindex++;
1474 continue;
1475 }
1476
1477 return tindex;
1478 }
1479
1480 return -1;
1481}
1482
1483/**********************************************************************/
1487 Tile *pstart, int tindex)
1488{
1489 int newx, newy;
1490
1491 LUASCRIPT_CHECK_STATE(L, nullptr);
1492 LUASCRIPT_CHECK_SELF(L, pstart, nullptr);
1494 tindex >= 0 && tindex < MAP_NUM_ITERATE_OUTWARDS_INDICES,
1495 3, "index out of bounds", nullptr);
1496
1498 newx += MAP_ITERATE_OUTWARDS_INDICES[tindex].dx;
1499 newy += MAP_ITERATE_OUTWARDS_INDICES[tindex].dy;
1500
1501 if (!normalize_map_pos(&(wld.map), &newx, &newy)) {
1502 return nullptr;
1503 }
1504
1505 return map_pos_to_tile(&(wld.map), newx, newy);
1506}
1507
1508/**********************************************************************/
1519
1520/**********************************************************************/
1536
1537/**********************************************************************/
1541{
1542 LUASCRIPT_CHECK_STATE(L, nullptr);
1543 LUASCRIPT_CHECK_SELF(L, punit, nullptr);
1544
1545 return unit_tile(punit);
1546}
1547
1548/**********************************************************************/
1559
1560/**********************************************************************/
1571
1572/**********************************************************************/
1576 Unit *punit)
1577{
1578 LUASCRIPT_CHECK_STATE(L, nullptr);
1579 LUASCRIPT_CHECK_ARG_NIL(L, punit, 2, Unit, nullptr);
1580
1581 return luascript_dir(punit->facing);
1582}
1583
1584/**********************************************************************/
1588{
1589 LUASCRIPT_CHECK_STATE(L, nullptr);
1590 LUASCRIPT_CHECK_SELF(L, punit, nullptr);
1591
1592 return punit->transporter;
1593}
1594
1595/**********************************************************************/
1606
1607/**********************************************************************/
1611 const char *flag)
1612{
1613 enum unit_type_flag_id id;
1614
1617 LUASCRIPT_CHECK_ARG_NIL(L, flag, 3, string, FALSE);
1618
1621 return utype_has_flag(punit_type, id);
1622 } else {
1623 luascript_error(L, "Unit type flag \"%s\" does not exist", flag);
1624 return FALSE;
1625 }
1626}
1627
1628/**********************************************************************/
1632 const char *role)
1633{
1634 enum unit_role_id id;
1635
1638 LUASCRIPT_CHECK_ARG_NIL(L, role, 3, string, FALSE);
1639
1641 if (unit_role_id_is_valid(id)) {
1642 return utype_has_role(punit_type, id);
1643 } else {
1644 luascript_error(L, "Unit role \"%s\" does not exist", role);
1645 return FALSE;
1646 }
1647}
1648
1649/**********************************************************************/
1662
1663/**********************************************************************/
1668{
1669 LUASCRIPT_CHECK_STATE(L, nullptr);
1671
1673}
1674
1675/**********************************************************************/
1686
1687
1688/**********************************************************************/
1698
1699/**********************************************************************/
1709
1710/**********************************************************************/
1720
1721/**********************************************************************/
1731
1732/**********************************************************************/
1736{
1737 LUASCRIPT_CHECK_STATE(L, nullptr);
1738 LUASCRIPT_CHECK_SELF(L, ptile, nullptr);
1739
1740 return tile_link(ptile);
1741}
1742
1743/**********************************************************************/
1747{
1748 LUASCRIPT_CHECK_STATE(L, nullptr);
1749 LUASCRIPT_CHECK_SELF(L, punit, nullptr);
1750
1751 return unit_tile_link(punit);
1752}
1753
1754/**********************************************************************/
1758{
1759 LUASCRIPT_CHECK_STATE(L, nullptr);
1760 LUASCRIPT_CHECK_SELF(L, pcity, nullptr);
1761
1762 return city_tile_link(pcity);
1763}
1764
1765/**********************************************************************/
1769{
1770 LUASCRIPT_CHECK_STATE(L, nullptr);
1771 LUASCRIPT_CHECK_SELF(L, punit, nullptr);
1772
1773 return unit_link(punit);
1774}
1775
1776/**********************************************************************/
1780{
1781 LUASCRIPT_CHECK_STATE(L, nullptr);
1782 LUASCRIPT_CHECK_SELF(L, pcity, nullptr);
1783
1784 return city_link(pcity);
1785}
const char * achievement_rule_name(struct achievement *pach)
const char * achievement_name_translation(struct achievement *pach)
const char * action_id_name_translation(action_id act_id)
Definition actions.c:1271
const char * action_id_rule_name(action_id act_id)
Definition actions.c:1260
enum action_target_kind action_get_target_kind(const struct action *paction)
Definition actions.c:1129
static struct action * action_by_number(action_id act_id)
Definition actions.h:400
int api_methods_tile_nat_x(lua_State *L, Tile *ptile)
int api_methods_tile_num_units(lua_State *L, Tile *ptile)
bool api_methods_is_city_unhappy(lua_State *L, City *pcity)
bool api_methods_is_gov_center(lua_State *L, City *pcity)
const char * api_methods_game_rulesetdir(lua_State *L)
int api_methods_player_future(lua_State *L, Player *pplayer)
bool api_methods_unit_type_can_exist_at_tile(lua_State *L, Unit_Type *punit_type, Tile *ptile)
int api_methods_player_num_cities(lua_State *L, Player *pplayer)
bool api_methods_unit_can_upgrade(lua_State *L, Unit *punit, bool is_free)
bool api_methods_player_can_employ(lua_State *L, Player *pplayer, Specialist *s)
bool api_methods_player_has_wonder(lua_State *L, Player *pplayer, Building_Type *building)
Unit_List_Link * api_methods_unit_list_next_link(lua_State *L, Unit_List_Link *ul_link)
const char * api_methods_nation_type_plural_translation(lua_State *L, Nation_Type *pnation)
const char * api_methods_disaster_name_translation(lua_State *L, Disaster *pdis)
bool api_methods_player_team_has_embassy(lua_State *L, Player *pplayer, Player *target)
Unit * api_methods_unit_list_link_data(lua_State *L, Unit_List_Link *ul_link)
const char * api_methods_get_diplstate(lua_State *L, Player *pplayer1, Player *pplayer2)
int api_methods_tile_nat_y(lua_State *L, Tile *ptile)
Unit_List_Link * api_methods_private_tile_unit_list_head(lua_State *L, Tile *ptile)
bool api_methods_player_has_embassy(lua_State *L, Player *pplayer, Player *target)
int api_methods_player_tech_cost(lua_State *L, Player *pplayer, Tech_Type *ptech)
lua_Object api_methods_player_researching(lua_State *L, Player *pplayer)
int api_methods_game_year_fragment(lua_State *L)
const char * api_methods_counter_name_translation(lua_State *L, Counter *c)
int api_methods_city_culture_get(lua_State *L, City *pcity)
const char * api_methods_unit_type_name_translation(lua_State *L, Unit_Type *punit_type)
const char * api_methods_game_ruleset_name(lua_State *L)
const char * api_methods_building_type_rule_name(lua_State *L, Building_Type *pbuilding)
bool api_methods_unit_seen(lua_State *L, Unit *self, Player *watcher)
City * api_methods_city_list_link_data(lua_State *L, City_List_Link *cl_link)
const char * api_methods_unit_tile_link(lua_State *L, Unit *punit)
const char * api_methods_counter_rule_name(lua_State *L, Counter *c)
bool api_methods_player_can_build_impr_direct(lua_State *L, Player *pplayer, Building_Type *itype)
int api_methods_player_num_units(lua_State *L, Player *pplayer)
const char * api_methods_tech_type_rule_name(lua_State *L, Tech_Type *ptech)
int api_methods_tile_map_x(lua_State *L, Tile *ptile)
bool api_methods_is_city_happy(lua_State *L, City *pcity)
const char * api_methods_achievement_rule_name(lua_State *L, Achievement *pach)
Unit_Type * api_methods_player_can_upgrade(lua_State *L, Player *pplayer, Unit_Type *utype)
const char * api_methods_city_link(lua_State *L, City *pcity)
const char * api_methods_nation_type_name_translation(lua_State *L, Nation_Type *pnation)
const char * api_methods_government_rule_name(lua_State *L, Government *pgovernment)
const char * api_methods_terrain_rule_name(lua_State *L, Terrain *pterrain)
int api_methods_player_number(lua_State *L, Player *pplayer)
int api_methods_player_infrapoints(lua_State *L, Player *pplayer)
Unit_List_Link * api_methods_private_unit_cargo_list_head(lua_State *L, Unit *punit)
const char * api_methods_specialist_rule_name(lua_State *L, Specialist *s)
const char * api_methods_player_controlling_gui(lua_State *L, Player *pplayer)
const char * api_methods_action_name_translation(lua_State *L, Action *pact)
const char * api_methods_terrain_class_name(lua_State *L, Terrain *pterrain)
bool api_methods_player_shares_research(lua_State *L, Player *pplayer, Player *aplayer)
const char * api_methods_tech_type_name_translation(lua_State *L, Tech_Type *ptech)
bool api_methods_city_can_employ(lua_State *L, City *pcity, Specialist *s)
bool api_methods_specialist_is_super(lua_State *L, Specialist *s)
Player * api_methods_tile_extra_owner(lua_State *L, Tile *ptile, const char *extra_name)
int api_methods_city_size_get(lua_State *L, City *pcity)
const char * api_methods_tech_cost_style(lua_State *L)
City * api_methods_tile_city(lua_State *L, Tile *ptile)
const char * api_methods_tech_leakage_style(lua_State *L)
const char * api_methods_government_name_translation(lua_State *L, Government *pgovernment)
bool api_method_player_can_research(lua_State *L, Player *pplayer, Tech_Type *ptech)
bool api_methods_tile_has_extra(lua_State *L, Tile *ptile, const char *name)
int api_methods_tile_sq_distance(lua_State *L, Tile *ptile1, Tile *ptile2)
bool api_methods_unit_type_has_role(lua_State *L, Unit_Type *punit_type, const char *role)
const char * api_methods_specialist_name_translation(lua_State *L, Specialist *s)
const char * api_methods_tile_link(lua_State *L, Tile *ptile)
int api_methods_player_culture_get(lua_State *L, Player *pplayer)
int api_methods_game_turn_deprecated(lua_State *L)
int api_methods_player_bulbs(lua_State *L, Player *pplayer)
const char * api_methods_achievement_name_translation(lua_State *L, Achievement *pach)
int api_methods_city_nationality_citizens(lua_State *L, City *pcity, Player *nationality)
int api_methods_city_num_specialists(lua_State *L, City *pcity, Specialist *s)
bool api_methods_building_type_is_great_wonder(lua_State *L, Building_Type *pbuilding)
bool api_methods_tile_seen(lua_State *L, Tile *self, Player *watcher)
const char * api_methods_city_tile_link(lua_State *L, City *pcity)
int api_methods_private_tile_next_outward_index(lua_State *L, Tile *pstart, int tindex, int max_dist)
Tile * api_methods_unit_tile_get(lua_State *L, Unit *punit)
bool api_methods_tile_has_road(lua_State *L, Tile *ptile, const char *name)
const char * api_methods_nation_type_rule_name(lua_State *L, Nation_Type *pnation)
const Direction * api_methods_unit_orientation_get(lua_State *L, Unit *punit)
int api_methods_game_turn(lua_State *L)
bool api_methods_player_knows_tech(lua_State *L, Player *pplayer, Tech_Type *ptech)
bool api_methods_enemy_tile(lua_State *L, Tile *ptile, Player *against)
bool api_methods_building_type_is_small_wonder(lua_State *L, Building_Type *pbuilding)
int api_methods_game_year(lua_State *L)
Tile * api_methods_private_tile_for_outward_index(lua_State *L, Tile *pstart, int tindex)
const char * api_methods_game_year_text(lua_State *L)
const char * api_methods_action_rule_name(lua_State *L, Action *pact)
const char * api_methods_disaster_rule_name(lua_State *L, Disaster *pdis)
const char * api_methods_building_type_name_translation(lua_State *L, Building_Type *pbuilding)
bool api_methods_building_type_is_wonder(lua_State *L, Building_Type *pbuilding)
const char * api_methods_research_name_translation(lua_State *L, Player *pplayer)
int api_methods_city_inspire_partisans(lua_State *L, City *self, Player *inspirer)
int api_methods_city_map_sq_radius(lua_State *L, City *pcity)
bool api_methods_city_has_building(lua_State *L, City *pcity, Building_Type *building)
const char * api_methods_unit_transform_problem(lua_State *L, Unit *punit, Unit_Type *ptype)
City_List_Link * api_methods_city_list_next_link(lua_State *L, City_List_Link *cl_link)
bool api_methods_unit_type_has_flag(lua_State *L, Unit_Type *punit_type, const char *flag)
const char * api_methods_unit_type_rule_name(lua_State *L, Unit_Type *punit_type)
bool api_methods_building_type_is_improvement(lua_State *L, Building_Type *pbuilding)
bool api_methods_tile_city_exists_within_max_city_map(lua_State *L, Tile *ptile, bool may_be_on_center)
bool api_methods_player_has_flag(lua_State *L, Player *pplayer, const char *flag)
lua_Object api_methods_private_list_players(lua_State *L)
bool api_methods_unit_city_can_be_built_here(lua_State *L, Unit *punit)
bool api_methods_tile_has_base(lua_State *L, Tile *ptile, const char *name)
int api_methods_player_gold(lua_State *L, Player *pplayer)
bool api_methods_tile_known(lua_State *L, Tile *self, Player *watcher)
const char * api_methods_research_rule_name(lua_State *L, Player *pplayer)
bool api_methods_is_primary_capital(lua_State *L, City *pcity)
City * api_methods_player_primary_capital(lua_State *L, Player *pplayer)
int api_methods_player_research_cost(lua_State *L, Player *pplayer)
int api_methods_tile_map_y(lua_State *L, Tile *ptile)
Unit_List_Link * api_methods_private_player_unit_list_head(lua_State *L, Player *pplayer)
const char * api_methods_action_target_kind(lua_State *L, Action *pact)
City_List_Link * api_methods_private_player_city_list_head(lua_State *L, Player *pplayer)
const char * api_methods_terrain_name_translation(lua_State *L, Terrain *pterrain)
Tile * api_methods_city_tile_get(lua_State *L, City *pcity)
const char * api_methods_unit_link(lua_State *L, Unit *punit)
bool api_methods_is_city_celebrating(lua_State *L, City *pcity)
int api_methods_counter_city_get(lua_State *L, Counter *c, City *city)
bool api_methods_is_capital(lua_State *L, City *pcity)
bool api_methods_player_can_build_unit_direct(lua_State *L, Player *pplayer, Unit_Type *utype)
Unit * api_methods_unit_transporter(lua_State *L, Unit *punit)
const char * calendar_text(void)
Definition calendar.c:142
citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot)
Definition citizens.c:74
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1240
bool is_capital(const struct city *pcity)
Definition city.c:1579
bool city_can_use_specialist(const struct city *pcity, Specialist_type_id type)
Definition city.c:1065
bool city_unhappy(const struct city *pcity)
Definition city.c:1626
bool city_celebrating(const struct city *pcity)
Definition city.c:1645
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:1487
bool city_happy(const struct city *pcity)
Definition city.c:1614
int city_map_radius_sq_get(const struct city *pcity)
Definition city.c:137
citizens city_specialists(const struct city *pcity)
Definition city.c:3343
bool is_gov_center(const struct city *pcity)
Definition city.c:1587
bool city_exists_within_max_city_map(const struct civ_map *nmap, const struct tile *ptile, bool may_be_on_center)
Definition city.c:2112
#define city_tile(_pcity_)
Definition city.h:564
static citizens city_size_get(const struct city *pcity)
Definition city.h:569
#define city_owner(_pcity_)
Definition city.h:563
static struct ai_type * self
Definition classicai.c:46
char * incite_cost
Definition comments.c:77
#define MAX_LEN_MSG
Definition conn_types.h:37
#define conn_list_iterate(connlist, pconn)
Definition connection.h:108
#define conn_list_iterate_end
Definition connection.h:110
int counter_index(const struct counter *pcount)
Definition counters.c:174
const char * counter_name_translation(const struct counter *counter)
Definition counters.c:157
const char * counter_rule_name(struct counter *pcount)
Definition counters.c:165
int city_culture(const struct city *pcity)
Definition culture.c:29
int player_culture(const struct player *plr)
Definition culture.c:49
#define log_deprecation(message,...)
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
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 int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
const char * disaster_rule_name(struct disaster_type *pdis)
Definition disaster.c:105
const char * disaster_name_translation(struct disaster_type *pdis)
Definition disaster.c:97
int int id
Definition editgui_g.h:28
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
struct extra_type * extra_type_by_rule_name(const char *name)
Definition extras.c:212
struct player * extra_owner(const struct tile *ptile)
Definition extras.c:1128
#define extra_type_iterate(_p)
Definition extras.h:315
#define extra_type_iterate_end
Definition extras.h:321
#define is_extra_caused_by(e, c)
Definition extras.h:203
#define extra_type_by_cause_iterate_end
Definition extras.h:339
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:333
static bool is_server(void)
unsigned char citizens
Definition fc_types.h:249
@ RPT_POSSIBLE
Definition fc_types.h:515
#define Qn_(String)
Definition fcintl.h:89
const char * city_tile_link(const struct city *pcity)
const char * tile_link(const struct tile *ptile)
const char * city_link(const struct city *pcity)
const char * unit_link(const struct unit *punit)
const char * unit_tile_link(const struct unit *punit)
struct civ_game game
Definition game.c:62
struct world wld
Definition game.c:63
const char * government_name_translation(const struct government *pgovern)
Definition government.c:145
const char * government_rule_name(const struct government *pgovern)
Definition government.c:135
GType type
Definition repodlgs.c:1313
bool can_player_build_improvement_direct(const struct player *p, const struct impr_type *pimprove)
bool is_improvement(const struct impr_type *pimprove)
bool wonder_is_built(const struct player *pplayer, const struct impr_type *pimprove)
const char * improvement_rule_name(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
bool is_small_wonder(const struct impr_type *pimprove)
const char * name
Definition inputfile.c:127
#define fc_assert_msg(condition, message,...)
Definition log.h:182
#define fc_assert(condition)
Definition log.h:177
#define fc_assert_ret_val(condition, val)
Definition log.h:195
int luascript_error(lua_State *L, const char *format,...)
Definition luascript.c:291
const Direction * luascript_dir(enum direction8 dir)
Definition luascript.c:789
#define LUASCRIPT_CHECK_STATE(L,...)
Definition luascript.h:117
#define LUASCRIPT_CHECK_SELF(L, value,...)
Definition luascript.h:146
#define LUASCRIPT_CHECK_ARG_NIL(L, value, narg, type,...)
Definition luascript.h:138
#define LUASCRIPT_CHECK_ARG(L, check, narg, msg,...)
Definition luascript.h:131
#define LUASCRIPT_CHECK(L, check, msg,...)
Definition luascript.h:124
const struct city_list_link City_List_Link
enum direction8 Direction
const struct unit_list_link Unit_List_Link
int sq_map_distance(const struct tile *tile0, const struct tile *tile1)
Definition map.c:686
struct tile * map_pos_to_tile(const struct civ_map *nmap, int map_x, int map_y)
Definition map.c:434
bool normalize_map_pos(const struct civ_map *nmap, int *x, int *y)
Definition map.c:1117
#define index_to_native_pos_y(mindex)
Definition map.h:166
static int index_to_map_pos_y(int mindex)
Definition map.h:763
static int index_to_map_pos_x(int mindex)
Definition map.h:750
#define index_to_native_pos_x(mindex)
Definition map.h:164
#define index_to_map_pos(pmap_x, pmap_y, mindex)
Definition map.h:229
bool can_exist_at_tile(const struct civ_map *nmap, const struct unit_type *utype, const struct tile *ptile)
Definition movement.c:278
const char * nation_rule_name(const struct nation_type *pnation)
Definition nation.c:138
const char * nation_adjective_translation(const struct nation_type *pnation)
Definition nation.c:149
const char * nation_plural_translation(const struct nation_type *pnation)
Definition nation.c:159
int player_count(void)
Definition player.c:806
int player_number(const struct player *pplayer)
Definition player.c:826
bool can_player_see_unit(const struct player *pplayer, const struct unit *punit)
Definition player.c:1095
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
Definition player.c:1979
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
Definition player.c:225
struct city * player_primary_capital(const struct player *pplayer)
Definition player.c:1325
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:325
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1397
bool player_has_embassy(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:213
#define players_iterate_end
Definition player.h:552
#define players_iterate(_pplayer)
Definition player.h:547
bool are_reqs_active_ranges(const enum req_range min_range, const enum req_range max_range, const struct req_context *context, const struct req_context *other_context, const struct requirement_vector *reqs, const enum req_problem_type prob_type)
const char * research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
Definition research.c:276
int research_total_bulbs_required(const struct research *presearch, Tech_type_id tech, bool loss_value)
Definition research.c:872
const char * research_rule_name(const struct research *presearch)
Definition research.c:145
struct research * research_get(const struct player *pplayer)
Definition research.c:130
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Definition research.c:622
int research_pretty_name(const struct research *presearch, char *buf, size_t buf_len)
Definition research.c:171
#define ARRAY_SIZE(x)
Definition shared.h:85
Specialist_type_id specialist_index(const struct specialist *sp)
Definition specialist.c:90
const char * specialist_rule_name(const struct specialist *sp)
Definition specialist.c:157
const char * specialist_plural_translation(const struct specialist *sp)
Definition specialist.c:166
bool is_super_specialist(const struct specialist *sp)
Definition specialist.c:208
Definition city.h:318
int * counter_values
Definition city.h:406
struct packet_ruleset_control control
Definition game.h:83
struct packet_game_info info
Definition game.h:89
char rulesetdir[MAX_LEN_NAME]
Definition game.h:246
struct civ_game::@32::@36 server
enum gui_type client_gui
Definition connection.h:179
enum tech_leakage_style tech_leakage
enum tech_cost_style tech_cost_style
char name[MAX_LEN_NAME]
int infra_points
Definition player.h:67
struct city_list * cities
Definition player.h:281
struct team * team
Definition player.h:261
struct unit_list * units
Definition player.h:282
struct conn_list * connections
Definition player.h:298
struct player_economic economic
Definition player.h:284
struct player_slot * slot
Definition player.h:250
struct requirement_vector reqs
Definition specialist.h:38
Definition tile.h:50
struct unit_list * units
Definition tile.h:58
Definition unit.h:140
struct unit_list * transporting
Definition unit.h:187
enum direction8 facing
Definition unit.h:144
struct tile * tile
Definition unit.h:142
struct unit::@84::@86 client
struct unit * transporter
Definition unit.h:186
struct civ_map map
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:186
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
struct advance * advance_by_number(const Tech_type_id atype)
Definition tech.c:107
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:300
const char * advance_rule_name(const struct advance *padvance)
Definition tech.c:309
Tech_type_id advance_index(const struct advance *padvance)
Definition tech.c:89
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
#define A_FUTURE
Definition tech.h:46
#define A_FIRST
Definition tech.h:44
#define A_UNSET
Definition tech.h:48
#define A_UNKNOWN
Definition tech.h:49
#define A_LAST
Definition tech.h:45
const char * terrain_name_translation(const struct terrain *pterrain)
Definition terrain.c:240
const char * terrain_rule_name(const struct terrain *pterrain)
Definition terrain.c:249
enum terrain_class terrain_type_terrain_class(const struct terrain *pterrain)
Definition terrain.c:585
enum known_type tile_get_known(const struct tile *ptile, const struct player *pplayer)
Definition tile.c:393
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_index(_pt_)
Definition tile.h:89
@ TILE_UNKNOWN
Definition tile.h:36
@ TILE_KNOWN_SEEN
Definition tile.h:38
#define tile_has_extra(ptile, pextra)
Definition tile.h:152
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:2020
enum unit_upgrade_result unit_upgrade_test(const struct civ_map *nmap, const struct unit *punit, bool is_free)
Definition unit.c:2052
#define unit_tile(_pu)
Definition unit.h:407
unit_upgrade_result
Definition unit.h:61
@ UU_NO_MONEY
Definition unit.h:64
@ UU_NOT_IN_CITY
Definition unit.h:65
@ UU_NO_UNITTYPE
Definition unit.h:63
@ UU_NOT_TERRAIN
Definition unit.h:68
@ UU_UNSUITABLE_TRANSPORT
Definition unit.h:69
@ UU_NOT_CITY_OWNER
Definition unit.h:66
@ UU_NOT_ENOUGH_ROOM
Definition unit.h:67
@ UU_OK
Definition unit.h:62
@ UU_NOT_ACTIVITY
Definition unit.h:70
static bool is_non_allied_unit_tile(const struct tile *ptile, const struct player *pplayer, bool everyone_non_allied)
Definition unit.h:443
bool can_player_build_unit_direct(const struct player *p, const struct unit_type *punittype, bool consider_reg_impr_req)
Definition unittype.c:1994
bool utype_has_role(const struct unit_type *punittype, int role)
Definition unittype.c:224
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1729
const char * utype_rule_name(const struct unit_type *punittype)
Definition unittype.c:1604
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1586
static bool utype_has_flag(const struct unit_type *punittype, int flag)
Definition unittype.h:624
#define MAP_ITERATE_OUTWARDS_INDICES
#define MAP_NUM_ITERATE_OUTWARDS_INDICES