Freeciv-3.2
Loading...
Searching...
No Matches
movement.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
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__MOVEMENT_H
14#define FC__MOVEMENT_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* common */
21#include "fc_types.h"
22#include "map.h"
23
24struct tile;
25
26#define SINGLE_MOVE (terrain_control.move_fragments)
27#define MOVE_COST_IGTER (terrain_control.igter_cost)
28/* packets.def MOVEFRAGS */
29#define MAX_MOVE_FRAGS 65535
30
31struct unit_type;
32struct terrain;
33
55
56int utype_move_rate(const struct unit_type *utype, const struct tile *ptile,
57 const struct player *pplayer, int veteran_level,
58 int hitpoints);
59int unit_move_rate(const struct unit *punit);
60int utype_unknown_move_cost(const struct unit_type *utype);
61
62bool unit_can_defend_here(const struct civ_map *nmap, const struct unit *punit);
63bool can_attack_non_native_hard_reqs(const struct unit_type *utype);
64bool can_attack_non_native(const struct unit_type *utype);
65bool can_attack_from_non_native(const struct unit_type *utype);
66
67bool is_city_channel_tile(const struct civ_map *nmap,
68 const struct unit_class *punitclass,
69 const struct tile *ptile,
70 const struct tile *pexclude);
71
72bool is_native_tile(const struct unit_type *punittype,
73 const struct tile *ptile);
74
76 const struct terrain *pterrain,
77 const bv_extras *extras);
78
79/****************************************************************************
80 Check if this tile is native to given unit class.
81
82 See is_native_to_class()
83****************************************************************************/
84static inline bool is_native_tile_to_class(const struct unit_class *punitclass,
85 const struct tile *ptile)
86{
88 tile_extras(ptile));
89}
90
91bool is_native_move(const struct civ_map *nmap,
92 const struct unit_class *punitclass,
93 const struct tile *src_tile,
94 const struct tile *dst_tile);
95bool is_native_near_tile(const struct civ_map *nmap,
96 const struct unit_class *uclass,
97 const struct tile *ptile);
98bool can_exist_at_tile(const struct civ_map *nmap,
99 const struct unit_type *utype,
100 const struct tile *ptile);
101bool can_unit_exist_at_tile(const struct civ_map *nmap,
102 const struct unit *punit, const struct tile *ptile);
103bool can_unit_survive_at_tile(const struct civ_map *nmap,
104 const struct unit *punit,
105 const struct tile *ptile);
107 const struct player *unit_owner,
108 const struct tile *src_tile,
109 const struct tile *dst_tile,
110 const struct civ_map *zmap);
111bool unit_can_move_to_tile(const struct civ_map *nmap,
112 const struct unit *punit,
113 const struct tile *ptile,
114 bool igzoc,
115 bool enter_transport,
116 bool enter_enemy_city);
117bool unit_can_teleport_to_tile(const struct civ_map *nmap,
118 const struct unit *punit,
119 const struct tile *ptile,
120 bool enter_transport,
121 bool enter_enemy_city);
124 const struct unit *punit,
125 enum unit_activity activity,
126 const struct tile *src_tile,
127 const struct tile *dst_tile,
128 bool igzoc,
129 bool enter_transport, struct unit *embark_to,
130 bool enter_enemy_city);
133 const struct unit *punit,
134 enum unit_activity activity,
135 const struct tile *src_tile,
136 const struct tile *dst_tile,
137 bool enter_transport, struct unit *embark_to,
138 bool enter_enemy_city);
139bool can_unit_transport(const struct unit *transporter, const struct unit *transported);
140bool can_unit_type_transport(const struct unit_type *transporter,
141 const struct unit_class *transported);
142bool unit_can_load(const struct unit *punit);
143bool unit_could_load_at(const struct unit *punit, const struct tile *ptile);
144
145void init_move_fragments(void);
146const char *move_points_text_full(int mp, bool reduce, const char *prefix,
147 const char *none, bool align);
148const char *move_points_text(int mp, bool reduce);
149
150#ifdef __cplusplus
151}
152#endif /* __cplusplus */
153
154#endif /* FC__MOVEMENT_H */
char * incite_cost
Definition comments.c:75
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
static struct extra_type extras[MAX_EXTRA_TYPES]
Definition extras.c:31
const char * move_points_text(int mp, bool reduce)
Definition movement.c:1015
bool unit_can_move_to_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile, bool igzoc, bool enter_transport, bool enter_enemy_city)
Definition movement.c:572
const char * move_points_text_full(int mp, bool reduce, const char *prefix, const char *none, bool align)
Definition movement.c:948
bool can_exist_at_tile(const struct civ_map *nmap, const struct unit_type *utype, const struct tile *ptile)
Definition movement.c:290
enum unit_move_result unit_move_to_tile_test(const struct civ_map *nmap, const struct unit *punit, enum unit_activity activity, const struct tile *src_tile, const struct tile *dst_tile, bool igzoc, bool enter_transport, struct unit *embark_to, bool enter_enemy_city)
Definition movement.c:630
bool can_unit_exist_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
Definition movement.c:319
bool is_native_tile(const struct unit_type *punittype, const struct tile *ptile)
Definition movement.c:331
bool can_step_taken_wrt_to_zoc(const struct unit_type *punittype, const struct player *unit_owner, const struct tile *src_tile, const struct tile *dst_tile, const struct civ_map *zmap)
Definition movement.c:542
int utype_unknown_move_cost(const struct unit_type *utype)
Definition movement.c:105
bool unit_can_load(const struct unit *punit)
Definition movement.c:883
bool can_unit_transport(const struct unit *transporter, const struct unit *transported)
Definition movement.c:855
int unit_move_rate(const struct unit *punit)
Definition movement.c:90
bool unit_could_load_at(const struct unit *punit, const struct tile *ptile)
Definition movement.c:911
bool can_attack_non_native_hard_reqs(const struct unit_type *utype)
Definition movement.c:204
static bool is_native_tile_to_class(const struct unit_class *punitclass, const struct tile *ptile)
Definition movement.h:84
bool can_attack_from_non_native(const struct unit_type *utype)
Definition movement.c:227
unit_move_result
Definition movement.h:34
@ MR_CANNOT_DISEMBARK
Definition movement.h:48
@ MR_OK
Definition movement.h:35
@ MR_RANDOM_ONLY
Definition movement.h:52
@ MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_UNIT
Definition movement.h:45
@ MR_TRIREME
Definition movement.h:47
@ MR_NON_NATIVE_MOVE
Definition movement.h:49
@ MR_BAD_MAP_POSITION
Definition movement.h:43
@ MR_BAD_ACTIVITY
Definition movement.h:41
@ MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_CITY
Definition movement.h:44
@ MR_ANIMAL_DISALLOWED
Definition movement.h:50
@ MR_PEACE
Definition movement.h:39
@ MR_ZOC
Definition movement.h:40
@ MR_NOT_ALLOWED
Definition movement.h:53
@ MR_DEATH
Definition movement.h:36
@ MR_NO_WAR
Definition movement.h:38
@ MR_BAD_DESTINATION
Definition movement.h:42
@ MR_NO_TRANSPORTER_CAPACITY
Definition movement.h:46
@ MR_UNIT_STAY
Definition movement.h:51
@ MR_PAUSE
Definition movement.h:37
bool unit_can_teleport_to_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile, bool enter_transport, bool enter_enemy_city)
Definition movement.c:592
enum unit_move_result unit_teleport_to_tile_test(const struct civ_map *nmap, const struct unit *punit, enum unit_activity activity, const struct tile *src_tile, const struct tile *dst_tile, bool enter_transport, struct unit *embark_to, bool enter_enemy_city)
Definition movement.c:774
bool unit_can_defend_here(const struct civ_map *nmap, const struct unit *punit)
Definition movement.c:174
bool is_native_move(const struct civ_map *nmap, const struct unit_class *punitclass, const struct tile *src_tile, const struct tile *dst_tile)
Definition movement.c:373
bool is_native_to_class(const struct unit_class *punitclass, const struct terrain *pterrain, const bv_extras *extras)
Definition movement.c:342
int utype_move_rate(const struct unit_type *utype, const struct tile *ptile, const struct player *pplayer, int veteran_level, int hitpoints)
Definition movement.c:47
bool is_city_channel_tile(const struct civ_map *nmap, const struct unit_class *punitclass, const struct tile *ptile, const struct tile *pexclude)
Definition movement.c:243
bool can_unit_survive_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
Definition movement.c:491
bool is_native_near_tile(const struct civ_map *nmap, const struct unit_class *uclass, const struct tile *ptile)
Definition movement.c:465
bool can_unit_type_transport(const struct unit_type *transporter, const struct unit_class *transported)
Definition movement.c:868
void init_move_fragments(void)
Definition movement.c:927
bool can_attack_non_native(const struct unit_type *utype)
Definition movement.c:214
Definition tile.h:50
Definition unit.h:138
#define tile_terrain(_tile)
Definition tile.h:110
static const bv_extras * tile_extras(const struct tile *ptile)
Definition tile.h:120
#define unit_owner(_pu)
Definition unit.h:396