Freeciv-3.1
Loading...
Searching...
No Matches
citytools.h
Go to the documentation of this file.
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.
7
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
15
16/* common */
17#include "events.h" /* enum event_type */
18#include "packets.h"
19#include "unitlist.h"
20
21#define LOG_BUILD_TARGET LOG_DEBUG
22
23#define SPECLIST_TAG trade_route_packet
24#define SPECLIST_TYPE struct packet_trade_route_info
25#include "speclist.h"
26#define trade_route_packet_list_iterate(ptrlist, ptr) \
27 TYPED_LIST_ITERATE(struct packet_trade_route_info, ptrlist, ptr)
28#define trade_route_packet_list_iterate_end LIST_ITERATE_END
29
30int build_points_left(struct city *pcity);
31
32void transfer_city_units(struct player *pplayer, struct player *pvictim,
33 struct unit_list *units, struct city *pcity,
34 struct city *exclude_city,
35 int kill_outside, bool verbose);
36bool transfer_city(struct player *ptaker, struct city *pcity,
37 int kill_outside, bool transfer_unit_verbose,
38 bool resolve_stack, bool raze, bool build_free);
39struct city *find_closest_city(const struct tile *ptile,
40 const struct city *pexclcity,
41 const struct player *pplayer,
42 bool only_ocean, bool only_continent,
43 bool only_known, bool only_player,
44 bool only_enemy, const struct unit_class *pclass);
45bool unit_conquer_city(struct unit *punit, struct city *pcity);
46
47bool send_city_suppression(bool now);
48void send_city_info(struct player *dest, struct city *pcity);
49void send_city_info_at_tile(struct player *pviewer, struct conn_list *dest,
50 struct city *pcity, struct tile *ptile);
51void send_all_known_cities(struct conn_list *dest);
52void send_player_cities(struct player *pplayer);
53void broadcast_city_info(struct city *pcity);
54void package_city(struct city *pcity, struct packet_city_info *packet,
55 struct packet_city_nationalities *nat_packet,
56 struct packet_city_rally_point *rally_packet,
57 struct packet_web_city_info_addition *web_packet,
58 struct trade_route_packet_list *routes,
59 bool dipl_invest);
60
61void reality_check_city(struct player *pplayer, struct tile *ptile);
62bool update_dumb_city(struct player *pplayer, struct city *pcity);
63void refresh_dumb_city(struct city *pcity);
64void remove_dumb_city(struct player *pplayer, struct tile *ptile);
65
66void city_build_free_buildings(struct city *pcity);
67
68void create_city(struct player *pplayer, struct tile *ptile,
69 const char *name, struct player *nationality);
70bool create_city_for_player(struct player *pplayer, struct tile *ptile,
71 const char *name);
72void remove_city(struct city *pcity);
73
74struct trade_route *remove_trade_route(struct city *pc1,
75 struct trade_route *proute,
76 bool announce, bool source_gone);
77
78bool city_illness_strike(struct city *pcity);
79
80void do_sell_building(struct player *pplayer, struct city *pcity,
81 struct impr_type *pimprove, const char *reason);
82struct city
83*build_or_move_building(struct city *pcity, struct impr_type *pimprove,
84 struct player **oldcity_owner);
85bool building_removed(struct city *pcity, const struct impr_type *pimprove,
86 const char *reason, struct unit *destroyer);
87void building_lost(struct city *pcity, const struct impr_type *pimprove,
88 const char *reason, struct unit *destroyer);
89void city_units_upkeep(const struct city *pcity);
90
91bool is_production_equal(const struct universal *one,
92 const struct universal *two);
93void change_build_target(struct player *pplayer, struct city *pcity,
94 struct universal *target,
95 enum event_type event);
96
97bool is_allowed_city_name(struct player *pplayer, const char *cityname,
98 char *error_buf, size_t bufsz);
99const char *city_name_suggestion(struct player *pplayer, struct tile *ptile);
100
101void city_freeze_workers(struct city *pcity);
102void city_thaw_workers(struct city *pcity);
103void city_freeze_workers_queue(struct city *pcity);
104void city_thaw_workers_queue(void);
105
106/* city map functions */
107void city_map_update_empty(struct city *pcity, struct tile *ptile);
108void city_map_update_worker(struct city *pcity, struct tile *ptile);
109
110bool city_map_update_tile_frozen(struct tile *ptile);
111bool city_map_update_tile_now(struct tile *ptile);
112
113void city_map_update_all(struct city *pcity);
115
116bool city_map_update_radius_sq(struct city *pcity);
117
119void city_refresh_vision(struct city *pcity);
120void refresh_player_cities_vision(struct player *pplayer);
121
122void sync_cities(void);
123
124void clear_worker_task(struct city *pcity, struct worker_task *ptask);
125void clear_worker_tasks(struct city *pcity);
126void package_and_send_worker_tasks(struct city *pcity);
127
128int city_production_buy_gold_cost(const struct city *pcity);
129
130int city_original_owner(const struct city *pcity,
131 const struct player *known_for);
132
133#endif /* FC__CITYTOOLS_H */
void city_map_update_empty(struct city *pcity, struct tile *ptile)
Definition citytools.c:3164
void city_freeze_workers_queue(struct city *pcity)
Definition citytools.c:159
void package_city(struct city *pcity, struct packet_city_info *packet, struct packet_city_nationalities *nat_packet, struct packet_city_rally_point *rally_packet, struct packet_web_city_info_addition *web_packet, struct trade_route_packet_list *routes, bool dipl_invest)
Definition citytools.c:2480
bool city_map_update_tile_now(struct tile *ptile)
Definition citytools.c:3229
const char * city_name_suggestion(struct player *pplayer, struct tile *ptile)
Definition citytools.c:456
void package_and_send_worker_tasks(struct city *pcity)
Definition citytools.c:3512
int city_production_buy_gold_cost(const struct city *pcity)
Definition citytools.c:3537
void send_city_info(struct player *dest, struct city *pcity)
Definition citytools.c:2327
bool update_dumb_city(struct player *pplayer, struct city *pcity)
Definition citytools.c:2683
void city_freeze_workers(struct city *pcity)
Definition citytools.c:135
bool is_production_equal(const struct universal *one, const struct universal *two)
struct city * build_or_move_building(struct city *pcity, struct impr_type *pimprove, struct player **oldcity_owner)
Definition citytools.c:2932
void city_build_free_buildings(struct city *pcity)
Definition citytools.c:1416
struct city * find_closest_city(const struct tile *ptile, const struct city *pexclcity, const struct player *pplayer, bool only_ocean, bool only_continent, bool only_known, bool only_player, bool only_enemy, const struct unit_class *pclass)
Definition citytools.c:854
void refresh_dumb_city(struct city *pcity)
Definition citytools.c:2188
void create_city(struct player *pplayer, struct tile *ptile, const char *name, struct player *nationality)
Definition citytools.c:1495
bool send_city_suppression(bool now)
Definition citytools.c:2143
void sync_cities(void)
Definition citytools.c:3238
void refresh_player_cities_vision(struct player *pplayer)
Definition citytools.c:3353
int city_original_owner(const struct city *pcity, const struct player *known_for)
Definition citytools.c:3559
bool city_map_update_radius_sq(struct city *pcity)
Definition citytools.c:3363
int build_points_left(struct city *pcity)
Definition citytools.c:574
void change_build_target(struct player *pplayer, struct city *pcity, struct universal *target, enum event_type event)
Definition citytools.c:3075
bool building_removed(struct city *pcity, const struct impr_type *pimprove, const char *reason, struct unit *destroyer)
Definition citytools.c:2960
void city_map_update_all_cities_for_player(struct player *pplayer)
Definition citytools.c:3272
bool city_illness_strike(struct city *pcity)
Definition citytools.c:2884
bool city_map_update_tile_frozen(struct tile *ptile)
Definition citytools.c:3221
void city_thaw_workers(struct city *pcity)
Definition citytools.c:145
void remove_dumb_city(struct player *pplayer, struct tile *ptile)
Definition citytools.c:2773
void building_lost(struct city *pcity, const struct impr_type *pimprove, const char *reason, struct unit *destroyer)
Definition citytools.c:2977
bool unit_conquer_city(struct unit *punit, struct city *pcity)
Definition citytools.c:1963
void clear_worker_task(struct city *pcity, struct worker_task *ptask)
Definition citytools.c:3476
void city_units_upkeep(const struct city *pcity)
Definition citytools.c:3026
void clear_worker_tasks(struct city *pcity)
Definition citytools.c:3502
bool is_allowed_city_name(struct player *pplayer, const char *cityname, char *error_buf, size_t bufsz)
Definition citytools.c:372
void city_landlocked_sell_coastal_improvements(struct tile *ptile)
Definition citytools.c:3291
void remove_city(struct city *pcity)
Definition citytools.c:1684
void do_sell_building(struct player *pplayer, struct city *pcity, struct impr_type *pimprove, const char *reason)
Definition citytools.c:2910
struct trade_route * remove_trade_route(struct city *pc1, struct trade_route *proute, bool announce, bool source_gone)
Definition citytools.c:2849
bool create_city_for_player(struct player *pplayer, struct tile *ptile, const char *name)
Definition citytools.c:1656
void send_city_info_at_tile(struct player *pviewer, struct conn_list *dest, struct city *pcity, struct tile *ptile)
Definition citytools.c:2376
void city_thaw_workers_queue(void)
Definition citytools.c:196
void broadcast_city_info(struct city *pcity)
Definition citytools.c:2217
bool transfer_city(struct player *ptaker, struct city *pcity, int kill_outside, bool transfer_unit_verbose, bool resolve_stack, bool raze, bool build_free)
Definition citytools.c:1070
void send_player_cities(struct player *pplayer)
Definition citytools.c:2307
void city_map_update_all(struct city *pcity)
Definition citytools.c:3257
void transfer_city_units(struct player *pplayer, struct player *pvictim, struct unit_list *units, struct city *pcity, struct city *exclude_city, int kill_outside, bool verbose)
Definition citytools.c:719
void city_map_update_worker(struct city *pcity, struct tile *ptile)
Definition citytools.c:3178
void reality_check_city(struct player *pplayer, struct tile *ptile)
Definition citytools.c:2751
void send_all_known_cities(struct conn_list *dest)
Definition citytools.c:2284
void city_refresh_vision(struct city *pcity)
Definition citytools.c:3338
enum announce_type announce
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:73
enum event_type event
Definition events.c:81
static const int bufsz
Definition helpdlg.c:70
const char * name
Definition inputfile.c:127
Definition city.h:309
struct trade_route_list * routes
Definition city.h:332
citizens * nationality
Definition city.h:329
Definition tile.h:49
Definition unit.h:138