Freeciv-3.1
|
#include "bitvector.h"
#include "log.h"
#include "mem.h"
#include "shared.h"
#include "timing.h"
#include "actions.h"
#include "city.h"
#include "combat.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "movement.h"
#include "packets.h"
#include "player.h"
#include "research.h"
#include "unit.h"
#include "unitlist.h"
#include "aiactions.h"
#include "pf_tools.h"
#include "barbarian.h"
#include "citytools.h"
#include "cityturn.h"
#include "diplomats.h"
#include "maphand.h"
#include "srv_log.h"
#include "unithand.h"
#include "unittools.h"
#include "advbuilding.h"
#include "advdata.h"
#include "advgoto.h"
#include "autosettlers.h"
#include "handicaps.h"
#include "aidata.h"
#include "aiguard.h"
#include "aihand.h"
#include "ailog.h"
#include "aiplayer.h"
#include "aitools.h"
#include "aiunit.h"
#include "daiactions.h"
#include "daicity.h"
#include "daimilitary.h"
#include "aidiplomat.h"
Go to the source code of this file.
Macros | |
#define | LOG_DIPLOMAT LOG_DEBUG |
#define | LOG_DIPLOMAT_BUILD LOG_DEBUG |
#define | DIPLO_DEFENSE_WANT 3000 |
Functions | |
static bool | is_city_surrounded_by_our_spies (struct player *pplayer, struct city *pcity) |
static void | find_city_to_diplomat (struct player *pplayer, struct unit *punit, struct city **ctarget, int *move_dist, struct pf_map *pfm) |
static int | count_stealable_techs (struct player *pplayer, struct player *tplayer) |
void | dai_choose_diplomat_defensive (struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, int def) |
void | dai_choose_diplomat_offensive (struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice) |
static void | dai_diplomat_city (struct ai_type *ait, struct unit *punit, struct city *ctarget) |
static struct city * | dai_diplomat_defend (struct ai_type *ait, struct player *pplayer, struct unit *punit, const struct unit_type *utype, struct pf_map *pfm) |
static bool | dai_diplomat_bribe_nearby (struct ai_type *ait, struct player *pplayer, struct unit *punit, struct pf_map *pfm) |
void | dai_manage_diplomat (struct ai_type *ait, struct player *pplayer, struct unit *punit) |
#define DIPLO_DEFENSE_WANT 3000 |
Definition at line 82 of file aidiplomat.c.
#define LOG_DIPLOMAT LOG_DEBUG |
Definition at line 77 of file aidiplomat.c.
#define LOG_DIPLOMAT_BUILD LOG_DEBUG |
Definition at line 78 of file aidiplomat.c.
Number of techs that we don't have and the enemy (tplayer) does.
Definition at line 94 of file aidiplomat.c.
Referenced by dai_diplomat_city().
void dai_choose_diplomat_defensive | ( | struct ai_type * | ait, |
struct player * | pplayer, | ||
struct city * | pcity, | ||
struct adv_choice * | choice, | ||
int | def | ||
) |
Calculates our need for diplomats as defensive units. May replace values in choice. The values 16000 and 3000 used below are totally arbitrary but seem to work.
Definition at line 115 of file aidiplomat.c.
Referenced by military_advisor_choose_build().
void dai_choose_diplomat_offensive | ( | struct ai_type * | ait, |
struct player * | pplayer, | ||
struct city * | pcity, | ||
struct adv_choice * | choice | ||
) |
Calculates our need for diplomats as offensive units. May replace values in choice.
Definition at line 164 of file aidiplomat.c.
Referenced by military_advisor_choose_build().
|
static |
Find units that we can reach, and bribe them. Returns TRUE if survived the ordeal, FALSE if not or we expended all our movement. Will try to bribe a ship on the coast as well as land stuff.
Definition at line 586 of file aidiplomat.c.
Referenced by dai_manage_diplomat().
|
static |
Check if something is on our receiving end for some nasty diplomat business! Note that punit may die or be moved during this function. We must be adjacent to target city.
We try to make embassy first, and abort if we already have one and target is allied. Then we steal, incite, sabotage or poison the city, in that order of priority.
Definition at line 325 of file aidiplomat.c.
Referenced by dai_manage_diplomat().
|
static |
Go to nearest/most threatened city (can be the current city too).
Definition at line 518 of file aidiplomat.c.
Referenced by dai_manage_diplomat().
If we are the only diplomat in a threatened city, defend against enemy actions. The passive defense is set by game.diplchance. The active defense is to bribe units which end their move nearby. Our next trick is to look for enemy cities on our continent and do our diplomat things.
FIXME: It is important to establish contact with all civilizations, so we should send diplomats by boat eventually. I just don't know how that part of the code works, yet - Per
Definition at line 721 of file aidiplomat.c.
Referenced by dai_manage_unit().
|
static |
Returns (in ctarget) the closest city to send diplomats against, or NULL if none available on this continent. punit can be virtual.
Definition at line 439 of file aidiplomat.c.
Referenced by dai_choose_diplomat_offensive(), and dai_manage_diplomat().
|
static |
Check if we have a diplomat / spy near a given city. This is used to prevent a stack of such units next to a foreign city.
Definition at line 415 of file aidiplomat.c.
Referenced by find_city_to_diplomat().