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
16 #include "events.h" /* enum event_type */
20 #define FOOD_WEIGHTING 25
21 #define SHIELD_WEIGHTING 14
22 #define TRADE_WEIGHTING 15
23 /* The Trade Weighting has to about as large as the Shield Weighting,
24 otherwise the AI will build Barracks to create veterans in cities
25 with only 1 shields production.
29 #define POLLUTION_WEIGHTING 16 /* tentative */
30 #define WARMING_FACTOR 50
31 #define COOLING_FACTOR WARMING_FACTOR
33 int build_points_left(struct city
*pcity
);
34 int do_make_unit_veteran(struct city
*pcity
,
35 const struct unit_type
*punittype
);
37 void transfer_city_units(struct player
*pplayer
, struct player
*pvictim
,
38 struct unit_list
*units
, struct city
*pcity
,
39 struct city
*exclude_city
,
40 int kill_outside
, bool verbose
);
41 bool transfer_city(struct player
*ptaker
, struct city
*pcity
,
42 int kill_outside
, bool transfer_unit_verbose
,
43 bool resolve_stack
, bool raze
, bool build_free
);
44 struct city
*find_closest_city(const struct tile
*ptile
,
45 const struct city
*pexclcity
,
46 const struct player
*pplayer
,
47 bool only_ocean
, bool only_continent
,
48 bool only_known
, bool only_player
,
49 bool only_enemy
, const struct unit_class
*pclass
);
50 void unit_enter_city(struct unit
*punit
, struct city
*pcity
, bool passenger
);
52 bool send_city_suppression(bool now
);
53 void send_city_info(struct player
*dest
, struct city
*pcity
);
54 void send_city_info_at_tile(struct player
*pviewer
, struct conn_list
*dest
,
55 struct city
*pcity
, struct tile
*ptile
);
56 void send_all_known_cities(struct conn_list
*dest
);
57 void send_player_cities(struct player
*pplayer
);
58 void package_city(struct city
*pcity
, struct packet_city_info
*packet
,
61 void reality_check_city(struct player
*pplayer
, struct tile
*ptile
);
62 bool update_dumb_city(struct player
*pplayer
, struct city
*pcity
);
63 void refresh_dumb_city(struct city
*pcity
);
64 void remove_dumb_city(struct player
*pplayer
, struct tile
*ptile
);
66 void city_build_free_buildings(struct city
*pcity
);
68 void create_city(struct player
*pplayer
, struct tile
*ptile
,
69 const char *name
, struct player
*nationality
);
70 void remove_city(struct city
*pcity
);
72 void establish_trade_route(struct city
*pc1
, struct city
*pc2
);
73 void remove_trade_route(struct city
*pc1
, struct city
*pc2
,
74 bool announce
, bool source_gone
);
76 void do_sell_building(struct player
*pplayer
, struct city
*pcity
,
77 struct impr_type
*pimprove
);
78 void building_lost(struct city
*pcity
, const struct impr_type
*pimprove
);
79 void city_units_upkeep(const struct city
*pcity
);
81 bool is_production_equal(const struct universal
*one
,
82 const struct universal
*two
);
83 void change_build_target(struct player
*pplayer
, struct city
*pcity
,
84 struct universal target
,
85 enum event_type event
);
87 bool is_allowed_city_name(struct player
*pplayer
, const char *cityname
,
88 char *error_buf
, size_t bufsz
);
89 const char *city_name_suggestion(struct player
*pplayer
, struct tile
*ptile
);
91 void city_freeze_workers(struct city
*pcity
);
92 void city_thaw_workers(struct city
*pcity
);
93 void city_freeze_workers_queue(struct city
*pcity
);
94 void city_thaw_workers_queue(void);
96 /* city map functions */
97 void city_map_update_empty(struct city
*pcity
, struct tile
*ptile
);
98 void city_map_update_worker(struct city
*pcity
, struct tile
*ptile
);
100 bool city_map_update_tile_frozen(struct tile
*ptile
);
101 bool city_map_update_tile_now(struct tile
*ptile
);
103 void city_map_update_all(struct city
*pcity
);
104 void city_map_update_all_cities_for_player(struct player
*pplayer
);
106 bool city_map_update_radius_sq(struct city
*pcity
);
108 void city_landlocked_sell_coastal_improvements(struct tile
*ptile
);
109 void city_refresh_vision(struct city
*pcity
);
111 void sync_cities(void);
113 #endif /* FC__CITYTOOLS_H */