Freeciv-3.3
Loading...
Searching...
No Matches
Functions
daieffects.c 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"

Go to the source code of this file.

Functions

static int get_entertainers (const struct city *pcity)
 
adv_want dai_content_effect_value (const struct player *pplayer, const struct city *pcity, int amount, int num_cities, int happiness_step)
 
static int num_affected_units (const struct effect *peffect, const struct adv_data *ai)
 
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)
 
static bool have_better_government (const struct player *pplayer, const struct government *pgov)
 
bool dai_can_requirement_be_met_in_city (const struct requirement *preq, const struct player *pplayer, const struct city *pcity)
 

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 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 NULL, so request pplayer separately.

Definition at line 821 of file daieffects.c.

Referenced by adjust_improvement_wants_by_effects(), dai_can_requirement_be_met_in_city(), 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 77 of file daieffects.c.

Referenced by dai_effect_value(), and military_advisor_choose_build().

◆ dai_effect_value()

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 
)

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

Definition at line 138 of file daieffects.c.

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 60 of file daieffects.c.

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 799 of file daieffects.c.

Referenced by dai_can_requirement_be_met_in_city(), and have_better_government().

◆ 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 120 of file daieffects.c.

Referenced by dai_effect_value().