Use linear-gradient instead of gtk css extension in gtk3.22-client theme
[freeciv.git] / common / movement.h
blob4c6b023f66619e63db491055ae232edbb70c60b6
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.
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
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
20 #include "fc_types.h"
21 #include "tile.h"
23 #define SINGLE_MOVE (terrain_control.move_fragments)
24 #define MOVE_COST_IGTER (terrain_control.igter_cost)
26 struct unit_type;
27 struct terrain;
29 enum unit_move_result {
30 MR_OK,
31 MR_DEATH,
32 MR_PAUSE,
33 MR_BAD_TYPE_FOR_CITY_TAKE_OVER,
34 MR_BAD_TYPE_FOR_CITY_TAKE_OVER_FROM_NON_NATIVE,
35 MR_NO_WAR, /* Can't move here without declaring war. */
36 MR_PEACE, /* Can't move here because of a peace treaty. */
37 MR_ZOC,
38 MR_BAD_ACTIVITY,
39 MR_BAD_DESTINATION,
40 MR_BAD_MAP_POSITION,
41 MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_CITY,
42 MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_UNIT,
43 MR_NO_TRANSPORTER_CAPACITY,
44 MR_TRIREME,
45 MR_CANNOT_DISEMBARK,
46 MR_NON_NATIVE_MOVE, /* Usually RMM_RELAXED road diagonally without link */
47 MR_ANIMAL_DISALLOWED,
48 MR_NOT_ALLOWED
51 int utype_move_rate(const struct unit_type *utype, const struct tile *ptile,
52 const struct player *pplayer, int veteran_level,
53 int hitpoints);
54 int unit_move_rate(const struct unit *punit);
55 int utype_unknown_move_cost(const struct unit_type *utype);
57 bool unit_can_defend_here(const struct unit *punit);
58 bool can_attack_non_native(const struct unit_type *utype);
59 bool can_attack_from_non_native(const struct unit_type *utype);
61 bool is_city_channel_tile(const struct unit_class *punitclass,
62 const struct tile *ptile,
63 const struct tile *pexclude);
65 bool is_native_tile(const struct unit_type *punittype,
66 const struct tile *ptile);
68 bool is_native_to_class(const struct unit_class *punitclass,
69 const struct terrain *pterrain,
70 const bv_extras *extras);
72 /****************************************************************************
73 Check if this tile is native to given unit class.
75 See is_native_to_class()
76 ****************************************************************************/
77 static inline bool is_native_tile_to_class(const struct unit_class *punitclass,
78 const struct tile *ptile)
80 return is_native_to_class(punitclass, tile_terrain(ptile),
81 tile_extras(ptile));
84 bool is_native_move(const struct unit_class *punitclass,
85 const struct tile *src_tile,
86 const struct tile *dst_tile);
87 bool is_native_near_tile(const struct unit_class *uclass, const struct tile *ptile);
88 bool can_exist_at_tile(const struct unit_type *utype,
89 const struct tile *ptile);
90 bool can_unit_exist_at_tile(const struct unit *punit, const struct tile *ptile);
91 bool can_unit_survive_at_tile(const struct unit *punit,
92 const struct tile *ptile);
93 bool can_step_taken_wrt_to_zoc(const struct unit_type *punittype,
94 const struct player *unit_owner,
95 const struct tile *src_tile,
96 const struct tile *dst_tile);
97 bool zoc_ok_move(const struct unit *punit, const struct tile *ptile);
98 bool unit_can_move_to_tile(const struct unit *punit,
99 const struct tile *ptile,
100 bool igzoc);
101 enum unit_move_result
102 unit_move_to_tile_test(const struct unit *punit,
103 enum unit_activity activity,
104 const struct tile *src_tile,
105 const struct tile *dst_tile,
106 bool igzoc,
107 struct unit *embark_to);
108 bool can_unit_transport(const struct unit *transporter, const struct unit *transported);
109 bool can_unit_type_transport(const struct unit_type *transporter,
110 const struct unit_class *transported);
111 bool unit_can_load(const struct unit *punit);
112 bool unit_could_load_at(const struct unit *punit, const struct tile *ptile);
114 void init_move_fragments(void);
115 const char *move_points_text_full(int mp, bool reduce, const char *prefix,
116 const char *none, bool align);
117 const char *move_points_text(int mp, bool reduce);
119 #ifdef __cplusplus
121 #endif /* __cplusplus */
123 #endif /* FC__MOVEMENT_H */