Freeciv21
Develop your civilization from humble roots to a global empire
daieffects.cpp File Reference
#include "city.h"
#include "effects.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "movement.h"
#include "multipliers.h"
#include "player.h"
#include "research.h"
#include "specialist.h"
#include "traderoutes.h"
#include "victory.h"
#include "plrhand.h"
#include "advdata.h"
#include "advtools.h"
#include "aitraits.h"
#include "handicaps.h"
#include "daieffects.h"
+ Include dependency graph for daieffects.cpp:

Go to the source code of this file.

Functions

static int get_entertainers (const struct city *pcity)
 Return the number of "luxury specialists". More...
 
adv_want dai_content_effect_value (const struct player *pplayer, const struct city *pcity, int amount, int num_cities, int happiness_step)
 How desirable particular effect making people content is for a particular city? More...
 
static int num_affected_units (const struct effect *peffect, const struct adv_data *ai)
 Number of AI stats units affected by effect. More...
 
adv_want dai_effect_value (struct player *pplayer, struct government *gov, const struct adv_data *adv, const struct city *pcity, const bool capital, int turns, const struct effect *peffect, const int c, const int nplayers)
 How desirable is a particular effect for a particular city, given the number of cities in range (c). More...
 
static bool have_better_government (const struct player *pplayer, const struct government *pgov)
 Checks recursively to see if the player already has a better government. More...
 
bool dai_can_requirement_be_met_in_city (const struct requirement *preq, const struct player *pplayer, const struct city *pcity)
 Does the AI expect to ever be able to meet this requirement. More...
 

Function Documentation

◆ dai_can_requirement_be_met_in_city()

bool dai_can_requirement_be_met_in_city ( const struct requirement preq,
const struct player pplayer,
const struct city pcity 
)

Does the AI expect to ever be able to meet this requirement.

The return value of this function is unreliable for requirements that are are currently active: the caller should only call this function to determine if a currently inactive requirement could be met in the future.

City may be nullptr, so request pplayer separately.

Definition at line 723 of file daieffects.cpp.

Referenced by adjust_improvement_wants_by_effects(), dai_wants_defender_against(), and utype_needs_improvement().

◆ dai_content_effect_value()

adv_want dai_content_effect_value ( const struct player pplayer,
const struct city pcity,
int  amount,
int  num_cities,
int  happiness_step 
)

How desirable particular effect making people content is for a particular city?

Definition at line 71 of file daieffects.cpp.

Referenced by dai_effect_value(), and military_advisor_choose_build().

◆ dai_effect_value()

adv_want dai_effect_value ( struct player pplayer,
struct government gov,
const struct adv_data adv,
const struct city pcity,
const bool  capital,
int  turns,
const struct effect peffect,
const int  c,
const int  nplayers 
)

How desirable is a particular effect for a particular city, given the number of cities in range (c).

Definition at line 130 of file daieffects.cpp.

Referenced by adjust_improvement_wants_by_effects(), dai_gov_value(), and dai_tech_effect_values().

◆ get_entertainers()

static int get_entertainers ( const struct city pcity)
static

Return the number of "luxury specialists".

This is the number of specialists who provide at least HAPPY_COST luxury, being the number of luxuries needed to make one citizen content or happy.

The AI assumes that for any specialist that provides HAPPY_COST luxury, if we can get that luxury from some other source it allows the specialist to become a worker. The benefits from an extra worker are weighed against the losses from acquiring the two extra luxury.

This is a very bad model if the abilities of specialists are changed. But as long as the civ2 model of specialists is used it will continue to work okay.

Definition at line 52 of file daieffects.cpp.

Referenced by dai_content_effect_value(), and dai_effect_value().

◆ have_better_government()

static bool have_better_government ( const struct player pplayer,
const struct government pgov 
)
static

Checks recursively to see if the player already has a better government.

Definition at line 701 of file daieffects.cpp.

Referenced by dai_can_requirement_be_met_in_city().

◆ num_affected_units()

static int num_affected_units ( const struct effect peffect,
const struct adv_data ai 
)
static

Number of AI stats units affected by effect.

Definition at line 110 of file daieffects.cpp.

Referenced by dai_effect_value().