Support VERSION_REVTYPE git builds on cleanup_checkout.sh
[freeciv.git] / client / climisc.h
blobb413ec68b3459fd47a73e7315a79e12fa435e620
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__CLIMISC_H
14 #define FC__CLIMISC_H
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
20 /* common */
21 #include "fc_types.h"
22 #include "featured_text.h" /* struct ft_color */
23 #include "events.h"
24 #include "unittype.h"
25 #include "unitlist.h"
27 struct Clause;
28 struct nation_type;
29 struct nation_set;
31 typedef int cid;
33 void client_remove_player(int plrno);
34 void client_remove_city(struct city *pcity);
35 void client_remove_unit(struct unit *punit);
37 void client_change_all(struct universal *from,
38 struct universal *to);
40 const char *get_embassy_status(const struct player *me,
41 const struct player *them);
42 const char *get_vision_status(const struct player *me,
43 const struct player *them);
44 void client_diplomacy_clause_string(char *buf, int bufsiz,
45 struct Clause *pclause);
47 void global_warming_scaled(int *chance, int *rate, int max);
48 void nuclear_winter_scaled(int *chance, int *rate, int max);
50 struct sprite *client_research_sprite(void);
51 struct sprite *client_warming_sprite(void);
52 struct sprite *client_cooling_sprite(void);
53 struct sprite *client_government_sprite(void);
55 void center_on_something(void);
57 /*
58 * A compound id (cid) can hold all objects a city can build:
59 * improvements (with wonders) and units. This is achieved by
60 * seperation the value set: a cid < B_LAST denotes a improvement
61 * (including wonders). A cid >= B_LAST denotes a unit with the
62 * unit_type_id of (cid - B_LAST).
65 cid cid_encode(struct universal target);
66 cid cid_encode_unit(struct unit_type *punittype);
67 cid cid_encode_building(struct impr_type *pimprove);
68 cid cid_encode_from_city(const struct city *pcity);
70 struct universal cid_decode(cid cid);
71 #define cid_production cid_decode
73 bool city_unit_supported(const struct city *pcity,
74 const struct universal *target);
75 bool city_unit_present(const struct city *pcity,
76 const struct universal *target);
77 bool city_building_present(const struct city *pcity,
78 const struct universal *target);
80 struct item {
81 struct universal item;
82 char descr[MAX_LEN_NAME + 40];
85 typedef bool (*TestCityFunc)(const struct city *, const struct universal *);
87 #define MAX_NUM_PRODUCTION_TARGETS (U_LAST + B_LAST)
88 void name_and_sort_items(struct universal *targets, int num_items,
89 struct item *items,
90 bool show_cost, struct city *pcity);
91 int collect_production_targets(struct universal *targets,
92 struct city **selected_cities,
93 int num_selected_cities, bool append_units,
94 bool append_wonders, bool change_prod,
95 TestCityFunc test_func);
96 int collect_currently_building_targets(struct universal *targets);
97 int collect_buildable_targets(struct universal *targets);
98 int collect_eventually_buildable_targets(struct universal *targets,
99 struct city *pcity,
100 bool advanced_tech);
101 int collect_already_built_targets(struct universal *targets,
102 struct city *pcity);
104 /* the number of units in city */
105 int num_present_units_in_city(struct city* pcity);
106 int num_supported_units_in_city(struct city* pcity);
108 void handle_event(const char *featured_text, struct tile *ptile,
109 enum event_type event, int turn, int phase, int conn_id);
110 void create_event(struct tile *ptile, enum event_type event,
111 const struct ft_color color, const char *format, ...)
112 fc__attribute((__format__ (__printf__, 4, 5)));
114 struct city *get_nearest_city(const struct unit *punit, int *sq_dist);
116 void cityrep_buy(struct city *pcity);
117 void common_taxrates_callback(int i);
119 bool can_units_do_connect(struct unit_list *punits,
120 enum unit_activity activity,
121 struct extra_type *tgt);
123 bool can_unit_act_against_own_tile(struct unit *punit);
124 bool can_units_act_against_own_tile(struct unit_list *punits);
126 void client_unit_init_act_prob_cache(struct unit *punit);
128 enum unit_bg_color_type { UNIT_BG_HP_LOSS,
129 UNIT_BG_LAND,
130 UNIT_BG_SEA,
131 UNIT_BG_AMPHIBIOUS,
132 UNIT_BG_FLYING };
134 enum unit_bg_color_type unit_color_type(const struct unit_type *punittype);
136 void buy_production_in_selected_cities(void);
138 void unit_focus_set_status(struct player *pplayer);
140 void client_player_init(struct player *pplayer);
142 void client_player_maps_reset(void);
144 bool mapimg_client_define(void);
145 bool mapimg_client_createmap(const char *filename);
147 struct nation_set *client_current_nation_set(void);
148 bool client_nation_is_in_current_set(const struct nation_type *pnation);
150 #ifdef __cplusplus
152 #endif /* __cplusplus */
154 #endif /* FC__CLIMISC_H */