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)
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
18 #endif /* __cplusplus */
23 #define SINGLE_MOVE (terrain_control.move_fragments)
24 #define MOVE_COST_IGTER (terrain_control.igter_cost)
29 enum unit_move_result
{
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. */
41 MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_CITY
,
42 MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_UNIT
,
43 MR_NO_TRANSPORTER_CAPACITY
,
48 int unit_move_rate(const struct unit
*punit
);
49 bool unit_can_defend_here(const struct unit
*punit
);
50 bool can_attack_non_native(const struct unit_type
*utype
);
51 bool can_attack_from_non_native(const struct unit_type
*utype
);
53 bool is_sailing_unit(const struct unit
*punit
);
54 bool is_ground_unit(const struct unit
*punit
);
55 bool is_sailing_unittype(const struct unit_type
*punittype
);
56 bool is_ground_unittype(const struct unit_type
*punittype
);
58 bool is_city_channel_tile(const struct unit_class
*punitclass
,
59 const struct tile
*ptile
,
60 const struct tile
*pexclude
);
62 bool is_native_tile(const struct unit_type
*punittype
,
63 const struct tile
*ptile
);
64 bool is_native_tile_to_class(const struct unit_class
*punitclass
,
65 const struct tile
*ptile
);
66 bool is_native_terrain(const struct unit_type
*punittype
,
67 const struct terrain
*pterrain
,
68 bv_bases bases
, bv_roads roads
);
69 bool is_native_to_class(const struct unit_class
*punitclass
,
70 const struct terrain
*pterrain
,
71 bv_bases bases
, bv_roads roads
);
72 bool is_native_near_tile(const struct unit_class
*uclass
, const struct tile
*ptile
);
73 bool can_exist_at_tile(const struct unit_type
*utype
,
74 const struct tile
*ptile
);
75 bool can_unit_exist_at_tile(const struct unit
*punit
, const struct tile
*ptile
);
76 bool can_unit_survive_at_tile(const struct unit
*punit
,
77 const struct tile
*ptile
);
78 bool can_step_taken_wrt_to_zoc(const struct unit_type
*punittype
,
79 const struct player
*unit_owner
,
80 const struct tile
*src_tile
,
81 const struct tile
*dst_tile
);
82 bool zoc_ok_move(const struct unit
*punit
, const struct tile
*ptile
);
83 bool unit_can_move_to_tile(const struct unit
*punit
,
84 const struct tile
*ptile
,
87 unit_move_to_tile_test(const struct unit
*punit
,
88 enum unit_activity activity
,
89 const struct tile
*src_tile
,
90 const struct tile
*dst_tile
,
92 bool can_unit_transport(const struct unit
*transporter
, const struct unit
*transported
);
93 bool can_unit_type_transport(const struct unit_type
*transporter
,
94 const struct unit_class
*transported
);
95 int unit_class_transporter_capacity(const struct tile
*ptile
,
96 const struct player
*pplayer
,
97 const struct unit_class
*pclass
);
98 struct unit
*transport_from_tile(const struct unit
*punit
,
99 const struct tile
*ptile
);
101 void init_move_fragments(void);
102 const char *move_points_text_full(int mp
, bool reduce
, const char *prefix
,
103 const char *none
, bool align
);
104 const char *move_points_text(int mp
, bool reduce
);
108 #endif /* __cplusplus */
110 #endif /* FC__MOVEMENT_H */