Freeciv-3.2
Loading...
Searching...
No Matches
Functions
aiferry.h File Reference
#include "support.h"
#include "fc_types.h"

Go to the source code of this file.

Functions

bool dai_is_ferry_type (const struct unit_type *pferry, struct ai_type *ait)
 
bool dai_is_ferry (struct unit *pferry, struct ai_type *ait)
 
void aiferry_init_stats (struct ai_type *ait, struct player *pplayer)
 
int aiferry_find_boat (struct ai_type *ait, struct unit *punit, int cap, struct pf_path **path)
 
int aiferry_avail_boats (struct ai_type *ait, struct player *pplayer)
 
void dai_ferry_init_ferry (struct ai_type *ait, struct unit *ferry)
 
void dai_ferry_lost (struct ai_type *ait, struct unit *punit)
 
void dai_ferry_transformed (struct ai_type *ait, struct unit *ferry, const struct unit_type *old)
 
void aiferry_clear_boat (struct ai_type *ait, struct unit *punit)
 
bool aiferry_gobyboat (struct ai_type *ait, struct player *pplayer, struct unit *punit, struct tile *dst_tile, bool with_bodyguard)
 
bool aiferry_goto_amphibious (struct ai_type *ait, struct unit *ferry, struct unit *passenger, struct tile *ptile)
 
bool dai_amphibious_goto_constrained (struct ai_type *ait, struct unit *ferry, struct unit *passenger, struct tile *ptile, struct pft_amphibious *parameter)
 
bool is_boat_free (struct ai_type *ait, struct unit *boat, struct unit *punit, int cap)
 
bool is_boss_of_boat (struct ai_type *ait, struct unit *punit)
 
void dai_manage_ferryboat (struct ai_type *ait, struct player *pplayer, struct unit *punit)
 

Function Documentation

◆ aiferry_avail_boats()

int aiferry_avail_boats ( struct ai_type ait,
struct player pplayer 
)

Returns the number of available boats. A simple accessor made to perform debug checks.

Definition at line 353 of file aiferry.c.

Referenced by dai_is_unit_tired_waiting_boat().

◆ aiferry_clear_boat()

void aiferry_clear_boat ( struct ai_type ait,
struct unit punit 
)

Use on a unit which no longer needs a boat.

Definition at line 251 of file aiferry.c.

Referenced by dai_caravan_goto(), dai_gothere(), dai_manage_barbarian_leader(), dai_manage_caravan(), dai_manage_military(), and dai_unit_new_task().

◆ aiferry_find_boat()

int aiferry_find_boat ( struct ai_type ait,
struct unit punit,
int  cap,
struct pf_path **  path 
)

Proper and real PF function for finding a boat. If you don't require the path to the ferry, pass path=NULL. Return the unit ID of the boat; punit is the passenger.

WARNING: Due to the nature of this function and PF (see the comment of combined_land_sea_move), the path won't lead onto the boat itself.

Definition at line 495 of file aiferry.c.

Referenced by dai_find_boat_for_unit(), find_best_city_placement(), and find_something_to_kill().

◆ aiferry_gobyboat()

bool aiferry_gobyboat ( struct ai_type ait,
struct player pplayer,
struct unit punit,
struct tile dest_tile,
bool  with_bodyguard 
)

This function is to be called if punit needs to use a boat to get to the destination.

Return values: TRUE if got to or next to our destination, FALSE otherwise.

TODO: A big one is rendezvous points between units and boats. When this is implemented, we won't have to be at the coast to ask for a boat to come to us.

Definition at line 764 of file aiferry.c.

Referenced by dai_gothere(), and dai_military_attack().

◆ aiferry_goto_amphibious()

bool aiferry_goto_amphibious ( struct ai_type ait,
struct unit ferry,
struct unit passenger,
struct tile ptile 
)

Move a passenger on a ferry to a specified destination. Return FALSE iff we died.

Definition at line 730 of file aiferry.c.

Referenced by dai_military_attack_barbarian().

◆ aiferry_init_stats()

void aiferry_init_stats ( struct ai_type ait,
struct player pplayer 
)

Call to initialize the ferryboat statistics

Definition at line 92 of file aiferry.c.

Referenced by dai_data_phase_begin().

◆ dai_amphibious_goto_constrained()

bool dai_amphibious_goto_constrained ( struct ai_type ait,
struct unit ferry,
struct unit passenger,
struct tile ptile,
struct pft_amphibious parameter 
)

Move a passenger on a ferry to a specified destination. The passenger is assumed to be on the given ferry. The destination may be inland, in which case the passenger will ride the ferry to a beach head, disembark, then continue on land. Return FALSE iff we died.

Definition at line 634 of file aiferry.c.

◆ dai_ferry_init_ferry()

void dai_ferry_init_ferry ( struct ai_type ait,
struct unit ferry 
)

Initialize new ferry when player gets it

Definition at line 167 of file aiferry.c.

Referenced by cai_ferry_init_ferry(), and texwai_ferry_init_ferry().

◆ dai_ferry_lost()

void dai_ferry_lost ( struct ai_type ait,
struct unit punit 
)

Close ferry when player loses it

Definition at line 221 of file aiferry.c.

Referenced by cai_ferry_lost(), and texwai_ferry_lost().

◆ dai_ferry_transformed()

void dai_ferry_transformed ( struct ai_type ait,
struct unit ferry,
const struct unit_type old 
)

Update ferry system when unit is transformed.

Definition at line 189 of file aiferry.c.

Referenced by cai_ferry_transformed(), and texwai_ferry_transformed().

◆ dai_is_ferry()

bool dai_is_ferry ( struct unit pferry,
struct ai_type ait 
)

Should unit be considered a ferry?

Definition at line 159 of file aiferry.c.

Referenced by dai_fill_unit_param(), dai_manage_unit(), dai_military_attack(), and find_best_city_placement().

◆ dai_is_ferry_type()

bool dai_is_ferry_type ( const struct unit_type pferry,
struct ai_type ait 
)

Print the list of boats of pplayer. Should unit type be considered a ferry?

Definition at line 149 of file aiferry.c.

Referenced by kill_something_with().

◆ dai_manage_ferryboat()

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

It's about 12 feet square and has a capacity of almost 1000 pounds. It is well constructed of teak, and looks seaworthy.

Manage ferryboat. If there is a passenger-in-charge, we let it drive the boat. If there isn't, appoint one from those we have on board.

If there is no one aboard, look for potential cargo. If none found, explore and then go to the nearest port.

Definition at line 1113 of file aiferry.c.

Referenced by dai_manage_unit().

◆ is_boat_free()

bool is_boat_free ( struct ai_type ait,
struct unit boat,
struct unit punit,
int  cap 
)

Runs a few checks to determine if "boat" is a free boat that can carry "cap" units of the same type as "punit" over sea.

Definition at line 438 of file aiferry.c.

Referenced by dai_military_attack_barbarian(), and find_something_to_kill().

◆ is_boss_of_boat()

bool is_boss_of_boat ( struct ai_type ait,
struct unit punit 
)

Check if unit is boss in ferry

Definition at line 471 of file aiferry.c.

Referenced by dai_manage_barbarian_leader().