Freeciv-3.2
|
#include "distribute.h"
#include "log.h"
#include "shared.h"
#include "timing.h"
#include "city.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "nation.h"
#include "packets.h"
#include "player.h"
#include "research.h"
#include "unit.h"
#include "victory.h"
#include "cm.h"
#include "citytools.h"
#include "cityturn.h"
#include "plrhand.h"
#include "sernet.h"
#include "spacerace.h"
#include "srv_log.h"
#include "unithand.h"
#include "advdata.h"
#include "advspace.h"
#include "advtools.h"
#include "handicaps.h"
#include "aitech.h"
#include "aitools.h"
#include "daicity.h"
#include "daidata.h"
#include "daidiplomacy.h"
#include "dailog.h"
#include "daimilitary.h"
#include "daiplayer.h"
#include "aihand.h"
Go to the source code of this file.
Macros | |
#define | LOGLEVEL_TAX LOG_DEBUG |
#define | AI_GOLD_RESERVE_MIN_TURNS 10 |
#define | AI_BULBS_RESERVE_MIN_TURNS 10 |
#define | PCT_DELTA_TAX 50 |
#define | PCT_DELTA_SCI 10 |
#define | RATE_NOT_SET -1 |
#define | RATE_VALID(_rate) (_rate != RATE_NOT_SET) |
#define | RATE_REMAINS(_rates) |
Enumerations | |
enum | { AI_RATE_SCI = 0 , AI_RATE_TAX , AI_RATE_LUX , AI_RATE_COUNT } |
enum | celebration { AI_CELEBRATION_UNCHECKED , AI_CELEBRATION_NO , AI_CELEBRATION_YES } |
Functions | |
static void | dai_manage_spaceship (struct player *pplayer) |
void | dai_calc_data (const struct player *pplayer, int *trade, int *expenses, int *income) |
static void | dai_manage_taxes (struct ai_type *ait, struct player *pplayer) |
static void | dai_manage_government (struct ai_type *ait, struct player *pplayer) |
void | dai_do_first_activities (struct ai_type *ait, struct player *pplayer) |
void | dai_do_last_activities (struct ai_type *ait, struct player *pplayer) |
Returns the total amount of trade generated (trade), total amount of gold needed as upkeep (expenses), and total amount of gold gained (income).
Definition at line 117 of file aihand.c.
Referenced by dai_action_value_unit_vs_city(), dai_choose_diplomat_offensive(), dai_diplomat_bribe_nearby(), dai_manage_taxes(), dai_spend_gold(), dai_upgrade_units(), and find_city_to_diplomat().
Activities to be done by AI before human turn. Here we just move the units intelligently.
Definition at line 748 of file aihand.c.
Referenced by cai_do_first_activities(), and texwai_first_activities().
Activities to be done by AI after human turn. Here we respond to dangers created by human and AI opposition by ordering defenders in cities and setting taxes accordingly. We also do other duties.
We do not move units here, otherwise humans complain that AI moves twice.
Definition at line 774 of file aihand.c.
Referenced by cai_do_last_activities(), and texwai_last_activities().
Change the government form, if it can and there is a good reason.
Definition at line 707 of file aihand.c.
Referenced by dai_do_last_activities().
Handle spaceship related stuff
Definition at line 98 of file aihand.c.
Referenced by dai_do_last_activities().
Set tax/science/luxury rates.
TODO: Add general support for luxuries: select the luxury rate at which all cities are content and the trade output (minus what is consumed by luxuries) is maximal. For this we need some more information from the city management code.
TODO: Audit the use of pplayer->ai.maxbuycost in the code elsewhere, then add support for it here.
This function first determins the minimum tax rate (rate_tax_min) and a tax rate for a balanced treasury (rate_tax_balance). Similarily, the science rates are determiend (rate_sci_min and rate_sci_balance). Considering the minimum rates for tax and science the chance for celebrations is checked. If celebration is possible for more than half of the cities, the needed luxury rate is saved as rate_lux_min_celebrate. For celebration some reserves are defined (see turns_for_rapture).
At the end the results are compared and the rates are selected as:
At the end the remaining is divided on science/gold/luxury depending on the AI settings.
Definition at line 211 of file aihand.c.
Referenced by dai_do_last_activities().