Freeciv21
Develop your civilization from humble roots to a global empire
pf_tools.h
Go to the documentation of this file.
1 /**************************************************************************
2  Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3  __ __ part of Freeciv21. Freeciv21 is free software: you can
4 / \\..// \ redistribute it and/or modify it under the terms of the GNU
5  ( oo ) General Public License as published by the Free Software
6  \__/ Foundation, either version 3 of the License, or (at your
7  option) any later version. You should have received
8  a copy of the GNU General Public License along with Freeciv21. If not,
9  see https://www.gnu.org/licenses/.
10 **************************************************************************/
11 #pragma once
12 
13 /* common/aicore */
14 #include "path_finding.h"
15 
16 /*
17  * Use to create 'amphibious' paths. An amphibious path starts on a sea tile,
18  * perhaps goes over some other sea tiles, then perhaps goes over some land
19  * tiles. This is suitable for a land unit riding on a ferry.
20  * If you want, you can use different call-backs for the land and sea legs,
21  * by changing the 'land' and 'sea' fields.
22  * Initialise the 'land' and 'sea' fields as you like, then initialise the
23  * other fields using using pft_fill_amphibious_parameter().
24  * Give the 'combined' field to pf_create_map to create a map
25  * for finding the path.
26  */
28  // The caller must initialize these.
29  struct pf_parameter land, sea;
30 
31  // Initialized in pft_fill_amphibious_parameter; do not touch.
33  struct pf_parameter combined;
34 };
35 
36 void pft_fill_unit_parameter(struct pf_parameter *parameter,
37  const struct unit *punit);
38 void pft_fill_unit_overlap_param(struct pf_parameter *parameter,
39  const struct unit *punit);
40 void pft_fill_unit_attack_param(struct pf_parameter *parameter,
41  const struct unit *punit);
42 
43 void pft_fill_utype_parameter(struct pf_parameter *parameter,
44  const struct unit_type *punittype,
45  struct tile *pstart_tile,
46  struct player *pplayer);
47 void pft_fill_utype_overlap_param(struct pf_parameter *parameter,
48  const struct unit_type *punittype,
49  struct tile *pstart_tile,
50  struct player *pplayer);
51 void pft_fill_reverse_parameter(struct pf_parameter *parameter,
52  struct tile *target_tile);
53 
55 enum tile_behavior no_fights_or_unknown(const struct tile *ptile,
56  enum known_type known,
57  const struct pf_parameter *param);
58 enum tile_behavior no_fights(const struct tile *ptile, enum known_type known,
59  const struct pf_parameter *param);
60 enum tile_behavior no_intermediate_fights(const struct tile *ptile,
61  enum known_type known,
62  const struct pf_parameter *param);
tile_behavior
Definition: path_finding.h:276
void pft_fill_reverse_parameter(struct pf_parameter *parameter, struct tile *target_tile)
Fill default parameters for reverse map.
Definition: pf_tools.cpp:923
void pft_fill_utype_overlap_param(struct pf_parameter *parameter, const struct unit_type *punittype, struct tile *pstart_tile, struct player *pplayer)
Switch on one tile overlapping into the non-native terrain.
Definition: pf_tools.cpp:857
enum tile_behavior no_fights(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
PF callback to prohibit attacking anyone.
Definition: pf_tools.cpp:484
void pft_fill_unit_overlap_param(struct pf_parameter *parameter, const struct unit *punit)
Switch on one tile overlapping into the non-native terrain.
Definition: pf_tools.cpp:871
void pft_fill_unit_parameter(struct pf_parameter *parameter, const struct unit *punit)
Fill classic parameters for an unit.
Definition: pf_tools.cpp:822
enum tile_behavior no_intermediate_fights(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
PF callback to prohibit attacking anyone, except at the destination.
Definition: pf_tools.cpp:499
void pft_fill_unit_attack_param(struct pf_parameter *parameter, const struct unit *punit)
pft_fill_*_attack_param() base function.
Definition: pf_tools.cpp:913
void pft_fill_utype_parameter(struct pf_parameter *parameter, const struct unit_type *punittype, struct tile *pstart_tile, struct player *pplayer)
Fill classic parameters for an unit type.
Definition: pf_tools.cpp:809
enum tile_behavior no_fights_or_unknown(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
PF callback to prohibit going into the unknown.
Definition: pf_tools.cpp:469
void pft_fill_amphibious_parameter(struct pft_amphibious *parameter)
Fill parameters for combined sea-land movement.
Definition: pf_tools.cpp:955
int land_scale
Definition: pf_tools.h:32
struct pf_parameter combined
Definition: pf_tools.h:33
struct pf_parameter land sea
Definition: pf_tools.h:29
Definition: player.h:231
Definition: tile.h:42
Definition: unit.h:134
known_type
Definition: tile.h:28