Freeciv-3.2
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,
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,
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
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 update_unit_upkeep(struct unit *punit, int free_uk[O_LAST]);
90void city_units_upkeep(const struct city *pcity);
91
93 const struct universal *two);
94void change_build_target(struct player *pplayer, struct city *pcity,
95 struct universal *target,
96 enum event_type event);
97
98bool is_allowed_city_name(struct player *pplayer, const char *cityname,
99 char *error_buf, size_t bufsz);
100const char *city_name_suggestion(struct player *pplayer, struct tile *ptile);
101
102void city_freeze_workers(struct city *pcity);
103void city_thaw_workers(struct city *pcity);
104void city_freeze_workers_queue(struct city *pcity);
105void city_thaw_workers_queue(void);
106
107/* city map functions */
108void city_map_update_empty(struct city *pcity, struct tile *ptile);
109void city_map_update_worker(struct city *pcity, struct tile *ptile);
110
111bool city_map_update_tile_frozen(struct tile *ptile);
112bool city_map_update_tile_now(struct tile *ptile);
113
114void city_map_update_all(struct city *pcity);
116
117bool city_map_update_radius_sq(struct city *pcity);
118
120void city_refresh_vision(struct city *pcity);
121void refresh_player_cities_vision(struct player *pplayer);
122
123void sync_cities(void);
124
125void clear_worker_task(struct city *pcity, struct worker_task *ptask);
126void clear_worker_tasks(struct city *pcity);
127void package_and_send_worker_tasks(struct city *pcity);
128
129int city_production_buy_gold_cost(const struct city *pcity);
130
132 const struct impr_type *pimprove,
133 const char *format);
134
135int city_original_owner(const struct city *pcity,
136 const struct player *known_for);
137
138#endif /* FC__CITYTOOLS_H */
void city_map_update_empty(struct city *pcity, struct tile *ptile)
Definition citytools.c:3268
void city_freeze_workers_queue(struct city *pcity)
Definition citytools.c:161
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:2526
bool city_map_update_tile_now(struct tile *ptile)
Definition citytools.c:3333
const char * city_name_suggestion(struct player *pplayer, struct tile *ptile)
Definition citytools.c:458
void package_and_send_worker_tasks(struct city *pcity)
Definition citytools.c:3615
int city_production_buy_gold_cost(const struct city *pcity)
Definition citytools.c:3639
void send_city_info(struct player *dest, struct city *pcity)
Definition citytools.c:2363
bool update_dumb_city(struct player *pplayer, struct city *pcity)
Definition citytools.c:2769
void city_freeze_workers(struct city *pcity)
Definition citytools.c:137
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:3019
void city_build_free_buildings(struct city *pcity)
Definition citytools.c:1434
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:856
void refresh_dumb_city(struct city *pcity)
Definition citytools.c:2216
void create_city(struct player *pplayer, struct tile *ptile, const char *name, struct player *nationality)
Definition citytools.c:1519
bool send_city_suppression(bool now)
Definition citytools.c:2166
void sync_cities(void)
Definition citytools.c:3342
void update_unit_upkeep(struct unit *punit, int free_uk[O_LAST])
Definition citytools.c:3105
void refresh_player_cities_vision(struct player *pplayer)
Definition citytools.c:3457
int city_original_owner(const struct city *pcity, const struct player *known_for)
Definition citytools.c:3689
bool city_map_update_radius_sq(struct city *pcity)
Definition citytools.c:3467
int build_points_left(struct city *pcity)
Definition citytools.c:576
void change_build_target(struct player *pplayer, struct city *pcity, struct universal *target, enum event_type event)
Definition citytools.c:3179
bool building_removed(struct city *pcity, const struct impr_type *pimprove, const char *reason, struct unit *destroyer)
Definition citytools.c:3051
void city_map_update_all_cities_for_player(struct player *pplayer)
Definition citytools.c:3376
bool city_illness_strike(struct city *pcity)
Definition citytools.c:2971
bool city_map_update_tile_frozen(struct tile *ptile)
Definition citytools.c:3325
void city_thaw_workers(struct city *pcity)
Definition citytools.c:147
void remove_dumb_city(struct player *pplayer, struct tile *ptile)
Definition citytools.c:2861
void building_lost(struct city *pcity, const struct impr_type *pimprove, const char *reason, struct unit *destroyer)
Definition citytools.c:3068
bool unit_conquer_city(struct unit *punit, struct city *pcity)
Definition citytools.c:1987
void clear_worker_task(struct city *pcity, struct worker_task *ptask)
Definition citytools.c:3580
void city_units_upkeep(const struct city *pcity)
Definition citytools.c:3156
void clear_worker_tasks(struct city *pcity)
Definition citytools.c:3605
bool is_allowed_city_name(struct player *pplayer, const char *cityname, char *error_buf, size_t bufsz)
Definition citytools.c:374
void city_landlocked_sell_coastal_improvements(struct tile *ptile)
Definition citytools.c:3395
void remove_city(struct city *pcity)
Definition citytools.c:1708
void do_sell_building(struct player *pplayer, struct city *pcity, struct impr_type *pimprove, const char *reason)
Definition citytools.c:2997
struct trade_route * remove_trade_route(struct city *pc1, struct trade_route *proute, bool announce, bool source_gone)
Definition citytools.c:2936
bool create_city_for_player(struct player *pplayer, struct tile *ptile, const char *name)
Definition citytools.c:1680
void send_city_info_at_tile(struct player *pviewer, struct conn_list *dest, struct city *pcity, struct tile *ptile)
Definition citytools.c:2415
void city_thaw_workers_queue(void)
Definition citytools.c:198
void broadcast_city_info(struct city *pcity)
Definition citytools.c:2245
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:1076
void city_add_improvement_with_gov_notice(struct city *pcity, const struct impr_type *pimprove, const char *format)
Definition citytools.c:3661
void send_player_cities(struct player *pplayer)
Definition citytools.c:2343
void city_map_update_all(struct city *pcity)
Definition citytools.c:3361
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:721
void city_map_update_worker(struct city *pcity, struct tile *ptile)
Definition citytools.c:3282
void reality_check_city(struct player *pplayer, struct tile *ptile)
Definition citytools.c:2840
void send_all_known_cities(struct conn_list *dest)
Definition citytools.c:2320
void city_refresh_vision(struct city *pcity)
Definition citytools.c:3442
enum announce_type announce
char * incite_cost
Definition comments.c:75
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:74
enum event_type event
Definition events.c:81
@ O_LAST
Definition fc_types.h:101
static const int bufsz
Definition helpdlg.c:70
const char * name
Definition inputfile.c:127
Definition city.h:320
struct trade_route_list * routes
Definition city.h:344
citizens * nationality
Definition city.h:341
Definition tile.h:50
Definition unit.h:138