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__CITYTOOLS_H
14 #define FC__CITYTOOLS_H
17 #include "events.h" /* enum event_type */
21 int build_points_left(struct city
*pcity
);
22 int do_make_unit_veteran(struct city
*pcity
,
23 const struct unit_type
*punittype
);
25 void transfer_city_units(struct player
*pplayer
, struct player
*pvictim
,
26 struct unit_list
*units
, struct city
*pcity
,
27 struct city
*exclude_city
,
28 int kill_outside
, bool verbose
);
29 bool transfer_city(struct player
*ptaker
, struct city
*pcity
,
30 int kill_outside
, bool transfer_unit_verbose
,
31 bool resolve_stack
, bool raze
, bool build_free
);
32 struct city
*find_closest_city(const struct tile
*ptile
,
33 const struct city
*pexclcity
,
34 const struct player
*pplayer
,
35 bool only_ocean
, bool only_continent
,
36 bool only_known
, bool only_player
,
37 bool only_enemy
, const struct unit_class
*pclass
);
38 void unit_enter_city(struct unit
*punit
, struct city
*pcity
, bool passenger
);
40 bool send_city_suppression(bool now
);
41 void send_city_info(struct player
*dest
, struct city
*pcity
);
42 void send_city_info_at_tile(struct player
*pviewer
, struct conn_list
*dest
,
43 struct city
*pcity
, struct tile
*ptile
);
44 void send_all_known_cities(struct conn_list
*dest
);
45 void send_player_cities(struct player
*pplayer
);
46 void package_city(struct city
*pcity
, struct packet_city_info
*packet
,
49 void reality_check_city(struct player
*pplayer
, struct tile
*ptile
);
50 bool update_dumb_city(struct player
*pplayer
, struct city
*pcity
);
51 void refresh_dumb_city(struct city
*pcity
);
52 void remove_dumb_city(struct player
*pplayer
, struct tile
*ptile
);
54 void city_build_free_buildings(struct city
*pcity
);
56 void create_city(struct player
*pplayer
, struct tile
*ptile
,
57 const char *name
, struct player
*nationality
);
58 void remove_city(struct city
*pcity
);
60 void establish_trade_route(struct city
*pc1
, struct city
*pc2
);
61 void remove_trade_route(struct city
*pc1
, struct city
*pc2
,
62 bool announce
, bool source_gone
);
64 void do_sell_building(struct player
*pplayer
, struct city
*pcity
,
65 struct impr_type
*pimprove
);
66 void building_lost(struct city
*pcity
, const struct impr_type
*pimprove
);
67 void city_units_upkeep(const struct city
*pcity
);
69 bool is_production_equal(const struct universal
*one
,
70 const struct universal
*two
);
71 void change_build_target(struct player
*pplayer
, struct city
*pcity
,
72 struct universal
*target
,
73 enum event_type event
);
75 bool is_allowed_city_name(struct player
*pplayer
, const char *cityname
,
76 char *error_buf
, size_t bufsz
);
77 const char *city_name_suggestion(struct player
*pplayer
, struct tile
*ptile
);
79 void city_freeze_workers(struct city
*pcity
);
80 void city_thaw_workers(struct city
*pcity
);
81 void city_freeze_workers_queue(struct city
*pcity
);
82 void city_thaw_workers_queue(void);
84 /* city map functions */
85 void city_map_update_empty(struct city
*pcity
, struct tile
*ptile
);
86 void city_map_update_worker(struct city
*pcity
, struct tile
*ptile
);
88 bool city_map_update_tile_frozen(struct tile
*ptile
);
89 bool city_map_update_tile_now(struct tile
*ptile
);
91 void city_map_update_all(struct city
*pcity
);
92 void city_map_update_all_cities_for_player(struct player
*pplayer
);
94 bool city_map_update_radius_sq(struct city
*pcity
);
96 void city_landlocked_sell_coastal_improvements(struct tile
*ptile
);
97 void city_refresh_vision(struct city
*pcity
);
98 void refresh_player_cities_vision(struct player
*pplayer
);
100 void sync_cities(void);
102 void clear_worker_task(struct city
*pcity
, struct worker_task
*ptask
);
103 void clear_worker_tasks(struct city
*pcity
);
104 void package_and_send_worker_tasks(struct city
*pcity
);
106 #endif /* FC__CITYTOOLS_H */