Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/nation.c Source File

Freeciv-3.1

Loading...
Searching...
No Matches
nation.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
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/***********************************************************************
15 Functions for handling the nations.
16***********************************************************************/
17
18#ifdef HAVE_CONFIG_H
19#include <fc_config.h>
20#endif
21
22/* utility */
23#include "fcintl.h"
24#include "log.h"
25#include "mem.h"
26#include "support.h"
27
28/* common */
29#include "connection.h"
30#include "game.h"
31#include "government.h"
32#include "player.h"
33#include "tech.h"
34#include "traits.h"
35
36#include "nation.h"
37
38
39/* Nation set structure. */
40 struct nation_set {
41 struct name_translation name;
42 char description[MAX_LEN_MSG];
43};
44
45 static struct nation_type *nations = NULL;
46
47 static int num_nation_sets;
48 static struct nation_set nation_sets[MAX_NUM_NATION_SETS];
49 static int num_nation_groups;
50 static struct nation_group nation_groups[MAX_NUM_NATION_GROUPS];
51
52/****************************************************************************
53 Runs action if the nation is not valid.
54****************************************************************************/
55#ifdef FREECIV_DEBUG
56#define NATION_CHECK(pnation, action) \
57 fc_assert_action(nation_check(pnation, \
58 log_do_output_for_level(LOG_ERROR), \
59 __FILE__, __FUNCTION__, __FC_LINE__), \
60 action)
61
62/************************************************************************/
66static inline bool nation_check(const struct nation_type *pnation,
67 bool do_output, const char *file,
68 const char *function, int line)
69{
70 if (0 == nation_count()) {
71 if (do_output) {
72 do_log(file, function, line, TRUE, LOG_ERROR,
73 "Function called before nations setup.");
74 }
75 return FALSE;
76 }
77 if (NULL == pnation) {
78 if (do_output) {
79 do_log(file, function, line, TRUE, LOG_ERROR,
80 "This function has NULL nation argument.");
81 }
82 return FALSE;
83 }
84 if (pnation->item_number < 0
85 || pnation->item_number >= nation_count()
86 || &nations[nation_index(pnation)] != pnation) {
87 if (do_output) {
88 do_log(file, function, line, TRUE, LOG_ERROR,
89 "This function has bad nation number %d (count %d).",
90 pnation->item_number, nation_count());
91 }
92 return FALSE;
93 }
94 return TRUE;
95}
96
97#else /* FREECIV_DEBUG */
98#define NATION_CHECK(pnation, action) /* Do Nothing. */
99#endif /* FREECIV_DEBUG */
100
101/************************************************************************/
105 struct nation_type *nation_by_translated_plural(const char *name)
106{
107 nations_iterate(pnation) {
108 if (0 == strcmp(nation_plural_translation(pnation), name)) {
109 return pnation;
110 }
111 } nations_iterate_end;
112
113 return NO_NATION_SELECTED;
114}
115
116/************************************************************************/
120 struct nation_type *nation_by_rule_name(const char *name)
121{
122 const char *qname = Qn_(name);
123
124 nations_iterate(pnation) {
125 if (0 == fc_strcasecmp(nation_rule_name(pnation), qname)) {
126 return pnation;
127 }
128 } nations_iterate_end;
129
130 return NO_NATION_SELECTED;
131}
132
133/************************************************************************/
137 const char *nation_rule_name(const struct nation_type *pnation)
138{
139 NATION_CHECK(pnation, return "");
140
141 return rule_name_get(&pnation->adjective);
142}
143
144/************************************************************************/
148 const char *nation_adjective_translation(const struct nation_type *pnation)
149{
150 NATION_CHECK(pnation, return "");
151 return name_translation_get(&pnation->adjective);
152}
153
154/************************************************************************/
158 const char *nation_plural_translation(const struct nation_type *pnation)
159{
160 NATION_CHECK(pnation, return "");
161 return name_translation_get(&pnation->noun_plural);
162}
163
164/************************************************************************/
168 const char *nation_adjective_for_player(const struct player *pplayer)
169{
170 return nation_adjective_translation(nation_of_player(pplayer));
171}
172
173/************************************************************************/
177 const char *nation_plural_for_player(const struct player *pplayer)
178{
179 return nation_plural_translation(nation_of_player(pplayer));
180}
181
182/************************************************************************/
187 bool is_nation_pickable(const struct nation_type *nation)
188{
189 fc_assert_ret_val(!is_server(), FALSE);
190 return nation->client.is_pickable;
191}
192
193/************************************************************************/
199 bool is_nation_playable(const struct nation_type *nation)
200{
201 NATION_CHECK(nation, return FALSE);
202 return nation->is_playable;
203}
204
205/************************************************************************/
210 enum barbarian_type nation_barbarian_type(const struct nation_type *nation)
211{
212 NATION_CHECK(nation, return NOT_A_BARBARIAN);
213 return nation->barb_type;
214}
215
216
217/****************************************************************************
218 Nation leader.
219****************************************************************************/
220 struct nation_leader {
221 char *name;
222 bool is_male;
223};
224
225/************************************************************************/
228const struct nation_leader_list *
229nation_leaders(const struct nation_type *pnation)
230{
231 NATION_CHECK(pnation, return NULL);
232 return pnation->leaders;
233}
234
235/************************************************************************/
238 struct nation_leader *nation_leader_new(struct nation_type *pnation,
239 const char *name, bool is_male)
240{
241 struct nation_leader *pleader;
242
243 NATION_CHECK(pnation, return NULL);
244 pleader = fc_malloc(sizeof(*pleader));
245 pleader->name = fc_strdup(name);
246 pleader->is_male = is_male;
247
248 nation_leader_list_append(pnation->leaders, pleader);
249 return pleader;
250}
251
252/************************************************************************/
255 static void nation_leader_destroy(struct nation_leader *pleader)
256{
257 free(pleader->name);
258 free(pleader);
259}
260
261/************************************************************************/
265struct nation_leader *
266nation_leader_by_name(const struct nation_type *pnation, const char *name)
267{
268 NATION_CHECK(pnation, return NULL);
269 nation_leader_list_iterate(pnation->leaders, pleader) {
270 if (0 == fc_strcasecmp(name, pleader->name)) {
271 return pleader;
272 }
273 } nation_leader_list_iterate_end;
274 return NULL;
275}
276
277/************************************************************************/
280 const char *nation_leader_name(const struct nation_leader *pleader)
281{
282 fc_assert_ret_val(NULL != pleader, NULL);
283 return pleader->name;
284}
285
286/************************************************************************/
289 bool nation_leader_is_male(const struct nation_leader *pleader)
290{
291 fc_assert_ret_val(NULL != pleader, TRUE);
292 return pleader->is_male;
293}
294
295/************************************************************************/
298 const char *nation_legend_translation(const struct nation_type *pnation,
299 const char *legend)
300{
301 if (pnation->translation_domain == NULL) {
302 return _(legend);
303 }
304
305 return DG_(pnation->translation_domain, legend);
306}
307
308/****************************************************************************
309 Nation default cities. The nation_city structure holds information about
310 a default choice for the city name. The 'name' field is, of course, just
311 the name for the city. The 'river' and 'terrain' fields are entries
312 recording whether the terrain is present near the city - we give higher
313 priority to cities which have matching terrain. In the case of a river we
314 only care if the city is _on_ the river, for other terrain features we
315 give the bonus if the city is close to the terrain.
316
317 This is controlled through the nation's ruleset like this:
318 cities = "Washington (ocean, river, swamp)", "New York (!mountains)"
319****************************************************************************/
320 struct nation_city {
321 char *name;
322 enum nation_city_preference river;
323 enum nation_city_preference terrain[MAX_NUM_TERRAINS];
324};
325
326/************************************************************************/
329const struct nation_city_list *
330nation_cities(const struct nation_type *pnation)
331{
332 NATION_CHECK(pnation, return NULL);
333 fc_assert_ret_val(is_server(), NULL);
334
335 return pnation->server.default_cities;
336}
337
338/************************************************************************/
341 struct nation_city *nation_city_new(struct nation_type *pnation,
342 const char *name)
343{
344 struct nation_city *pncity;
345
346 NATION_CHECK(pnation, return NULL);
347 fc_assert_ret_val(is_server(), NULL);
348
349 fc_assert(0 == NCP_NONE);
350 pncity = fc_calloc(1, sizeof(*pncity)); /* Set NCP_NONE. */
351 pncity->name = fc_strdup(name);
352
353 nation_city_list_append(pnation->server.default_cities, pncity);
354 return pncity;
355}
356
357/************************************************************************/
360 static void nation_city_destroy(struct nation_city *pncity)
361{
362 free(pncity->name);
363 free(pncity);
364}
365
366/************************************************************************/
369enum nation_city_preference
370nation_city_preference_revert(enum nation_city_preference prefer)
371{
372 switch (prefer) {
373 case NCP_DISLIKE:
374 return NCP_LIKE;
375 case NCP_NONE:
376 return NCP_NONE;
377 case NCP_LIKE:
378 return NCP_DISLIKE;
379 }
380
381 log_error("%s(): Wrong nation_city_preference variant (%d).",
382 __FUNCTION__, prefer);
383 return NCP_NONE;
384}
385
386/************************************************************************/
389 void nation_city_set_terrain_preference(struct nation_city *pncity,
390 const struct terrain *pterrain,
391 enum nation_city_preference prefer)
392{
393 fc_assert_ret(NULL != pncity);
394 fc_assert_ret(NULL != pterrain);
395 pncity->terrain[terrain_index(pterrain)] = prefer;
396}
397
398/************************************************************************/
401 void nation_city_set_river_preference(struct nation_city *pncity,
402 enum nation_city_preference prefer)
403{
404 fc_assert_ret(NULL != pncity);
405 pncity->river = prefer;
406}
407
408/************************************************************************/
411 const char *nation_city_name(const struct nation_city *pncity)
412{
413 fc_assert_ret_val(NULL != pncity, NULL);
414 return pncity->name;
415}
416
417/************************************************************************/
420enum nation_city_preference
421nation_city_terrain_preference(const struct nation_city *pncity,
422 const struct terrain *pterrain)
423{
424 fc_assert_ret_val(NULL != pncity, NCP_DISLIKE);
425 fc_assert_ret_val(NULL != pterrain, NCP_DISLIKE);
426 return pncity->terrain[terrain_index(pterrain)];
427}
428
429/************************************************************************/
432enum nation_city_preference
433nation_city_river_preference(const struct nation_city *pncity)
434{
435 fc_assert_ret_val(NULL != pncity, NCP_DISLIKE);
436 return pncity->river;
437}
438
439
440/************************************************************************/
443 struct nation_type *nation_of_player(const struct player *pplayer)
444{
445 fc_assert_ret_val(NULL != pplayer, NULL);
446 NATION_CHECK(pplayer->nation, return NULL);
447 return pplayer->nation;
448}
449
450/************************************************************************/
453 struct nation_type *nation_of_city(const struct city *pcity)
454{
455 fc_assert_ret_val(pcity != NULL, NULL);
456 return nation_of_player(city_owner(pcity));
457}
458
459/************************************************************************/
462 struct nation_type *nation_of_unit(const struct unit *punit)
463{
464 fc_assert_ret_val(punit != NULL, NULL);
465 return nation_of_player(unit_owner(punit));
466}
467
468/************************************************************************/
474 struct nation_type *nation_by_number(const Nation_type_id nation)
475{
476 if (nation < 0 || nation >= game.control.nation_count) {
477 return NULL;
478 }
479 return nations + nation;
480}
481
482/************************************************************************/
485 Nation_type_id nation_number(const struct nation_type *pnation)
486{
487 fc_assert_ret_val(NULL != pnation, -1);
488 return pnation->item_number;
489}
490
491/************************************************************************/
497 Nation_type_id nation_index(const struct nation_type *pnation)
498{
499 fc_assert_ret_val(NULL != pnation, -1);
500 return pnation - nations;
501}
502
503/************************************************************************/
506 Nation_type_id nation_count(void)
507{
508 return game.control.nation_count;
509}
510
511/****************************************************************************
512 Nation iterator.
513****************************************************************************/
514 struct nation_iter {
515 struct iterator vtable;
516 struct nation_type *p, *end;
517};
518#define NATION_ITER(p) ((struct nation_iter *)(p))
519
520/************************************************************************/
523 size_t nation_iter_sizeof(void)
524{
525 return sizeof(struct nation_iter);
526}
527
528/************************************************************************/
531 static void nation_iter_next(struct iterator *iter)
532{
533 NATION_ITER(iter)->p++;
534}
535
536/************************************************************************/
539 static void *nation_iter_get(const struct iterator *iter)
540{
541 return NATION_ITER(iter)->p;
542}
543
544/************************************************************************/
547 static bool nation_iter_valid(const struct iterator *iter)
548{
549 struct nation_iter *it = NATION_ITER(iter);
550 return it->p < it->end;
551}
552
553/************************************************************************/
556 struct iterator *nation_iter_init(struct nation_iter *it)
557{
558 it->vtable.next = nation_iter_next;
559 it->vtable.get = nation_iter_get;
560 it->vtable.valid = nation_iter_valid;
561 it->p = nations;
562 if (nations == NULL) {
563 it->end = NULL;
564 } else {
565 it->end = nations + nation_count();
566 }
567 return ITERATOR(it);
568}
569
570/************************************************************************/
573 static void nation_init(struct nation_type *pnation)
574{
575 memset(pnation, 0, sizeof(*pnation));
576
577 pnation->item_number = pnation - nations;
578 pnation->translation_domain = NULL;
579 pnation->leaders = nation_leader_list_new_full(nation_leader_destroy);
580 pnation->sets = nation_set_list_new();
581 pnation->groups = nation_group_list_new();
582
583 if (is_server()) {
584 pnation->server.default_cities =
585 nation_city_list_new_full(nation_city_destroy);
586 pnation->server.civilwar_nations = nation_list_new();
587 pnation->server.parent_nations = nation_list_new();
588 pnation->server.conflicts_with = nation_list_new();
589 /* server.rgb starts out NULL */
590 pnation->server.traits = fc_calloc(TRAIT_COUNT,
591 sizeof(*pnation->server.traits));
592 }
593}
594
595/************************************************************************/
598 static void nation_free(struct nation_type *pnation)
599{
600 free(pnation->legend);
601 FC_FREE(pnation->translation_domain);
602 nation_leader_list_destroy(pnation->leaders);
603 nation_set_list_destroy(pnation->sets);
604 nation_group_list_destroy(pnation->groups);
605
606 if (is_server()) {
607 nation_city_list_destroy(pnation->server.default_cities);
608 nation_list_destroy(pnation->server.civilwar_nations);
609 nation_list_destroy(pnation->server.parent_nations);
610 nation_list_destroy(pnation->server.conflicts_with);
611 rgbcolor_destroy(pnation->server.rgb);
612 FC_FREE(pnation->server.traits);
613 }
614
615 memset(pnation, 0, sizeof(*pnation));
616}
617
618/************************************************************************/
621 void nations_alloc(int num)
622{
623 int i;
624
625 nations = fc_malloc(sizeof(*nations) * num);
626 game.control.nation_count = num;
627
628 for (i = 0; i < num; i++) {
629 nation_init(nations + i);
630 }
631}
632
633/************************************************************************/
636 void nations_free(void)
637{
638 int i;
639
640 if (NULL == nations) {
641 return;
642 }
643
644 for (i = 0; i < game.control.nation_count; i++) {
645 nation_free(nations + i);
646 }
647
648 free(nations);
649 nations = NULL;
650 game.control.nation_count = 0;
651}
652
653/************************************************************************/
658 struct government *init_government_of_nation(const struct nation_type *pnation)
659{
660 NATION_CHECK(pnation, return game.default_government);
661 if (pnation->init_government) {
662 return pnation->init_government;
663 } else {
664 return game.default_government;
665 }
666}
667
668/************************************************************************/
671 struct nation_style *style_of_nation(const struct nation_type *pnation)
672{
673 NATION_CHECK(pnation, return 0);
674 return pnation->style;
675}
676
677/************************************************************************/
681 const struct rgbcolor *nation_color(const struct nation_type *pnation)
682{
683 NATION_CHECK(pnation, return NULL);
684 return pnation->server.rgb;
685}
686
687/************************************************************************/
690 int nation_set_count(void)
691{
692 return num_nation_sets;
693}
694
695/************************************************************************/
698 int nation_set_index(const struct nation_set *pset)
699{
700 fc_assert_ret_val(NULL != pset, -1);
701 return pset - nation_sets;
702}
703
704/************************************************************************/
707 int nation_set_number(const struct nation_set *pset)
708{
709 return nation_set_index(pset);
710}
711
712/************************************************************************/
715 struct nation_set *nation_set_new(const char *set_name,
716 const char *set_rule_name,
717 const char *set_description)
718{
719 struct nation_set *pset;
720
721 if (game.control.num_nation_sets <= num_nation_sets) {
722 log_error("More nation sets than reported (%d).",
723 game.control.num_nation_sets);
724 return NULL;
725 }
726
727 if (MAX_NUM_NATION_SETS <= num_nation_sets) {
728 log_error("Too many nation sets (%d is the maximum).",
729 MAX_NUM_NATION_SETS);
730 return NULL;
731 }
732
733 /* Print the name and truncate if needed. */
734 pset = nation_sets + num_nation_sets;
735 names_set(&pset->name, NULL, set_name, set_rule_name);
736 (void) sz_loud_strlcpy(pset->description, set_description,
737 "Nation set description \"%s\" too long; truncating.");
738
739 if (NULL != nation_set_by_rule_name(rule_name_get(&pset->name))) {
740 log_error("Duplicate nation set name %s.", rule_name_get(&pset->name));
741 return NULL;
742 }
743
744 if (NULL != nation_group_by_rule_name(rule_name_get(&pset->name))) {
745 log_error("Nation set name %s is already used for a group.",
746 rule_name_get(&pset->name));
747 return NULL;
748 }
749
750 num_nation_sets++;
751
752 return pset;
753}
754
755/************************************************************************/
761 struct nation_set *nation_set_by_number(int id)
762{
763 /* Return valid pointer on client side even when the data of the
764 * group is not yet received. So compare against expected number
765 * of sets (game.control.num_nation_sets) and not
766 * what we have already set up (num_nation_sets) */
767 if (id < 0 || id >= game.control.num_nation_sets) {
768 return NULL;
769 }
770
771 return nation_sets + id;
772}
773
774/************************************************************************/
778 struct nation_set *nation_set_by_rule_name(const char *name)
779{
780 const char *qname = Qn_(name);
781
782 nation_sets_iterate(pset) {
783 if (0 == fc_strcasecmp(rule_name_get(&pset->name), qname)) {
784 return pset;
785 }
786 } nation_sets_iterate_end;
787
788 return NULL;
789}
790
791/************************************************************************/
796 const char *nation_set_untranslated_name(const struct nation_set *pset)
797{
798 fc_assert_ret_val(NULL != pset, NULL);
799 return untranslated_name(&pset->name);
800}
801
802/************************************************************************/
806 const char *nation_set_rule_name(const struct nation_set *pset)
807{
808 fc_assert_ret_val(NULL != pset, NULL);
809
810 return rule_name_get(&pset->name);
811}
812
813/************************************************************************/
817 const char *nation_set_name_translation(const struct nation_set *pset)
818{
819 fc_assert_ret_val(NULL != pset, NULL);
820 return name_translation_get(&pset->name);
821}
822
823/************************************************************************/
827 const char *nation_set_description(const struct nation_set *pset)
828{
829 fc_assert_ret_val(NULL != pset, NULL);
830 return pset->description;
831}
832
833/************************************************************************/
836 bool nation_is_in_set(const struct nation_type *pnation,
837 const struct nation_set *pset)
838{
839 fc_assert_ret_val(NULL != pnation, FALSE);
840
841 nation_set_list_iterate(pnation->sets, aset) {
842 if (aset == pset) {
843 return TRUE;
844 }
845 } nation_set_list_iterate_end;
846 return FALSE;
847}
848
849/************************************************************************/
858 struct nation_set *nation_set_by_setting_value(const char *setting)
859{
860 struct nation_set *pset = NULL;
861
862 if (strlen(setting) > 0) {
863 pset = nation_set_by_rule_name(setting);
864 }
865 if (pset == NULL) {
866 /* Either no nation set specified, or the specified one isn't in the
867 * current ruleset. Default to the first nation set specified by
868 * the ruleset. */
869 pset = nation_set_by_number(0);
870 }
871 fc_assert(pset != NULL);
872
873 return pset;
874}
875
876/****************************************************************************
877 Nation set iterator.
878****************************************************************************/
879 struct nation_set_iter {
880 struct iterator vtable;
881 struct nation_set *p, *end;
882};
883#define NATION_SET_ITER(p) ((struct nation_set_iter *)(p))
884
885/************************************************************************/
888 size_t nation_set_iter_sizeof(void)
889{
890 return sizeof(struct nation_set_iter);
891}
892
893/************************************************************************/
896 static void nation_set_iter_next(struct iterator *iter)
897{
898 NATION_SET_ITER(iter)->p++;
899}
900
901/************************************************************************/
904 static void *nation_set_iter_get(const struct iterator *iter)
905{
906 return NATION_SET_ITER(iter)->p;
907}
908
909/************************************************************************/
912 static bool nation_set_iter_valid(const struct iterator *iter)
913{
914 struct nation_set_iter *it = NATION_SET_ITER(iter);
915 return it->p < it->end;
916}
917
918/************************************************************************/
921 struct iterator *nation_set_iter_init(struct nation_set_iter *it)
922{
923 it->vtable.next = nation_set_iter_next;
924 it->vtable.get = nation_set_iter_get;
925 it->vtable.valid = nation_set_iter_valid;
926 it->p = nation_sets;
927 it->end = nation_sets + nation_set_count();
928 return ITERATOR(it);
929}
930
931/************************************************************************/
934 int nation_group_count(void)
935{
936 return num_nation_groups;
937}
938
939/************************************************************************/
942 int nation_group_index(const struct nation_group *pgroup)
943{
944 fc_assert_ret_val(NULL != pgroup, -1);
945 return pgroup - nation_groups;
946}
947
948/************************************************************************/
951 int nation_group_number(const struct nation_group *pgroup)
952{
953 return nation_group_index(pgroup);
954}
955
956/************************************************************************/
959 struct nation_group *nation_group_new(const char *name)
960{
961 struct nation_group *pgroup;
962
963 if (game.control.num_nation_groups <= num_nation_groups) {
964 log_error("More nation groups than reported (%d).",
965 game.control.num_nation_groups);
966 return NULL;
967 }
968
969 if (MAX_NUM_NATION_GROUPS <= num_nation_groups) {
970 log_error("Too many nation groups (%d is the maximum).",
971 MAX_NUM_NATION_GROUPS);
972 return NULL;
973 }
974
975 /* Print the name and truncate if needed. */
976 pgroup = nation_groups + num_nation_groups;
977 name_set(&pgroup->name, NULL, name);
978 if (NULL != nation_group_by_rule_name(rule_name_get(&pgroup->name))) {
979 log_error("Duplicate nation group name %s.", rule_name_get(&pgroup->name));
980 return NULL;
981 }
982
983 if (NULL != nation_set_by_rule_name(rule_name_get(&pgroup->name))) {
984 log_error("Nation group name %s is already used for a set.",
985 rule_name_get(&pgroup->name));
986 return NULL;
987 }
988
989 if (is_server()) {
990 pgroup->server.match = 0;
991 }
992 num_nation_groups++;
993
994 return pgroup;
995}
996
997/************************************************************************/
1003 struct nation_group *nation_group_by_number(int id)
1004{
1005 /* Return valid pointer on client side even when the data of the
1006 * group is not yet received. So compare against expected number
1007 * of groups (game.control.num_nation_groups) and not
1008 * what we have already set up (num_nation_groups) */
1009 if (id < 0 || id >= game.control.num_nation_groups) {
1010 return NULL;
1011 }
1012
1013 return nation_groups + id;
1014}
1015
1016/************************************************************************/
1020 struct nation_group *nation_group_by_rule_name(const char *name)
1021{
1022 const char *qname = Qn_(name);
1023
1024 nation_groups_iterate(pgroup) {
1025 if (0 == fc_strcasecmp(rule_name_get(&pgroup->name), qname)) {
1026 return pgroup;
1027 }
1028 } nation_groups_iterate_end;
1029
1030 return NULL;
1031}
1032
1033/************************************************************************/
1036 void nation_group_set_hidden(struct nation_group *pgroup, bool hidden)
1037{
1038 fc_assert_ret(NULL != pgroup);
1039 pgroup->hidden = hidden;
1040}
1041
1042/************************************************************************/
1046 void nation_group_set_match(struct nation_group *pgroup, int match)
1047{
1048 fc_assert_ret(is_server());
1049 fc_assert_ret(NULL != pgroup);
1050 pgroup->server.match = match;
1051}
1052
1053/************************************************************************/
1056 bool is_nation_group_hidden(struct nation_group *pgroup)
1057{
1058 fc_assert_ret_val(NULL != pgroup, TRUE);
1059 return pgroup->hidden;
1060}
1061
1062/************************************************************************/
1068 const char *nation_group_untranslated_name(const struct nation_group *pgroup)
1069{
1070 fc_assert_ret_val(NULL != pgroup, NULL);
1071 return untranslated_name(&pgroup->name);
1072}
1073
1074/************************************************************************/
1078 const char *nation_group_rule_name(const struct nation_group *pgroup)
1079{
1080 fc_assert_ret_val(NULL != pgroup, NULL);
1081
1082 return rule_name_get(&pgroup->name);
1083}
1084
1085/************************************************************************/
1089 const char *nation_group_name_translation(const struct nation_group *pgroup)
1090{
1091 fc_assert_ret_val(NULL != pgroup, NULL);
1092 return name_translation_get(&pgroup->name);
1093}
1094
1095/************************************************************************/
1098 bool nation_is_in_group(const struct nation_type *pnation,
1099 const struct nation_group *pgroup)
1100{
1101 fc_assert_ret_val(NULL != pnation, FALSE);
1102
1103 nation_group_list_iterate(pnation->groups, agroup) {
1104 if (agroup == pgroup) {
1105 return TRUE;
1106 }
1107 } nation_group_list_iterate_end;
1108 return FALSE;
1109}
1110
1111/****************************************************************************
1112 Nation group iterator.
1113****************************************************************************/
1114 struct nation_group_iter {
1115 struct iterator vtable;
1116 struct nation_group *p, *end;
1117};
1118#define NATION_GROUP_ITER(p) ((struct nation_group_iter *)(p))
1119
1120/************************************************************************/
1123 size_t nation_group_iter_sizeof(void)
1124{
1125 return sizeof(struct nation_group_iter);
1126}
1127
1128/************************************************************************/
1131 static void nation_group_iter_next(struct iterator *iter)
1132{
1133 NATION_GROUP_ITER(iter)->p++;
1134}
1135
1136/************************************************************************/
1139 static void *nation_group_iter_get(const struct iterator *iter)
1140{
1141 return NATION_GROUP_ITER(iter)->p;
1142}
1143
1144/************************************************************************/
1147 static bool nation_group_iter_valid(const struct iterator *iter)
1148{
1149 struct nation_group_iter *it = NATION_GROUP_ITER(iter);
1150 return it->p < it->end;
1151}
1152
1153/************************************************************************/
1156 struct iterator *nation_group_iter_init(struct nation_group_iter *it)
1157{
1158 it->vtable.next = nation_group_iter_next;
1159 it->vtable.get = nation_group_iter_get;
1160 it->vtable.valid = nation_group_iter_valid;
1161 it->p = nation_groups;
1162 it->end = nation_groups + nation_group_count();
1163 return ITERATOR(it);
1164}
1165
1166/************************************************************************/
1169 void nation_sets_groups_init(void)
1170{
1171 num_nation_sets = num_nation_groups = 0;
1172}
1173
1174/************************************************************************/
1177 void nation_sets_groups_free(void)
1178{
1179 num_nation_sets = num_nation_groups = 0;
1180}
1181
1182/************************************************************************/
1186 bool can_conn_edit_players_nation(const struct connection *pconn,
1187 const struct player *pplayer)
1188{
1189 return (can_conn_edit(pconn)
1190 || (game.info.is_new_game
1191 && ((!pconn->observer && pconn->playing == pplayer)
1192 || pconn->access_level >= ALLOW_CTRL)));
1193}
1194
1195/************************************************************************/
1205 int nations_match(const struct nation_type *pnation1,
1206 const struct nation_type *pnation2,
1207 bool ignore_conflicts)
1208{
1209 bool in_conflict = FALSE;
1210 int sum = 0;
1211
1212 fc_assert_ret_val(is_server(), -1);
1213 NATION_CHECK(pnation1, return -1);
1214 NATION_CHECK(pnation2, return -1);
1215
1216 if (!ignore_conflicts) {
1217 nation_list_iterate(pnation1->server.conflicts_with, pnation0) {
1218 if (pnation0 == pnation2) {
1219 in_conflict = TRUE;
1220 sum = 1; /* Be sure to return something negative. */
1221 break;
1222 }
1223 } nation_list_iterate_end;
1224
1225 if (!in_conflict) {
1226 nation_list_iterate(pnation2->server.conflicts_with, pnation0) {
1227 if (pnation0 == pnation1) {
1228 in_conflict = TRUE;
1229 sum = 1; /* Be sure to return something negative. */
1230 break;
1231 }
1232 } nation_list_iterate_end;
1233 }
1234 }
1235
1236 nation_group_list_iterate(pnation1->groups, pgroup) {
1237 if (nation_is_in_group(pnation2, pgroup)) {
1238 sum += pgroup->server.match;
1239 }
1240 } nation_group_list_iterate_end;
1241
1242 return (in_conflict ? -sum : sum);
1243}
city_owner
#define city_owner(_pcity_)
Definition city.h:543
can_conn_edit
bool can_conn_edit(const struct connection *pconn)
Definition connection.c:510
connection.h
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:73
id
int int id
Definition editgui_g.h:28
is_server
static bool is_server(void)
Definition fc_interface.h:69
MAX_NUM_NATION_SETS
#define MAX_NUM_NATION_SETS
Definition fc_types.h:57
Nation_type_id
int Nation_type_id
Definition fc_types.h:350
MAX_NUM_NATION_GROUPS
#define MAX_NUM_NATION_GROUPS
Definition fc_types.h:58
fcintl.h
DG_
#define DG_(domain, String)
Definition fcintl.h:68
_
#define _(String)
Definition fcintl.h:67
Qn_
#define Qn_(String)
Definition fcintl.h:89
game
struct civ_game game
Definition game.c:57
game.h
government.h
name
const char * name
Definition inputfile.c:127
ITERATOR
#define ITERATOR(p)
Definition iterator.h:37
do_log
void do_log(const char *file, const char *function, int line, bool print_from_where, enum log_level level, const char *message,...)
Definition log.c:514
log.h
fc_assert_ret
#define fc_assert_ret(condition)
Definition log.h:191
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
LOG_ERROR
@ LOG_ERROR
Definition log.h:30
log_error
#define log_error(message,...)
Definition log.h:103
mem.h
fc_calloc
#define fc_calloc(n, esz)
Definition mem.h:38
FC_FREE
#define FC_FREE(ptr)
Definition mem.h:41
fc_strdup
#define fc_strdup(str)
Definition mem.h:43
fc_malloc
#define fc_malloc(sz)
Definition mem.h:34
name_set
static void name_set(struct name_translation *ptrans, const char *domain, const char *vernacular_name)
Definition name_translation.h:88
rule_name_get
static const char * rule_name_get(const struct name_translation *ptrans)
Definition name_translation.h:112
name_translation_get
static const char * name_translation_get(const struct name_translation *ptrans)
Definition name_translation.h:121
untranslated_name
static const char * untranslated_name(const struct name_translation *ptrans)
Definition name_translation.h:104
names_set
static void names_set(struct name_translation *ptrans, const char *domain, const char *vernacular_name, const char *rule_name)
Definition name_translation.h:60
nation_group_set_match
void nation_group_set_match(struct nation_group *pgroup, int match)
Definition nation.c:1046
nations_free
void nations_free(void)
Definition nation.c:636
nation_city_name
const char * nation_city_name(const struct nation_city *pncity)
Definition nation.c:411
nation_city_destroy
static void nation_city_destroy(struct nation_city *pncity)
Definition nation.c:360
nation_group_untranslated_name
const char * nation_group_untranslated_name(const struct nation_group *pgroup)
Definition nation.c:1068
nation_cities
const struct nation_city_list * nation_cities(const struct nation_type *pnation)
Definition nation.c:330
nation_group_by_rule_name
struct nation_group * nation_group_by_rule_name(const char *name)
Definition nation.c:1020
nation_by_translated_plural
struct nation_type * nation_by_translated_plural(const char *name)
Definition nation.c:105
nation_rule_name
const char * nation_rule_name(const struct nation_type *pnation)
Definition nation.c:137
nation_city_preference_revert
enum nation_city_preference nation_city_preference_revert(enum nation_city_preference prefer)
Definition nation.c:370
nation_group_index
int nation_group_index(const struct nation_group *pgroup)
Definition nation.c:942
nation_free
static void nation_free(struct nation_type *pnation)
Definition nation.c:598
nation_count
Nation_type_id nation_count(void)
Definition nation.c:506
nation_iter_get
static void * nation_iter_get(const struct iterator *iter)
Definition nation.c:539
nation_number
Nation_type_id nation_number(const struct nation_type *pnation)
Definition nation.c:485
nation_group_new
struct nation_group * nation_group_new(const char *name)
Definition nation.c:959
nation_leader_by_name
struct nation_leader * nation_leader_by_name(const struct nation_type *pnation, const char *name)
Definition nation.c:266
nation_set_iter_init
struct iterator * nation_set_iter_init(struct nation_set_iter *it)
Definition nation.c:921
nations_match
int nations_match(const struct nation_type *pnation1, const struct nation_type *pnation2, bool ignore_conflicts)
Definition nation.c:1205
nation_iter_valid
static bool nation_iter_valid(const struct iterator *iter)
Definition nation.c:547
nation_of_unit
struct nation_type * nation_of_unit(const struct unit *punit)
Definition nation.c:462
nation_leader_is_male
bool nation_leader_is_male(const struct nation_leader *pleader)
Definition nation.c:289
nation_adjective_for_player
const char * nation_adjective_for_player(const struct player *pplayer)
Definition nation.c:168
nation_set_iter_sizeof
size_t nation_set_iter_sizeof(void)
Definition nation.c:888
nation_iter_next
static void nation_iter_next(struct iterator *iter)
Definition nation.c:531
nation_set_new
struct nation_set * nation_set_new(const char *set_name, const char *set_rule_name, const char *set_description)
Definition nation.c:715
nation_adjective_translation
const char * nation_adjective_translation(const struct nation_type *pnation)
Definition nation.c:148
nation_sets
static struct nation_set nation_sets[MAX_NUM_NATION_SETS]
Definition nation.c:48
nation_by_number
struct nation_type * nation_by_number(const Nation_type_id nation)
Definition nation.c:474
nation_set_index
int nation_set_index(const struct nation_set *pset)
Definition nation.c:698
nation_city_new
struct nation_city * nation_city_new(struct nation_type *pnation, const char *name)
Definition nation.c:341
nation_city_terrain_preference
enum nation_city_preference nation_city_terrain_preference(const struct nation_city *pncity, const struct terrain *pterrain)
Definition nation.c:421
is_nation_pickable
bool is_nation_pickable(const struct nation_type *nation)
Definition nation.c:187
nation_leaders
const struct nation_leader_list * nation_leaders(const struct nation_type *pnation)
Definition nation.c:229
nation_set_name_translation
const char * nation_set_name_translation(const struct nation_set *pset)
Definition nation.c:817
nation_group_rule_name
const char * nation_group_rule_name(const struct nation_group *pgroup)
Definition nation.c:1078
nation_of_player
struct nation_type * nation_of_player(const struct player *pplayer)
Definition nation.c:443
nation_set_untranslated_name
const char * nation_set_untranslated_name(const struct nation_set *pset)
Definition nation.c:796
nation_of_city
struct nation_type * nation_of_city(const struct city *pcity)
Definition nation.c:453
nation_group_iter_next
static void nation_group_iter_next(struct iterator *iter)
Definition nation.c:1131
is_nation_playable
bool is_nation_playable(const struct nation_type *nation)
Definition nation.c:199
nation_groups
static struct nation_group nation_groups[MAX_NUM_NATION_GROUPS]
Definition nation.c:50
nation_iter_init
struct iterator * nation_iter_init(struct nation_iter *it)
Definition nation.c:556
nation_sets_groups_free
void nation_sets_groups_free(void)
Definition nation.c:1177
nation_set_number
int nation_set_number(const struct nation_set *pset)
Definition nation.c:707
nation_color
const struct rgbcolor * nation_color(const struct nation_type *pnation)
Definition nation.c:681
nation_city_set_terrain_preference
void nation_city_set_terrain_preference(struct nation_city *pncity, const struct terrain *pterrain, enum nation_city_preference prefer)
Definition nation.c:389
NATION_SET_ITER
#define NATION_SET_ITER(p)
Definition nation.c:883
num_nation_sets
static int num_nation_sets
Definition nation.c:47
nation_group_iter_init
struct iterator * nation_group_iter_init(struct nation_group_iter *it)
Definition nation.c:1156
nation_city_set_river_preference
void nation_city_set_river_preference(struct nation_city *pncity, enum nation_city_preference prefer)
Definition nation.c:401
nation_is_in_group
bool nation_is_in_group(const struct nation_type *pnation, const struct nation_group *pgroup)
Definition nation.c:1098
nation_set_iter_get
static void * nation_set_iter_get(const struct iterator *iter)
Definition nation.c:904
nation_is_in_set
bool nation_is_in_set(const struct nation_type *pnation, const struct nation_set *pset)
Definition nation.c:836
nation_set_description
const char * nation_set_description(const struct nation_set *pset)
Definition nation.c:827
nation_group_name_translation
const char * nation_group_name_translation(const struct nation_group *pgroup)
Definition nation.c:1089
nation_city_river_preference
enum nation_city_preference nation_city_river_preference(const struct nation_city *pncity)
Definition nation.c:433
nation_set_count
int nation_set_count(void)
Definition nation.c:690
num_nation_groups
static int num_nation_groups
Definition nation.c:49
nation_sets_groups_init
void nation_sets_groups_init(void)
Definition nation.c:1169
nation_set_by_number
struct nation_set * nation_set_by_number(int id)
Definition nation.c:761
nation_by_rule_name
struct nation_type * nation_by_rule_name(const char *name)
Definition nation.c:120
nation_group_by_number
struct nation_group * nation_group_by_number(int id)
Definition nation.c:1003
nation_leader_destroy
static void nation_leader_destroy(struct nation_leader *pleader)
Definition nation.c:255
NATION_GROUP_ITER
#define NATION_GROUP_ITER(p)
Definition nation.c:1118
nation_set_iter_next
static void nation_set_iter_next(struct iterator *iter)
Definition nation.c:896
nation_set_iter_valid
static bool nation_set_iter_valid(const struct iterator *iter)
Definition nation.c:912
nation_plural_translation
const char * nation_plural_translation(const struct nation_type *pnation)
Definition nation.c:158
nation_set_by_rule_name
struct nation_set * nation_set_by_rule_name(const char *name)
Definition nation.c:778
is_nation_group_hidden
bool is_nation_group_hidden(struct nation_group *pgroup)
Definition nation.c:1056
nations
static struct nation_type * nations
Definition nation.c:45
can_conn_edit_players_nation
bool can_conn_edit_players_nation(const struct connection *pconn, const struct player *pplayer)
Definition nation.c:1186
nation_set_by_setting_value
struct nation_set * nation_set_by_setting_value(const char *setting)
Definition nation.c:858
nation_index
Nation_type_id nation_index(const struct nation_type *pnation)
Definition nation.c:497
nation_leader_name
const char * nation_leader_name(const struct nation_leader *pleader)
Definition nation.c:280
NATION_ITER
#define NATION_ITER(p)
Definition nation.c:518
nation_group_iter_valid
static bool nation_group_iter_valid(const struct iterator *iter)
Definition nation.c:1147
nation_group_iter_get
static void * nation_group_iter_get(const struct iterator *iter)
Definition nation.c:1139
nation_group_count
int nation_group_count(void)
Definition nation.c:934
nation_set_rule_name
const char * nation_set_rule_name(const struct nation_set *pset)
Definition nation.c:806
nation_leader_new
struct nation_leader * nation_leader_new(struct nation_type *pnation, const char *name, bool is_male)
Definition nation.c:238
NATION_CHECK
#define NATION_CHECK(pnation, action)
Definition nation.c:98
nation_group_set_hidden
void nation_group_set_hidden(struct nation_group *pgroup, bool hidden)
Definition nation.c:1036
nation_init
static void nation_init(struct nation_type *pnation)
Definition nation.c:573
nations_alloc
void nations_alloc(int num)
Definition nation.c:621
nation_barbarian_type
enum barbarian_type nation_barbarian_type(const struct nation_type *nation)
Definition nation.c:210
nation_plural_for_player
const char * nation_plural_for_player(const struct player *pplayer)
Definition nation.c:177
nation_iter_sizeof
size_t nation_iter_sizeof(void)
Definition nation.c:523
nation_group_number
int nation_group_number(const struct nation_group *pgroup)
Definition nation.c:951
nation_group_iter_sizeof
size_t nation_group_iter_sizeof(void)
Definition nation.c:1123
init_government_of_nation
struct government * init_government_of_nation(const struct nation_type *pnation)
Definition nation.c:658
style_of_nation
struct nation_style * style_of_nation(const struct nation_type *pnation)
Definition nation.c:671
nation_legend_translation
const char * nation_legend_translation(const struct nation_type *pnation, const char *legend)
Definition nation.c:298
nation.h
nation_leader_list_iterate
#define nation_leader_list_iterate(leaderlist, pleader)
Definition nation.h:56
nation_list_iterate
#define nation_list_iterate(nationlist, pnation)
Definition nation.h:83
nation_sets_iterate_end
#define nation_sets_iterate_end
Definition nation.h:304
nation_set_list_iterate_end
#define nation_set_list_iterate_end
Definition nation.h:67
nation_group_list_iterate
#define nation_group_list_iterate(grouplist, pgroup)
Definition nation.h:74
nation_sets_iterate
#define nation_sets_iterate(NAME_pset)
Definition nation.h:300
nations_iterate_end
#define nations_iterate_end
Definition nation.h:335
nation_city_preference
nation_city_preference
Definition nation.h:38
NCP_NONE
@ NCP_NONE
Definition nation.h:40
NCP_DISLIKE
@ NCP_DISLIKE
Definition nation.h:39
NCP_LIKE
@ NCP_LIKE
Definition nation.h:41
nation_list_iterate_end
#define nation_list_iterate_end
Definition nation.h:85
nations_iterate
#define nations_iterate(NAME_pnation)
Definition nation.h:332
nation_leader_list_iterate_end
#define nation_leader_list_iterate_end
Definition nation.h:58
nation_group_list_iterate_end
#define nation_group_list_iterate_end
Definition nation.h:76
nation_set_list_iterate
#define nation_set_list_iterate(setlist, pset)
Definition nation.h:65
nation_groups_iterate
#define nation_groups_iterate(NAME_pgroup)
Definition nation.h:310
nation_groups_iterate_end
#define nation_groups_iterate_end
Definition nation.h:314
NO_NATION_SELECTED
#define NO_NATION_SELECTED
Definition nation.h:29
MAX_LEN_MSG
#define MAX_LEN_MSG
Definition packets.h:43
player.h
rgbcolor_destroy
void rgbcolor_destroy(struct rgbcolor *prgbcolor)
Definition rgbcolor.c:74
sz_loud_strlcpy
#define sz_loud_strlcpy(buffer, str, errmsg)
Definition shared.h:155
city
Definition city.h:309
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::default_government
struct government * default_government
Definition game.h:93
connection
Definition connection.h:141
connection::playing
struct player * playing
Definition connection.h:156
connection::access_level
enum cmdlevel access_level
Definition connection.h:182
connection::observer
bool observer
Definition connection.h:152
government
Definition government.h:52
iterator
Definition iterator.h:31
iterator::valid
bool(* valid)(const struct iterator *it)
Definition iterator.h:34
iterator::get
void *(* get)(const struct iterator *it)
Definition iterator.h:33
iterator::next
void(* next)(struct iterator *it)
Definition iterator.h:32
name_translation
Definition name_translation.h:35
nation_city
Definition nation.c:320
nation_city::river
enum nation_city_preference river
Definition nation.c:322
nation_city::terrain
enum nation_city_preference terrain[MAX_NUM_TERRAINS]
Definition nation.c:323
nation_city::name
char * name
Definition nation.c:321
nation_group_iter
Definition nation.c:1114
nation_group_iter::vtable
struct iterator vtable
Definition nation.c:1115
nation_group_iter::p
struct nation_group * p
Definition nation.c:1116
nation_group_iter::end
struct nation_group * end
Definition nation.c:1116
nation_group
Definition nation.h:166
nation_group::match
int match
Definition nation.h:175
nation_group::name
struct name_translation name
Definition nation.h:167
nation_group::server
struct nation_group::@54::@56 server
nation_group::hidden
bool hidden
Definition nation.h:168
nation_iter
Definition nation.c:514
nation_iter::vtable
struct iterator vtable
Definition nation.c:515
nation_iter::end
struct nation_type * end
Definition nation.c:516
nation_iter::p
struct nation_type * p
Definition nation.c:516
nation_leader
Definition nation.c:220
nation_leader::name
char * name
Definition nation.c:221
nation_leader::is_male
bool is_male
Definition nation.c:222
nation_set_iter
Definition nation.c:879
nation_set_iter::vtable
struct iterator vtable
Definition nation.c:880
nation_set_iter::end
struct nation_set * end
Definition nation.c:881
nation_set_iter::p
struct nation_set * p
Definition nation.c:881
nation_set
Definition nation.c:40
nation_set::name
struct name_translation name
Definition nation.c:41
nation_set::description
char description[MAX_LEN_MSG]
Definition nation.c:42
nation_style
Definition style.h:22
nation_type
Definition nation.h:97
nation_type::conflicts_with
struct nation_list * conflicts_with
Definition nation.h:139
nation_type::groups
struct nation_group_list * groups
Definition nation.h:115
nation_type::noun_plural
struct name_translation noun_plural
Definition nation.h:101
nation_type::parent_nations
struct nation_list * parent_nations
Definition nation.h:135
nation_type::sets
struct nation_set_list * sets
Definition nation.h:112
nation_type::adjective
struct name_translation adjective
Definition nation.h:100
nation_type::rgb
struct rgbcolor * rgb
Definition nation.h:142
nation_type::client
struct nation_type::@50::@53 client
nation_type::traits
struct trait_limits * traits
Definition nation.h:144
nation_type::init_government
struct government * init_government
Definition nation.h:123
nation_type::is_pickable
bool is_pickable
Definition nation.h:160
nation_type::leaders
struct nation_leader_list * leaders
Definition nation.h:104
nation_type::legend
char * legend
Definition nation.h:106
nation_type::item_number
Nation_type_id item_number
Definition nation.h:98
nation_type::barb_type
enum barbarian_type barb_type
Definition nation.h:109
nation_type::translation_domain
char * translation_domain
Definition nation.h:99
nation_type::server
struct nation_type::@50::@52 server
nation_type::style
struct nation_style * style
Definition nation.h:105
nation_type::default_cities
struct nation_city_list * default_cities
Definition nation.h:130
nation_type::civilwar_nations
struct nation_list * civilwar_nations
Definition nation.h:134
nation_type::is_playable
bool is_playable
Definition nation.h:108
packet_game_info::is_new_game
bool is_new_game
Definition packets_gen.h:186
packet_ruleset_control::nation_count
int nation_count
Definition packets_gen.h:1471
packet_ruleset_control::num_nation_sets
int num_nation_sets
Definition packets_gen.h:1476
packet_ruleset_control::num_nation_groups
int num_nation_groups
Definition packets_gen.h:1475
player
Definition player.h:249
player::nation
struct nation_type * nation
Definition player.h:260
rgbcolor
Definition rgbcolor.h:33
setting
Definition settings.c:88
terrain
Definition terrain.h:176
unit
Definition unit.h:138
fc_strcasecmp
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:189
support.h
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
tech.h
terrain_index
Terrain_type_id terrain_index(const struct terrain *pterrain)
Definition terrain.c:126
MAX_NUM_TERRAINS
#define MAX_NUM_TERRAINS
Definition terrain.h:64
traits.h
unit_owner
#define unit_owner(_pu)
Definition unit.h:387