webperimental: killstack decides stack protects.
[freeciv.git] / server / citytools.h
blob1306ba12db88eeca49e1ac1662cc36c031c9e58a
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__CITYTOOLS_H
14 #define FC__CITYTOOLS_H
16 /* common */
17 #include "events.h" /* enum event_type */
18 #include "packets.h"
19 #include "unitlist.h"
21 #define LOG_BUILD_TARGET LOG_DEBUG
23 #define SPECLIST_TAG traderoute_packet
24 #define SPECLIST_TYPE struct packet_traderoute_info
25 #include "speclist.h"
26 #define traderoute_packet_list_iterate(ptrlist, ptr) \
27 TYPED_LIST_ITERATE(struct packet_traderoute_info, ptrlist, ptr)
28 #define traderoute_packet_list_iterate_end LIST_ITERATE_END
30 int build_points_left(struct city *pcity);
31 int do_make_unit_veteran(struct city *pcity,
32 const struct unit_type *punittype);
34 void transfer_city_units(struct player *pplayer, struct player *pvictim,
35 struct unit_list *units, struct city *pcity,
36 struct city *exclude_city,
37 int kill_outside, bool verbose);
38 bool transfer_city(struct player *ptaker, struct city *pcity,
39 int kill_outside, bool transfer_unit_verbose,
40 bool resolve_stack, bool raze, bool build_free);
41 struct city *find_closest_city(const struct tile *ptile,
42 const struct city *pexclcity,
43 const struct player *pplayer,
44 bool only_ocean, bool only_continent,
45 bool only_known, bool only_player,
46 bool only_enemy, const struct unit_class *pclass);
47 bool unit_conquer_city(struct unit *punit, struct city *pcity);
49 bool send_city_suppression(bool now);
50 void send_city_info(struct player *dest, struct city *pcity);
51 void send_city_info_at_tile(struct player *pviewer, struct conn_list *dest,
52 struct city *pcity, struct tile *ptile);
53 void send_all_known_cities(struct conn_list *dest);
54 void send_player_cities(struct player *pplayer);
55 void package_city(struct city *pcity, struct packet_city_info *packet,
56 struct packet_web_city_info_addition *web_packet,
57 struct traderoute_packet_list *routes,
58 bool dipl_invest);
60 void reality_check_city(struct player *pplayer, struct tile *ptile);
61 bool update_dumb_city(struct player *pplayer, struct city *pcity);
62 void refresh_dumb_city(struct city *pcity);
63 void remove_dumb_city(struct player *pplayer, struct tile *ptile);
65 void city_build_free_buildings(struct city *pcity);
67 void create_city(struct player *pplayer, struct tile *ptile,
68 const char *name, struct player *nationality);
69 void remove_city(struct city *pcity);
71 void establish_trade_route(struct city *pc1, struct city *pc2);
72 struct trade_route *remove_trade_route(struct city *pc1, struct trade_route *proute,
73 bool announce, bool source_gone);
75 void do_sell_building(struct player *pplayer, struct city *pcity,
76 struct impr_type *pimprove);
77 void building_lost(struct city *pcity, const struct impr_type *pimprove);
78 void city_units_upkeep(const struct city *pcity);
80 bool is_production_equal(const struct universal *one,
81 const struct universal *two);
82 void change_build_target(struct player *pplayer, struct city *pcity,
83 struct universal *target,
84 enum event_type event);
86 bool is_allowed_city_name(struct player *pplayer, const char *cityname,
87 char *error_buf, size_t bufsz);
88 const char *city_name_suggestion(struct player *pplayer, struct tile *ptile);
90 void city_freeze_workers(struct city *pcity);
91 void city_thaw_workers(struct city *pcity);
92 void city_freeze_workers_queue(struct city *pcity);
93 void city_thaw_workers_queue(void);
95 /* city map functions */
96 void city_map_update_empty(struct city *pcity, struct tile *ptile);
97 void city_map_update_worker(struct city *pcity, struct tile *ptile);
99 bool city_map_update_tile_frozen(struct tile *ptile);
100 bool city_map_update_tile_now(struct tile *ptile);
102 void city_map_update_all(struct city *pcity);
103 void city_map_update_all_cities_for_player(struct player *pplayer);
105 bool city_map_update_radius_sq(struct city *pcity);
107 void city_landlocked_sell_coastal_improvements(struct tile *ptile);
108 void city_refresh_vision(struct city *pcity);
109 void refresh_player_cities_vision(struct player *pplayer);
111 void sync_cities(void);
113 void clear_worker_task(struct city *pcity, struct worker_task *ptask);
114 void clear_worker_tasks(struct city *pcity);
115 void package_and_send_worker_tasks(struct city *pcity);
117 #endif /* FC__CITYTOOLS_H */