Freeciv-3.3
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,
45 const struct unit_class *pclass);
46bool unit_conquer_city(struct unit *punit, struct city *pcity);
47
48bool send_city_suppression(bool now);
49void send_city_info(struct player *dest, struct city *pcity);
50void send_city_info_at_tile(struct player *pviewer, struct conn_list *dest,
51 struct city *pcity, struct tile *ptile);
52void send_all_known_cities(struct conn_list *dest);
53void send_player_cities(struct player *pplayer);
54void broadcast_city_info(struct city *pcity);
55void package_city(struct city *pcity, struct packet_city_info *packet,
60 bool dipl_invest);
61
62void reality_check_city(struct player *pplayer, struct tile *ptile);
63bool update_dumb_city(struct player *pplayer, struct city *pcity);
64void refresh_dumb_city(struct city *pcity);
65void remove_dumb_city(struct player *pplayer, struct tile *ptile);
66
68
69void create_city(struct player *pplayer, struct tile *ptile,
70 const char *name, struct player *nationality);
71bool create_city_for_player(struct player *pplayer, struct tile *ptile,
72 const char *name, struct player *nationality);
73void remove_city(struct city *pcity);
74
76 struct trade_route *proute,
77 bool announce, bool source_gone);
78
79bool city_illness_strike(struct city *pcity);
80
81void do_sell_building(struct player *pplayer, struct city *pcity,
82 struct impr_type *pimprove, const char *reason);
84 struct impr_type *pimprove,
85 struct player **oldcity_owner);
86bool building_removed(struct city *pcity, const struct impr_type *pimprove,
87 const char *reason, struct unit *destroyer);
88void building_lost(struct city *pcity, const struct impr_type *pimprove,
89 const char *reason, struct unit *destroyer);
90void update_unit_upkeep(struct unit *punit, int free_uk[O_LAST]);
91void city_units_upkeep(const struct city *pcity);
92
94 const struct universal *two);
95void change_build_target(struct player *pplayer, struct city *pcity,
96 struct universal *target,
97 enum event_type event);
98
99bool is_allowed_city_name(struct player *pplayer, const char *cityname,
100 char *error_buf, size_t bufsz);
101const char *city_name_suggestion(struct player *pplayer, struct tile *ptile);
102
103void city_freeze_workers(struct city *pcity);
104void city_thaw_workers(struct city *pcity);
106void city_thaw_workers_queue(void);
107
108/* City map functions */
109void city_map_update_empty(struct city *pcity, struct tile *ptile);
110void city_map_update_worker(struct city *pcity, struct tile *ptile);
111
112bool city_map_update_tile_frozen(struct tile *ptile);
113bool city_map_update_tile_now(struct tile *ptile);
114
115void city_map_update_all(struct city *pcity);
117
119
121void city_refresh_vision(struct city *pcity);
122void refresh_player_cities_vision(struct player *pplayer);
123
124void sync_cities(void);
125
126void clear_worker_task(struct city *pcity, struct worker_task *ptask);
127void clear_worker_tasks(struct city *pcity);
129
130int city_production_buy_gold_cost(const struct city *pcity);
131
133 const struct impr_type *pimprove,
134 const char *format);
135
136int city_original_owner(const struct city *pcity,
137 const struct player *known_for);
138
139#endif /* FC__CITYTOOLS_H */
void city_map_update_empty(struct city *pcity, struct tile *ptile)
Definition citytools.c:3277
void city_freeze_workers_queue(struct city *pcity)
Definition citytools.c:160
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:2531
bool city_map_update_tile_now(struct tile *ptile)
Definition citytools.c:3342
bool create_city_for_player(struct player *pplayer, struct tile *ptile, const char *name, struct player *nationality)
Definition citytools.c:1681
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:3624
int city_production_buy_gold_cost(const struct city *pcity)
Definition citytools.c:3648
void send_city_info(struct player *dest, struct city *pcity)
Definition citytools.c:2368
bool update_dumb_city(struct player *pplayer, struct city *pcity)
Definition citytools.c:2776
void city_freeze_workers(struct city *pcity)
Definition citytools.c:136
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:3027
void city_build_free_buildings(struct city *pcity)
Definition citytools.c:1435
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:2220
void create_city(struct player *pplayer, struct tile *ptile, const char *name, struct player *nationality)
Definition citytools.c:1520
bool send_city_suppression(bool now)
Definition citytools.c:2170
void sync_cities(void)
Definition citytools.c:3351
void update_unit_upkeep(struct unit *punit, int free_uk[O_LAST])
Definition citytools.c:3114
void refresh_player_cities_vision(struct player *pplayer)
Definition citytools.c:3466
int city_original_owner(const struct city *pcity, const struct player *known_for)
Definition citytools.c:3699
bool city_map_update_radius_sq(struct city *pcity)
Definition citytools.c:3476
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:3188
bool building_removed(struct city *pcity, const struct impr_type *pimprove, const char *reason, struct unit *destroyer)
Definition citytools.c:3060
void city_map_update_all_cities_for_player(struct player *pplayer)
Definition citytools.c:3385
bool city_illness_strike(struct city *pcity)
Definition citytools.c:2979
bool city_map_update_tile_frozen(struct tile *ptile)
Definition citytools.c:3334
void city_thaw_workers(struct city *pcity)
Definition citytools.c:146
void remove_dumb_city(struct player *pplayer, struct tile *ptile)
Definition citytools.c:2868
void building_lost(struct city *pcity, const struct impr_type *pimprove, const char *reason, struct unit *destroyer)
Definition citytools.c:3077
bool unit_conquer_city(struct unit *punit, struct city *pcity)
Definition citytools.c:1992
void clear_worker_task(struct city *pcity, struct worker_task *ptask)
Definition citytools.c:3589
void city_units_upkeep(const struct city *pcity)
Definition citytools.c:3165
void clear_worker_tasks(struct city *pcity)
Definition citytools.c:3614
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:3404
void remove_city(struct city *pcity)
Definition citytools.c:1713
void do_sell_building(struct player *pplayer, struct city *pcity, struct impr_type *pimprove, const char *reason)
Definition citytools.c:3005
struct trade_route * remove_trade_route(struct city *pc1, struct trade_route *proute, bool announce, bool source_gone)
Definition citytools.c:2943
void send_city_info_at_tile(struct player *pviewer, struct conn_list *dest, struct city *pcity, struct tile *ptile)
Definition citytools.c:2420
void city_thaw_workers_queue(void)
Definition citytools.c:197
void broadcast_city_info(struct city *pcity)
Definition citytools.c:2249
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:1077
void city_add_improvement_with_gov_notice(struct city *pcity, const struct impr_type *pimprove, const char *format)
Definition citytools.c:3670
void send_player_cities(struct player *pplayer)
Definition citytools.c:2348
void city_map_update_all(struct city *pcity)
Definition citytools.c:3370
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:3291
void reality_check_city(struct player *pplayer, struct tile *ptile)
Definition citytools.c:2847
void send_all_known_cities(struct conn_list *dest)
Definition citytools.c:2324
void city_refresh_vision(struct city *pcity)
Definition citytools.c:3451
enum announce_type announce
char * incite_cost
Definition comments.c:76
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
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 int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
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:317
struct trade_route_list * routes
Definition city.h:341
citizens * nationality
Definition city.h:338
Definition tile.h:50
Definition unit.h:140