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

Freeciv-3.3

Loading...
Searching...
No Matches
improvement.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#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* utility */
19#include "fcintl.h"
20#include "log.h"
21#include "mem.h"
22#include "shared.h" /* ARRAY_SIZE */
23#include "string_vector.h"
24#include "support.h"
25
26/* common */
27#include "game.h"
28#include "map.h"
29#include "tech.h"
30#include "victory.h"
31
32#include "improvement.h"
33
34/**************************************************************************
35All the city improvements:
36Use improvement_by_number(id) to access the array.
37The improvement_types array is now setup in:
38 server/ruleset.c (for the server)
39 client/packhand.c (for the client)
40**************************************************************************/
41 static struct impr_type improvement_types[B_LAST];
42
43 static struct user_flag user_impr_flags[MAX_NUM_USER_BUILDING_FLAGS];
44
45/**********************************************************************/
48 void improvements_init(void)
49{
50 int i;
51
52 /* Can't use improvement_iterate() or improvement_by_number() here
53 * because num_impr_types isn't known yet. */
54 for (i = 0; i < ARRAY_SIZE(improvement_types); i++) {
55 struct impr_type *p = &improvement_types[i];
56
57 p->item_number = i;
58 requirement_vector_init(&p->reqs);
59 requirement_vector_init(&p->obsolete_by);
60 p->ruledit_disabled = FALSE;
61 p->ruledit_dlg = NULL;
62 }
63}
64
65/**********************************************************************/
68 static void improvement_free(struct impr_type *p)
69{
70 if (NULL != p->helptext) {
71 strvec_destroy(p->helptext);
72 p->helptext = NULL;
73 }
74
75 requirement_vector_free(&p->reqs);
76 requirement_vector_free(&p->obsolete_by);
77}
78
79/**********************************************************************/
82 void improvements_free(void)
83{
84 improvement_iterate(p) {
85 improvement_free(p);
86 } improvement_iterate_end;
87}
88
89/**********************************************************************/
92 void improvement_feature_cache_init(void)
93{
94 improvement_iterate(pimprove) {
95 pimprove->allows_units = FALSE;
96 unit_type_iterate(putype) {
97 if (requirement_needs_improvement(pimprove, &putype->build_reqs)) {
98 pimprove->allows_units = TRUE;
99 break;
100 }
101 } unit_type_iterate_end;
102
103 pimprove->allows_extras = FALSE;
104 extra_type_iterate(pextra) {
105 if (requirement_needs_improvement(pimprove, &pextra->reqs)) {
106 pimprove->allows_extras = TRUE;
107 break;
108 }
109 } extra_type_iterate_end;
110
111 pimprove->prevents_disaster = FALSE;
112 disaster_type_iterate(pdis) {
113 if (!requirement_fulfilled_by_improvement(pimprove, &pdis->reqs)) {
114 pimprove->prevents_disaster = TRUE;
115 break;
116 }
117 } disaster_type_iterate_end;
118
119 pimprove->protects_vs_actions = FALSE;
120 action_enablers_iterate(act) {
121 if (!requirement_fulfilled_by_improvement(pimprove,
122 &act->target_reqs)) {
123 pimprove->protects_vs_actions = TRUE;
124 break;
125 }
126 } action_enablers_iterate_end;
127
128 pimprove->allows_actions = FALSE;
129 action_enablers_iterate(act) {
130 if (requirement_needs_improvement(pimprove, &act->actor_reqs)) {
131 pimprove->allows_actions = TRUE;
132 break;
133 }
134 } action_enablers_iterate_end;
135
136 } improvement_iterate_end;
137}
138
139/**********************************************************************/
142 struct impr_type *improvement_array_first(void)
143{
144 if (game.control.num_impr_types > 0) {
145 return improvement_types;
146 }
147 return NULL;
148}
149
150/**********************************************************************/
153 const struct impr_type *improvement_array_last(void)
154{
155 if (game.control.num_impr_types > 0) {
156 return &improvement_types[game.control.num_impr_types - 1];
157 }
158 return NULL;
159}
160
161/**********************************************************************/
164 Impr_type_id improvement_count(void)
165{
166 return game.control.num_impr_types;
167}
168
169/**********************************************************************/
175 Impr_type_id improvement_index(const struct impr_type *pimprove)
176{
177 fc_assert_ret_val(NULL != pimprove, -1);
178 return pimprove - improvement_types;
179}
180
181/**********************************************************************/
184 Impr_type_id improvement_number(const struct impr_type *pimprove)
185{
186 fc_assert_ret_val(NULL != pimprove, -1);
187 return pimprove->item_number;
188}
189
190/**********************************************************************/
194 struct impr_type *improvement_by_number(const Impr_type_id id)
195{
196 if (id < 0 || id >= improvement_count()) {
197 return NULL;
198 }
199 return &improvement_types[id];
200}
201
202/**********************************************************************/
211 const struct impr_type *valid_improvement(const struct impr_type *pimprove)
212{
213 if (NULL == pimprove) {
214 return NULL;
215 }
216
217 if (!victory_enabled(VC_SPACERACE)
218 && (building_has_effect(pimprove, EFT_SS_STRUCTURAL)
219 || building_has_effect(pimprove, EFT_SS_COMPONENT)
220 || building_has_effect(pimprove, EFT_SS_MODULE))) {
221 /* This assumes that space parts don't have any other effects. */
222 return NULL;
223 }
224
225 return pimprove;
226}
227
228/**********************************************************************/
234 const struct impr_type *valid_improvement_by_number(const Impr_type_id id)
235{
236 return valid_improvement(improvement_by_number(id));
237}
238
239/**********************************************************************/
243 const char *improvement_name_translation(const struct impr_type *pimprove)
244{
245 return name_translation_get(&pimprove->name);
246}
247
248/**********************************************************************/
252 const char *improvement_rule_name(const struct impr_type *pimprove)
253{
254 return rule_name_get(&pimprove->name);
255}
256
257/**********************************************************************/
261 int impr_base_build_shield_cost(const struct impr_type *pimprove)
262{
263 int base = pimprove->build_cost;
264
265 return MAX(base * game.info.shieldbox / 100, 1);
266}
267
268/**********************************************************************/
273 int impr_estimate_build_shield_cost(const struct player *pplayer,
274 const struct tile *ptile,
275 const struct impr_type *pimprove)
276{
277 int base = pimprove->build_cost
278 * (100 +
279 get_target_bonus_effects(NULL,
280 &(const struct req_context) {
281 .player = pplayer,
282 .building = pimprove,
283 .tile = ptile,
284 },
285 NULL,
286 EFT_IMPR_BUILD_COST_PCT)) / 100;
287
288 return MAX(base * game.info.shieldbox / 100, 1);
289}
290
291/**********************************************************************/
294 int impr_build_shield_cost(const struct city *pcity,
295 const struct impr_type *pimprove)
296{
297 int base = pimprove->build_cost
298 * (100 + get_building_bonus(pcity, pimprove, EFT_IMPR_BUILD_COST_PCT)) / 100;
299
300 return MAX(base * game.info.shieldbox / 100, 1);
301}
302
303/**********************************************************************/
306 int impr_buy_gold_cost(const struct city *pcity,
307 const struct impr_type *pimprove, int shields_in_stock)
308{
309 int cost = 0;
310 const int missing = impr_build_shield_cost(pcity, pimprove) - shields_in_stock;
311
312 if (is_convert_improvement(pimprove)) {
313 /* Can't buy coinage-like improvements. */
314 return 0;
315 }
316
317 if (missing > 0) {
318 cost = 2 * missing;
319 }
320
321 if (shields_in_stock == 0) {
322 cost *= 2;
323 }
324
325 cost = cost
326 * (100 + get_building_bonus(pcity, pimprove, EFT_IMPR_BUY_COST_PCT)) / 100;
327
328 return cost;
329}
330
331/**********************************************************************/
334 int impr_sell_gold(const struct impr_type *pimprove)
335{
336 return MAX(pimprove->build_cost * game.info.shieldbox / 100, 1);
337}
338
339/**********************************************************************/
343 bool is_wonder(const struct impr_type *pimprove)
344{
345 return (is_great_wonder(pimprove) || is_small_wonder(pimprove));
346}
347
348/**********************************************************************/
352 struct impr_type *improvement_by_translated_name(const char *name)
353{
354 improvement_iterate(pimprove) {
355 if (0 == strcmp(improvement_name_translation(pimprove), name)) {
356 return pimprove;
357 }
358 } improvement_iterate_end;
359
360 return NULL;
361}
362
363/**********************************************************************/
367 struct impr_type *improvement_by_rule_name(const char *name)
368{
369 const char *qname = Qn_(name);
370
371 improvement_iterate(pimprove) {
372 if (0 == fc_strcasecmp(improvement_rule_name(pimprove), qname)) {
373 return pimprove;
374 }
375 } improvement_iterate_end;
376
377 return NULL;
378}
379
380/**********************************************************************/
383 bool improvement_has_flag(const struct impr_type *pimprove,
384 enum impr_flag_id flag)
385{
386 fc_assert_ret_val(impr_flag_id_is_valid(flag), FALSE);
387 return BV_ISSET(pimprove->flags, flag);
388}
389
390/**********************************************************************/
393 bool is_improvement_visible(const struct impr_type *pimprove)
394{
395 return (is_wonder(pimprove)
396 || improvement_has_flag(pimprove, IF_VISIBLE_BY_OTHERS));
397}
398
399/**********************************************************************/
403 bool can_improvement_go_obsolete(const struct impr_type *pimprove)
404{
405 return requirement_vector_size(&pimprove->obsolete_by) > 0;
406}
407
408/**********************************************************************/
411 bool improvement_obsolete(const struct player *pplayer,
412 const struct impr_type *pimprove,
413 const struct city *pcity)
414{
415 const struct req_context context = {
416 .player = pplayer,
417 .city = pcity,
418 .tile = pcity ? city_tile(pcity) : NULL,
419 .building = pimprove,
420 };
421
422 requirement_vector_iterate(&pimprove->obsolete_by, preq) {
423 if (is_req_active(&context, NULL, preq, RPT_CERTAIN)) {
424 return TRUE;
425 }
426 } requirement_vector_iterate_end;
427
428 return FALSE;
429}
430
431/**********************************************************************/
434 static bool impr_provides_buildable_units(const struct city *pcity,
435 const struct impr_type *pimprove)
436{
437 /* Fast check */
438 if (!pimprove->allows_units) {
439 return FALSE;
440 }
441
442 unit_type_iterate(ut) {
443 if (requirement_needs_improvement(pimprove, &ut->build_reqs)
444 && can_city_build_unit_now(pcity, ut)) {
445 return TRUE;
446 }
447 } unit_type_iterate_end;
448
449 return FALSE;
450}
451
452/**********************************************************************/
455 static bool impr_provides_buildable_extras(const struct city *pcity,
456 const struct impr_type *pimprove)
457{
458 const struct civ_map *nmap = &(wld.map);
459
460 /* Fast check */
461 if (!pimprove->allows_extras) {
462 return FALSE;
463 }
464
465 extra_type_iterate(pextra) {
466 if (requirement_needs_improvement(pimprove, &pextra->reqs)) {
467 city_tile_iterate(nmap, city_map_radius_sq_get(pcity),
468 city_tile(pcity), ptile) {
469 if (player_can_build_extra(pextra, city_owner(pcity), ptile)) {
470 return TRUE;
471 }
472 } city_tile_iterate_end;
473 }
474 } extra_type_iterate_end;
475
476 return FALSE;
477}
478
479/**********************************************************************/
482 static bool impr_prevents_disaster(const struct city *pcity,
483 const struct impr_type *pimprove)
484{
485 /* Fast check */
486 if (!pimprove->prevents_disaster) {
487 return FALSE;
488 }
489
490 disaster_type_iterate(pdis) {
491 if (!requirement_fulfilled_by_improvement(pimprove, &pdis->reqs)
492 && !can_disaster_happen(pdis, pcity)) {
493 return TRUE;
494 }
495 } disaster_type_iterate_end;
496
497 return FALSE;
498}
499
500/**********************************************************************/
506 static bool impr_protects_vs_actions(const struct city *pcity,
507 const struct impr_type *pimprove)
508{
509 /* Fast check */
510 if (!pimprove->protects_vs_actions) {
511 return FALSE;
512 }
513
514 action_enablers_iterate(enabler) {
515 if (!requirement_fulfilled_by_improvement(pimprove, &enabler->target_reqs)
516 && !is_action_possible_on_city(enabler_get_action_id(enabler),
517 NULL, pcity)) {
518 return TRUE;
519 }
520 } action_enablers_iterate_end;
521
522 return FALSE;
523}
524
525/**********************************************************************/
528 static bool impr_allows_actions(const struct city *pcity,
529 const struct impr_type *pimprove)
530{
531 /* Fast check */
532 if (!pimprove->allows_actions) {
533 return FALSE;
534 }
535
536 action_enablers_iterate(enabler) {
537 if (requirement_needs_improvement(pimprove, &enabler->actor_reqs)) {
538 action_id act = enabler_get_action_id(enabler);
539
540 switch (action_id_get_actor_kind(act)) {
541 case AAK_UNIT:
542 unit_type_iterate(ut) {
543 if (!utype_can_do_action(ut, act)) {
544 /* Not relevant */
545 continue;
546 }
547
548 if (utype_player_already_has_this(city_owner(pcity), ut)) {
549 /* The player has a unit that may use the building */
550 return TRUE;
551 }
552
553 if (can_city_build_unit_now(pcity, ut)) {
554 /* This city can build a unit that uses the building */
555 return TRUE;
556 }
557 } unit_type_iterate_end;
558 break;
559 case AAK_COUNT:
560 fc_assert(action_id_get_actor_kind(act) != AAK_COUNT);
561 break;
562 }
563 }
564 } action_enablers_iterate_end;
565
566 return FALSE;
567}
568
569/**********************************************************************/
579 static bool improvement_has_side_effects(const struct city *pcity,
580 const struct impr_type *pimprove)
581{
582 return (impr_provides_buildable_units(pcity, pimprove)
583 || impr_provides_buildable_extras(pcity, pimprove)
584 || impr_prevents_disaster(pcity, pimprove)
585 || impr_allows_actions(pcity, pimprove)
586 || impr_protects_vs_actions(pcity, pimprove));
587}
588
589/**********************************************************************/
592 static bool improvement_has_effects(const struct city *pcity,
593 const struct impr_type *pimprove)
594{
595 struct universal source = { .kind = VUT_IMPROVEMENT,
596 .value = { .building = pimprove } };
597 struct effect_list *plist = get_req_source_effects(&source);
598
599 if (!plist || improvement_obsolete(city_owner(pcity), pimprove, pcity)) {
600 return FALSE;
601 }
602
603 effect_list_iterate(plist, peffect) {
604 if (0 != get_potential_improvement_bonus(pimprove, pcity,
605 peffect->type, RPT_CERTAIN, TRUE)) {
606 return TRUE;
607 }
608 } effect_list_iterate_end;
609
610 return FALSE;
611}
612
613/**********************************************************************/
620 bool is_improvement_productive(const struct city *pcity,
621 const struct impr_type *pimprove)
622{
623 return (!improvement_obsolete(city_owner(pcity), pimprove, pcity)
624 && (improvement_has_flag(pimprove, IF_GOLD)
625 || improvement_has_side_effects(pcity, pimprove)
626 || improvement_has_effects(pcity, pimprove)));
627}
628
629/**********************************************************************/
641 bool is_improvement_redundant(const struct city *pcity,
642 const struct impr_type *pimprove)
643{
644 /* A capitalization production is never redundant. */
645 if (improvement_has_flag(pimprove, IF_GOLD)) {
646 return FALSE;
647 }
648
649 /* If an improvement has side effects, don't claim it's redundant. */
650 if (improvement_has_side_effects(pcity, pimprove)) {
651 return FALSE;
652 }
653
654 /* Otherwise, it's redundant if its effects are available by other means,
655 * or if it's an obsolete wonder (great or small). */
656 return is_building_replaced(pcity, pimprove, RPT_CERTAIN)
657 || improvement_obsolete(city_owner(pcity), pimprove, pcity);
658}
659
660/**********************************************************************/
664 bool can_player_build_improvement_direct(const struct player *p,
665 const struct impr_type *pimprove)
666{
667 const struct req_context context = { .player = p };
668
669 bool space_part = FALSE;
670
671 if (!valid_improvement(pimprove)) {
672 return FALSE;
673 }
674
675 requirement_vector_iterate(&pimprove->reqs, preq) {
676 if (preq->range >= REQ_RANGE_PLAYER
677 && !is_req_active(&context, NULL, preq, RPT_CERTAIN)) {
678 return FALSE;
679 }
680 } requirement_vector_iterate_end;
681
682 /* Check for space part construction. This assumes that space parts have
683 * no other effects. */
684 if (building_has_effect(pimprove, EFT_SS_STRUCTURAL)) {
685 space_part = TRUE;
686 if (p->spaceship.structurals >= NUM_SS_STRUCTURALS) {
687 return FALSE;
688 }
689 }
690 if (building_has_effect(pimprove, EFT_SS_COMPONENT)) {
691 space_part = TRUE;
692 if (p->spaceship.components >= NUM_SS_COMPONENTS) {
693 return FALSE;
694 }
695 }
696 if (building_has_effect(pimprove, EFT_SS_MODULE)) {
697 space_part = TRUE;
698 if (p->spaceship.modules >= NUM_SS_MODULES) {
699 return FALSE;
700 }
701 }
702 if (space_part
703 && (get_player_bonus(p, EFT_ENABLE_SPACE) <= 0
704 || p->spaceship.state >= SSHIP_LAUNCHED)) {
705 return FALSE;
706 }
707
708 if (is_great_wonder(pimprove)) {
709 /* Can't build wonder if already built */
710 if (!great_wonder_is_available(pimprove)) {
711 return FALSE;
712 }
713 }
714
715 return TRUE;
716}
717
718/**********************************************************************/
722 bool can_player_build_improvement_now(const struct player *p,
723 struct impr_type *pimprove)
724{
725 if (!can_player_build_improvement_direct(p, pimprove)) {
726 return FALSE;
727 }
728 if (improvement_obsolete(p, pimprove, NULL)) {
729 return FALSE;
730 }
731 return TRUE;
732}
733
734/**********************************************************************/
739 bool can_player_build_improvement_later(const struct player *p,
740 const struct impr_type *pimprove)
741{
742 const struct req_context context = { .player = p };
743
744 if (!valid_improvement(pimprove)) {
745 return FALSE;
746 }
747 if (improvement_obsolete(p, pimprove, NULL)) {
748 return FALSE;
749 }
750 if (is_great_wonder(pimprove) && !great_wonder_is_available(pimprove)) {
751 /* Can't build wonder if already built */
752 return FALSE;
753 }
754
755 /* Check for requirements that aren't met and that are unchanging (so
756 * they can never be met). */
757 requirement_vector_iterate(&pimprove->reqs, preq) {
758 if (preq->range >= REQ_RANGE_PLAYER
759 && is_req_preventing(&context, NULL, preq, RPT_POSSIBLE)) {
760 return FALSE;
761 }
762 } requirement_vector_iterate_end;
763 /* FIXME: should check some "unchanging" reqs here - like if there's
764 * a nation requirement, we can go ahead and check it now. */
765
766 return TRUE;
767}
768
769/**********************************************************************/
772 bool is_great_wonder(const struct impr_type *pimprove)
773{
774 return (pimprove->genus == IG_GREAT_WONDER);
775}
776
777/**********************************************************************/
780 bool is_small_wonder(const struct impr_type *pimprove)
781{
782 return (pimprove->genus == IG_SMALL_WONDER);
783}
784
785/**********************************************************************/
788 bool is_improvement(const struct impr_type *pimprove)
789{
790 return (pimprove->genus == IG_IMPROVEMENT);
791}
792
793/**********************************************************************/
797 bool is_special_improvement(const struct impr_type *pimprove)
798{
799 /* TODO: Find either a new term for traditional "special" improvements
800 * (maybe "project"?), or a new umbrella term for all improvements that
801 * can't be present in the city as a finished building (including special
802 * and convert improvements). */
803 return (pimprove->genus == IG_SPECIAL)
804 || is_convert_improvement(pimprove);
805}
806
807/**********************************************************************/
811 bool is_convert_improvement(const struct impr_type *pimprove)
812{
813 return (pimprove->genus == IG_CONVERT);
814}
815
816/**********************************************************************/
819 void wonder_built(const struct city *pcity, const struct impr_type *pimprove)
820{
821 struct player *pplayer;
822 int windex = improvement_number(pimprove);
823
824 fc_assert_ret(NULL != pcity);
825 fc_assert_ret(is_wonder(pimprove));
826
827 pplayer = city_owner(pcity);
828 pplayer->wonders[windex] = pcity->id;
829
830 if (is_great_wonder(pimprove)) {
831 game.info.great_wonder_owners[windex] = player_number(pplayer);
832 }
833}
834
835/**********************************************************************/
839 void wonder_destroyed(const struct city *pcity,
840 const struct impr_type *pimprove)
841{
842 struct player *pplayer;
843 int windex = improvement_number(pimprove);
844
845 fc_assert_ret(NULL != pcity);
846 fc_assert_ret(is_wonder(pimprove));
847
848 pplayer = city_owner(pcity);
849 fc_assert_ret(pplayer->wonders[windex] == pcity->id);
850 pplayer->wonders[windex] = WONDER_LOST;
851
852 if (is_great_wonder(pimprove)) {
853 fc_assert_ret(game.info.great_wonder_owners[windex]
854 == player_number(pplayer));
855 game.info.great_wonder_owners[windex] = WONDER_DESTROYED;
856 }
857}
858
859/**********************************************************************/
863 bool wonder_is_lost(const struct player *pplayer,
864 const struct impr_type *pimprove)
865{
866 fc_assert_ret_val(NULL != pplayer, FALSE);
867 fc_assert_ret_val(is_wonder(pimprove), FALSE);
868
869 return pplayer->wonders[improvement_index(pimprove)] == WONDER_LOST;
870}
871
872/**********************************************************************/
876 bool wonder_is_built(const struct player *pplayer,
877 const struct impr_type *pimprove)
878{
879 fc_assert_ret_val(NULL != pplayer, FALSE);
880 fc_assert_ret_val(is_wonder(pimprove), FALSE);
881
882 return WONDER_BUILT(pplayer->wonders[improvement_index(pimprove)]);
883}
884
885/**********************************************************************/
891 struct city *city_from_wonder(const struct player *pplayer,
892 const struct impr_type *pimprove)
893{
894 int idx = improvement_index(pimprove);
895 int city_id;
896
897 if (idx < 0) {
898 return NULL;
899 }
900
901 city_id = pplayer->wonders[idx];
902
903 fc_assert_ret_val(NULL != pplayer, NULL);
904 fc_assert_ret_val(is_wonder(pimprove), NULL);
905
906 if (!WONDER_BUILT(city_id)) {
907 return NULL;
908 }
909
910#ifdef FREECIV_DEBUG
911 if (is_server()) {
912 /* On client side, this info is not always known. */
913 struct city *pcity = player_city_by_number(pplayer, city_id);
914
915 if (NULL == pcity) {
916 log_error("Player %s (nb %d) has outdated wonder info for "
917 "%s (nb %d), it points to city nb %d.",
918 player_name(pplayer), player_number(pplayer),
919 improvement_rule_name(pimprove),
920 improvement_number(pimprove), city_id);
921 } else if (!city_has_building(pcity, pimprove)) {
922 log_error("Player %s (nb %d) has outdated wonder info for "
923 "%s (nb %d), the city %s (nb %d) doesn't have this wonder.",
924 player_name(pplayer), player_number(pplayer),
925 improvement_rule_name(pimprove),
926 improvement_number(pimprove), city_name_get(pcity), pcity->id);
927 return NULL;
928 }
929
930 return pcity;
931 }
932#endif /* FREECIV_DEBUG */
933
934 return player_city_by_number(pplayer, city_id);
935}
936
937/**********************************************************************/
944 bool wonder_visible_to_player(const struct impr_type *wonder,
945 const struct player *pplayer,
946 const struct player *owner,
947 enum fc_tristate embassy)
948{
949 if (pplayer == owner) {
950 /* Can see all own wonders,
951 * even improvements if that matters. */
952 return TRUE;
953 }
954
955 if (is_great_wonder(wonder)) {
956 return TRUE;
957 }
958
959 if (is_small_wonder(wonder)) {
960 switch (game.info.small_wonder_visibility) {
961 case WV_ALWAYS:
962 return TRUE;
963 case WV_NEVER:
964 return FALSE;
965 case WV_EMBASSY:
966 return embassy == TRI_YES
967 || (embassy == TRI_MAYBE && team_has_embassy(pplayer->team, owner));
968 }
969
970 fc_assert(FALSE);
971
972 return FALSE;
973 }
974
975 /* Now a wonder, but regular improvement */
976 return FALSE;
977}
978
979/**********************************************************************/
982 bool great_wonder_is_built(const struct impr_type *pimprove)
983{
984 fc_assert_ret_val(is_great_wonder(pimprove), FALSE);
985
986 return WONDER_OWNED(game.info.great_wonder_owners
987 [improvement_index(pimprove)]);
988}
989
990/**********************************************************************/
993 bool great_wonder_is_destroyed(const struct impr_type *pimprove)
994{
995 fc_assert_ret_val(is_great_wonder(pimprove), FALSE);
996
997 return (WONDER_DESTROYED
998 == game.info.great_wonder_owners[improvement_index(pimprove)]);
999}
1000
1001/**********************************************************************/
1004 bool great_wonder_is_available(const struct impr_type *pimprove)
1005{
1006 fc_assert_ret_val(is_great_wonder(pimprove), FALSE);
1007
1008 return (WONDER_NOT_OWNED
1009 == game.info.great_wonder_owners[improvement_index(pimprove)]);
1010}
1011
1012/**********************************************************************/
1016 struct city *city_from_great_wonder(const struct impr_type *pimprove)
1017{
1018 int player_id = game.info.great_wonder_owners[improvement_index(pimprove)];
1019
1020 fc_assert_ret_val(is_great_wonder(pimprove), NULL);
1021
1022 if (WONDER_OWNED(player_id)) {
1023#ifdef FREECIV_DEBUG
1024 const struct player *pplayer = player_by_number(player_id);
1025 struct city *pcity = city_from_wonder(pplayer, pimprove);
1026
1027 if (is_server() && NULL == pcity) {
1028 log_error("Game has outdated wonder info for %s (nb %d), "
1029 "the player %s (nb %d) doesn't have this wonder.",
1030 improvement_rule_name(pimprove),
1031 improvement_number(pimprove),
1032 player_name(pplayer), player_number(pplayer));
1033 }
1034
1035 return pcity;
1036#else
1037 return city_from_wonder(player_by_number(player_id), pimprove);
1038#endif /* FREECIV_DEBUG */
1039 } else {
1040 return NULL;
1041 }
1042}
1043
1044/**********************************************************************/
1048 struct player *great_wonder_owner(const struct impr_type *pimprove)
1049{
1050 int player_id = game.info.great_wonder_owners[improvement_index(pimprove)];
1051
1052 fc_assert_ret_val(is_great_wonder(pimprove), NULL);
1053
1054 if (WONDER_OWNED(player_id)) {
1055 return player_by_number(player_id);
1056 } else {
1057 return NULL;
1058 }
1059}
1060
1061/**********************************************************************/
1064 bool small_wonder_is_built(const struct player *pplayer,
1065 const struct impr_type *pimprove)
1066{
1067 fc_assert_ret_val(is_small_wonder(pimprove), FALSE);
1068
1069 return (NULL != pplayer
1070 && wonder_is_built(pplayer, pimprove));
1071}
1072
1073/**********************************************************************/
1076 struct city *city_from_small_wonder(const struct player *pplayer,
1077 const struct impr_type *pimprove)
1078{
1079 fc_assert_ret_val(is_small_wonder(pimprove), NULL);
1080
1081 if (NULL == pplayer) {
1082 return NULL; /* Used in some places in the client. */
1083 } else {
1084 return city_from_wonder(pplayer, pimprove);
1085 }
1086}
1087
1088/**********************************************************************/
1091 bool can_sell_building(const struct impr_type *pimprove)
1092{
1093 return (valid_improvement(pimprove)
1094 && is_building_sellable(pimprove));
1095}
1096
1097/**********************************************************************/
1100 bool can_city_sell_building(const struct city *pcity,
1101 const struct impr_type *pimprove)
1102{
1103 return (city_has_building(pcity, pimprove)
1104 && is_building_sellable(pimprove));
1105}
1106
1107/**********************************************************************/
1110 bool is_building_sellable(const struct impr_type *pimprove)
1111{
1112 return is_improvement(pimprove);
1113}
1114
1115/**********************************************************************/
1120 enum test_result test_player_sell_building_now(struct player *pplayer,
1121 struct city *pcity,
1122 const struct impr_type *pimprove)
1123{
1124 /* Check if player can sell anything from this city */
1125 if (pcity->owner != pplayer) {
1126 return TR_OTHER_FAILURE;
1127 }
1128
1129 if (pcity->did_sell) {
1130 return TR_ALREADY_SOLD;
1131 }
1132
1133 /* Check if particular building can be solt */
1134 if (pimprove != NULL
1135 && !can_city_sell_building(pcity, pimprove)) {
1136 return TR_OTHER_FAILURE;
1137 }
1138
1139 return TR_SUCCESS;
1140}
1141
1142/**********************************************************************/
1146 const struct impr_type *improvement_replacement(const struct impr_type *pimprove)
1147{
1148 requirement_vector_iterate(&pimprove->obsolete_by, pobs) {
1149 if (pobs->source.kind == VUT_IMPROVEMENT && pobs->present) {
1150 return pobs->source.value.building;
1151 }
1152 } requirement_vector_iterate_end;
1153
1154 return NULL;
1155}
1156
1157/************************************************************************/
1160 void user_impr_flags_init(void)
1161{
1162 int i;
1163
1164 for (i = 0; i < MAX_NUM_USER_BUILDING_FLAGS; i++) {
1165 user_flag_init(&user_impr_flags[i]);
1166 }
1167}
1168
1169/************************************************************************/
1172 void impr_flags_free(void)
1173{
1174 int i;
1175
1176 for (i = 0; i < MAX_NUM_USER_BUILDING_FLAGS; i++) {
1177 user_flag_free(&user_impr_flags[i]);
1178 }
1179}
1180
1181/************************************************************************/
1184 void set_user_impr_flag_name(enum impr_flag_id id, const char *name,
1185 const char *helptxt)
1186{
1187 int bfid = id - IF_USER_FLAG_1;
1188
1189 fc_assert_ret(id >= IF_USER_FLAG_1 && id <= IF_LAST_USER_FLAG);
1190
1191 if (user_impr_flags[bfid].name != NULL) {
1192 FC_FREE(user_impr_flags[bfid].name);
1193 user_impr_flags[bfid].name = NULL;
1194 }
1195
1196 if (name && name[0] != '\0') {
1197 user_impr_flags[bfid].name = fc_strdup(name);
1198 }
1199
1200 if (user_impr_flags[bfid].helptxt != NULL) {
1201 free(user_impr_flags[bfid].helptxt);
1202 user_impr_flags[bfid].helptxt = NULL;
1203 }
1204
1205 if (helptxt && helptxt[0] != '\0') {
1206 user_impr_flags[bfid].helptxt = fc_strdup(helptxt);
1207 }
1208}
1209
1210/************************************************************************/
1213 const char *impr_flag_id_name_cb(enum impr_flag_id flag)
1214{
1215 if (flag < IF_USER_FLAG_1 || flag > IF_LAST_USER_FLAG) {
1216 return NULL;
1217 }
1218
1219 return user_impr_flags[flag - IF_USER_FLAG_1].name;
1220}
1221
1222/************************************************************************/
1225 const char *impr_flag_helptxt(enum impr_flag_id id)
1226{
1227 fc_assert(id >= IF_USER_FLAG_1 && id <= IF_LAST_USER_FLAG);
1228
1229 return user_impr_flags[id - IF_USER_FLAG_1].helptxt;
1230}
is_action_possible_on_city
bool is_action_possible_on_city(action_id act_id, const struct player *actor_player, const struct city *target_city)
Definition actions.c:5444
action_enablers_iterate_end
#define action_enablers_iterate_end
Definition actions.h:274
enabler_get_action_id
#define enabler_get_action_id(_enabler_)
Definition actions.h:178
action_id_get_actor_kind
#define action_id_get_actor_kind(act_id)
Definition actions.h:403
action_enablers_iterate
#define action_enablers_iterate(_enabler_)
Definition actions.h:268
BV_ISSET
#define BV_ISSET(bv, bit)
Definition bitvector.h:78
city_has_building
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1236
city_name_get
const char * city_name_get(const struct city *pcity)
Definition city.c:1133
city_map_radius_sq_get
int city_map_radius_sq_get(const struct city *pcity)
Definition city.c:137
can_city_build_unit_now
bool can_city_build_unit_now(const struct city *pcity, const struct unit_type *punittype)
Definition city.c:948
city_tile
#define city_tile(_pcity_)
Definition city.h:564
city_owner
#define city_owner(_pcity_)
Definition city.h:563
city_tile_iterate
#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile)
Definition city.h:230
city_tile_iterate_end
#define city_tile_iterate_end
Definition city.h:238
incite_cost
char * incite_cost
Definition comments.c:74
base
static void base(QVariant data1, QVariant data2)
Definition dialogs.cpp:2938
cost
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 cost
Definition dialogs_g.h:74
can_disaster_happen
bool can_disaster_happen(const struct disaster_type *pdis, const struct city *pcity)
Definition disaster.c:139
disaster_type_iterate
#define disaster_type_iterate(_p)
Definition disaster.h:82
disaster_type_iterate_end
#define disaster_type_iterate_end
Definition disaster.h:88
id
int int id
Definition editgui_g.h:28
is_building_replaced
bool is_building_replaced(const struct city *pcity, const struct impr_type *pimprove, const enum req_problem_type prob_type)
Definition effects.c:693
get_potential_improvement_bonus
int get_potential_improvement_bonus(const struct impr_type *pimprove, const struct city *pcity, enum effect_type effect_type, const enum req_problem_type prob_type, bool consider_multipliers)
Definition effects.c:1202
get_building_bonus
int get_building_bonus(const struct city *pcity, const struct impr_type *building, enum effect_type effect_type)
Definition effects.c:1004
get_target_bonus_effects
int get_target_bonus_effects(struct effect_list *plist, const struct req_context *context, const struct req_context *other_context, enum effect_type effect_type)
Definition effects.c:744
get_req_source_effects
struct effect_list * get_req_source_effects(const struct universal *psource)
Definition effects.c:153
building_has_effect
bool building_has_effect(const struct impr_type *pimprove, enum effect_type effect_type)
Definition effects.c:639
get_player_bonus
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Definition effects.c:824
effect_list_iterate_end
#define effect_list_iterate_end
Definition effects.h:81
effect_list_iterate
#define effect_list_iterate(effect_list, peffect)
Definition effects.h:79
player_can_build_extra
bool player_can_build_extra(const struct extra_type *pextra, const struct player *pplayer, const struct tile *ptile)
Definition extras.c:468
extra_type_iterate
#define extra_type_iterate(_p)
Definition extras.h:315
extra_type_iterate_end
#define extra_type_iterate_end
Definition extras.h:321
is_server
static bool is_server(void)
Definition fc_interface.h:69
MAX_NUM_USER_BUILDING_FLAGS
#define MAX_NUM_USER_BUILDING_FLAGS
Definition fc_types.h:655
Impr_type_id
int Impr_type_id
Definition fc_types.h:380
RPT_CERTAIN
@ RPT_CERTAIN
Definition fc_types.h:678
RPT_POSSIBLE
@ RPT_POSSIBLE
Definition fc_types.h:677
action_id
int action_id
Definition fc_types.h:393
test_result
test_result
Definition fc_types.h:1225
TR_ALREADY_SOLD
@ TR_ALREADY_SOLD
Definition fc_types.h:1228
TR_OTHER_FAILURE
@ TR_OTHER_FAILURE
Definition fc_types.h:1227
TR_SUCCESS
@ TR_SUCCESS
Definition fc_types.h:1226
IF_LAST_USER_FLAG
#define IF_LAST_USER_FLAG
Definition fc_types.h:654
VC_SPACERACE
@ VC_SPACERACE
Definition fc_types.h:1251
fcintl.h
Qn_
#define Qn_(String)
Definition fcintl.h:89
user_flag_init
void user_flag_init(struct user_flag *flag)
Definition game.c:827
user_flag_free
void user_flag_free(struct user_flag *flag)
Definition game.c:836
game
struct civ_game game
Definition game.c:61
wld
struct world wld
Definition game.c:62
game.h
owner
struct city * owner
Definition citydlg.c:226
source
static GtkWidget * source
Definition gotodlg.c:58
valid_improvement
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
Definition improvement.c:211
improvement_by_number
struct impr_type * improvement_by_number(const Impr_type_id id)
Definition improvement.c:194
can_sell_building
bool can_sell_building(const struct impr_type *pimprove)
Definition improvement.c:1091
impr_sell_gold
int impr_sell_gold(const struct impr_type *pimprove)
Definition improvement.c:334
improvements_init
void improvements_init(void)
Definition improvement.c:48
is_building_sellable
bool is_building_sellable(const struct impr_type *pimprove)
Definition improvement.c:1110
improvement_array_last
const struct impr_type * improvement_array_last(void)
Definition improvement.c:153
valid_improvement_by_number
const struct impr_type * valid_improvement_by_number(const Impr_type_id id)
Definition improvement.c:234
can_city_sell_building
bool can_city_sell_building(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:1100
can_player_build_improvement_direct
bool can_player_build_improvement_direct(const struct player *p, const struct impr_type *pimprove)
Definition improvement.c:664
great_wonder_is_built
bool great_wonder_is_built(const struct impr_type *pimprove)
Definition improvement.c:982
improvement_has_side_effects
static bool improvement_has_side_effects(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:579
test_player_sell_building_now
enum test_result test_player_sell_building_now(struct player *pplayer, struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:1120
user_impr_flags_init
void user_impr_flags_init(void)
Definition improvement.c:1160
is_special_improvement
bool is_special_improvement(const struct impr_type *pimprove)
Definition improvement.c:797
impr_prevents_disaster
static bool impr_prevents_disaster(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:482
is_improvement_redundant
bool is_improvement_redundant(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:641
can_player_build_improvement_later
bool can_player_build_improvement_later(const struct player *p, const struct impr_type *pimprove)
Definition improvement.c:739
wonder_built
void wonder_built(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:819
great_wonder_is_destroyed
bool great_wonder_is_destroyed(const struct impr_type *pimprove)
Definition improvement.c:993
wonder_is_lost
bool wonder_is_lost(const struct player *pplayer, const struct impr_type *pimprove)
Definition improvement.c:863
can_player_build_improvement_now
bool can_player_build_improvement_now(const struct player *p, struct impr_type *pimprove)
Definition improvement.c:722
is_improvement
bool is_improvement(const struct impr_type *pimprove)
Definition improvement.c:788
improvement_has_effects
static bool improvement_has_effects(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:592
wonder_is_built
bool wonder_is_built(const struct player *pplayer, const struct impr_type *pimprove)
Definition improvement.c:876
impr_base_build_shield_cost
int impr_base_build_shield_cost(const struct impr_type *pimprove)
Definition improvement.c:261
improvement_number
Impr_type_id improvement_number(const struct impr_type *pimprove)
Definition improvement.c:184
impr_provides_buildable_extras
static bool impr_provides_buildable_extras(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:455
small_wonder_is_built
bool small_wonder_is_built(const struct player *pplayer, const struct impr_type *pimprove)
Definition improvement.c:1064
can_improvement_go_obsolete
bool can_improvement_go_obsolete(const struct impr_type *pimprove)
Definition improvement.c:403
impr_flag_id_name_cb
const char * impr_flag_id_name_cb(enum impr_flag_id flag)
Definition improvement.c:1213
improvement_rule_name
const char * improvement_rule_name(const struct impr_type *pimprove)
Definition improvement.c:252
is_improvement_visible
bool is_improvement_visible(const struct impr_type *pimprove)
Definition improvement.c:393
city_from_wonder
struct city * city_from_wonder(const struct player *pplayer, const struct impr_type *pimprove)
Definition improvement.c:891
improvement_index
Impr_type_id improvement_index(const struct impr_type *pimprove)
Definition improvement.c:175
impr_buy_gold_cost
int impr_buy_gold_cost(const struct city *pcity, const struct impr_type *pimprove, int shields_in_stock)
Definition improvement.c:306
impr_build_shield_cost
int impr_build_shield_cost(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:294
improvement_free
static void improvement_free(struct impr_type *p)
Definition improvement.c:68
is_wonder
bool is_wonder(const struct impr_type *pimprove)
Definition improvement.c:343
impr_protects_vs_actions
static bool impr_protects_vs_actions(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:506
is_great_wonder
bool is_great_wonder(const struct impr_type *pimprove)
Definition improvement.c:772
improvement_obsolete
bool improvement_obsolete(const struct player *pplayer, const struct impr_type *pimprove, const struct city *pcity)
Definition improvement.c:411
impr_allows_actions
static bool impr_allows_actions(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:528
improvement_by_translated_name
struct impr_type * improvement_by_translated_name(const char *name)
Definition improvement.c:352
improvement_feature_cache_init
void improvement_feature_cache_init(void)
Definition improvement.c:92
improvement_has_flag
bool improvement_has_flag(const struct impr_type *pimprove, enum impr_flag_id flag)
Definition improvement.c:383
improvement_by_rule_name
struct impr_type * improvement_by_rule_name(const char *name)
Definition improvement.c:367
city_from_small_wonder
struct city * city_from_small_wonder(const struct player *pplayer, const struct impr_type *pimprove)
Definition improvement.c:1076
wonder_destroyed
void wonder_destroyed(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:839
set_user_impr_flag_name
void set_user_impr_flag_name(enum impr_flag_id id, const char *name, const char *helptxt)
Definition improvement.c:1184
is_convert_improvement
bool is_convert_improvement(const struct impr_type *pimprove)
Definition improvement.c:811
impr_flags_free
void impr_flags_free(void)
Definition improvement.c:1172
improvement_types
static struct impr_type improvement_types[B_LAST]
Definition improvement.c:41
wonder_visible_to_player
bool wonder_visible_to_player(const struct impr_type *wonder, const struct player *pplayer, const struct player *owner, enum fc_tristate embassy)
Definition improvement.c:944
impr_flag_helptxt
const char * impr_flag_helptxt(enum impr_flag_id id)
Definition improvement.c:1225
improvement_name_translation
const char * improvement_name_translation(const struct impr_type *pimprove)
Definition improvement.c:243
city_from_great_wonder
struct city * city_from_great_wonder(const struct impr_type *pimprove)
Definition improvement.c:1016
improvement_count
Impr_type_id improvement_count(void)
Definition improvement.c:164
impr_provides_buildable_units
static bool impr_provides_buildable_units(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:434
is_small_wonder
bool is_small_wonder(const struct impr_type *pimprove)
Definition improvement.c:780
improvement_array_first
struct impr_type * improvement_array_first(void)
Definition improvement.c:142
impr_estimate_build_shield_cost
int impr_estimate_build_shield_cost(const struct player *pplayer, const struct tile *ptile, const struct impr_type *pimprove)
Definition improvement.c:273
improvement_replacement
const struct impr_type * improvement_replacement(const struct impr_type *pimprove)
Definition improvement.c:1146
great_wonder_owner
struct player * great_wonder_owner(const struct impr_type *pimprove)
Definition improvement.c:1048
great_wonder_is_available
bool great_wonder_is_available(const struct impr_type *pimprove)
Definition improvement.c:1004
improvements_free
void improvements_free(void)
Definition improvement.c:82
is_improvement_productive
bool is_improvement_productive(const struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:620
user_impr_flags
static struct user_flag user_impr_flags[MAX_NUM_USER_BUILDING_FLAGS]
Definition improvement.c:43
improvement.h
WONDER_NOT_OWNED
#define WONDER_NOT_OWNED
Definition improvement.h:140
WONDER_BUILT
#define WONDER_BUILT(city_id)
Definition improvement.h:146
improvement_iterate_end
#define improvement_iterate_end
Definition improvement.h:205
WONDER_DESTROYED
#define WONDER_DESTROYED
Definition improvement.h:139
improvement_iterate
#define improvement_iterate(_p)
Definition improvement.h:199
WONDER_LOST
#define WONDER_LOST
Definition improvement.h:144
B_LAST
#define B_LAST
Definition improvement.h:42
WONDER_OWNED
#define WONDER_OWNED(player_id)
Definition improvement.h:141
name
const char * name
Definition inputfile.c:127
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
#define log_error(message,...)
Definition log.h:103
map.h
mem.h
FC_FREE
#define FC_FREE(ptr)
Definition mem.h:41
fc_strdup
#define fc_strdup(str)
Definition mem.h:43
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
player_by_number
struct player * player_by_number(const int player_id)
Definition player.c:849
player_number
int player_number(const struct player *pplayer)
Definition player.c:837
player_name
const char * player_name(const struct player *pplayer)
Definition player.c:895
team_has_embassy
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
Definition player.c:220
player_city_by_number
struct city * player_city_by_number(const struct player *pplayer, int city_id)
Definition player.c:1203
is_req_active
bool is_req_active(const struct req_context *context, const struct req_context *other_context, const struct requirement *req, const enum req_problem_type prob_type)
Definition requirements.c:5711
is_req_preventing
enum req_unchanging_status is_req_preventing(const struct req_context *context, const struct req_context *other_context, const struct requirement *req, enum req_problem_type prob_type)
Definition requirements.c:6098
requirement_fulfilled_by_improvement
#define requirement_fulfilled_by_improvement(_imp_, _rqs_)
Definition requirements.h:415
requirement_vector_iterate_end
#define requirement_vector_iterate_end
Definition requirements.h:94
requirement_vector_iterate
#define requirement_vector_iterate(req_vec, preq)
Definition requirements.h:92
requirement_needs_improvement
#define requirement_needs_improvement(_imp_, _rqs_)
Definition requirements.h:439
shared.h
fc_tristate
fc_tristate
Definition shared.h:46
TRI_YES
@ TRI_YES
Definition shared.h:46
TRI_MAYBE
@ TRI_MAYBE
Definition shared.h:46
ARRAY_SIZE
#define ARRAY_SIZE(x)
Definition shared.h:85
MAX
#define MAX(x, y)
Definition shared.h:54
NUM_SS_MODULES
#define NUM_SS_MODULES
Definition spaceship.h:89
NUM_SS_COMPONENTS
#define NUM_SS_COMPONENTS
Definition spaceship.h:88
NUM_SS_STRUCTURALS
#define NUM_SS_STRUCTURALS
Definition spaceship.h:87
SSHIP_LAUNCHED
@ SSHIP_LAUNCHED
Definition spaceship.h:85
strvec_destroy
void strvec_destroy(struct strvec *psv)
Definition string_vector.c:72
string_vector.h
city
Definition city.h:320
city::did_sell
bool did_sell
Definition city.h:380
city::id
int id
Definition city.h:326
city::owner
struct player * owner
Definition city.h:323
city::tile
struct tile * tile
Definition city.h:322
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_map
Definition map_types.h:71
impr_type
Definition improvement.h:50
impr_type::allows_actions
bool allows_actions
Definition improvement.h:75
impr_type::build_cost
int build_cost
Definition improvement.h:60
impr_type::genus
enum impr_genus_id genus
Definition improvement.h:63
impr_type::ruledit_disabled
bool ruledit_disabled
Definition improvement.h:53
impr_type::protects_vs_actions
bool protects_vs_actions
Definition improvement.h:74
impr_type::obsolete_by
struct requirement_vector obsolete_by
Definition improvement.h:59
impr_type::item_number
Impr_type_id item_number
Definition improvement.h:51
impr_type::prevents_disaster
bool prevents_disaster
Definition improvement.h:73
impr_type::reqs
struct requirement_vector reqs
Definition improvement.h:58
impr_type::allows_extras
bool allows_extras
Definition improvement.h:72
impr_type::helptext
struct strvec * helptext
Definition improvement.h:65
impr_type::allows_units
bool allows_units
Definition improvement.h:71
impr_type::name
struct name_translation name
Definition improvement.h:52
impr_type::flags
bv_impr_flags flags
Definition improvement.h:64
impr_type::ruledit_dlg
void * ruledit_dlg
Definition improvement.h:54
packet_game_info::shieldbox
int shieldbox
Definition packets_gen.h:225
packet_game_info::great_wonder_owners
int great_wonder_owners[B_LAST]
Definition packets_gen.h:179
packet_game_info::small_wonder_visibility
enum wonder_visib_type small_wonder_visibility
Definition packets_gen.h:255
packet_ruleset_control::num_impr_types
int num_impr_types
Definition packets_gen.h:1439
player_spaceship::modules
int modules
Definition spaceship.h:98
player_spaceship::components
int components
Definition spaceship.h:97
player_spaceship::state
enum spaceship_state state
Definition spaceship.h:108
player_spaceship::structurals
int structurals
Definition spaceship.h:96
player
Definition player.h:249
player::wonders
int wonders[B_LAST]
Definition player.h:305
player::team
struct team * team
Definition player.h:261
player::spaceship
struct player_spaceship spaceship
Definition player.h:286
req_context
Definition requirements.h:100
req_context::player
const struct player * player
Definition requirements.h:101
tile
Definition tile.h:50
universal
Definition fc_types.h:878
universal::kind
enum universals_n kind
Definition fc_types.h:880
user_flag
Definition game.h:73
user_flag::name
char * name
Definition game.h:74
user_flag::helptxt
char * helptxt
Definition game.h:75
world::map
struct civ_map map
Definition world_object.h:38
fc_strcasecmp
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:186
support.h
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
tech.h
utype_player_already_has_this
bool utype_player_already_has_this(const struct player *pplayer, const struct unit_type *putype)
Definition unittype.c:1941
utype_can_do_action
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:371
unit_type_iterate
#define unit_type_iterate(_p)
Definition unittype.h:859
unit_type_iterate_end
#define unit_type_iterate_end
Definition unittype.h:866
victory_enabled
bool victory_enabled(enum victory_condition_type victory)
Definition victory.c:26
victory.h