Freeciv-3.1: /fast/freeciv/nightly/S3_1/ai/default/aiferry.h Source File

Freeciv-3.1

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
70bool dai_amphibious_goto_constrained(struct ai_type *ait,
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 */
aiferry_find_boat
int aiferry_find_boat(struct ai_type *ait, struct unit *punit, int cap, struct pf_path **path)
Definition aiferry.c:497
dai_manage_ferryboat
void dai_manage_ferryboat(struct ai_type *ait, struct player *pplayer, struct unit *punit)
Definition aiferry.c:1111
is_boat_free
bool is_boat_free(struct ai_type *ait, struct unit *boat, struct unit *punit, int cap)
Definition aiferry.c:440
dai_is_ferry_type
bool dai_is_ferry_type(const struct unit_type *pferry, struct ai_type *ait)
Definition aiferry.c:151
aiferry_init_stats
void aiferry_init_stats(struct ai_type *ait, struct player *pplayer)
Definition aiferry.c:94
dai_ferry_lost
void dai_ferry_lost(struct ai_type *ait, struct unit *punit)
Definition aiferry.c:223
dai_ferry_transformed
void dai_ferry_transformed(struct ai_type *ait, struct unit *ferry, const struct unit_type *old)
Definition aiferry.c:191
aiferry_goto_amphibious
bool aiferry_goto_amphibious(struct ai_type *ait, struct unit *ferry, struct unit *passenger, struct tile *ptile)
Definition aiferry.c:732
is_boss_of_boat
bool is_boss_of_boat(struct ai_type *ait, struct unit *punit)
Definition aiferry.c:473
aiferry_avail_boats
int aiferry_avail_boats(struct ai_type *ait, struct player *pplayer)
Definition aiferry.c:355
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)
Definition aiferry.c:636
dai_is_ferry
bool dai_is_ferry(struct unit *pferry, struct ai_type *ait)
Definition aiferry.c:161
dai_ferry_init_ferry
void dai_ferry_init_ferry(struct ai_type *ait, struct unit *ferry)
Definition aiferry.c:169
aiferry_clear_boat
void aiferry_clear_boat(struct ai_type *ait, struct unit *punit)
Definition aiferry.c:253
aiferry_gobyboat
bool aiferry_gobyboat(struct ai_type *ait, struct player *pplayer, struct unit *punit, struct tile *dst_tile, bool with_bodyguard)
Definition aiferry.c:766
punit
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:73
fc_types.h
ai_type
Definition ai.h:50
pf_path
Definition path_finding.h:344
pft_amphibious
Definition pf_tools.h:36
player
Definition player.h:249
tile
Definition tile.h:49
unit_type
Definition unittype.h:481
unit
Definition unit.h:138
support.h