Freeciv-3.3
Loading...
Searching...
No Matches
daieffects.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2002 - The Freeciv Project
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* common */
19#include "city.h"
20#include "effects.h"
21#include "game.h"
22#include "government.h"
23#include "map.h"
24#include "movement.h"
25#include "multipliers.h"
26#include "player.h"
27#include "research.h"
28#include "specialist.h"
29#include "traderoutes.h"
30#include "victory.h"
31
32/* server */
33#include "plrhand.h"
34
35/* server/advisors */
36#include "advdata.h"
37#include "advtools.h"
38
39/* ai */
40#include "aitraits.h"
41#include "handicaps.h"
42
43
44#include "daieffects.h"
45
46/**********************************************************************/
60static int get_entertainers(const struct city *pcity)
61{
62 int providers = 0;
63
66 providers += pcity->specialists[i];
67 }
69
70 return providers;
71}
72
73/**********************************************************************/
78 const struct city *pcity,
79 int amount,
80 int num_cities,
82{
83 adv_want v = 0;
84
86 int i;
88
89 /* See if some step of happiness calculation gets capped */
90 for (i = happiness_step; i < FEELING_FINAL; i++) {
92 }
93
95 }
96
97 if (num_cities > 1) {
98 int factor = 2;
99
100 /* Try to build wonders to offset empire size unhappiness */
101 if (city_list_size(pplayer->cities)
103 if (get_player_bonus(pplayer, EFT_EMPIRE_SIZE_BASE) > 0) {
105
106 factor += city_list_size(pplayer->cities)
107 / MAX(step_bonus, 1);
108 }
109 factor += 2;
110 }
111 v += factor * num_cities * amount;
112 }
113
114 return v;
115}
116
117/**********************************************************************/
120static int num_affected_units(const struct effect *peffect,
121 const struct adv_data *ai)
122{
123 int unit_count = 0;
124
127 unit_count += ai->stats.units.byclass[uclass_index(pclass)];
128 }
130
131 return unit_count;
132}
133
134/**********************************************************************/
139 const struct adv_data *adv, const struct city *pcity,
140 const bool capital, int turns,
141 const struct effect *peffect, const int c,
142 const int nplayers)
143{
144 int amount = peffect->value;
147 int num;
148 int trait;
149 adv_want v = 0;
150 enum effect_type value_as;
151
152 if (peffect->multiplier) {
153 if (pplayer) {
154 amount = (player_multiplier_effect_value(pplayer, peffect->multiplier)
155 * amount) / 100;
156 } else {
157 amount = 0;
158 }
159 }
160
161 if (amount == 0) {
162 /* We could prune such effects in ruleset loading already,
163 * but we allow people tuning their rulesets to temporarily disable
164 * the effect by setting value to 0 without need to completely
165 * remove the effect.
166 * Shortcutting these effects here is not only for performance,
167 * more importantly it makes sure code below assuming amount to
168 * be positive does not assign positive value. */
169 return 0;
170 }
171
173
174 switch (value_as) {
175 /* These effects have already been evaluated in base_want() */
176 case EFT_CAPITAL_CITY:
177 case EFT_GOV_CENTER:
178 case EFT_UPKEEP_FREE:
184 case EFT_OUTPUT_BONUS:
190 case EFT_OUTPUT_WASTE:
199 case EFT_MINING_PCT:
201 break;
202
205 /* Wild guess. "Amount" is the number of tiles (on average) that
206 * will be revealed by the effect. Note that with an omniscient
207 * AI this effect is actually not useful at all. */
208 v += c * amount;
209 break;
210
211 case EFT_TURN_YEARS:
214 /* AI doesn't care about these. */
215 break;
216
217 /* WAG evaluated effects */
219 v += c * amount / 100;
220 break;
221 case EFT_MAKE_HAPPY:
223 if (city_list_size(pplayer->cities)
225 v += c * amount; /* Offset large empire size */
226 }
227 v += c * amount;
228 break;
229 case EFT_UNIT_RECOVER:
230 /* TODO */
231 break;
232 case EFT_NO_UNHAPPY:
234 break;
237 break;
238 case EFT_MAKE_CONTENT:
240 break;
244 amount) * 25;
245 v += MIN(amount, 5) * c;
246 }
247 break;
251 * MAX(unit_list_size(pcity->units_supported), 0) * 2;
252 v += c * MAX(amount + 2, 1);
253 }
254 break;
256 amount = (amount * research_count()) / 100;
259 {
260 int bulbs;
261 int value;
262
263 if (nplayers <= amount) {
264 break;
265 }
266
267 bulbs = 0;
269 if (aplayer != pplayer
271 || !players_on_same_team(aplayer, pplayer))) {
272 bulbs += (aplayer->server.bulbs_last_turn
273 + city_list_size(aplayer->cities) + 1);
274 }
276
277 /* For some number of turns we will be receiving bulbs for free
278 * Bulbs should be amortized properly for each turn.
279 * We use formula for the sum of geometric series:
280 */
281 value = bulbs * (1.0 - pow(1.0 - (1.0 / MORT), turns)) * MORT;
282
283 value = value * (100 - game.server.freecost)
284 * (nplayers - amount) / (nplayers * amount * 100);
285
286 /* WAG */
287 value /= 3;
288
289 v += value;
290 break;
291 }
293 /* Compare to EFT_GIVE_IMM_TECH which gives game.info.sciencebox * num_techs */
294 v += game.info.sciencebox * (100 - game.server.conquercost) / 200
295 * amount / 100;
296 break;
297 case EFT_GROWTH_FOOD:
298 /* FIXME: As total value is clipped 0 ... 100, single
299 * effect should have no value at all in some cases. */
300 v += c * 4 + (amount / 10) * MAX(pcity->surplus[O_FOOD], 0);
301 break;
302 case EFT_SHRINK_FOOD:
303 v += c * 4 + (amount / 15) * MAX(-pcity->surplus[O_FOOD], 1);
304 break;
305 case EFT_POPCOST_FREE:
306 v += amount * city_granary_size(pcity->size) / 10;
307 break;
308 case EFT_HEALTH_PCT:
309 /* Is plague possible */
310 if (game.info.illness_on) {
311 v += c * 5 + (amount / 5) * pcity->server.illness;
312 }
313 break;
314 case EFT_AIRLIFT:
315 /* FIXME: We need some smart algorithm here. The below is
316 * totally braindead. */
317 v += c + MIN(adv->stats.units.airliftable, 13);
318 break;
320 if (!can_change_to_government(pplayer, adv->goal.govt.gov)) {
321 v += MIN(MIN(adv->goal.govt.val, 65),
323 adv->goal.govt.req) * 10);
324 }
325 break;
326 case EFT_ENABLE_NUKE:
327 /* Treat nuke as a Cruise Missile upgrade */
328 v += 20 + adv->stats.units.suicide_attackers * 5;
329 break;
330 case EFT_ENABLE_SPACE:
332 v += 10;
333 if (adv->dipl.production_leader == pplayer
334 || adv->dipl.tech_leader == pplayer) {
335 v += 150;
336 }
337 }
338 break;
339 case EFT_VICTORY:
340 v += 250;
341 break;
343 if (adv_wants_science(pplayer)) {
344 v += amount * (game.info.sciencebox + 1);
345 }
346 break;
348 {
349 int new_contacts = 0;
350
352 if (player_diplstate_get(pplayer, theother)->contact_turns_left <= 0) {
353 new_contacts++;
354 }
356
357 v += 30 * new_contacts;
358 }
359 break;
361 v += 2 * nplayers;
362 break;
364 case EFT_NO_ANARCHY:
365 break; /* Useless for AI */
366 case EFT_NUKE_PROOF:
367 if (adv->threats.nuclear) {
369 * (capital + 1) * amount / 100;
370 }
371 break;
372 case EFT_REVEAL_MAP:
373 if (!adv->explore.land_done || !adv->explore.sea_done) {
374 v += 10;
375 }
376 break;
377 case EFT_UNIT_SLOTS:
378 v += 8 * c;
379 break;
380 case EFT_SIZE_UNLIMIT:
381 /* Note we look up the SIZE_UNLIMIT again right below. This could
382 * be avoided... */
383 if (amount > 0) {
385 amount = 20; /* really big city */
386 }
387 } else {
388 /* Effect trying to remove unlimit. */
389 v -= 30 * c * adv->food_priority;
390 break;
391 }
392 fc__fallthrough; /* there not being a break here is deliberate, mind you */
393 case EFT_SIZE_ADJ:
396 int extra_food = pcity->surplus[O_FOOD];
397
398 if (city_granary_size(city_size_get(pcity)) == pcity->food_stock) {
399 /* The idea being that if we have a full granary, we have an
400 * automatic surplus of our granary excess in addition to anything
401 * collected by city workers. */
402 extra_food += pcity->food_stock -
404 }
405
406 if (amount > 0 && !city_can_grow_to(pcity, city_size_get(pcity) + 1)) {
407 v += extra_food * adv->food_priority * amount;
409 v += 30 * extra_food;
410 }
411 }
412 v += c * amount * 4 / aqueduct_size;
413 }
414 break;
416 case EFT_SS_COMPONENT:
417 case EFT_SS_MODULE:
419 /* If someone has started building spaceship already or
420 * we have chance to win a spacerace */
421 && (adv->dipl.spacerace_leader
422 || adv->dipl.production_leader == pplayer
423 || adv->dipl.tech_leader == pplayer)) {
424 int space_want;
425
426 if (pcity->id == adv->wonder_city) {
427 /* adjust_improvement_wants_by_effects() lowers want for any non-wonder
428 * target on wonder city. We want space part want reduced even more than
429 * regular buildings, as buildings are at least helping the specific city
430 * when finished. */
431 space_want = 120;
432 } else {
433 space_want = 210;
434 }
435
436 if (pplayer->spaceship.state == SSHIP_STARTED) {
437 /* We are already running. Let's not make it a half-hearted attempt. */
438 space_want *= 3;
439 }
440
441 v += space_want;
442 }
443 break;
446 /* Uhm, problem: City Wall has -50% here!! */
447 break;
448 case EFT_MOVE_BONUS:
449 num = num_affected_units(peffect, adv);
450 v += (8 * v * amount + num);
451 break;
453 /* TODO: As an override, this can be either good or bad,
454 * depending on the value being overridden. */
455 break;
457 v += unit_list_size(pcity->tile->units) * 2;
458 break;
459 case EFT_HP_REGEN:
460 case EFT_HP_REGEN_2:
461 num = num_affected_units(peffect, adv);
462 v += (5 * c + num);
463 break;
464 case EFT_MIN_HP_PCT:
465 num = num_affected_units(peffect, adv);
466 /* Lesser value than EFT_HP_REGEN as this does not add health
467 * with full effect value, but only up to the effect value.
468 * Only badly wounded units affected at all. */
469 v += (3 * c + num);
470 break;
472 num = num_affected_units(peffect, adv);
473 v += amount * (2 * c + num) / 50;
474 break;
475 case EFT_VETERAN_WORK:
476 num = num_affected_units(peffect, adv);
477 v += amount * (2 * c + num) / 70;
478 break;
480 /* FIXME: check other reqs (e.g., unitflag) */
481 num = num_affected_units(peffect, adv);
482 v += amount * (3 * c + num);
483 break;
484 case EFT_UPGRADE_UNIT:
485 if (amount == 1) {
486 v += adv->stats.units.upgradeable * 2;
487 } else if (amount == 2) {
488 v += adv->stats.units.upgradeable * 3;
489 } else {
490 v += adv->stats.units.upgradeable * 4;
491 }
492 break;
494 num = num_affected_units(peffect, adv);
495 v += ((2 * c + num) * amount) / 400;
496 break;
497 case EFT_ATTACK_BONUS:
498 num = num_affected_units(peffect, adv);
499 v += (num + 4) * amount / 200;
500 break;
501 case EFT_DEFEND_BONUS:
502 if (has_handicap(pplayer, H_DEFENSIVE)) {
503 v += amount / 10; /* make AI slow */
504 }
505
506 /* TODO: Really should consider how many affected enemy units there is. */
509 if (pclass->adv.sea_move != MOVE_NONE) {
511 }
512 if (pclass->adv.land_move != MOVE_NONE) {
514 }
515 }
517 /* Don't bother searching more if we already know enough. */
518 break;
519 }
521
523 if (is_ocean_tile(pcity->tile)) {
525 ? amount / 6 : amount / 25;
526 } else {
528 if (is_ocean_tile(tile2)) {
529 if (adv->oceans[-tile_continent(tile2)].threat) {
530 v += amount / 6;
531 break;
532 }
533 }
535 }
536 }
537 v += (amount / 25 + adv->threats.invasions - 1) * c; /* For wonder */
538 if (capital || affects_land_capable_units) {
540
541 if ((place > 0 && adv->continents[place].threat)
542 || capital
543 || (adv->threats.invasions
544 /* FIXME: This ignores riverboats on some rulesets.
545 We should analyze rulesets when game starts
546 and have relevant checks here. */
548 if (place > 0 && adv->continents[place].threat) {
549 v += amount * 4 / 5;
550 } else {
551 v += amount / (!adv->threats.igwall ? (18 - capital * 6) : 18);
552 }
553 }
554 }
555 break;
557 num = num_affected_units(peffect, adv);
558 v += (num + 4) * amount / 250; /* Divisor 250 is a bit bigger than one for
559 * EFT_ATTACK_BONUS that is always active.
560 * Fortify bonus applies only in special case that
561 * unit is fortified. */
562 break;
563 case EFT_GAIN_AI_LOVE:
565 if (is_ai(aplayer)) {
566 if (has_handicap(pplayer, H_DEFENSIVE)) {
567 v += amount / 10;
568 } else {
569 v += amount / 20;
570 }
571 }
573 break;
575 /* This is based on average base upgrade price of 50. */
576 v -= adv->stats.units.upgradeable * amount / 2;
577 break;
579 v += amount / 4;
580 break;
582 /* Relatively low, since we don't expect ever to lose our capital,
583 * and otherwise this doesn't matter. */
584 v += amount / 10;
585 break;
586
587 /* Currently not supported for building AI - wait for modpack users */
595 case EFT_MAX_RATES:
598 case EFT_RAPTURE_GROW:
600 case EFT_HAS_SENATE:
603 case EFT_FANATICS:
604 case EFT_NO_DIPLOMACY:
625 break;
626 /* This has no effect for AI */
628 case EFT_CITY_IMAGE:
630 break;
631 case EFT_PERFORMANCE:
633 /* Consider each culture point worth 1/10 point, minimum of 1 point... */
634 v += amount / 10 + 1;
635 break;
636 case EFT_HISTORY:
638 /* ...and history effect to accumulate those points for 50 turns. */
639 v += amount * 5;
640 break;
641 case EFT_CULTURE_PCT:
642 /* Assume that this multiplies accumulation of 5 history points / turn */
643 v += amount * 5 * 5 / 100;
644 break;
646 v -= amount * 50;
647 break;
648 case EFT_TECH_LEAKAGE:
649 {
650 int leak_val = 0;
651
652 switch (game.info.tech_leakage) {
654 break;
656 leak_val = (normal_player_count() - 1) * 2;
657 break;
659 leak_val = (normal_player_count() - 1) * 5;
660 break;
662 leak_val = (normal_player_count() - 1) * 5 + 2 * 3;
663 break;
664 }
665
666 if (amount > 0 && get_player_bonus(pplayer, EFT_TECH_LEAKAGE) <= 0) {
667 v += leak_val;
668 } else if (amount < 0) {
669 v -= leak_val;
670 }
671 }
672 break;
675 v -= amount * 30;
676 break;
679 v -= amount * 25;
680 break;
682 v += amount * 10; /* AI wants bigger city radii */
683 break;
685 v += amount * 10;
686 break;
688 /* Consider all foreign cities within set distance */
691 ptile) {
692 struct city *acity = tile_city(ptile);
693
694 if (!acity || acity == pcity || city_owner(acity) == pplayer) {
695 /* No city, the city in the center, or our own city */
696 continue;
697 }
698
699 v += amount; /* AI wants migration into its cities! */
701 break;
703 {
704 /* We may know no caravans yet, then consider primary one
705 * (Supposed that if this effect is defined then some unit
706 * can establish trade routes) */
708 const struct unit_type *van = best_role_unit(pcity, trr);
709 int bonus;
710
711 if (NULL == van){
712 if (0 < num_role_units(trr)) {
713 van = get_role_unit(trr, 0);
714 }
715 }
716 /* NOTE: if you have "DiplRel" in reqs, becomes 0 */
717 bonus =
719 &(const struct req_context) {
720 .player = city_owner(pcity),
721 .city = pcity,
722 .tile = city_tile(pcity),
723 .unittype = van
725
726 trait = ai_trait_get_value(TRAIT_TRADER, pplayer);
727 v += amount
728 * (pow(2.0,
729 (double) bonus / 1000.0)
730 + c)
731 * trait
734 && amount > 0) {
735 /* Has no free trade routes before this */
736 v += trait;
737 }
738 }
739 break;
741 {
742 int trade = 0;
743
744 trait = ai_trait_get_value(TRAIT_TRADER, pplayer);
745
747 trade += trade_base_between_cities(pcity, tgt);
749
750 v += trade * amount * trait / 100 / TRAIT_DEFAULT_VALUE;
751
753 && amount > 0) {
754 /* Space for future routes */
755 v += trait * 5 / TRAIT_DEFAULT_VALUE;
756 }
757 }
758 break;
760 v -= amount / 40;
761 break;
763 v -= amount / 80;
764 break;
765 case EFT_RETIRE_PCT:
767 v -= amount * num / 20;
768 break;
771 {
772 /* Taking MAX_MOVE_FRAGS takes all the move fragments. */
774
775 /* Lose all movement => 1. */
777 }
778 break;
779 case EFT_INFRA_POINTS:
780 v += amount * adv->infra_priority;
781 break;
786 /* The AI has no idea what this does. */
787 break;
788 case EFT_COUNT:
789 log_error("Bad effect type.");
790 break;
791 }
792
793 return v;
794}
795
796/**********************************************************************/
799static bool have_better_government(const struct player *pplayer,
800 const struct government *pgov)
801{
802 if (pgov->ai.better) {
803 if (pplayer->government == pgov->ai.better) {
804 return TRUE;
805 } else {
806 return have_better_government(pplayer, pgov->ai.better);
807 }
808 }
809 return FALSE;
810}
811/**********************************************************************/
822 const struct player *pplayer,
823 const struct city *pcity)
824{
825 switch (preq->source.kind) {
826 case VUT_GOVERNMENT:
827 /* We can't meet a government requirement if we have a better one. */
828 return !have_better_government(pplayer, preq->source.value.govern);
829
830 case VUT_IMPROVEMENT:
831 case VUT_SITE:
832 {
833 const struct impr_type *pimprove = preq->source.value.building;
834
835 if (preq->present
836 && preq->source.kind == VUT_IMPROVEMENT
837 && improvement_obsolete(pplayer, pimprove, pcity)) {
838 /* Would need to unobsolete a building, which is too hard. */
839 return FALSE;
840 } else if (!preq->present && pcity != NULL
841 && I_NEVER < pcity->built[improvement_index(pimprove)].turn
842 && (preq->source.kind != VUT_IMPROVEMENT
843 || !can_improvement_go_obsolete(pimprove))) {
844 /* Would need to unbuild an unobsoleteable building, which is too hard. */
845 return FALSE;
846 } else if (preq->present) {
849 return FALSE;
850 }
852 }
853 break;
854 } /* VUT_IMPROVEMENT inline block */
855
856 case VUT_SPECIALIST:
857 if (preq->present) {
858 requirement_vector_iterate(&(preq->source.value.specialist)->reqs,
859 sreq) {
861 return FALSE;
862 }
864 } /* It is always possible to remove a specialist. */
865 break;
866
867 case VUT_NATIONALITY:
868 /* Crude, but the right answer needs to consider civil wars. */
869 return nation_is_in_current_set(preq->source.value.nation);
870
872 return FALSE;
873
874 case VUT_CITYSTATUS:
875 if (pcity != NULL) {
876 if (preq->source.value.citystatus == CITYS_OWNED_BY_ORIGINAL
877 && pcity->original != NULL) {
878 if (preq->present) {
879 return city_owner(pcity) == pcity->original;
880 } else {
881 return city_owner(pcity) != pcity->original;
882 }
883 } else if (preq->source.value.citystatus == CITYS_TRANSFERRED) {
884 if ((preq->present && pcity->acquire_t == CACQ_FOUNDED)
885 || (!preq->present && pcity->acquire_t != CACQ_FOUNDED)) {
886 /* Would change only when the AI loses the city */
887 return FALSE;
888 }
889 }
890 }
891 break;
892 case VUT_TERRAIN:
893 case VUT_TERRAINCLASS:
894 case VUT_TERRAINALTER:
895 case VUT_TERRFLAG:
896 case VUT_ROADFLAG:
897 case VUT_EXTRAFLAG:
898 case VUT_EXTRA:
899 /* TODO: These could be determined by building a map of all
900 * possible futures (e.g. terrain transformations, etc.),
901 * and traversing it for all tiles in largest possible range
902 * of city, and using that to check requirements. */
903 break;
904
905 case VUT_ADVANCE:
906 case VUT_MINSIZE:
907 case VUT_MINYEAR:
908 case VUT_TOPO:
909 case VUT_WRAP:
910 case VUT_AGE:
911 case VUT_TECHFLAG:
912 case VUT_ACHIEVEMENT:
913 case VUT_MINCULTURE:
914 case VUT_MINTECHS:
915 /* No way to remove once present. */
916 return preq->present;
917
918 case VUT_FORM_AGE:
919 /* FIXME: Sometimes it would be possible to convert back and forth */
920 return preq->present;
921
923 /* No way to add once lost. */
924 return !preq->present;
925
926 case VUT_NATION:
927 case VUT_NATIONGROUP:
928 case VUT_AI_LEVEL:
930 case VUT_MINLATITUDE:
931 case VUT_MAXLATITUDE:
932 case VUT_PLAYER_FLAG:
933 case VUT_PLAYER_STATE:
934 /* Beyond player control. */
935 return FALSE;
936
937 case VUT_OTYPE:
938 case VUT_IMPR_GENUS:
939 /* Can always be achieved. */
940 return TRUE;
941
942 case VUT_MINCITIES:
943 /* We don't WANT to lose cities */
944 return preq->present;
945
946 case VUT_IMPR_FLAG:
947 /* TODO: Have at least some checks for this. */
948 break;
949
950 case VUT_NONE:
951 case VUT_COUNTER:
952 case VUT_UTYPE:
953 case VUT_UTFLAG:
954 case VUT_UCLASS:
955 case VUT_UCFLAG:
956 case VUT_DIPLREL:
957 case VUT_DIPLREL_TILE:
961 case VUT_MAXTILEUNITS:
962 case VUT_STYLE:
963 case VUT_UNITSTATE:
964 case VUT_ACTIVITY:
965 case VUT_CITYTILE:
966 case VUT_MINMOVES:
967 case VUT_MINVETERAN:
968 case VUT_MINHP:
969 case VUT_ACTION:
970 case VUT_GOOD:
971 case VUT_MINCALFRAG:
974 case VUT_TILE_REL:
975 case VUT_COUNT:
976 /* No sensible implementation possible with data available. */
977 break;
978 }
979
980 return TRUE;
981}
#define action_id_get_role(act_id)
Definition actions.h:457
bool adv_wants_science(struct player *pplayer)
Definition advdata.c:1102
#define MORT
Definition advtools.h:19
int ai_trait_get_value(enum trait tr, struct player *pplayer)
Definition aitraits.c:68
int city_granary_size(int city_size)
Definition city.c:2132
bool city_can_grow_to(const struct city *pcity, int pop_size)
Definition city.c:2012
int city_map_radius_sq_get(const struct city *pcity)
Definition city.c:137
#define city_tile(_pcity_)
Definition city.h:561
static citizens city_size_get(const struct city *pcity)
Definition city.h:566
@ CITIZEN_UNHAPPY
Definition city.h:267
#define city_owner(_pcity_)
Definition city.h:560
@ FEELING_EFFECT
Definition city.h:278
@ FEELING_FINAL
Definition city.h:281
char * incite_cost
Definition comments.c:76
bool dai_can_requirement_be_met_in_city(const struct requirement *preq, const struct player *pplayer, const struct city *pcity)
Definition daieffects.c:821
adv_want dai_effect_value(struct player *pplayer, const struct adv_data *adv, const struct city *pcity, const bool capital, int turns, const struct effect *peffect, const int c, const int nplayers)
Definition daieffects.c:138
adv_want dai_content_effect_value(const struct player *pplayer, const struct city *pcity, int amount, int num_cities, int happiness_step)
Definition daieffects.c:77
static int num_affected_units(const struct effect *peffect, const struct adv_data *ai)
Definition daieffects.c:120
static bool have_better_government(const struct player *pplayer, const struct government *pgov)
Definition daieffects.c:799
static int get_entertainers(const struct city *pcity)
Definition daieffects.c:60
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
Definition effects.c:842
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
enum effect_type user_effect_ai_valued_as(enum effect_type real)
Definition effects.c:1357
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Definition effects.c:824
float adv_want
Definition fc_types.h:1063
@ VC_SPACERACE
Definition fc_types.h:979
@ O_FOOD
Definition fc_types.h:101
@ O_LUXURY
Definition fc_types.h:101
signed short Continent_id
Definition fc_types.h:231
struct civ_game game
Definition game.c:61
struct world wld
Definition game.c:62
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Definition government.c:166
bool has_handicap(const struct player *pplayer, enum handicap_type htype)
Definition handicaps.c:66
@ H_DEFENSIVE
Definition handicaps.h:21
bool can_improvement_go_obsolete(const struct impr_type *pimprove)
Impr_type_id improvement_index(const struct impr_type *pimprove)
bool improvement_obsolete(const struct player *pplayer, const struct impr_type *pimprove, const struct city *pcity)
#define log_error(message,...)
Definition log.h:104
#define iterate_outward(nmap, start_tile, max_dist, itr_tile)
Definition map.h:364
#define iterate_outward_end
Definition map.h:368
#define adjc_iterate_end
Definition map.h:430
#define adjc_iterate(nmap, center_tile, itr_tile)
Definition map.h:425
#define MAX_MOVE_FRAGS
Definition movement.h:29
int player_multiplier_effect_value(const struct player *pplayer, const struct multiplier *pmul)
Definition player.c:1975
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
Definition player.c:1480
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:324
#define players_iterate_end
Definition player.h:542
#define players_iterate(_pplayer)
Definition player.h:537
#define is_ai(plr)
Definition player.h:232
#define players_iterate_alive_end
Definition player.h:552
#define players_iterate_alive(_pplayer)
Definition player.h:547
int normal_player_count(void)
Definition plrhand.c:3209
bool nation_is_in_current_set(const struct nation_type *pnation)
Definition plrhand.c:2595
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
#define requirement_fulfilled_by_unit_class(_uc_, _rqs_)
int research_goal_unknown_techs(const struct research *presearch, Tech_type_id goal)
Definition research.c:750
int research_count(void)
Definition research.c:1336
struct research * research_get(const struct player *pplayer)
Definition research.c:128
#define MIN(x, y)
Definition shared.h:55
#define MAX(x, y)
Definition shared.h:54
@ SSHIP_STARTED
Definition spaceship.h:84
int get_specialist_output(const struct city *pcity, Specialist_type_id sp, Output_type_id otype)
Definition specialist.c:217
#define specialist_type_iterate_end
Definition specialist.h:79
#define specialist_type_iterate(sp)
Definition specialist.h:73
bool threat
Definition advdata.h:47
int req
Definition advdata.h:133
adv_want val
Definition advdata.h:132
struct adv_data::@95 dipl
struct adv_data::@96::@98 govt
bool invasions
Definition advdata.h:66
bool igwall
Definition advdata.h:69
struct adv_data::@96 goal
int byclass[UCL_LAST]
Definition advdata.h:91
int nuclear
Definition advdata.h:68
int upgradeable
Definition advdata.h:94
int food_priority
Definition advdata.h:114
struct adv_area_info * oceans
Definition advdata.h:62
struct player * production_leader
Definition advdata.h:106
struct adv_data::@92 threats
struct government * gov
Definition advdata.h:131
struct adv_area_info * continents
Definition advdata.h:61
int airliftable
Definition advdata.h:89
struct adv_data::@93 explore
struct adv_data::@94::@97 units
bool sea_done
Definition advdata.h:77
int suicide_attackers
Definition advdata.h:89
int wonder_city
Definition advdata.h:55
bool land_done
Definition advdata.h:76
struct player * tech_leader
Definition advdata.h:105
struct player * spacerace_leader
Definition advdata.h:104
struct adv_data::@94 stats
Definition city.h:317
struct packet_game_info info
Definition game.h:89
int conquercost
Definition game.h:143
int freecost
Definition game.h:155
struct civ_game::@32::@36 server
int mgr_distance
Definition game.h:165
struct government * better
Definition government.h:69
struct government::@43 ai
struct requirement_vector reqs
Definition improvement.h:58
enum tech_leakage_style tech_leakage
enum spaceship_state state
Definition spaceship.h:108
struct city_list * cities
Definition player.h:281
struct government * government
Definition player.h:258
const struct ai_type * ai
Definition player.h:289
struct player_spaceship spaceship
Definition player.h:286
struct unit_list * units
Definition tile.h:58
struct unit_type::@90 adv
int id
Definition unit.h:147
struct unit::@84::@87 server
struct tile * tile
Definition unit.h:142
struct civ_map map
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
#define fc__fallthrough
Definition support.h:119
bool is_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
Definition terrain.c:612
#define is_ocean_tile(ptile)
Definition terrain.h:196
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_continent(_tile)
Definition tile.h:93
int trade_base_between_cities(const struct city *pc1, const struct city *pc2)
int city_num_trade_routes(const struct city *pcity)
unsigned max_trade_routes(const struct city *pcity)
Definition traderoutes.c:48
#define trade_partners_iterate_end
#define trade_partners_iterate(c, p)
#define TRAIT_DEFAULT_VALUE
Definition traits.h:32
struct unit_type * best_role_unit(const struct city *pcity, int role)
Definition unittype.c:2277
struct unit_type * get_role_unit(int role, int role_index)
Definition unittype.c:2259
int num_role_units(int role)
Definition unittype.c:2209
#define unit_class_iterate(_p)
Definition unittype.h:915
@ MOVE_NONE
Definition unittype.h:144
#define uclass_index(_c_)
Definition unittype.h:749
#define unit_class_iterate_end
Definition unittype.h:922
bool victory_enabled(enum victory_condition_type victory)
Definition victory.c:26