Freeciv-3.3
Loading...
Searching...
No Matches
aiferry.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2002 - The Freeciv Project
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__AIFERRY_H
14#define FC__AIFERRY_H
15
16#include "support.h" /* bool type */
17
18#include "fc_types.h"
19
20struct pf_path;
21struct pft_amphibious;
22
23bool dai_is_ferry_type(const struct unit_type *pferry, struct ai_type *ait);
24bool dai_is_ferry(struct unit *pferry, struct ai_type *ait);
25
26/*
27 * Initialize ferrybaot-related statistics in the ai data.
28 */
29void aiferry_init_stats(struct ai_type *ait, struct player *pplayer);
30
31/*
32 * Find the nearest boat. Can be called from inside the continents too
33 */
34int aiferry_find_boat(struct ai_type *ait, struct unit *punit,
35 int cap, struct pf_path **path);
36
37/*
38 * How many boats are available
39 */
40int aiferry_avail_boats(struct ai_type *ait, struct player *pplayer);
41
42/*
43 * Initializes aiferry stats for a new unit
44 */
45void dai_ferry_init_ferry(struct ai_type *ait, struct unit *ferry);
46void dai_ferry_lost(struct ai_type *ait, struct unit *punit);
47void dai_ferry_transformed(struct ai_type *ait, struct unit *ferry,
48 const struct unit_type *old);
49
50/*
51 * Release the boat reserved in punit's ai.ferryboat field.
52 */
53void aiferry_clear_boat(struct ai_type *ait, struct unit *punit);
54
55/*
56 * Go to the destination by hitching a ride on a boat. Will try to find
57 * a beachhead but it works better if dst_tile is on the coast.
58 * Loads a bodyguard too, if necessary.
59 */
60bool aiferry_gobyboat(struct ai_type *ait, struct player *pplayer,
61 struct unit *punit, struct tile *dst_tile,
62 bool with_bodyguard);
63/*
64 * Go to the destination on a particular boat. Will try to find
65 * a beachhead but it works better if ptile is on the coast.
66 */
67bool aiferry_goto_amphibious(struct ai_type *ait, struct unit *ferry,
68 struct unit *passenger, struct tile *ptile);
69
71 struct unit *ferry,
72 struct unit *passenger,
73 struct tile *ptile,
74 struct pft_amphibious *parameter);
75
76bool is_boat_free(struct ai_type *ait, struct unit *boat,
77 struct unit *punit, int cap);
78bool is_boss_of_boat(struct ai_type *ait, struct unit *punit);
79
80/*
81 * Main boat managing function. Gets units on board to where they want to
82 * go and then looks for new passengers or (if it fails) for a city which
83 * will build a passenger soon.
84 */
85void dai_manage_ferryboat(struct ai_type *ait, struct player *pplayer,
86 struct unit *punit);
87
88#endif /* FC__AIFERRY_H */
int aiferry_find_boat(struct ai_type *ait, struct unit *punit, int cap, struct pf_path **path)
Definition aiferry.c:495
void dai_manage_ferryboat(struct ai_type *ait, struct player *pplayer, struct unit *punit)
Definition aiferry.c:1113
bool is_boat_free(struct ai_type *ait, struct unit *boat, struct unit *punit, int cap)
Definition aiferry.c:438
bool dai_is_ferry_type(const struct unit_type *pferry, struct ai_type *ait)
Definition aiferry.c:149
void aiferry_init_stats(struct ai_type *ait, struct player *pplayer)
Definition aiferry.c:92
void dai_ferry_lost(struct ai_type *ait, struct unit *punit)
Definition aiferry.c:221
void dai_ferry_transformed(struct ai_type *ait, struct unit *ferry, const struct unit_type *old)
Definition aiferry.c:189
bool aiferry_goto_amphibious(struct ai_type *ait, struct unit *ferry, struct unit *passenger, struct tile *ptile)
Definition aiferry.c:730
bool is_boss_of_boat(struct ai_type *ait, struct unit *punit)
Definition aiferry.c:471
int aiferry_avail_boats(struct ai_type *ait, struct player *pplayer)
Definition aiferry.c:353
bool dai_amphibious_goto_constrained(struct ai_type *ait, struct unit *ferry, struct unit *passenger, struct tile *ptile, struct pft_amphibious *parameter)
Definition aiferry.c:634
bool dai_is_ferry(struct unit *pferry, struct ai_type *ait)
Definition aiferry.c:159
void dai_ferry_init_ferry(struct ai_type *ait, struct unit *ferry)
Definition aiferry.c:167
void aiferry_clear_boat(struct ai_type *ait, struct unit *punit)
Definition aiferry.c:251
bool aiferry_gobyboat(struct ai_type *ait, struct player *pplayer, struct unit *punit, struct tile *dst_tile, bool with_bodyguard)
Definition aiferry.c:764
char * incite_cost
Definition comments.c:76
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
Definition ai.h:50
Definition tile.h:50
Definition unit.h:140