Freeciv-3.1: /fast/freeciv/nightly/S3_1/server/cityhand.c Source File

Freeciv-3.1

Loading...
Searching...
No Matches
cityhand.c
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
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <stdio.h>
19#include <stdlib.h>
20#include <string.h>
21
22/* utility */
23#include "capability.h"
24#include "fcintl.h"
25#include "log.h"
26#include "mem.h"
27#include "rand.h"
28#include "support.h"
29
30/* common */
31#include "city.h"
32#include "events.h"
33#include "game.h"
34#include "idex.h"
35#include "map.h"
36#include "player.h"
37#include "specialist.h"
38#include "unit.h"
39#include "worklist.h"
40
41/* common/aicore */
42#include "cm.h"
43
44/* server */
45#include "citytools.h"
46#include "cityturn.h"
47#include "notify.h"
48#include "plrhand.h"
49#include "sanitycheck.h"
50#include "unithand.h"
51#include "unittools.h"
52
53#include "cityhand.h"
54
55/**********************************************************************/
60 void handle_city_name_suggestion_req(struct player *pplayer, int unit_id16,
61 int unit_id32)
62{
63 struct unit *punit;
64
65 if (!has_capability("ids32", pplayer->current_conn->capability)) {
66 unit_id32 = unit_id16;
67 }
68
69 punit = player_unit_by_number(pplayer, unit_id32);
70
71 if (NULL == punit) {
72 /* Probably died or bribed. */
73 log_verbose("handle_city_name_suggestion_req() invalid unit %d",
74 unit_id32);
75 return;
76 }
77
78 if (action_prob_possible(action_prob_vs_tile(punit, ACTION_FOUND_CITY,
79 unit_tile(punit), NULL))) {
80 log_verbose("handle_city_name_suggest_req(unit_pos (%d, %d))",
81 TILE_XY(unit_tile(punit)));
82 dlsend_packet_city_name_suggestion_info(pplayer->connections,
83 unit_id32, unit_id32,
84 city_name_suggestion(pplayer, unit_tile(punit)));
85
86 /* The rest of this function is error handling. */
87 return;
88 }
89
90 log_verbose("handle_city_name_suggest_req(unit_pos (%d, %d)): "
91 "cannot build there.", TILE_XY(unit_tile(punit)));
92
93 illegal_action_msg(pplayer, E_BAD_COMMAND, punit, ACTION_FOUND_CITY,
94 unit_tile(punit), NULL, NULL);
95}
96
97/**********************************************************************/
100 void handle_city_change_specialist(struct player *pplayer,
101 int city_id16, int city_id32,
102 Specialist_type_id from,
103 Specialist_type_id to)
104{
105 struct city *pcity;
106
107 if (!has_capability("ids32", pplayer->current_conn->capability)) {
108 city_id32 = city_id16;
109 }
110
111 pcity = player_city_by_number(pplayer, city_id32);
112
113 if (pcity == NULL) {
114 return;
115 }
116
117 if (to < 0 || to >= specialist_count()
118 || from < 0 || from >= specialist_count()
119 || !city_can_use_specialist(pcity, to)
120 || pcity->specialists[from] == 0) {
121 /* This could easily just be due to clicking faster on the specialist
122 * than the server can cope with. */
123 log_verbose("Error in specialist change request from client.");
124 return;
125 }
126
127 pcity->specialists[from]--;
128 pcity->specialists[to]++;
129
130 city_refresh(pcity);
131 sanity_check_city(pcity);
132 send_city_info(pplayer, pcity);
133}
134
135/**********************************************************************/
138 void handle_city_make_specialist(struct player *pplayer,
139 int city_id16, int city_id32, int tile_id)
140{
141 struct tile *ptile;
142 struct city *pcity;
143
144 if (!has_capability("ids32", pplayer->current_conn->capability)) {
145 city_id32 = city_id16;
146 }
147
148 ptile = index_to_tile(&(wld.map), tile_id);
149 pcity = player_city_by_number(pplayer, city_id32);
150
151 if (NULL == pcity) {
152 /* Probably lost. */
153 log_verbose("handle_city_make_specialist() bad city number %d.",
154 city_id32);
155 return;
156 }
157
158 if (NULL == ptile) {
159 log_error("handle_city_make_specialist() bad tile number %d.", tile_id);
160 return;
161 }
162
163 if (!city_map_includes_tile(pcity, ptile)) {
164 log_error("handle_city_make_specialist() tile (%d, %d) not in the "
165 "city map of \"%s\".", TILE_XY(ptile), city_name_get(pcity));
166 return;
167 }
168
169 if (is_free_worked(pcity, ptile)) {
170 auto_arrange_workers(pcity);
171 } else if (tile_worked(ptile) == pcity) {
172 city_map_update_empty(pcity, ptile);
173 pcity->specialists[DEFAULT_SPECIALIST]++;
174 } else {
175 log_verbose("handle_city_make_specialist() not working (%d, %d) "
176 "\"%s\".", TILE_XY(ptile), city_name_get(pcity));
177 }
178
179 city_refresh(pcity);
180 sanity_check_city(pcity);
181 sync_cities();
182}
183
184/**********************************************************************/
189 void handle_city_make_worker(struct player *pplayer,
190 int city_id16, int city_id32, int tile_id)
191{
192 struct tile *ptile = index_to_tile(&(wld.map), tile_id);
193 struct city *pcity;
194
195 if (!has_capability("ids32", pplayer->current_conn->capability)) {
196 city_id32 = city_id16;
197 }
198
199 pcity = player_city_by_number(pplayer, city_id32);
200
201 if (NULL == pcity) {
202 /* Probably lost. */
203 log_verbose("handle_city_make_worker() bad city number %d.", city_id32);
204 return;
205 }
206
207 if (NULL == ptile) {
208 log_error("handle_city_make_worker() bad tile number %d.", tile_id);
209 return;
210 }
211
212 if (!city_map_includes_tile(pcity, ptile)) {
213 log_error("handle_city_make_worker() tile (%d, %d) not in the "
214 "city map of \"%s\".", TILE_XY(ptile), city_name_get(pcity));
215 return;
216 }
217
218 if (is_free_worked(pcity, ptile)) {
219 auto_arrange_workers(pcity);
220 sync_cities();
221 return;
222 }
223
224 if (tile_worked(ptile) == pcity) {
225 log_verbose("handle_city_make_worker() already working (%d, %d) \"%s\".",
226 TILE_XY(ptile), city_name_get(pcity));
227 return;
228 }
229
230 if (0 == city_specialists(pcity)) {
231 log_verbose("handle_city_make_worker() no specialists (%d, %d) \"%s\".",
232 TILE_XY(ptile), city_name_get(pcity));
233 return;
234 }
235
236 if (!city_can_work_tile(pcity, ptile)) {
237 log_verbose("handle_city_make_worker() cannot work here (%d, %d) \"%s\".",
238 TILE_XY(ptile), city_name_get(pcity));
239 return;
240 }
241
242 city_map_update_worker(pcity, ptile);
243
244 specialist_type_iterate(i) {
245 if (pcity->specialists[i] > 0) {
246 pcity->specialists[i]--;
247 break;
248 }
249 } specialist_type_iterate_end;
250
251 city_refresh(pcity);
252 sanity_check_city(pcity);
253 sync_cities();
254}
255
256/**********************************************************************/
260 void really_handle_city_sell(struct player *pplayer, struct city *pcity,
261 struct impr_type *pimprove)
262{
263 enum test_result sell_result;
264 int price;
265
266 sell_result = test_player_sell_building_now(pplayer, pcity, pimprove);
267
268 if (sell_result == TR_ALREADY_SOLD) {
269 notify_player(pplayer, pcity->tile, E_BAD_COMMAND, ftc_server,
270 _("You have already sold something here this turn."));
271 return;
272 }
273
274 if (sell_result != TR_SUCCESS) {
275 return;
276 }
277
278 pcity->did_sell=TRUE;
279 price = impr_sell_gold(pimprove);
280 notify_player(pplayer, pcity->tile, E_IMP_SOLD, ftc_server,
281 PL_("You sell %s in %s for %d gold.",
282 "You sell %s in %s for %d gold.", price),
283 improvement_name_translation(pimprove),
284 city_link(pcity), price);
285 do_sell_building(pplayer, pcity, pimprove, "sold");
286
287 city_refresh(pcity);
288
289 /* If we sold the walls the other players should see it */
290 send_city_info(NULL, pcity);
291 send_player_info_c(pplayer, pplayer->connections);
292}
293
294/**********************************************************************/
298 void handle_city_sell(struct player *pplayer, int city_id16, int city_id32,
299 int build_id)
300{
301 struct city *pcity;
302 struct impr_type *pimprove = improvement_by_number(build_id);
303
304 if (!has_capability("ids32", pplayer->current_conn->capability)) {
305 city_id32 = city_id16;
306 }
307
308 pcity = player_city_by_number(pplayer, city_id32);
309
310 if (!pcity || !pimprove) {
311 return;
312 }
313
314 really_handle_city_sell(pplayer, pcity, pimprove);
315}
316
317/**********************************************************************/
321 void really_handle_city_buy(struct player *pplayer, struct city *pcity)
322{
323 int cost, total;
324
325 /* This function corresponds to city_can_buy() in the client. */
326
327 fc_assert_ret(pcity && player_owns_city(pplayer, pcity));
328
329 if (pcity->turn_founded == game.info.turn) {
330 notify_player(pplayer, pcity->tile, E_BAD_COMMAND, ftc_server,
331 _("Cannot buy in city created this turn."));
332 return;
333 }
334
335 if (pcity->did_buy) {
336 notify_player(pplayer, pcity->tile, E_BAD_COMMAND, ftc_server,
337 _("You have already bought this turn."));
338 return;
339 }
340
341 if (city_production_has_flag(pcity, IF_GOLD)) {
342 notify_player(pplayer, pcity->tile, E_BAD_COMMAND, ftc_server,
343 _("You don't buy %s!"),
344 improvement_name_translation(pcity->production.value.building));
345 return;
346 }
347
348 if (VUT_UTYPE == pcity->production.kind && pcity->anarchy != 0) {
349 notify_player(pplayer, pcity->tile, E_BAD_COMMAND, ftc_server,
350 _("Can't buy units when city is in disorder."));
351 return;
352 }
353
354 total = city_production_build_shield_cost(pcity);
355 cost = city_production_buy_gold_cost(pcity);
356 if (cost <= 0) {
357 return; /* sanity */
358 }
359 if (cost > pplayer->economic.gold) {
360 /* In case something changed while player tried to buy, or player
361 * tried to cheat! */
362 /* Split into two to allow localization of two pluralisations. */
363 char buf[MAX_LEN_MSG];
364 /* TRANS: This whole string is only ever used when included in one
365 * other string (search for this string to find it). */
366 fc_snprintf(buf, ARRAY_SIZE(buf), PL_("%d gold required.",
367 "%d gold required.",
368 cost), cost);
369 notify_player(pplayer, pcity->tile, E_BAD_COMMAND, ftc_server,
370 /* TRANS: %s is a pre-pluralised string:
371 * "%d gold required." */
372 PL_("%s You only have %d gold.",
373 "%s You only have %d gold.", pplayer->economic.gold),
374 buf, pplayer->economic.gold);
375 return;
376 }
377
378 pplayer->economic.gold -= cost;
379 if (pcity->shield_stock < total) {
380 /* As we never put penalty on disbanded_shields, we can
381 * fully well add the missing shields there. */
382 pcity->disbanded_shields += total - pcity->shield_stock;
383 pcity->shield_stock=total; /* AI wants this -- Syela */
384 pcity->did_buy = TRUE; /* !PS: no need to set buy flag otherwise */
385 }
386 city_refresh(pcity);
387
388 if (VUT_UTYPE == pcity->production.kind) {
389 notify_player(pplayer, pcity->tile, E_UNIT_BUY, ftc_server,
390 /* TRANS: bought an unit. */
391 Q_("?unit:You bought %s in %s."),
392 utype_name_translation(pcity->production.value.utype),
393 city_name_get(pcity));
394 } else if (VUT_IMPROVEMENT == pcity->production.kind) {
395 notify_player(pplayer, pcity->tile, E_IMP_BUY, ftc_server,
396 /* TRANS: bought an improvement .*/
397 Q_("?improvement:You bought %s in %s."),
398 improvement_name_translation(pcity->production.value.building),
399 city_name_get(pcity));
400 }
401
402 conn_list_do_buffer(pplayer->connections);
403 send_city_info(pplayer, pcity);
404 send_player_info_c(pplayer, pplayer->connections);
405 conn_list_do_unbuffer(pplayer->connections);
406}
407
408/**********************************************************************/
411 void handle_city_worklist(struct player *pplayer, int city_id16, int city_id32,
412 const struct worklist *worklist)
413{
414 struct city *pcity;
415
416 if (!has_capability("ids32", pplayer->current_conn->capability)) {
417 city_id32 = city_id16;
418 }
419
420 pcity = player_city_by_number(pplayer, city_id32);
421
422 if (pcity == NULL) {
423 return;
424 }
425
426 worklist_copy(&pcity->worklist, worklist);
427
428 send_city_info(pplayer, pcity);
429}
430
431/**********************************************************************/
435 void handle_city_buy(struct player *pplayer, int city_id16, int city_id32)
436{
437 struct city *pcity;
438
439 if (!has_capability("ids32", pplayer->current_conn->capability)) {
440 city_id32 = city_id16;
441 }
442
443 pcity = player_city_by_number(pplayer, city_id32);
444
445 if (pcity == NULL) {
446 return;
447 }
448
449 really_handle_city_buy(pplayer, pcity);
450}
451
452/**********************************************************************/
455 void handle_city_refresh(struct player *pplayer, int city_id16, int city_id32)
456{
457 if (!has_capability("ids32", pplayer->current_conn->capability)) {
458 city_id32 = city_id16;
459 }
460
461 if (city_id32 != 0) {
462 struct city *pcity = player_city_by_number(pplayer, city_id32);
463
464 if (pcity == NULL) {
465 return;
466 }
467
468 city_refresh(pcity);
469 send_city_info(pplayer, pcity);
470 } else {
471 city_refresh_for_player(pplayer);
472 }
473}
474
475/**********************************************************************/
478 void handle_city_change(struct player *pplayer, int city_id16, int city_id32,
479 int production_kind, int production_value)
480{
481 struct universal prod;
482 struct city *pcity;
483
484 if (!has_capability("ids32", pplayer->current_conn->capability)) {
485 city_id32 = city_id16;
486 }
487
488 pcity = player_city_by_number(pplayer, city_id32);
489
490 if (!universals_n_is_valid(production_kind)) {
491 log_error("[%s] bad production_kind %d.", __FUNCTION__,
492 production_kind);
493 prod.kind = VUT_NONE;
494 return;
495 } else {
496 prod = universal_by_number(production_kind, production_value);
497 if (!universals_n_is_valid(prod.kind)) {
498 log_error("[%s] production_kind %d with bad production_value %d.",
499 __FUNCTION__, production_kind, production_value);
500 prod.kind = VUT_NONE;
501 return;
502 }
503 }
504
505 if (pcity == NULL) {
506 return;
507 }
508
509 if (are_universals_equal(&pcity->production, &prod)) {
510 /* The client probably shouldn't send such a packet. */
511 return;
512 }
513
514 if (!can_city_build_now(pcity, &prod)) {
515 return;
516 }
517 if (!city_can_change_build(pcity)) {
518 notify_player(pplayer, pcity->tile, E_BAD_COMMAND, ftc_server,
519 _("You have bought this turn, can't change."));
520 return;
521 }
522
523 change_build_target(pplayer, pcity, &prod, E_CITY_PRODUCTION_CHANGED);
524
525 city_refresh(pcity);
526 sanity_check_city(pcity);
527 send_city_info(pplayer, pcity);
528}
529
530/**********************************************************************/
533 void handle_city_rename(struct player *pplayer, int city_id16, int city_id32,
534 const char *name)
535{
536 struct city *pcity;
537 char message[1024];
538
539 if (!has_capability("ids32", pplayer->current_conn->capability)) {
540 city_id32 = city_id16;
541 }
542
543 pcity = player_city_by_number(pplayer, city_id32);
544
545 if (pcity == NULL) {
546 return;
547 }
548
549 if (!is_allowed_city_name(pplayer, name, message, sizeof(message))) {
550 notify_player(pplayer, pcity->tile, E_BAD_COMMAND,
551 ftc_server, "%s", message);
552 return;
553 }
554
555 city_name_set(pcity, name);
556 city_refresh(pcity);
557 send_city_info(NULL, pcity);
558}
559
560/**********************************************************************/
564 void handle_city_options_req(struct player *pplayer,
565 int city_id16, int city_id32,
566 bv_city_options options)
567{
568 struct city *pcity;
569
570 if (!has_capability("ids32", pplayer->current_conn->capability)) {
571 city_id32 = city_id16;
572 }
573
574 pcity = player_city_by_number(pplayer, city_id32);
575
576 if (pcity == NULL) {
577 return;
578 }
579
580 pcity->city_options = options;
581
582 send_city_info(pplayer, pcity);
583}
584
585/**********************************************************************/
588 void handle_city_rally_point(struct player *pplayer,
589 const struct packet_city_rally_point *packet)
590{
591 struct city *pcity;
592
593 if (!has_capability("ids32", pplayer->current_conn->capability)) {
594 pcity = player_city_by_number(pplayer, packet->city_id16);
595 } else {
596 pcity = player_city_by_number(pplayer, packet->city_id32);
597 }
598
599 if (pcity != NULL) {
600 city_rally_point_receive(packet, pcity);
601 send_city_info(pplayer, pcity);
602 }
603}
action_prob_possible
bool action_prob_possible(const struct act_prob probability)
Definition actions.c:6707
action_prob_vs_tile
struct act_prob action_prob_vs_tile(const struct unit *actor_unit, const action_id act_id, const struct tile *target_tile, const struct extra_type *target_extra)
Definition actions.c:6225
has_capability
bool has_capability(const char *cap, const char *capstr)
Definition capability.c:77
capability.h
is_free_worked
bool is_free_worked(const struct city *pcity, const struct tile *ptile)
Definition city.c:3496
city_production_build_shield_cost
int city_production_build_shield_cost(const struct city *pcity)
Definition city.c:722
city_name_set
void city_name_set(struct city *pcity, const char *new_name)
Definition city.c:1119
can_city_build_now
bool can_city_build_now(const struct city *pcity, const struct universal *target)
Definition city.c:989
city_name_get
const char * city_name_get(const struct city *pcity)
Definition city.c:1111
city_can_use_specialist
bool city_can_use_specialist(const struct city *pcity, Specialist_type_id type)
Definition city.c:1039
city_production_has_flag
bool city_production_has_flag(const struct city *pcity, enum impr_flag_id flag)
Definition city.c:712
city_map_includes_tile
bool city_map_includes_tile(const struct city *const pcity, const struct tile *map_tile)
Definition city.c:288
city_specialists
citizens city_specialists(const struct city *pcity)
Definition city.c:3226
city_rally_point_receive
void city_rally_point_receive(const struct packet_city_rally_point *packet, struct city *pcity)
Definition city.c:3536
city_can_work_tile
bool city_can_work_tile(const struct city *pcity, const struct tile *ptile)
Definition city.c:1425
city_can_change_build
bool city_can_change_build(const struct city *pcity)
Definition city.c:1053
city.h
handle_city_rally_point
void handle_city_rally_point(struct player *pplayer, const struct packet_city_rally_point *packet)
Definition cityhand.c:588
handle_city_refresh
void handle_city_refresh(struct player *pplayer, int city_id16, int city_id32)
Definition cityhand.c:455
handle_city_options_req
void handle_city_options_req(struct player *pplayer, int city_id16, int city_id32, bv_city_options options)
Definition cityhand.c:564
handle_city_make_specialist
void handle_city_make_specialist(struct player *pplayer, int city_id16, int city_id32, int tile_id)
Definition cityhand.c:138
handle_city_make_worker
void handle_city_make_worker(struct player *pplayer, int city_id16, int city_id32, int tile_id)
Definition cityhand.c:189
really_handle_city_buy
void really_handle_city_buy(struct player *pplayer, struct city *pcity)
Definition cityhand.c:321
handle_city_worklist
void handle_city_worklist(struct player *pplayer, int city_id16, int city_id32, const struct worklist *worklist)
Definition cityhand.c:411
handle_city_sell
void handle_city_sell(struct player *pplayer, int city_id16, int city_id32, int build_id)
Definition cityhand.c:298
handle_city_change
void handle_city_change(struct player *pplayer, int city_id16, int city_id32, int production_kind, int production_value)
Definition cityhand.c:478
handle_city_buy
void handle_city_buy(struct player *pplayer, int city_id16, int city_id32)
Definition cityhand.c:435
handle_city_change_specialist
void handle_city_change_specialist(struct player *pplayer, int city_id16, int city_id32, Specialist_type_id from, Specialist_type_id to)
Definition cityhand.c:100
handle_city_name_suggestion_req
void handle_city_name_suggestion_req(struct player *pplayer, int unit_id16, int unit_id32)
Definition cityhand.c:60
handle_city_rename
void handle_city_rename(struct player *pplayer, int city_id16, int city_id32, const char *name)
Definition cityhand.c:533
really_handle_city_sell
void really_handle_city_sell(struct player *pplayer, struct city *pcity, struct impr_type *pimprove)
Definition cityhand.c:260
cityhand.h
city_map_update_empty
void city_map_update_empty(struct city *pcity, struct tile *ptile)
Definition citytools.c:3157
city_name_suggestion
const char * city_name_suggestion(struct player *pplayer, struct tile *ptile)
Definition citytools.c:451
city_production_buy_gold_cost
int city_production_buy_gold_cost(const struct city *pcity)
Definition citytools.c:3530
send_city_info
void send_city_info(struct player *dest, struct city *pcity)
Definition citytools.c:2320
sync_cities
void sync_cities(void)
Definition citytools.c:3231
change_build_target
void change_build_target(struct player *pplayer, struct city *pcity, struct universal *target, enum event_type event)
Definition citytools.c:3068
is_allowed_city_name
bool is_allowed_city_name(struct player *pplayer, const char *cityname, char *error_buf, size_t bufsz)
Definition citytools.c:367
do_sell_building
void do_sell_building(struct player *pplayer, struct city *pcity, struct impr_type *pimprove, const char *reason)
Definition citytools.c:2903
city_map_update_worker
void city_map_update_worker(struct city *pcity, struct tile *ptile)
Definition citytools.c:3171
citytools.h
auto_arrange_workers
void auto_arrange_workers(struct city *pcity)
Definition cityturn.c:368
city_refresh
bool city_refresh(struct city *pcity)
Definition cityturn.c:161
city_refresh_for_player
void city_refresh_for_player(struct player *pplayer)
Definition cityturn.c:184
cityturn.h
cm.h
conn_list_do_unbuffer
void conn_list_do_unbuffer(struct conn_list *dest)
Definition connection.c:365
conn_list_do_buffer
void conn_list_do_buffer(struct conn_list *dest)
Definition connection.c:355
punit
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
cost
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 cost
Definition dialogs_g.h:73
events.h
Specialist_type_id
int Specialist_type_id
Definition fc_types.h:345
test_result
test_result
Definition fc_types.h:1097
TR_ALREADY_SOLD
@ TR_ALREADY_SOLD
Definition fc_types.h:1100
TR_SUCCESS
@ TR_SUCCESS
Definition fc_types.h:1098
fcintl.h
Q_
#define Q_(String)
Definition fcintl.h:70
PL_
#define PL_(String1, String2, n)
Definition fcintl.h:71
_
#define _(String)
Definition fcintl.h:67
ftc_server
const struct ft_color ftc_server
Definition featured_text.c:77
city_link
const char * city_link(const struct city *pcity)
Definition featured_text.c:1072
game
struct civ_game game
Definition game.c:57
wld
struct world wld
Definition game.c:58
game.h
idex.h
improvement_by_number
struct impr_type * improvement_by_number(const Impr_type_id id)
Definition improvement.c:192
impr_sell_gold
int impr_sell_gold(const struct impr_type *pimprove)
Definition improvement.c:332
test_player_sell_building_now
enum test_result test_player_sell_building_now(struct player *pplayer, struct city *pcity, const struct impr_type *pimprove)
Definition improvement.c:1083
improvement_name_translation
const char * improvement_name_translation(const struct impr_type *pimprove)
Definition improvement.c:241
name
const char * name
Definition inputfile.c:127
log.h
fc_assert_ret
#define fc_assert_ret(condition)
Definition log.h:191
log_verbose
#define log_verbose(message,...)
Definition log.h:109
log_error
#define log_error(message,...)
Definition log.h:103
index_to_tile
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
Definition map.c:454
map.h
mem.h
notify_player
void notify_player(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
Definition notify.c:292
notify.h
MAX_LEN_MSG
#define MAX_LEN_MSG
Definition packets.h:43
dlsend_packet_city_name_suggestion_info
void dlsend_packet_city_name_suggestion_info(struct conn_list *dest, int unit_id16, int unit_id32, const char *name)
Definition packets_gen.c:30670
player_unit_by_number
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
Definition player.c:1205
player_city_by_number
struct city * player_city_by_number(const struct player *pplayer, int city_id)
Definition player.c:1179
player_owns_city
bool player_owns_city(const struct player *pplayer, const struct city *pcity)
Definition player.c:255
player.h
send_player_info_c
void send_player_info_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1000
plrhand.h
rand.h
universal_by_number
struct universal universal_by_number(const enum universals_n kind, const int value)
Definition requirements.c:567
are_universals_equal
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
Definition requirements.c:5278
sanitycheck.h
sanity_check_city
#define sanity_check_city(x)
Definition sanitycheck.h:41
ARRAY_SIZE
#define ARRAY_SIZE(x)
Definition shared.h:85
specialist_count
Specialist_type_id specialist_count(void)
Definition specialist.c:71
specialist.h
specialist_type_iterate_end
#define specialist_type_iterate_end
Definition specialist.h:79
specialist_type_iterate
#define specialist_type_iterate(sp)
Definition specialist.h:73
DEFAULT_SPECIALIST
#define DEFAULT_SPECIALIST
Definition specialist.h:43
city
Definition city.h:309
city::did_sell
bool did_sell
Definition city.h:367
city::disbanded_shields
int disbanded_shields
Definition city.h:377
city::city_options
bv_city_options city_options
Definition city.h:389
city::turn_founded
int turn_founded
Definition city.h:372
city::did_buy
bool did_buy
Definition city.h:366
city::anarchy
int anarchy
Definition city.h:370
city::worklist
struct worklist worklist
Definition city.h:387
city::production
struct universal production
Definition city.h:382
city::specialists
citizens specialists[SP_MAX]
Definition city.h:324
city::tile
struct tile * tile
Definition city.h:311
city::shield_stock
int shield_stock
Definition city.h:355
city::prod
int prod[O_LAST]
Definition city.h:346
civ_game::info
struct packet_game_info info
Definition game.h:89
connection::capability
char capability[MAX_LEN_CAPSTR]
Definition connection.h:176
impr_type
Definition improvement.h:68
message
Definition messagewin_common.h:29
packet_city_rally_point
Definition packets_gen.h:497
packet_city_rally_point::city_id32
int city_id32
Definition packets_gen.h:499
packet_city_rally_point::city_id16
int city_id16
Definition packets_gen.h:498
packet_game_info::turn
int turn
Definition packets_gen.h:241
player_economic::gold
int gold
Definition player.h:70
player
Definition player.h:249
player::current_conn
struct connection * current_conn
Definition player.h:297
player::connections
struct conn_list * connections
Definition player.h:298
player::economic
struct player_economic economic
Definition player.h:284
tile
Definition tile.h:49
unit
Definition unit.h:138
universal
Definition fc_types.h:756
universal::kind
enum universals_n kind
Definition fc_types.h:758
universal::value
universals_u value
Definition fc_types.h:757
worklist
Definition worklist.h:28
world::map
struct civ_map map
Definition world_object.h:38
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
support.h
TRUE
#define TRUE
Definition support.h:46
tile_worked
#define tile_worked(_tile)
Definition tile.h:113
TILE_XY
#define TILE_XY(ptile)
Definition tile.h:42
universals_u::utype
const struct unit_type * utype
Definition fc_types.h:604
universals_u::building
const struct impr_type * building
Definition fc_types.h:598
unit.h
unit_tile
#define unit_tile(_pu)
Definition unit.h:388
illegal_action_msg
void illegal_action_msg(struct player *pplayer, const enum event_type event, struct unit *actor, const action_id stopped_action, const struct tile *target_tile, const struct city *target_city, const struct unit *target_unit)
Definition unithand.c:2352
unithand.h
unittools.h
utype_name_translation
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1612
worklist_copy
void worklist_copy(struct worklist *dst, const struct worklist *src)
Definition worklist.c:112
worklist.h