Freeciv21
Develop your civilization from humble roots to a global empire
aiair.cpp File Reference
#include "log.h"
#include "combat.h"
#include "game.h"
#include "map.h"
#include "movement.h"
#include "pf_tools.h"
#include "player.h"
#include "unit.h"
#include "maphand.h"
#include "srv_log.h"
#include "unithand.h"
#include "unittools.h"
#include "advbuilding.h"
#include "advgoto.h"
#include "handicaps.h"
#include "ailog.h"
#include "aiplayer.h"
#include "aitools.h"
#include "aiunit.h"
#include "aiair.h"
+ Include dependency graph for aiair.cpp:

Go to the source code of this file.

Macros

#define PROB_MULTIPLIER   100
 

Functions

static struct tilefind_nearest_airbase (const struct unit *punit, PFPath *path)
 Looks for nearest airbase for punit reachable imediatly. More...
 
static bool dai_should_we_air_attack_tile (struct ai_type *ait, struct unit *punit, struct tile *ptile)
 Very preliminary estimate for our intent to attack the tile (x, y). More...
 
static int dai_evaluate_tile_for_air_attack (struct unit *punit, struct tile *dst_tile)
 Returns an estimate for the profit gained through attack. More...
 
static int find_something_to_bomb (struct ai_type *ait, struct unit *punit, PFPath *path, struct tile **pptile)
 Find something to bomb Air-units specific victim search Returns the want for the best target. More...
 
static struct tiledai_find_strategic_airbase (struct ai_type *ait, const struct unit *punit, PFPath *path)
 Iterates through reachable cities and appraises them as a possible base for air operations by (air)unit punit. More...
 
void dai_manage_airunit (struct ai_type *ait, struct player *pplayer, struct unit *punit)
 Trying to manage bombers and stuff. More...
 
bool dai_choose_attacker_air (struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, bool allow_gold_upkeep)
 Chooses the best available and usable air unit and records it in choice, if it's better than previous choice The interface is somewhat different from other ai_choose, but that's what it should be like, I believe – GB. More...
 

Macro Definition Documentation

◆ PROB_MULTIPLIER

#define PROB_MULTIPLIER   100

Function Documentation

◆ dai_choose_attacker_air()

bool dai_choose_attacker_air ( struct ai_type ait,
struct player pplayer,
struct city pcity,
struct adv_choice choice,
bool  allow_gold_upkeep 
)

Chooses the best available and usable air unit and records it in choice, if it's better than previous choice The interface is somewhat different from other ai_choose, but that's what it should be like, I believe – GB.

Definition at line 429 of file aiair.cpp.

Referenced by military_advisor_choose_build().

◆ dai_evaluate_tile_for_air_attack()

static int dai_evaluate_tile_for_air_attack ( struct unit punit,
struct tile dst_tile 
)
static

Returns an estimate for the profit gained through attack.

Assumes that the victim is within one day's flight

Definition at line 113 of file aiair.cpp.

Referenced by find_something_to_bomb().

◆ dai_find_strategic_airbase()

static struct tile* dai_find_strategic_airbase ( struct ai_type ait,
const struct unit punit,
PFPath path 
)
static

Iterates through reachable cities and appraises them as a possible base for air operations by (air)unit punit.

Returns nullptr if not found. The path is stored in the path argument if not nullptr.

Definition at line 260 of file aiair.cpp.

Referenced by dai_manage_airunit().

◆ dai_manage_airunit()

void dai_manage_airunit ( struct ai_type ait,
struct player pplayer,
struct unit punit 
)

Trying to manage bombers and stuff.

If we are in the open { if moving intelligently on a valid GOTO, { carry on doing it. } else { go refuel } } else { try to attack something } TODO: distant target selection, support for fuel > 2

Definition at line 334 of file aiair.cpp.

Referenced by dai_manage_unit().

◆ dai_should_we_air_attack_tile()

static bool dai_should_we_air_attack_tile ( struct ai_type ait,
struct unit punit,
struct tile ptile 
)
static

Very preliminary estimate for our intent to attack the tile (x, y).

Used by bombers only.

Definition at line 87 of file aiair.cpp.

Referenced by find_something_to_bomb().

◆ find_nearest_airbase()

static struct tile* find_nearest_airbase ( const struct unit punit,
PFPath path 
)
static

Looks for nearest airbase for punit reachable imediatly.

Returns nullptr if not found. The path is stored in the path argument if not nullptr. TODO: Special handicaps for planes running out of fuel IMO should be less restrictive than general H_MAP, H_FOG

Definition at line 53 of file aiair.cpp.

Referenced by dai_manage_airunit().

◆ find_something_to_bomb()

static int find_something_to_bomb ( struct ai_type ait,
struct unit punit,
PFPath path,
struct tile **  pptile 
)
static

Find something to bomb Air-units specific victim search Returns the want for the best target.

The targets are stored in the path and pptile arguments if not nullptr. TODO: take counterattack dangers into account TODO: make separate handicaps for air units seeing targets IMO should be more restrictive than general H_MAP, H_FOG

Definition at line 197 of file aiair.cpp.

Referenced by dai_choose_attacker_air(), dai_find_strategic_airbase(), and dai_manage_airunit().