Freeciv-3.2: /fast/freeciv/nightly/S3_2/client/packhand.c Source File

Freeciv-3.2

Loading...
Searching...
No Matches
packhand.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 <string.h>
19
20/* utility */
21#include "bitvector.h"
22#include "capability.h"
23#include "fcintl.h"
24#include "log.h"
25#include "mem.h"
26#include "rand.h"
27#include "string_vector.h"
28#include "support.h"
29
30/* common */
31#include "achievements.h"
32#include "actions.h"
33#include "capstr.h"
34#include "citizens.h"
35#include "counters.h"
36#include "events.h"
37#include "extras.h"
38#include "game.h"
39#include "government.h"
40#include "idex.h"
41#include "map.h"
42#include "name_translation.h"
43#include "movement.h"
44#include "multipliers.h"
45#include "nation.h"
46#include "packets.h"
47#include "player.h"
48#include "research.h"
49#include "rgbcolor.h"
50#include "road.h"
51#include "spaceship.h"
52#include "specialist.h"
53#include "style.h"
54#include "traderoutes.h"
55#include "unit.h"
56#include "unitlist.h"
57#include "worklist.h"
58
59/* client/include */
60#include "chatline_g.h"
61#include "citydlg_g.h"
62#include "cityrep_g.h"
63#include "connectdlg_g.h"
64#include "dialogs_g.h"
65#include "editgui_g.h"
66#include "gui_main_g.h"
67#include "inteldlg_g.h"
68#include "mapctrl_g.h" /* popup_newcity_dialog() */
69#include "mapview_g.h"
70#include "menu_g.h"
71#include "messagewin_g.h"
72#include "pages_g.h"
73#include "plrdlg_g.h"
74#include "ratesdlg_g.h"
75#include "repodlgs_g.h"
76#include "spaceshipdlg_g.h"
77#include "voteinfo_bar_g.h"
78#include "wldlg_g.h"
79
80/* client */
81#include "agents.h"
82#include "attribute.h"
83#include "audio.h"
84#include "client_main.h"
85#include "climap.h"
86#include "climisc.h"
87#include "clitreaty.h"
88#include "connectdlg_common.h"
89#include "control.h"
90#include "editor.h"
91#include "goto.h" /* client_goto_init() */
92#include "helpdata.h" /* boot_help_texts() */
93#include "mapview_common.h"
94#include "music.h"
95#include "options.h"
96#include "overview_common.h"
97#include "tilespec.h"
98#include "update_queue.h"
99#include "voteinfo.h"
100
101/* client/luascript */
102#include "script_client.h"
103
104#include "packhand.h"
105
106/* Define this macro to get additional debug output about the transport
107 * status of the units. */
108#undef DEBUG_TRANSPORT
109
110static void city_packet_common(struct city *pcity, struct tile *pcenter,
111 struct player *powner,
112 struct tile_list *worked_tiles,
113 bool is_new, bool popup, bool investigate);
114static bool handle_unit_packet_common(struct unit *packet_unit);
115
116
117/* The dumbest of cities, placeholders for unknown and unseen cities. */
118static struct {
119 struct city_list *cities;
120 struct player *placeholder;
121} invisible = {
122 .cities = NULL,
123 .placeholder = NULL
124};
125
126static struct {
127 int len;
128 enum event_type event;
129 char *caption;
130 char *headline;
131 char *lines;
132 int parts;
133} page_msg_report = { .parts = 0 };
134
135extern const char forced_tileset_name[];
136
137 static int last_turn = 0;
138
139/* Refresh the action selection dialog */
140#define REQEST_BACKGROUND_REFRESH (1)
141/* Get possible actions for fast auto attack. */
142#define REQEST_BACKGROUND_FAST_AUTO_ATTACK (2)
143
144/* A unit will auto attack with the following actions. */
145 const action_id auto_attack_actions[] = {
146 ACTION_CAPTURE_UNITS,
147 ACTION_BOMBARD, ACTION_BOMBARD2, ACTION_BOMBARD3,
148 ACTION_BOMBARD_LETHAL,
149 ACTION_NUKE, ACTION_NUKE_CITY, ACTION_NUKE_UNITS,
150 ACTION_ATTACK, ACTION_SUICIDE_ATTACK,
151 ACTION_WIPE_UNITS,
152 ACTION_CONQUER_CITY, ACTION_CONQUER_CITY2,
153 ACTION_CONQUER_CITY3, ACTION_CONQUER_CITY4,
154 ACTION_STRIKE_PRODUCTION,
155 ACTION_CONQUER_EXTRAS, ACTION_CONQUER_EXTRAS2,
156 ACTION_CONQUER_EXTRAS3, ACTION_CONQUER_EXTRAS4,
157 /* End the action list. */
158 ACTION_NONE
159};
160
161/* A unit will not auto attack if any of these actions are legal. */
162 const action_id auto_attack_blockers[] = {
163 ACTION_ESTABLISH_EMBASSY, ACTION_ESTABLISH_EMBASSY_STAY,
164 ACTION_SPY_INVESTIGATE_CITY, ACTION_INV_CITY_SPEND,
165 ACTION_SPY_POISON, ACTION_SPY_POISON_ESC,
166 ACTION_SPY_STEAL_GOLD, ACTION_SPY_STEAL_GOLD_ESC,
167 ACTION_SPY_SPREAD_PLAGUE,
168 ACTION_SPY_SABOTAGE_CITY, ACTION_SPY_SABOTAGE_CITY_ESC,
169 ACTION_SPY_TARGETED_SABOTAGE_CITY,
170 ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC,
171 ACTION_SPY_SABOTAGE_CITY_PRODUCTION,
172 ACTION_SPY_SABOTAGE_CITY_PRODUCTION_ESC,
173 ACTION_SPY_STEAL_TECH, ACTION_SPY_STEAL_TECH_ESC,
174 ACTION_SPY_TARGETED_STEAL_TECH,
175 ACTION_SPY_TARGETED_STEAL_TECH_ESC,
176 ACTION_SPY_INCITE_CITY, ACTION_SPY_INCITE_CITY_ESC,
177 ACTION_TRADE_ROUTE, ACTION_MARKETPLACE,
178 ACTION_HELP_WONDER,
179 ACTION_SPY_BRIBE_UNIT,
180 ACTION_SPY_SABOTAGE_UNIT, ACTION_SPY_SABOTAGE_UNIT_ESC,
181 ACTION_SPY_ATTACK,
182 ACTION_FOUND_CITY,
183 ACTION_JOIN_CITY,
184 ACTION_STEAL_MAPS, ACTION_STEAL_MAPS_ESC,
185 ACTION_SPY_NUKE, ACTION_SPY_NUKE_ESC,
186 ACTION_DESTROY_CITY,
187 ACTION_EXPEL_UNIT,
188 ACTION_DISBAND_UNIT_RECOVER,
189 ACTION_HOME_CITY,
190 ACTION_HOMELESS,
191 ACTION_UPGRADE_UNIT,
192 ACTION_PARADROP, ACTION_PARADROP_CONQUER, ACTION_PARADROP_FRIGHTEN,
193 ACTION_PARADROP_FRIGHTEN_CONQUER, ACTION_PARADROP_ENTER,
194 ACTION_PARADROP_ENTER_CONQUER,
195 ACTION_AIRLIFT,
196 ACTION_HEAL_UNIT, ACTION_HEAL_UNIT2,
197 ACTION_TRANSFORM_TERRAIN,
198 ACTION_CULTIVATE,
199 ACTION_PLANT,
200 ACTION_PILLAGE,
201 ACTION_CLEAN,
202 ACTION_ROAD,
203 ACTION_BASE,
204 ACTION_MINE,
205 ACTION_IRRIGATE,
206 ACTION_HUT_ENTER, ACTION_HUT_ENTER2, ACTION_HUT_ENTER3, ACTION_HUT_ENTER4,
207 ACTION_HUT_FRIGHTEN, ACTION_HUT_FRIGHTEN2,
208 ACTION_HUT_FRIGHTEN3, ACTION_HUT_FRIGHTEN4,
209 /* Actually an attack but it needs a target to be specified. */
210 ACTION_STRIKE_BUILDING,
211 /* End the action list. */
212 ACTION_NONE
213};
214
215/************************************************************************/
218 void packhand_free(void)
219{
220 if (NULL != invisible.cities) {
221 city_list_iterate(invisible.cities, pcity) {
222 idex_unregister_city(&wld, pcity);
223 destroy_city_virtual(pcity);
224 } city_list_iterate_end;
225
226 city_list_destroy(invisible.cities);
227 invisible.cities = NULL;
228 }
229
230 if (NULL != invisible.placeholder) {
231 free(invisible.placeholder);
232 invisible.placeholder = NULL;
233 }
234}
235
236/************************************************************************/
239 static void packhand_init(void)
240{
241 packhand_free();
242
243 invisible.cities = city_list_new();
244
245 /* Can't use player_new() here, as it will register the player. */
246 invisible.placeholder = fc_calloc(1, sizeof(*invisible.placeholder));
247 memset(invisible.placeholder, 0, sizeof(*invisible.placeholder));
248 /* Set some values to prevent bugs ... */
249 sz_strlcpy(invisible.placeholder->name, ANON_PLAYER_NAME);
250 sz_strlcpy(invisible.placeholder->username, _(ANON_USER_NAME));
251 invisible.placeholder->unassigned_user = TRUE;
252 sz_strlcpy(invisible.placeholder->ranked_username, ANON_USER_NAME);
253 invisible.placeholder->unassigned_ranked = TRUE;
254}
255
256/************************************************************************/
264 static struct unit *unpackage_unit(const struct packet_unit_info *packet)
265{
266 struct unit *punit = unit_virtual_create(player_by_number(packet->owner),
267 NULL,
268 utype_by_number(packet->type),
269 packet->veteran);
270
271 /* Owner, veteran, and type fields are already filled in by
272 * unit_virtual_create() */
273 punit->nationality = player_by_number(packet->nationality);
274 punit->id = packet->id;
275 unit_tile_set(punit, index_to_tile(&(wld.map), packet->tile));
276 punit->facing = packet->facing;
277 punit->homecity = packet->homecity;
278 output_type_iterate(o) {
279 punit->upkeep[o] = packet->upkeep[o];
280 } output_type_iterate_end;
281 punit->moves_left = packet->movesleft;
282 punit->hp = packet->hp;
283 punit->activity = packet->activity;
284 punit->activity_count = packet->activity_count;
285
286 if (packet->activity_tgt == EXTRA_NONE) {
287 punit->activity_target = NULL;
288 } else {
289 punit->activity_target = extra_by_number(packet->activity_tgt);
290 }
291
292 punit->changed_from = packet->changed_from;
293 punit->changed_from_count = packet->changed_from_count;
294
295 if (packet->changed_from_tgt == EXTRA_NONE) {
296 punit->changed_from_target = NULL;
297 } else {
298 punit->changed_from_target = extra_by_number(packet->changed_from_tgt);
299 }
300
301 punit->ssa_controller = packet->ssa_controller;
302 punit->fuel = packet->fuel;
303 punit->goto_tile = index_to_tile(&(wld.map), packet->goto_tile);
304 punit->paradropped = packet->paradropped;
305 punit->done_moving = packet->done_moving;
306 punit->stay = packet->stay;
307 punit->birth_turn = packet->birth_turn;
308 punit->current_form_turn = packet->current_form_turn;
309
310 /* Transporter / transporting information. */
311 punit->client.occupied = packet->occupied;
312 if (packet->transported) {
313 punit->client.transported_by = packet->transported_by;
314 } else {
315 punit->client.transported_by = -1;
316 }
317 if (packet->carrying >= 0) {
318 punit->carrying = goods_by_number(packet->carrying);
319 } else {
320 punit->carrying = NULL;
321 }
322
323 punit->battlegroup = packet->battlegroup;
324 punit->has_orders = packet->has_orders;
325 punit->orders.length = packet->orders_length;
326 punit->orders.index = packet->orders_index;
327 punit->orders.repeat = packet->orders_repeat;
328 punit->orders.vigilant = packet->orders_vigilant;
329 if (punit->has_orders) {
330 int i;
331
332 for (i = 0; i < packet->orders_length; i++) {
333 /* Just an assert. The client doesn't use the action data. */
334 fc_assert(packet->orders[i].order != ORDER_PERFORM_ACTION
335 || action_id_exists(packet->orders[i].action));
336 }
337 punit->orders.list
338 = fc_malloc(punit->orders.length * sizeof(*punit->orders.list));
339 memcpy(punit->orders.list, packet->orders,
340 punit->orders.length * sizeof(*punit->orders.list));
341 }
342
343 punit->action_decision_want = packet->action_decision_want;
344 punit->action_decision_tile
345 = index_to_tile(&(wld.map), packet->action_decision_tile);
346
347 punit->client.asking_city_name = FALSE;
348
349 return punit;
350}
351
352/************************************************************************/
362static struct unit *
363unpackage_short_unit(const struct packet_unit_short_info *packet)
364{
365 struct unit *punit = unit_virtual_create(player_by_number(packet->owner),
366 NULL,
367 utype_by_number(packet->type),
368 0);
369
370 /* Owner and type fields are already filled in by unit_virtual_create() */
371 punit->id = packet->id;
372 unit_tile_set(punit, index_to_tile(&(wld.map), packet->tile));
373 punit->facing = packet->facing;
374 punit->nationality = NULL;
375 punit->veteran = packet->veteran;
376 punit->hp = packet->hp;
377 punit->activity = packet->activity;
378
379 if (packet->activity_tgt == EXTRA_NONE) {
380 punit->activity_target = NULL;
381 } else {
382 punit->activity_target = extra_by_number(packet->activity_tgt);
383 }
384
385 /* Transporter / transporting information. */
386 punit->client.occupied = packet->occupied;
387 if (packet->transported) {
388 punit->client.transported_by = packet->transported_by;
389 } else {
390 punit->client.transported_by = -1;
391 }
392
393 return punit;
394}
395
396/************************************************************************/
400 void handle_server_join_reply(bool you_can_join, const char *message,
401 const char *capability,
402 const char *challenge_file, int conn_id)
403{
404 const char *s_capability = client.conn.capability;
405
406 conn_set_capability(&client.conn, capability);
407 close_connection_dialog();
408
409 if (you_can_join) {
410 struct packet_client_info client_info;
411
412 log_verbose("join game accept:%s", message);
413 client.conn.established = TRUE;
414 client.conn.id = conn_id;
415
416 agents_game_joined();
417 set_server_busy(FALSE);
418
419 if (get_client_page() == PAGE_MAIN
420 || get_client_page() == PAGE_NETWORK) {
421 set_client_page(PAGE_START);
422 }
423
424 client_info.gui = get_gui_type();
425#ifdef EMERGENCY_VERSION
426 client_info.emerg_version = EMERGENCY_VERSION;
427#else
428 client_info.emerg_version = 0;
429#endif
430 strncpy(client_info.distribution, FREECIV_DISTRIBUTOR,
431 sizeof(client_info.distribution));
432 send_packet_client_info(&client.conn, &client_info);
433
434 /* We could always use hack, verify we're local */
435#ifdef FREECIV_DEBUG
436 if (!hackless)
437#endif /* FREECIV_DEBUG */
438 {
439 send_client_wants_hack(challenge_file);
440 }
441
442 set_client_state(C_S_PREPARING);
443 } else {
444 output_window_printf(ftc_client,
445 _("You were rejected from the game: %s"), message);
446 client.conn.id = -1; /* not in range of conn_info id */
447
448 if (auto_connect) {
449 log_normal(_("You were rejected from the game: %s"), message);
450 }
451 server_connect();
452
453 set_client_page(PAGE_MAIN);
454 }
455 if (strcmp(s_capability, our_capability) == 0) {
456 return;
457 }
458 output_window_printf(ftc_client, _("Client capability string: %s"),
459 our_capability);
460 output_window_printf(ftc_client, _("Server capability string: %s"),
461 s_capability);
462}
463
464/************************************************************************/
468 void handle_city_remove(int city_id)
469{
470 struct city *pcity = game_city_by_number(city_id);
471 bool need_menus_update;
472
473 fc_assert_ret_msg(NULL != pcity, "Bad city %d.", city_id);
474
475 need_menus_update = (NULL != get_focus_unit_on_tile(city_tile(pcity)));
476
477 agents_city_remove(pcity);
478 editgui_notify_object_changed(OBJTYPE_CITY, pcity->id, TRUE);
479 client_remove_city(pcity);
480
481 /* Update menus if the focus unit is on the tile. */
482 if (need_menus_update) {
483 menus_update();
484 }
485}
486
487/************************************************************************/
491 void handle_unit_remove(int unit_id)
492{
493 struct unit *punit = game_unit_by_number(unit_id);
494 struct unit_list *cargos;
495 struct player *powner;
496 bool need_economy_report_update;
497
498 if (!punit) {
499 log_error("Server wants us to remove unit id %d, "
500 "but we don't know about this unit!",
501 unit_id);
502 return;
503 }
504
505 /* Close the action selection dialog if the actor unit is lost. */
506 if (action_selection_actor_unit() == punit->id) {
507 action_selection_close();
508 /* Open another action selection dialog if there are other actors in the
509 * current selection that want a decision. */
510 action_selection_next_in_focus(unit_id);
511 }
512
513 need_economy_report_update = (0 < punit->upkeep[O_GOLD]);
514 powner = unit_owner(punit);
515
516 /* Unload cargo if this is a transporter. */
517 cargos = unit_transport_cargo(punit);
518 if (unit_list_size(cargos) > 0) {
519 unit_list_iterate(cargos, pcargo) {
520 unit_transport_unload(pcargo);
521 } unit_list_iterate_end;
522 }
523
524 /* Unload unit if it is transported. */
525 if (unit_transport_get(punit)) {
526 unit_transport_unload(punit);
527 }
528 punit->client.transported_by = -1;
529
530 agents_unit_remove(punit);
531 editgui_notify_object_changed(OBJTYPE_UNIT, punit->id, TRUE);
532 client_remove_unit(punit);
533
534 if (!client_has_player() || powner == client_player()) {
535 if (need_economy_report_update) {
536 economy_report_dialog_update();
537 }
538 units_report_dialog_update();
539 }
540}
541
542/************************************************************************/
545 void handle_nuke_tile_info(int tile)
546{
547 put_nuke_mushroom_pixmaps(index_to_tile(&(wld.map), tile));
548}
549
550/************************************************************************/
553 void handle_team_name_info(int team_id, const char *team_name)
554{
555 struct team_slot *tslot = team_slot_by_number(team_id);
556
557 fc_assert_ret(NULL != tslot);
558 team_slot_set_defined_name(tslot, team_name);
559 conn_list_dialog_update();
560}
561
562/************************************************************************/
568 void handle_unit_combat_info(const struct packet_unit_combat_info *packet)
569{
570 bool show_combat = FALSE;
571 struct unit *punit0 = game_unit_by_number(packet->attacker_unit_id);
572 struct unit *punit1 = game_unit_by_number(packet->defender_unit_id);
573
574 if (punit0 && punit1) {
575 popup_combat_info(packet->attacker_unit_id, packet->defender_unit_id,
576 packet->attacker_hp, packet->defender_hp,
577 packet->make_att_veteran, packet->make_def_veteran);
578 if (tile_visible_mapcanvas(unit_tile(punit0))
579 && tile_visible_mapcanvas(unit_tile(punit1))) {
580 show_combat = TRUE;
581 } else if (gui_options.auto_center_on_combat) {
582 if (unit_owner(punit0) == client.conn.playing) {
583 center_tile_mapcanvas(unit_tile(punit0));
584 } else {
585 center_tile_mapcanvas(unit_tile(punit1));
586 }
587 show_combat = TRUE;
588 }
589
590 if (show_combat) {
591 int hp0 = packet->attacker_hp, hp1 = packet->defender_hp;
592
593 audio_play_sound(unit_type_get(punit0)->sound_fight,
594 unit_type_get(punit0)->sound_fight_alt,
595 NULL);
596 audio_play_sound(unit_type_get(punit1)->sound_fight,
597 unit_type_get(punit1)->sound_fight_alt,
598 NULL);
599
600 if (gui_options.smooth_combat_step_msec > 0) {
601 decrease_unit_hp_smooth(punit0, hp0, punit1, hp1);
602 } else {
603 punit0->hp = hp0;
604 punit1->hp = hp1;
605
606 set_units_in_combat(NULL, NULL);
607 refresh_unit_mapcanvas(punit0, unit_tile(punit0), TRUE, FALSE);
608 refresh_unit_mapcanvas(punit1, unit_tile(punit1), TRUE, FALSE);
609 }
610 }
611 if (packet->make_att_veteran && punit0) {
612 punit0->veteran++;
613 refresh_unit_mapcanvas(punit0, unit_tile(punit0), TRUE, FALSE);
614 }
615 if (packet->make_def_veteran && punit1) {
616 punit1->veteran++;
617 refresh_unit_mapcanvas(punit1, unit_tile(punit1), TRUE, FALSE);
618 }
619 }
620}
621
622/************************************************************************/
628 static bool update_improvement_from_packet(struct city *pcity,
629 struct impr_type *pimprove,
630 bool have_impr)
631{
632 if (have_impr) {
633 if (pcity->built[improvement_index(pimprove)].turn <= I_NEVER) {
634 city_add_improvement(pcity, pimprove);
635 return TRUE;
636 }
637 } else {
638 if (pcity->built[improvement_index(pimprove)].turn > I_NEVER) {
639 city_remove_improvement(pcity, pimprove);
640 return TRUE;
641 }
642 }
643 return FALSE;
644}
645
646/************************************************************************/
650 void handle_city_info(const struct packet_city_info *packet)
651{
652 struct universal product;
653 int i;
654 bool popup;
655 bool city_is_new = FALSE;
656 bool city_has_changed_owner = FALSE;
657 bool need_science_dialog_update = FALSE;
658 bool need_units_dialog_update = FALSE;
659 bool need_economy_dialog_update = FALSE;
660 bool name_changed = FALSE;
661 bool update_descriptions = FALSE;
662 bool shield_stock_changed = FALSE;
663 bool production_changed = FALSE;
664 bool trade_routes_changed = FALSE;
665 struct unit_list *pfocus_units = get_units_in_focus();
666 struct city *pcity = game_city_by_number(packet->id);
667 struct tile_list *worked_tiles = NULL;
668 struct tile *pcenter = index_to_tile(&(wld.map), packet->tile);
669 struct tile *ptile = NULL;
670 struct player *powner = player_by_number(packet->owner);
671
672 fc_assert_ret_msg(NULL != powner, "Bad player number %d.", packet->owner);
673 fc_assert_ret_msg(NULL != pcenter, "Invalid tile index %d.", packet->tile);
674
675 if (!universals_n_is_valid(packet->production_kind)) {
676 log_error("handle_city_info() bad production_kind %d.",
677 packet->production_kind);
678 product.kind = VUT_NONE;
679 } else {
680 product = universal_by_number(packet->production_kind,
681 packet->production_value);
682 if (!universals_n_is_valid(product.kind)) {
683 log_error("handle_city_info() "
684 "production_kind %d with bad production_value %d.",
685 packet->production_kind, packet->production_value);
686 product.kind = VUT_NONE;
687 }
688 }
689
690 if (NULL != pcity) {
691 ptile = city_tile(pcity);
692
693 if (NULL == ptile) {
694 /* Invisible worked city */
695 city_list_remove(invisible.cities, pcity);
696 city_is_new = TRUE;
697
698 pcity->tile = pcenter;
699 ptile = pcenter;
700 pcity->owner = powner;
701 pcity->original = player_by_number(packet->original);
702 } else if (city_owner(pcity) != powner) {
703 /* Remember what were the worked tiles. The server won't
704 * send them to us again. */
705 city_tile_iterate_skip_free_worked(&(wld.map), city_map_radius_sq_get(pcity),
706 ptile, pworked, _index, _x, _y) {
707 if (pcity == tile_worked(pworked)) {
708 if (NULL == worked_tiles) {
709 worked_tiles = tile_list_new();
710 }
711 tile_list_append(worked_tiles, pworked);
712 }
713 } city_tile_iterate_skip_free_worked_end;
714 client_remove_city(pcity);
715 pcity = NULL;
716 city_has_changed_owner = TRUE;
717 }
718 }
719
720 if (NULL == pcity) {
721 city_is_new = TRUE;
722 pcity = create_city_virtual(powner, pcenter, packet->name);
723 pcity->id = packet->id;
724 idex_register_city(&wld, pcity);
725 update_descriptions = TRUE;
726 } else if (pcity->id != packet->id) {
727 log_error("handle_city_info() city id %d != id %d.",
728 pcity->id, packet->id);
729 return;
730 } else if (ptile != pcenter) {
731 log_error("handle_city_info() city tile (%d, %d) != (%d, %d).",
732 TILE_XY(ptile), TILE_XY(pcenter));
733 return;
734 } else {
735 name_changed = (fc_strncmp(packet->name, pcity->name, MAX_LEN_CITYNAME));
736
737 while (trade_route_list_size(pcity->routes) > packet->trade_route_count) {
738 struct trade_route *proute = trade_route_list_get(pcity->routes, -1);
739
740 trade_route_list_remove(pcity->routes, proute);
741 FC_FREE(proute);
742 trade_routes_changed = TRUE;
743 }
744
745 /* Descriptions should probably be updated if the
746 * city name, production or time-to-grow changes.
747 * Note that if either the food stock or surplus
748 * have changed, the time-to-grow is likely to
749 * have changed as well. */
750 update_descriptions = (gui_options.draw_city_names && name_changed)
751 || (gui_options.draw_city_productions
752 && (!are_universals_equal(&pcity->production, &product)
753 || pcity->surplus[O_SHIELD] != packet->surplus[O_SHIELD]
754 || pcity->shield_stock != packet->shield_stock))
755 || (gui_options.draw_city_growth
756 && (pcity->food_stock != packet->food_stock
757 || pcity->surplus[O_FOOD] != packet->surplus[O_FOOD]))
758 || (gui_options.draw_city_trade_routes && trade_routes_changed);
759
760 city_name_set(pcity, packet->name);
761 }
762
763 /* Check data */
764 city_size_set(pcity, 0);
765 for (i = 0; i < FEELING_LAST; i++) {
766 pcity->feel[CITIZEN_HAPPY][i] = packet->ppl_happy[i];
767 pcity->feel[CITIZEN_CONTENT][i] = packet->ppl_content[i];
768 pcity->feel[CITIZEN_UNHAPPY][i] = packet->ppl_unhappy[i];
769 pcity->feel[CITIZEN_ANGRY][i] = packet->ppl_angry[i];
770 }
771 for (i = 0; i < CITIZEN_LAST; i++) {
772 city_size_add(pcity, pcity->feel[i][FEELING_FINAL]);
773 }
774 specialist_type_iterate(sp) {
775 pcity->specialists[sp] = packet->specialists[sp];
776 city_size_add(pcity, pcity->specialists[sp]);
777 } specialist_type_iterate_end;
778
779 if (city_size_get(pcity) != packet->size) {
780 log_error("handle_city_info() "
781 "%d citizens not equal %d city size in \"%s\".",
782 city_size_get(pcity), packet->size, city_name_get(pcity));
783 city_size_set(pcity, packet->size);
784 }
785
786 pcity->history = packet->history;
787 pcity->client.culture = packet->culture;
788 pcity->client.buy_cost = packet->buy_cost;
789
790 pcity->city_radius_sq = packet->city_radius_sq;
791
792 pcity->city_options = packet->city_options;
793
794 if (pcity->surplus[O_SCIENCE] != packet->surplus[O_SCIENCE]
795 || pcity->surplus[O_SCIENCE] != packet->surplus[O_SCIENCE]
796 || pcity->waste[O_SCIENCE] != packet->waste[O_SCIENCE]
797 || (pcity->unhappy_penalty[O_SCIENCE]
798 != packet->unhappy_penalty[O_SCIENCE])
799 || pcity->prod[O_SCIENCE] != packet->prod[O_SCIENCE]
800 || pcity->citizen_base[O_SCIENCE] != packet->citizen_base[O_SCIENCE]
801 || pcity->usage[O_SCIENCE] != packet->usage[O_SCIENCE]) {
802 need_science_dialog_update = TRUE;
803 }
804
805 pcity->food_stock = packet->food_stock;
806 if (pcity->shield_stock != packet->shield_stock) {
807 shield_stock_changed = TRUE;
808 pcity->shield_stock = packet->shield_stock;
809 }
810 pcity->pollution = packet->pollution;
811 pcity->illness_trade = packet->illness_trade;
812
813 if (!are_universals_equal(&pcity->production, &product)) {
814 production_changed = TRUE;
815 }
816 /* Need to consider shield stock/surplus for unit dialog as used build
817 * slots may change, affecting number of "in-progress" units. */
818 if ((city_is_new && VUT_UTYPE == product.kind)
819 || (production_changed && (VUT_UTYPE == pcity->production.kind
820 || VUT_UTYPE == product.kind))
821 || pcity->surplus[O_SHIELD] != packet->surplus[O_SHIELD]
822 || shield_stock_changed) {
823 need_units_dialog_update = TRUE;
824 }
825 pcity->production = product;
826
827 output_type_iterate(o) {
828 pcity->surplus[o] = packet->surplus[o];
829 pcity->waste[o] = packet->waste[o];
830 pcity->unhappy_penalty[o] = packet->unhappy_penalty[o];
831 pcity->prod[o] = packet->prod[o];
832 pcity->citizen_base[o] = packet->citizen_base[o];
833 pcity->usage[o] = packet->usage[o];
834 } output_type_iterate_end;
835
836#ifdef DONE_BY_create_city_virtual
837 if (city_is_new) {
838 worklist_init(&pcity->worklist);
839
840 for (i = 0; i < ARRAY_SIZE(pcity->built); i++) {
841 pcity->built[i].turn = I_NEVER;
842 }
843 }
844#endif /* DONE_BY_create_city_virtual */
845
846 worklist_copy(&pcity->worklist, &packet->worklist);
847
848 pcity->airlift = packet->airlift;
849 pcity->did_buy = packet->did_buy;
850 pcity->did_sell = packet->did_sell;
851 pcity->was_happy = packet->was_happy;
852 pcity->had_famine = packet->had_famine;
853
854 pcity->turn_founded = packet->turn_founded;
855 pcity->turn_last_built = packet->turn_last_built;
856
857 if (!universals_n_is_valid(packet->changed_from_kind)) {
858 log_error("handle_city_info() bad changed_from_kind %d.",
859 packet->changed_from_kind);
860 product.kind = VUT_NONE;
861 } else {
862 product = universal_by_number(packet->changed_from_kind,
863 packet->changed_from_value);
864 if (!universals_n_is_valid(product.kind)) {
865 log_error("handle_city_info() bad changed_from_value %d.",
866 packet->changed_from_value);
867 product.kind = VUT_NONE;
868 }
869 }
870 pcity->changed_from = product;
871
872 pcity->before_change_shields = packet->before_change_shields;
873 pcity->disbanded_shields = packet->disbanded_shields;
874 pcity->caravan_shields = packet->caravan_shields;
875 pcity->last_turns_shield_surplus = packet->last_turns_shield_surplus;
876
877 improvement_iterate(pimprove) {
878 bool have = BV_ISSET(packet->improvements, improvement_index(pimprove));
879
880 if (have && !city_is_new
881 && pcity->built[improvement_index(pimprove)].turn <= I_NEVER) {
882 audio_play_sound(pimprove->soundtag, pimprove->soundtag_alt,
883 pimprove->soundtag_alt2);
884 }
885 need_economy_dialog_update |=
886 update_improvement_from_packet(pcity, pimprove, have);
887 } improvement_iterate_end;
888
889 /* We should be able to see units in the city. But for a diplomat
890 * investigating an enemy city we can't. In that case we don't update
891 * the occupied flag at all: it's already been set earlier and we'll
892 * get an update if it changes. */
893 if (can_player_see_units_in_city(client.conn.playing, pcity)) {
894 pcity->client.occupied
895 = (unit_list_size(pcity->tile->units) > 0);
896 }
897
898 pcity->client.walls = packet->walls;
899 if (pcity->client.walls > NUM_WALL_TYPES) {
900 pcity->client.walls = NUM_WALL_TYPES;
901 }
902 pcity->style = packet->style;
903 pcity->capital = packet->capital;
904 if (packet->capital == CAPITAL_PRIMARY) {
905 powner->primary_capital_id = pcity->id;
906 } else if (powner->primary_capital_id == pcity->id) {
907 powner->primary_capital_id = 0;
908 }
909 pcity->client.city_image = packet->city_image;
910 pcity->steal = packet->steal;
911
912 pcity->client.happy = city_happy(pcity);
913 pcity->client.unhappy = city_unhappy(pcity);
914
915 popup = (city_is_new && can_client_change_view()
916 && powner == client.conn.playing
917 && gui_options.popup_new_cities)
918 || packet->diplomat_investigate;
919
920 city_packet_common(pcity, pcenter, powner, worked_tiles,
921 city_is_new, popup, packet->diplomat_investigate);
922
923 if (city_is_new && !city_has_changed_owner) {
924 agents_city_new(pcity);
925 } else {
926 agents_city_changed(pcity);
927 }
928
929 /* Update the description if necessary. */
930 if (update_descriptions) {
931 update_city_description(pcity);
932 }
933
934 /* Update focus unit info label if necessary. */
935 if (name_changed) {
936 unit_list_iterate(pfocus_units, pfocus_unit) {
937 if (pfocus_unit->homecity == pcity->id) {
938 update_unit_info_label(pfocus_units);
939 break;
940 }
941 } unit_list_iterate_end;
942 }
943
944 /* Update the science dialog if necessary. */
945 if (need_science_dialog_update) {
946 science_report_dialog_update();
947 }
948
949 /* Update the units dialog if necessary. */
950 if (need_units_dialog_update) {
951 units_report_dialog_update();
952 }
953
954 /* Update the economy dialog if necessary. */
955 if (need_economy_dialog_update) {
956 economy_report_dialog_update();
957 }
958
959 /* Update the panel text (including civ population). */
960 update_info_label();
961
962 /* Update caravan dialog */
963 if ((production_changed || shield_stock_changed)
964 && action_selection_target_city() == pcity->id) {
965 dsend_packet_unit_get_actions(&client.conn,
966 action_selection_actor_unit(),
967 action_selection_target_unit(),
968 city_tile(pcity)->index,
969 action_selection_target_extra(),
970 REQEST_BACKGROUND_REFRESH);
971 }
972
973 if (gui_options.draw_city_trade_routes
974 && (trade_routes_changed
975 || (city_is_new && 0 < city_num_trade_routes(pcity)))) {
976 update_map_canvas_visible();
977 }
978}
979
980/************************************************************************/
983 void handle_city_nationalities(const struct packet_city_nationalities *packet)
984{
985 struct city *pcity = game_city_by_number(packet->id);
986
987 /* The nationality of the citizens. */
988 if (pcity != NULL && game.info.citizen_nationality) {
989 int i;
990
991 citizens_init(pcity);
992 for (i = 0; i < packet->nationalities_count; i++) {
993 citizens_nation_set(pcity, player_slot_by_number(packet->nation_id[i]),
994 packet->nation_citizens[i]);
995 }
996 fc_assert(citizens_count(pcity) == city_size_get(pcity));
997 }
998}
999
1000/************************************************************************/
1003 void handle_city_rally_point(const struct packet_city_rally_point *packet)
1004{
1005 struct city *pcity = game_city_by_number(packet->id);
1006
1007 if (pcity != NULL) {
1008 city_rally_point_receive(packet, pcity);
1009 }
1010}
1011
1012/************************************************************************/
1017 static void city_packet_common(struct city *pcity, struct tile *pcenter,
1018 struct player *powner,
1019 struct tile_list *worked_tiles,
1020 bool is_new, bool popup, bool investigate)
1021{
1022 if (NULL != worked_tiles) {
1023 /* We need to transfer the worked infos because the server will assume
1024 * those infos are kept in our side and won't send to us again. */
1025 tile_list_iterate(worked_tiles, pwork) {
1026 tile_set_worked(pwork, pcity);
1027 } tile_list_iterate_end;
1028 tile_list_destroy(worked_tiles);
1029 }
1030
1031 if (is_new) {
1032 tile_set_worked(pcenter, pcity); /* is_free_worked() */
1033 city_list_prepend(powner->cities, pcity);
1034
1035 if (client_is_global_observer() || powner == client_player()) {
1036 city_report_dialog_update();
1037 }
1038
1039 players_iterate(pp) {
1040 unit_list_iterate(pp->units, punit) {
1041 if (punit->homecity == pcity->id) {
1042 unit_list_prepend(pcity->units_supported, punit);
1043 }
1044 } unit_list_iterate_end;
1045 } players_iterate_end;
1046
1047 pcity->client.first_citizen_index = fc_rand(MAX_NUM_CITIZEN_SPRITES);
1048 } else {
1049 if (client_is_global_observer() || powner == client_player()) {
1050 city_report_dialog_update_city(pcity);
1051 }
1052 }
1053
1054 if (can_client_change_view()) {
1055 refresh_city_mapcanvas(pcity, pcenter, FALSE, FALSE);
1056 }
1057
1058 if (city_workers_display == pcity) {
1059 city_workers_display = NULL;
1060 }
1061
1062 if (investigate) {
1063 /* Commit the collected supported and present units. */
1064 if (pcity->client.collecting_info_units_supported != NULL) {
1065 /* We got units, let's move the unit lists. */
1066 fc_assert(pcity->client.collecting_info_units_present != NULL);
1067
1068 unit_list_destroy(pcity->client.info_units_present);
1069 pcity->client.info_units_present =
1070 pcity->client.collecting_info_units_present;
1071 pcity->client.collecting_info_units_present = NULL;
1072
1073 unit_list_destroy(pcity->client.info_units_supported);
1074 pcity->client.info_units_supported =
1075 pcity->client.collecting_info_units_supported;
1076 pcity->client.collecting_info_units_supported = NULL;
1077 } else {
1078 /* We didn't get any unit, let's clear the unit lists. */
1079 fc_assert(pcity->client.collecting_info_units_present == NULL);
1080
1081 unit_list_clear(pcity->client.info_units_supported);
1082 unit_list_clear(pcity->client.info_units_present);
1083 }
1084 }
1085
1086 if (popup
1087 && NULL != client.conn.playing
1088 && is_human(client.conn.playing)
1089 && can_client_issue_orders()) {
1090 menus_update();
1091 if (!city_dialog_is_open(pcity)) {
1092 popup_city_dialog(pcity);
1093 }
1094 }
1095
1096 if (!is_new
1097 && (popup || can_player_see_city_internals(client.conn.playing, pcity))) {
1098 refresh_city_dialog(pcity);
1099 }
1100
1101 /* update menus if the focus unit is on the tile. */
1102 if (get_focus_unit_on_tile(pcenter)) {
1103 menus_update();
1104 }
1105
1106 if (is_new) {
1107 log_debug("(%d,%d) creating city %d, %s %s", TILE_XY(pcenter),
1108 pcity->id, nation_rule_name(nation_of_city(pcity)),
1109 city_name_get(pcity));
1110 }
1111
1112 editgui_notify_object_changed(OBJTYPE_CITY, pcity->id, FALSE);
1113}
1114
1115/************************************************************************/
1119 void handle_trade_route_info(const struct packet_trade_route_info *packet)
1120{
1121 struct city *pcity = game_city_by_number(packet->city);
1122 struct trade_route *proute;
1123 bool city_changed = FALSE;
1124
1125 if (pcity == NULL) {
1126 return;
1127 }
1128
1129 proute = trade_route_list_get(pcity->routes, packet->index);
1130 if (proute == NULL) {
1131 fc_assert(trade_route_list_size(pcity->routes) == packet->index);
1132
1133 proute = fc_malloc(sizeof(struct trade_route));
1134 trade_route_list_append(pcity->routes, proute);
1135 city_changed = TRUE;
1136 }
1137
1138 proute->partner = packet->partner;
1139 proute->value = packet->value;
1140 proute->dir = packet->direction;
1141 proute->goods = goods_by_number(packet->goods);
1142
1143 if (gui_options.draw_city_trade_routes && city_changed) {
1144 update_city_description(pcity);
1145 update_map_canvas_visible();
1146 }
1147}
1148
1149/************************************************************************/
1154 void handle_city_short_info(const struct packet_city_short_info *packet)
1155{
1156 bool city_has_changed_owner = FALSE;
1157 bool city_is_new = FALSE;
1158 bool name_changed = FALSE;
1159 bool update_descriptions = FALSE;
1160 struct city *pcity = game_city_by_number(packet->id);
1161 struct tile *pcenter = index_to_tile(&(wld.map), packet->tile);
1162 struct tile *ptile = NULL;
1163 struct tile_list *worked_tiles = NULL;
1164 struct player *powner = player_by_number(packet->owner);
1165 int radius_sq = game.info.init_city_radius_sq;
1166
1167 fc_assert_ret_msg(NULL != powner, "Bad player number %d.", packet->owner);
1168 fc_assert_ret_msg(NULL != pcenter, "Invalid tile index %d.", packet->tile);
1169
1170 if (NULL != pcity) {
1171 ptile = city_tile(pcity);
1172
1173 if (NULL == ptile) {
1174 /* Invisible worked city */
1175 city_list_remove(invisible.cities, pcity);
1176 city_is_new = TRUE;
1177
1178 pcity->tile = pcenter;
1179 pcity->owner = powner;
1180 pcity->original = NULL;
1181
1182 whole_map_iterate(&(wld.map), wtile) {
1183 if (wtile->worked == pcity) {
1184 int dist_sq = sq_map_distance(pcenter, wtile);
1185
1186 if (dist_sq > city_map_radius_sq_get(pcity)) {
1187 city_map_radius_sq_set(pcity, dist_sq);
1188 }
1189 }
1190 } whole_map_iterate_end;
1191 } else if (city_owner(pcity) != powner) {
1192 /* Remember what were the worked tiles. The server won't
1193 * send to us again. */
1194 city_tile_iterate_skip_free_worked(&(wld.map), city_map_radius_sq_get(pcity), ptile,
1195 pworked, _index, _x, _y) {
1196 if (pcity == tile_worked(pworked)) {
1197 if (NULL == worked_tiles) {
1198 worked_tiles = tile_list_new();
1199 }
1200 tile_list_append(worked_tiles, pworked);
1201 }
1202 } city_tile_iterate_skip_free_worked_end;
1203 radius_sq = city_map_radius_sq_get(pcity);
1204 client_remove_city(pcity);
1205 pcity = NULL;
1206 city_has_changed_owner = TRUE;
1207 }
1208 }
1209
1210 if (NULL == pcity) {
1211 city_is_new = TRUE;
1212 pcity = create_city_virtual(powner, pcenter, packet->name);
1213 pcity->id = packet->id;
1214 city_map_radius_sq_set(pcity, radius_sq);
1215 idex_register_city(&wld, pcity);
1216 } else if (pcity->id != packet->id) {
1217 log_error("handle_city_short_info() city id %d != id %d.",
1218 pcity->id, packet->id);
1219 return;
1220 } else if (city_tile(pcity) != pcenter) {
1221 log_error("handle_city_short_info() city tile (%d, %d) != (%d, %d).",
1222 TILE_XY(city_tile(pcity)), TILE_XY(pcenter));
1223 return;
1224 } else {
1225 name_changed = (fc_strncmp(packet->name, pcity->name, MAX_LEN_CITYNAME));
1226
1227 /* Check if city descriptions should be updated */
1228 if (gui_options.draw_city_names && name_changed) {
1229 update_descriptions = TRUE;
1230 }
1231
1232 city_name_set(pcity, packet->name);
1233
1234 memset(pcity->feel, 0, sizeof(pcity->feel));
1235 memset(pcity->specialists, 0, sizeof(pcity->specialists));
1236 }
1237
1238 pcity->specialists[DEFAULT_SPECIALIST] = packet->size;
1239 city_size_set(pcity, packet->size);
1240
1241 /* We can't actually see the internals of the city, but the server tells
1242 * us this much. */
1243 if (pcity->client.occupied != packet->occupied) {
1244 pcity->client.occupied = packet->occupied;
1245 if (gui_options.draw_full_citybar) {
1246 update_descriptions = TRUE;
1247 }
1248 }
1249 pcity->client.walls = packet->walls;
1250 if (pcity->client.walls > NUM_WALL_TYPES) {
1251 pcity->client.walls = NUM_WALL_TYPES;
1252 }
1253 pcity->style = packet->style;
1254 pcity->capital = packet->capital;
1255 if (packet->capital == CAPITAL_PRIMARY) {
1256 powner->primary_capital_id = pcity->id;
1257 } else if (powner->primary_capital_id == pcity->id) {
1258 powner->primary_capital_id = 0;
1259 }
1260 pcity->client.city_image = packet->city_image;
1261
1262 pcity->client.happy = packet->happy;
1263 pcity->client.unhappy = packet->unhappy;
1264
1265 improvement_iterate(pimprove) {
1266 /* Don't update the non-visible improvements, they could hide the
1267 * previously seen informations about the city (diplomat investigation).
1268 */
1269 if (is_improvement_visible(pimprove)) {
1270 bool have = BV_ISSET(packet->improvements,
1271 improvement_index(pimprove));
1272 update_improvement_from_packet(pcity, pimprove, have);
1273 }
1274 } improvement_iterate_end;
1275
1276 city_packet_common(pcity, pcenter, powner, worked_tiles,
1277 city_is_new, FALSE, FALSE);
1278
1279 if (city_is_new && !city_has_changed_owner) {
1280 agents_city_new(pcity);
1281 } else {
1282 agents_city_changed(pcity);
1283 }
1284
1285 /* Update the description if necessary. */
1286 if (update_descriptions) {
1287 update_city_description(pcity);
1288 }
1289}
1290
1291/************************************************************************/
1294 void handle_worker_task(const struct packet_worker_task *packet)
1295{
1296 struct city *pcity = game_city_by_number(packet->city_id);
1297 struct worker_task *ptask = NULL;
1298
1299 if (pcity == NULL
1300 || (pcity->owner != client.conn.playing && !client_is_global_observer())) {
1301 return;
1302 }
1303
1304 worker_task_list_iterate(pcity->task_reqs, ptask_old) {
1305 if (tile_index(ptask_old->ptile) == packet->tile_id) {
1306 ptask = ptask_old;
1307 break;
1308 }
1309 } worker_task_list_iterate_end;
1310
1311 if (ptask == NULL) {
1312 if (packet->activity == ACTIVITY_LAST) {
1313 return;
1314 } else {
1315 ptask = fc_malloc(sizeof(struct worker_task));
1316 worker_task_list_append(pcity->task_reqs, ptask);
1317 }
1318 } else {
1319 if (packet->activity == ACTIVITY_LAST) {
1320 worker_task_list_remove(pcity->task_reqs, ptask);
1321 free(ptask);
1322 ptask = NULL;
1323 }
1324 }
1325
1326 if (ptask != NULL) {
1327 ptask->ptile = index_to_tile(&(wld.map), packet->tile_id);
1328 ptask->act = packet->activity;
1329 if (packet->tgt >= 0) {
1330 ptask->tgt = extra_by_number(packet->tgt);
1331 } else {
1332 ptask->tgt = NULL;
1333 }
1334 ptask->want = packet->want;
1335 }
1336
1337 if (ptask && !worker_task_is_sane(ptask)) {
1338 log_debug("Bad worker task");
1339 worker_task_list_remove(pcity->task_reqs, ptask);
1340 free(ptask);
1341 ptask = NULL;
1342 return;
1343 }
1344
1345 refresh_city_dialog(pcity);
1346}
1347
1348/************************************************************************/
1351 void handle_new_year(int year, int fragments, int turn)
1352{
1353 game.info.year = year;
1354 game.info.fragment_count = fragments;
1355 /*
1356 * The turn was increased in handle_end_turn()
1357 */
1358 fc_assert(game.info.turn == turn);
1359 update_info_label();
1360
1361 unit_focus_update();
1362 auto_center_on_focus_unit();
1363
1364 update_unit_info_label(get_units_in_focus());
1365 menus_update();
1366
1367 set_seconds_to_turndone(current_turn_timeout());
1368
1369#if 0
1370 /* This information shouldn't be needed, but if it is this is the only
1371 * way we can get it. */
1372 if (NULL != client.conn.playing) {
1373 turn_gold_difference =
1374 client.conn.playing->economic.gold - last_turn_gold_amount;
1375 last_turn_gold_amount = client.conn.playing->economic.gold;
1376 }
1377#endif
1378
1379 update_city_descriptions();
1380 link_marks_decrease_turn_counters();
1381
1382 if (gui_options.sound_bell_at_new_turn) {
1383 create_event(NULL, E_TURN_BELL, ftc_client,
1384 _("Start of turn %d"), game.info.turn);
1385 }
1386
1387 agents_new_turn();
1388
1389 if (last_turn != turn) {
1390 start_turn();
1391 last_turn = turn;
1392 }
1393}
1394
1395/************************************************************************/
1400 void handle_end_phase(void)
1401{
1402 /* Messagewindow will contain events happened since our own phase ended,
1403 * so player of the first phase and last phase are in equal situation. */
1404 meswin_clear_older(game.info.turn, game.info.phase);
1405}
1406
1407/************************************************************************/
1411 void handle_start_phase(int phase)
1412{
1413 if (!client_has_player() && !client_is_observer()) {
1414 /* We are on detached state, let ignore this packet. */
1415 return;
1416 }
1417
1418 if (phase < 0
1419 || (game.info.phase_mode == PMT_PLAYERS_ALTERNATE
1420 && phase >= player_count())
1421 || (game.info.phase_mode == PMT_TEAMS_ALTERNATE
1422 && phase >= team_count())) {
1423 log_error("handle_start_phase() illegal phase %d.", phase);
1424 return;
1425 }
1426
1427 set_client_state(C_S_RUNNING);
1428
1429 game.info.phase = phase;
1430
1431 /* Possibly replace wait cursor with something else */
1432 if (phase == 0) {
1433 /* TODO: Have server set as busy also if switching phase
1434 * is taking long in a alternating phases mode. */
1435 set_server_busy(FALSE);
1436 }
1437
1438 if (NULL != client.conn.playing
1439 && is_player_phase(client.conn.playing, phase)) {
1440 agents_start_turn();
1441 non_ai_unit_focus = FALSE;
1442
1443 update_turn_done_button_state();
1444
1445 if (is_ai(client.conn.playing)
1446 && !gui_options.ai_manual_turn_done) {
1447 user_ended_turn();
1448 }
1449
1450 unit_focus_set_status(client.conn.playing);
1451
1452 city_list_iterate(client.conn.playing->cities, pcity) {
1453 pcity->client.colored = FALSE;
1454 } city_list_iterate_end;
1455
1456 unit_list_iterate(client.conn.playing->units, punit) {
1457 punit->client.colored = FALSE;
1458 } unit_list_iterate_end;
1459
1460 update_map_canvas_visible();
1461 }
1462
1463 update_info_label();
1464}
1465
1466/************************************************************************/
1470 void handle_begin_turn(void)
1471{
1472 log_debug("handle_begin_turn()");
1473
1474 /* Server is still considered busy until it handles also the beginning
1475 * of the first phase. */
1476
1477 stop_turn_change_wait();
1478}
1479
1480/************************************************************************/
1484 void handle_end_turn(void)
1485{
1486 log_debug("handle_end_turn()");
1487
1488 /* Make sure wait cursor is in use */
1489 set_server_busy(TRUE);
1490
1491 start_turn_change_wait();
1492
1493 /*
1494 * The local idea of the game.info.turn is increased here since the
1495 * client will get unit updates (reset of move points for example)
1496 * between handle_end_turn() and handle_new_year(). These
1497 * unit updates will look like they did take place in the old turn
1498 * which is incorrect. If we get the authoritative information about
1499 * the game.info.turn in handle_new_year() we will check it.
1500 */
1501 game.info.turn++;
1502
1503 log_verbose(_("Beginning turn %d"), game.info.turn);
1504
1505 agents_before_new_turn();
1506}
1507
1508/************************************************************************/
1511 void play_sound_for_event(enum event_type type)
1512{
1513 const char *sound_tag = get_event_tag(type);
1514
1515 if (sound_tag) {
1516 audio_play_sound(sound_tag, NULL, NULL);
1517 }
1518}
1519
1520/************************************************************************/
1524 void handle_chat_msg(const struct packet_chat_msg *packet)
1525{
1526 handle_event(packet->message,
1527 index_to_tile(&(wld.map), packet->tile),
1528 packet->event,
1529 packet->turn,
1530 packet->phase,
1531 packet->conn_id);
1532}
1533
1534/************************************************************************/
1544 void handle_early_chat_msg(const struct packet_early_chat_msg *packet)
1545{
1546 handle_event(packet->message,
1547 index_to_tile(&(wld.map), packet->tile),
1548 packet->event,
1549 packet->turn,
1550 packet->phase,
1551 packet->conn_id);
1552}
1553
1554/************************************************************************/
1558 void handle_connect_msg(const char *message)
1559{
1560 popup_connect_msg(_("Welcome"), message);
1561}
1562
1563/************************************************************************/
1567 void handle_server_info(const char *version_label, int major_version,
1568 int minor_version, int patch_version, int emerg_version)
1569{
1570 if (emerg_version > 0) {
1571 log_verbose("Server has version %d.%d.%d.%d%s",
1572 major_version, minor_version, patch_version, emerg_version,
1573 version_label);
1574 } else {
1575 log_verbose("Server has version %d.%d.%d%s",
1576 major_version, minor_version, patch_version, version_label);
1577 }
1578}
1579
1580/************************************************************************/
1583 void handle_page_msg(const char *caption, const char *headline,
1584 enum event_type event, int len, int parts)
1585{
1586 if (!client_has_player()
1587 || is_human(client_player())
1588 || event != E_BROADCAST_REPORT) {
1589 if (page_msg_report.parts > 0) {
1590 /* Previous one was never finished */
1591 free(page_msg_report.caption);
1592 free(page_msg_report.headline);
1593 free(page_msg_report.lines);
1594 }
1595 page_msg_report.len = len;
1596 page_msg_report.event = event;
1597 page_msg_report.caption = fc_strdup(caption);
1598 page_msg_report.headline = fc_strdup(headline);
1599 page_msg_report.parts = parts;
1600 page_msg_report.lines = fc_malloc(len + 1);
1601 page_msg_report.lines[0] = '\0';
1602
1603 if (parts == 0) {
1604 /* Empty report - handle as if last part was just received. */
1605 page_msg_report.parts = 1;
1606 handle_page_msg_part("");
1607 }
1608 }
1609}
1610
1611/************************************************************************/
1614 void handle_page_msg_part(const char *lines)
1615{
1616 if (page_msg_report.lines != NULL) {
1617 /* We have already decided to show the message at the time we got
1618 * the header packet. */
1619 fc_strlcat(page_msg_report.lines, lines, page_msg_report.len + 1);
1620 page_msg_report.parts--;
1621
1622 if (page_msg_report.parts == 0) {
1623 /* This is the final part */
1624 popup_notify_dialog(page_msg_report.caption,
1625 page_msg_report.headline,
1626 page_msg_report.lines);
1627 play_sound_for_event(page_msg_report.event);
1628
1629 free(page_msg_report.caption);
1630 free(page_msg_report.headline);
1631 free(page_msg_report.lines);
1632 page_msg_report.lines = NULL;
1633 }
1634 }
1635}
1636
1637/************************************************************************/
1640 void handle_unit_info(const struct packet_unit_info *packet)
1641{
1642 struct unit *punit;
1643
1644 punit = unpackage_unit(packet);
1645 if (handle_unit_packet_common(punit)) {
1646 punit->client.transported_by = -1;
1647 unit_virtual_destroy(punit);
1648 }
1649}
1650
1651/**********************************************************************/
1656 static void action_decision_handle(struct unit *punit)
1657{
1658 if (!gui_options.popup_attack_actions) {
1659 action_array_iterate(auto_attack_actions, act_id) {
1660 if (utype_can_do_action(unit_type_get(punit), act_id)) {
1661 /* An auto action like auto attack could be legal. Check for those
1662 * at once so they won't have to wait for player focus. */
1663 dsend_packet_unit_get_actions(&client.conn,
1664 punit->id,
1665 IDENTITY_NUMBER_ZERO,
1666 tile_index(punit->action_decision_tile),
1667 EXTRA_NONE,
1668 REQEST_BACKGROUND_FAST_AUTO_ATTACK);
1669 return;
1670 }
1671 } action_array_iterate_end;
1672 }
1673
1674 /* This should be done in the foreground */
1675 action_decision_request(punit);
1676}
1677
1678/************************************************************************/
1694 static bool handle_unit_packet_common(struct unit *packet_unit)
1695{
1696 struct city *pcity;
1697 struct unit *punit;
1698 bool need_menus_update = FALSE;
1699 bool need_economy_report_update = FALSE;
1700 bool need_units_report_update = FALSE;
1701 bool repaint_unit = FALSE;
1702 bool repaint_city = FALSE; /* regards unit's homecity */
1703 struct tile *old_tile = NULL;
1704 bool check_focus = FALSE; /* conservative focus change */
1705 bool moved = FALSE;
1706 bool ret = FALSE;
1707
1708 punit = player_unit_by_number(unit_owner(packet_unit), packet_unit->id);
1709 if (!punit && game_unit_by_number(packet_unit->id)) {
1710 /* This means unit has changed owner. We deal with this here
1711 * by simply deleting the old one and creating a new one. */
1712 handle_unit_remove(packet_unit->id);
1713 }
1714
1715 if (punit) {
1716 /* In some situations, the size of repaint units require can change;
1717 * in particular, city-builder units sometimes get a potential-city
1718 * outline, but to speed up redraws we don't repaint this whole area
1719 * unnecessarily. We need to ensure that when the footprint shrinks,
1720 * old bits aren't left behind on the canvas.
1721 * If the current (old) status of the unit is such that it gets a large
1722 * repaint, as a special case, queue a large repaint immediately, to
1723 * schedule the correct amount/location to be redrawn; but rely on the
1724 * repaint being deferred until the unit is updated, so that what's
1725 * drawn reflects the new status (e.g., no city outline). */
1726 if (unit_drawn_with_city_outline(punit, TRUE)) {
1727 refresh_unit_mapcanvas(punit, unit_tile(punit), TRUE, FALSE);
1728 }
1729
1730 ret = TRUE;
1731 punit->activity_count = packet_unit->activity_count;
1732 unit_change_battlegroup(punit, packet_unit->battlegroup);
1733 if (punit->ssa_controller != packet_unit->ssa_controller) {
1734 punit->ssa_controller = packet_unit->ssa_controller;
1735 repaint_unit = TRUE;
1736 /* AI is set: may change focus */
1737 /* AI is cleared: keep focus */
1738 if (packet_unit->ssa_controller != SSA_NONE
1739 && unit_is_in_focus(punit)) {
1740 check_focus = TRUE;
1741 }
1742 }
1743
1744 if (punit->facing != packet_unit->facing) {
1745 punit->facing = packet_unit->facing;
1746 repaint_unit = TRUE;
1747 }
1748
1749 if (punit->activity != packet_unit->activity
1750 || punit->activity_target == packet_unit->activity_target
1751 || punit->client.transported_by != packet_unit->client.transported_by
1752 || punit->client.occupied != packet_unit->client.occupied
1753 || punit->has_orders != packet_unit->has_orders
1754 || punit->orders.repeat != packet_unit->orders.repeat
1755 || punit->orders.vigilant != packet_unit->orders.vigilant
1756 || punit->orders.index != packet_unit->orders.index) {
1757
1758 /*** Change in activity or activity's target. ***/
1759
1760 /* May change focus if focus unit gets a new activity.
1761 * But if new activity is Idle, it means user specifically selected
1762 * the unit */
1763 if (unit_is_in_focus(punit)
1764 && (packet_unit->activity != ACTIVITY_IDLE
1765 || packet_unit->has_orders)) {
1766 check_focus = TRUE;
1767 }
1768
1769 repaint_unit = TRUE;
1770
1771 /* Wakeup Focus */
1772 if (gui_options.wakeup_focus
1773 && NULL != client.conn.playing
1774 && is_human(client.conn.playing)
1775 && unit_owner(punit) == client.conn.playing
1776 && punit->activity == ACTIVITY_SENTRY
1777 && packet_unit->activity == ACTIVITY_IDLE
1778 && !unit_is_in_focus(punit)
1779 && is_player_phase(client.conn.playing, game.info.phase)) {
1780 /* many wakeup units per tile are handled */
1781 unit_focus_urgent(punit);
1782 check_focus = FALSE; /* and keep it */
1783 }
1784
1785 punit->activity = packet_unit->activity;
1786 punit->activity_target = packet_unit->activity_target;
1787
1788 if (punit->client.transported_by
1789 != packet_unit->client.transported_by) {
1790 if (packet_unit->client.transported_by == -1) {
1791 /* The unit was unloaded from its transport. The check for a new
1792 * transport is done below. */
1793 unit_transport_unload(punit);
1794 }
1795
1796 punit->client.transported_by = packet_unit->client.transported_by;
1797 }
1798
1799 if (punit->client.occupied != packet_unit->client.occupied) {
1800 if (get_focus_unit_on_tile(unit_tile(packet_unit))) {
1801 /* Special case: (un)loading a unit in a transporter on the same
1802 *tile as the focus unit may (dis)allow the focus unit to be
1803 * loaded. Thus the orders->(un)load menu item needs updating. */
1804 need_menus_update = TRUE;
1805 }
1806 punit->client.occupied = packet_unit->client.occupied;
1807 }
1808
1809 punit->has_orders = packet_unit->has_orders;
1810 punit->orders.length = packet_unit->orders.length;
1811 punit->orders.index = packet_unit->orders.index;
1812 punit->orders.repeat = packet_unit->orders.repeat;
1813 punit->orders.vigilant = packet_unit->orders.vigilant;
1814
1815 /* We cheat by just stealing the packet unit's list. */
1816 if (punit->orders.list) {
1817 free(punit->orders.list);
1818 }
1819 punit->orders.list = packet_unit->orders.list;
1820 packet_unit->orders.list = NULL;
1821
1822 if (NULL == client.conn.playing
1823 || unit_owner(punit) == client.conn.playing) {
1824 refresh_unit_city_dialogs(punit);
1825 }
1826 } /*** End of Change in activity or activity's target. ***/
1827
1828 /* These two lines force the menus to be updated as appropriate when
1829 * the focus unit changes. */
1830 if (unit_is_in_focus(punit)) {
1831 need_menus_update = TRUE;
1832 }
1833
1834 if (punit->homecity != packet_unit->homecity) {
1835 /* change homecity */
1836 struct city *hcity;
1837
1838 if ((hcity = game_city_by_number(punit->homecity))) {
1839 unit_list_remove(hcity->units_supported, punit);
1840 refresh_city_dialog(hcity);
1841 }
1842
1843 punit->homecity = packet_unit->homecity;
1844 if ((hcity = game_city_by_number(punit->homecity))) {
1845 unit_list_prepend(hcity->units_supported, punit);
1846 repaint_city = TRUE;
1847 }
1848
1849 /* This can change total upkeep figures */
1850 need_units_report_update = TRUE;
1851 }
1852
1853 if (punit->hp != packet_unit->hp) {
1854 /* hp changed */
1855 punit->hp = packet_unit->hp;
1856 repaint_unit = TRUE;
1857 }
1858
1859 if (punit->utype != unit_type_get(packet_unit)) {
1860 /* Unit type has changed (been upgraded) */
1861 struct city *ccity = tile_city(unit_tile(punit));
1862
1863 punit->utype = unit_type_get(packet_unit);
1864 repaint_unit = TRUE;
1865 repaint_city = TRUE;
1866 if (ccity != NULL && (ccity->id != punit->homecity)) {
1867 refresh_city_dialog(ccity);
1868 }
1869 if (unit_is_in_focus(punit)) {
1870 /* Update the orders menu -- the unit might have new abilities */
1871 need_menus_update = TRUE;
1872 }
1873 need_units_report_update = TRUE;
1874 }
1875
1876 /* May change focus if an attempted move or attack exhausted unit */
1877 if (punit->moves_left != packet_unit->moves_left
1878 && unit_is_in_focus(punit)) {
1879 check_focus = TRUE;
1880 }
1881
1882 if (!same_pos(unit_tile(punit), unit_tile(packet_unit))) {
1883 /*** Change position ***/
1884 struct city *ccity = tile_city(unit_tile(punit));
1885
1886 old_tile = unit_tile(punit);
1887 moved = TRUE;
1888
1889 /* Show where the unit is going. */
1890 do_move_unit(punit, packet_unit);
1891
1892 if (ccity != NULL) {
1893 if (can_player_see_units_in_city(client.conn.playing, ccity)) {
1894 /* Unit moved out of a city - update the occupied status. */
1895 bool new_occupied =
1896 (unit_list_size(ccity->tile->units) > 0);
1897
1898 if (ccity->client.occupied != new_occupied) {
1899 ccity->client.occupied = new_occupied;
1900 refresh_city_mapcanvas(ccity, ccity->tile, FALSE, FALSE);
1901 if (gui_options.draw_full_citybar) {
1902 update_city_description(ccity);
1903 }
1904 }
1905 }
1906
1907 if (ccity->id == punit->homecity) {
1908 repaint_city = TRUE;
1909 } else {
1910 refresh_city_dialog(ccity);
1911 }
1912 }
1913
1914 if ((ccity = tile_city(unit_tile(punit)))) {
1915 if (can_player_see_units_in_city(client.conn.playing, ccity)) {
1916 /* Unit moved into a city - obviously it's occupied. */
1917 if (!ccity->client.occupied) {
1918 ccity->client.occupied = TRUE;
1919 refresh_city_mapcanvas(ccity, ccity->tile, FALSE, FALSE);
1920 if (gui_options.draw_full_citybar) {
1921 update_city_description(ccity);
1922 }
1923 }
1924 }
1925
1926 if (ccity->id == punit->homecity) {
1927 repaint_city = TRUE;
1928 } else {
1929 refresh_city_dialog(ccity);
1930 }
1931 }
1932
1933 } /*** End of Change position. ***/
1934
1935 if (repaint_city || repaint_unit) {
1936 /* We repaint the city if the unit itself needs repainting or if
1937 * there is a special city-only redrawing to be done. */
1938 if ((pcity = game_city_by_number(punit->homecity))) {
1939 refresh_city_dialog(pcity);
1940 }
1941 if (repaint_unit && tile_city(unit_tile(punit))
1942 && tile_city(unit_tile(punit)) != pcity) {
1943 /* Refresh the city we're occupying too. */
1944 refresh_city_dialog(tile_city(unit_tile(punit)));
1945 }
1946 }
1947
1948 need_economy_report_update = (punit->upkeep[O_GOLD]
1949 != packet_unit->upkeep[O_GOLD]);
1950 /* unit upkeep information */
1951 output_type_iterate(o) {
1952 punit->upkeep[o] = packet_unit->upkeep[o];
1953 } output_type_iterate_end;
1954
1955 punit->nationality = packet_unit->nationality;
1956 punit->veteran = packet_unit->veteran;
1957 punit->moves_left = packet_unit->moves_left;
1958 punit->fuel = packet_unit->fuel;
1959 punit->goto_tile = packet_unit->goto_tile;
1960 punit->paradropped = packet_unit->paradropped;
1961 punit->stay = packet_unit->stay;
1962 if (punit->done_moving != packet_unit->done_moving) {
1963 punit->done_moving = packet_unit->done_moving;
1964 check_focus = TRUE;
1965 }
1966
1967 /* This won't change punit; it enqueues the call for later handling. */
1968 agents_unit_changed(punit);
1969 editgui_notify_object_changed(OBJTYPE_UNIT, punit->id, FALSE);
1970
1971 if ((punit->action_decision_want != packet_unit->action_decision_want
1972 || (punit->action_decision_tile
1973 != packet_unit->action_decision_tile))
1974 && should_ask_server_for_actions(packet_unit)) {
1975 /* The unit wants the player to decide. */
1976 if (action_selection_actor_unit() != punit->id) {
1977 /* Pop up an action selection dialog if the unit has focus or give
1978 * the unit higher priority in the focus queue if not. */
1979 punit->action_decision_tile = packet_unit->action_decision_tile;
1980 action_decision_handle(punit);
1981 check_focus = TRUE;
1982 } else {
1983 /* Refresh already open action selection dialog. */
1984 dsend_packet_unit_get_actions(&client.conn,
1985 action_selection_actor_unit(),
1986 action_selection_target_unit(),
1987 tile_index(
1988 packet_unit->action_decision_tile),
1989 action_selection_target_extra(),
1990 REQEST_BACKGROUND_REFRESH);
1991 }
1992 }
1993 punit->action_decision_want = packet_unit->action_decision_want;
1994 punit->action_decision_tile = packet_unit->action_decision_tile;
1995 } else {
1996 /*** Create new unit ***/
1997 punit = packet_unit;
1998 idex_register_unit(&wld, punit);
1999
2000 unit_list_prepend(unit_owner(punit)->units, punit);
2001 unit_list_prepend(unit_tile(punit)->units, punit);
2002
2003 unit_register_battlegroup(punit);
2004
2005 if ((pcity = game_city_by_number(punit->homecity))) {
2006 unit_list_prepend(pcity->units_supported, punit);
2007 }
2008
2009 log_debug("New %s %s id %d (%d %d) hc %d %s",
2010 nation_rule_name(nation_of_unit(punit)),
2011 unit_rule_name(punit), TILE_XY(unit_tile(punit)),
2012 punit->id, punit->homecity,
2013 (pcity ? city_name_get(pcity) : "(unknown)"));
2014
2015 repaint_unit = !unit_transported(punit);
2016 agents_unit_new(punit);
2017
2018 /* Check if we should link cargo units.
2019 * (This might be necessary if the cargo info was sent to us before
2020 * this transporter.) */
2021 if (punit->client.occupied) {
2022 unit_list_iterate(unit_tile(punit)->units, aunit) {
2023 if (aunit->client.transported_by == punit->id) {
2024 fc_assert(aunit->transporter == NULL);
2025 unit_transport_load(aunit, punit, TRUE);
2026 }
2027 } unit_list_iterate_end;
2028 }
2029
2030 if ((pcity = tile_city(unit_tile(punit)))) {
2031 /* The unit is in a city - obviously it's occupied. */
2032 pcity->client.occupied = TRUE;
2033 }
2034
2035 if (should_ask_server_for_actions(punit)) {
2036 /* The unit wants the player to decide. */
2037 action_decision_handle(punit);
2038 check_focus = TRUE;
2039 }
2040
2041 need_units_report_update = TRUE;
2042 } /*** End of Create new unit ***/
2043
2044 fc_assert_ret_val(punit != NULL, ret);
2045
2046 /* Check if we have to load the unit on a transporter. */
2047 if (punit->client.transported_by != -1) {
2048 struct unit *ptrans
2049 = game_unit_by_number(packet_unit->client.transported_by);
2050
2051 /* Load unit only if transporter is known by the client.
2052 * (If not, cargo will be loaded later when the transporter info is
2053 * sent to the client.) */
2054 if (ptrans && ptrans != unit_transport_get(punit)) {
2055 /* First, we have to unload the unit from its old transporter. */
2056 unit_transport_unload(punit);
2057 unit_transport_load(punit, ptrans, TRUE);
2058#ifdef DEBUG_TRANSPORT
2059 log_debug("load %s (ID: %d) onto %s (ID: %d)",
2060 unit_name_translation(punit), punit->id,
2061 unit_name_translation(ptrans), ptrans->id);
2062 } else if (ptrans && ptrans == unit_transport_get(punit)) {
2063 log_debug("%s (ID: %d) is loaded onto %s (ID: %d)",
2064 unit_name_translation(punit), punit->id,
2065 unit_name_translation(ptrans), ptrans->id);
2066 } else {
2067 log_debug("%s (ID: %d) is not loaded", unit_name_translation(punit),
2068 punit->id);
2069#endif /* DEBUG_TRANSPORT */
2070 }
2071 }
2072
2073 if (unit_is_in_focus(punit)
2074 || get_focus_unit_on_tile(unit_tile(punit))
2075 || (moved && get_focus_unit_on_tile(old_tile))) {
2076 update_unit_info_label(get_units_in_focus());
2077 /* Update (an possible active) unit select dialog. */
2078 unit_select_dialog_update();
2079 }
2080
2081 if (repaint_unit) {
2082 refresh_unit_mapcanvas(punit, unit_tile(punit), TRUE, FALSE);
2083 }
2084
2085 if ((check_focus || get_num_units_in_focus() == 0)
2086 && NULL != client.conn.playing
2087 && is_human(client.conn.playing)
2088 && is_player_phase(client.conn.playing, game.info.phase)) {
2089 unit_focus_update();
2090 }
2091
2092 if (need_menus_update) {
2093 menus_update();
2094 }
2095
2096 if (!client_has_player() || unit_owner(punit) == client_player()) {
2097 if (need_economy_report_update) {
2098 economy_report_dialog_update();
2099 }
2100 if (need_units_report_update) {
2101 units_report_dialog_update();
2102 }
2103 }
2104
2105 return ret;
2106}
2107
2108/************************************************************************/
2114 void handle_investigate_started(const struct packet_investigate_started *packet)
2115{
2116 struct city *pcity = game_city_by_number(packet->city_id);
2117
2118 if (!pcity) {
2119 log_error("Investigate city: unknown city id %d!",
2120 packet->city_id);
2121 return;
2122 }
2123
2124 /* Start collecting supported and present units. */
2125
2126 /* Ensure we are not already in an investigate cycle. */
2127 fc_assert(pcity->client.collecting_info_units_supported == NULL);
2128 fc_assert(pcity->client.collecting_info_units_present == NULL);
2129 pcity->client.collecting_info_units_supported =
2130 unit_list_new_full(unit_virtual_destroy);
2131 pcity->client.collecting_info_units_present =
2132 unit_list_new_full(unit_virtual_destroy);
2133}
2134
2135/************************************************************************/
2138 void handle_investigate_finished(const struct packet_investigate_finished *packet)
2139{
2140}
2141
2142/************************************************************************/
2145 void handle_unit_short_info(const struct packet_unit_short_info *packet)
2146{
2147 struct city *pcity;
2148 struct unit *punit;
2149
2150 /* Special case for a diplomat/spy investigating a city: The investigator
2151 * needs to know the supported and present units of a city, whether or not
2152 * they are fogged. So, we send a list of them all before sending the city
2153 * info. */
2154 if (packet->packet_use == UNIT_INFO_CITY_SUPPORTED
2155 || packet->packet_use == UNIT_INFO_CITY_PRESENT) {
2156
2157 pcity = game_city_by_number(packet->info_city_id);
2158 if (!pcity) {
2159 log_error("Investigate city: unknown city id %d!",
2160 packet->info_city_id);
2161 return;
2162 }
2163
2164 /* Append a unit struct to the proper list. */
2165 punit = unpackage_short_unit(packet);
2166 if (packet->packet_use == UNIT_INFO_CITY_SUPPORTED) {
2167 fc_assert(pcity->client.collecting_info_units_supported != NULL);
2168 unit_list_append(pcity->client.collecting_info_units_supported, punit);
2169 } else {
2170 fc_assert(packet->packet_use == UNIT_INFO_CITY_PRESENT);
2171 fc_assert(pcity->client.collecting_info_units_present != NULL);
2172 unit_list_append(pcity->client.collecting_info_units_present, punit);
2173 }
2174
2175 /* Done with special case. */
2176 return;
2177 }
2178
2179 if (player_by_number(packet->owner) == client.conn.playing) {
2180 log_error("handle_unit_short_info() for own unit.");
2181 }
2182
2183 punit = unpackage_short_unit(packet);
2184 if (handle_unit_packet_common(punit)) {
2185 punit->client.transported_by = -1;
2186 unit_virtual_destroy(punit);
2187 }
2188}
2189
2190/************************************************************************/
2193 void handle_set_topology(int topology_id, int wrap_id)
2194{
2195 wld.map.topology_id = topology_id;
2196 wld.map.wrap_id = wrap_id;
2197
2198 if (forced_tileset_name[0] == '\0'
2199 && (tileset_map_topo_compatible(topology_id, tileset, NULL)
2200 == TOPO_INCOMP_HARD
2201 || strcmp(tileset_basename(tileset), game.control.preferred_tileset))) {
2202 const char *ts_to_load;
2203
2204 ts_to_load = tileset_name_for_topology(topology_id);
2205
2206 if (ts_to_load != NULL && ts_to_load[0] != '\0') {
2207 tilespec_reread_frozen_refresh(ts_to_load);
2208 }
2209 }
2210}
2211
2212/************************************************************************/
2216 void handle_map_info(const struct packet_map_info *packet)
2217{
2218 int ts_topo;
2219
2220 if (!map_is_empty()) {
2221 map_free(&(wld.map));
2222 free_city_map_index();
2223 }
2224
2225 wld.map.xsize = packet->xsize;
2226 wld.map.ysize = packet->ysize;
2227
2228 wld.map.north_latitude = packet->north_latitude;
2229 wld.map.south_latitude = packet->south_latitude;
2230
2231 if (tileset_map_topo_compatible(packet->topology_id, tileset, &ts_topo) == TOPO_INCOMP_HARD) {
2232 tileset_error(LOG_NORMAL, tileset_name_get(tileset),
2233 _("Map topology (%s) and tileset (%s) incompatible."),
2234 describe_topology(packet->topology_id), describe_topology(ts_topo));
2235 }
2236
2237 wld.map.topology_id = packet->topology_id;
2238 wld.map.wrap_id = packet->wrap_id;
2239
2240 map_init_topology();
2241 main_map_allocate();
2242 client_player_maps_reset();
2243 init_client_goto();
2244 mapdeco_init();
2245
2246 generate_citydlg_dimensions();
2247
2248 calculate_overview_dimensions();
2249
2250 packhand_init();
2251}
2252
2253/************************************************************************/
2256 void handle_game_info(const struct packet_game_info *pinfo)
2257{
2258 bool boot_help;
2259 bool update_aifill_button = FALSE, update_ai_skill_level = FALSE;
2260 bool toggle_edit_ui = FALSE;
2261
2262 if (game.info.aifill != pinfo->aifill) {
2263 update_aifill_button = TRUE;
2264 }
2265 if (game.info.skill_level != pinfo->skill_level) {
2266 update_ai_skill_level = TRUE;
2267 }
2268
2269 if (game.info.is_edit_mode != pinfo->is_edit_mode) {
2270 toggle_edit_ui = TRUE;
2271
2272 popdown_all_city_dialogs();
2273 /* Clears the current goto command. */
2274 clear_hover_state();
2275
2276 if (pinfo->is_edit_mode) {
2277 if (game.scenario.handmade && !handmade_scenario_warning()) {
2278 /* Gui didn't handle this */
2279 output_window_append(ftc_client,
2280 _("This scenario may have manually set properties the editor "
2281 "cannot handle."));
2282 output_window_append(ftc_client,
2283 _("They won't be saved when scenario is saved from the editor."));
2284 }
2285 }
2286 }
2287
2288 game.info = *pinfo;
2289
2290 /* check the values! */
2291#define VALIDATE(_count, _maximum, _string) \
2292 if (game.info._count > _maximum) { \
2293 log_error("handle_game_info(): Too many " _string "; using %d of %d", \
2294 _maximum, game.info._count); \
2295 game.info._count = _maximum; \
2296 }
2297
2298 VALIDATE(granary_num_inis, MAX_GRANARY_INIS, "granary entries");
2299#undef VALIDATE
2300
2301 game.default_government =
2302 government_by_number(game.info.default_government_id);
2303 game.government_during_revolution =
2304 government_by_number(game.info.government_during_revolution_id);
2305
2306 boot_help = (can_client_change_view()
2307 && game.info.victory_conditions != pinfo->victory_conditions);
2308 if (boot_help) {
2309 boot_help_texts(); /* reboot, after setting game.spacerace */
2310 }
2311 unit_focus_update();
2312 menus_update();
2313 players_dialog_update();
2314 if (update_aifill_button || update_ai_skill_level) {
2315 update_start_page();
2316 }
2317
2318 if (can_client_change_view()) {
2319 update_info_label();
2320 }
2321
2322 if (toggle_edit_ui) {
2323 editgui_refresh();
2324 }
2325
2326 editgui_notify_object_changed(OBJTYPE_GAME, 1, FALSE);
2327}
2328
2329/************************************************************************/
2332 void handle_calendar_info(const struct packet_calendar_info *pcalendar)
2333{
2334 game.calendar = *pcalendar;
2335}
2336
2337/************************************************************************/
2340 void handle_timeout_info(float seconds_to_phasedone, float last_turn_change_time)
2341{
2342 if (current_turn_timeout() != 0 && seconds_to_phasedone >= 0) {
2343 /* If this packet is received in the middle of a turn, this value
2344 * represents the number of seconds from now to the end of the turn
2345 * (not from the start of the turn). So we need to restart our
2346 * timer. */
2347 set_seconds_to_turndone(seconds_to_phasedone);
2348 }
2349
2350 game.tinfo.last_turn_change_time = last_turn_change_time;
2351}
2352
2353/************************************************************************/
2357 void set_government_choice(struct government *government)
2358{
2359 if (NULL != client.conn.playing
2360 && can_client_issue_orders()
2361 && government != government_of_player(client.conn.playing)) {
2362 dsend_packet_player_change_government(&client.conn, government_number(government));
2363 }
2364}
2365
2366/************************************************************************/
2370 void start_revolution(void)
2371{
2372 dsend_packet_player_change_government(&client.conn,
2373 game.info.government_during_revolution_id);
2374}
2375
2376/************************************************************************/
2381 void handle_player_remove(int playerno)
2382{
2383 struct player_slot *pslot;
2384 struct player *pplayer;
2385 int plr_nbr;
2386
2387 pslot = player_slot_by_number(playerno);
2388
2389 if (NULL == pslot || !player_slot_is_used(pslot)) {
2390 /* Ok, just ignore. */
2391 return;
2392 }
2393
2394 pplayer = player_slot_get_player(pslot);
2395
2396 if (can_client_change_view()) {
2397 close_intel_dialog(pplayer);
2398 }
2399
2400 /* Update the connection informations. */
2401 if (client_player() == pplayer) {
2402 client.conn.playing = NULL;
2403 }
2404 conn_list_iterate(pplayer->connections, pconn) {
2405 pconn->playing = NULL;
2406 } conn_list_iterate_end;
2407 conn_list_clear(pplayer->connections);
2408
2409 /* Save player number before player is freed */
2410 plr_nbr = player_number(pplayer);
2411
2412 player_destroy(pplayer);
2413
2414 players_dialog_update();
2415 conn_list_dialog_update();
2416
2417 editgui_refresh();
2418 editgui_notify_object_changed(OBJTYPE_PLAYER, plr_nbr, TRUE);
2419}
2420
2421/************************************************************************/
2426 void handle_player_info(const struct packet_player_info *pinfo)
2427{
2428 bool is_new_nation = FALSE;
2429 bool turn_done_changed = FALSE;
2430 bool new_player = FALSE;
2431 int i;
2432 struct player *pplayer, *my_player;
2433 struct nation_type *pnation;
2434 struct government *pgov, *ptarget_gov;
2435 struct player_slot *pslot;
2436 struct team_slot *tslot;
2437
2438 /* Player. */
2439 pslot = player_slot_by_number(pinfo->playerno);
2440 fc_assert(NULL != pslot);
2441 new_player = !player_slot_is_used(pslot);
2442 pplayer = player_new(pslot);
2443
2444 if ((pplayer->rgb == NULL) != !pinfo->color_valid
2445 || (pinfo->color_valid
2446 && (pplayer->rgb->r != pinfo->color_red
2447 || pplayer->rgb->g != pinfo->color_green
2448 || pplayer->rgb->b != pinfo->color_blue))) {
2449 struct rgbcolor *prgbcolor;
2450
2451 if (pinfo->color_valid) {
2452 prgbcolor = rgbcolor_new(pinfo->color_red,
2453 pinfo->color_green,
2454 pinfo->color_blue);
2455 fc_assert_ret(prgbcolor != NULL);
2456 } else {
2457 prgbcolor = NULL;
2458 }
2459
2460 player_set_color(pplayer, prgbcolor);
2461 tileset_player_init(tileset, pplayer);
2462
2463 rgbcolor_destroy(prgbcolor);
2464
2465 /* Queue a map update -- may need to redraw borders, etc. */
2466 update_map_canvas_visible();
2467 }
2468 pplayer->client.color_changeable = pinfo->color_changeable;
2469
2470 if (new_player) {
2471 /* Initialise client side player data (tile vision). At the moment
2472 * redundant as the values are initialised with 0 due to fc_calloc(). */
2473 client_player_init(pplayer);
2474 }
2475
2476 /* Team. */
2477 tslot = team_slot_by_number(pinfo->team);
2478 fc_assert(NULL != tslot);
2479
2480 /* Should never fail when slot given is not NULL */
2481 team_add_player(pplayer, team_new(tslot));
2482
2483 pnation = nation_by_number(pinfo->nation);
2484 pgov = government_by_number(pinfo->government);
2485 ptarget_gov = government_by_number(pinfo->target_government);
2486
2487 /* Now update the player information. */
2488 sz_strlcpy(pplayer->name, pinfo->name);
2489 sz_strlcpy(pplayer->username, pinfo->username);
2490 pplayer->unassigned_user = pinfo->unassigned_user;
2491
2492 is_new_nation = player_set_nation(pplayer, pnation);
2493 pplayer->is_male = pinfo->is_male;
2494 pplayer->score.game = pinfo->score;
2495 pplayer->was_created = pinfo->was_created;
2496
2497 pplayer->autoselect_weight = pinfo->autoselect_weight;
2498 pplayer->economic.gold = pinfo->gold;
2499 pplayer->economic.tax = pinfo->tax;
2500 pplayer->economic.science = pinfo->science;
2501 pplayer->economic.luxury = pinfo->luxury;
2502 pplayer->client.tech_upkeep = pinfo->tech_upkeep;
2503 pplayer->government = pgov;
2504 pplayer->target_government = ptarget_gov;
2505 pplayer->real_embassy = pinfo->real_embassy;
2506 pplayer->gives_shared_vision = pinfo->gives_shared_vision;
2507 pplayer->gives_shared_tiles = pinfo->gives_shared_tiles;
2508 pplayer->style = style_by_number(pinfo->style);
2509
2510 if (pplayer == client.conn.playing) {
2511 bool music_change = FALSE;
2512
2513 if (pplayer->music_style != pinfo->music_style) {
2514 pplayer->music_style = pinfo->music_style;
2515 music_change = TRUE;
2516 }
2517 if (pplayer->client.mood != pinfo->mood) {
2518 pplayer->client.mood = pinfo->mood;
2519 music_change = TRUE;
2520 }
2521
2522 if (music_change) {
2523 start_style_music();
2524 }
2525 }
2526
2527 pplayer->history = pinfo->history;
2528 pplayer->client.culture = pinfo->culture;
2529
2530 if (pplayer->economic.infra_points != pinfo->infrapoints) {
2531 pplayer->economic.infra_points = pinfo->infrapoints;
2532 update_infra_dialog();
2533 }
2534
2535 /* Don't use player_iterate or player_slot_count here, because we ignore
2536 * the real number of players and we want to read all the datas. */
2537 fc_assert(ARRAY_SIZE(pplayer->ai_common.love) >= ARRAY_SIZE(pinfo->love));
2538 for (i = 0; i < ARRAY_SIZE(pinfo->love); i++) {
2539 pplayer->ai_common.love[i] = pinfo->love[i];
2540 }
2541
2542 my_player = client_player();
2543
2544 pplayer->is_connected = pinfo->is_connected;
2545
2546 for (i = 0; i < B_LAST; i++) {
2547 pplayer->wonders[i] = pinfo->wonders[i];
2548 }
2549
2550 /* Set AI.control. */
2551 if (is_ai(pplayer) != BV_ISSET(pinfo->flags, PLRF_AI)) {
2552 BV_SET_VAL(pplayer->flags, PLRF_AI, BV_ISSET(pinfo->flags, PLRF_AI));
2553 if (pplayer == my_player) {
2554 if (is_ai(my_player)) {
2555 output_window_append(ftc_client, _("AI mode is now ON."));
2556 if (!gui_options.ai_manual_turn_done && !pplayer->phase_done) {
2557 /* End turn immediately */
2558 user_ended_turn();
2559 }
2560 } else {
2561 output_window_append(ftc_client, _("AI mode is now OFF."));
2562 }
2563 }
2564 }
2565
2566 pplayer->flags = pinfo->flags;
2567
2568 pplayer->ai_common.science_cost = pinfo->science_cost;
2569
2570 turn_done_changed = (pplayer->phase_done != pinfo->phase_done
2571 || (BV_ISSET(pplayer->flags, PLRF_AI) !=
2572 BV_ISSET(pinfo->flags, PLRF_AI)));
2573 pplayer->phase_done = pinfo->phase_done;
2574
2575 pplayer->is_ready = pinfo->is_ready;
2576 pplayer->nturns_idle = pinfo->nturns_idle;
2577 pplayer->is_alive = pinfo->is_alive;
2578 pplayer->turns_alive = pinfo->turns_alive;
2579 pplayer->ai_common.barbarian_type = pinfo->barbarian_type;
2580 pplayer->revolution_finishes = pinfo->revolution_finishes;
2581 pplayer->ai_common.skill_level = pinfo->ai_skill_level;
2582
2583 fc_assert(pinfo->multip_count == multiplier_count());
2584 game.control.num_multipliers = pinfo->multip_count;
2585 multipliers_iterate(pmul) {
2586 int idx = multiplier_index(pmul);
2587
2588 pplayer->multipliers[idx].value = pinfo->multiplier[idx];
2589 pplayer->multipliers[idx].target = pinfo->multiplier_target[idx];
2590 pplayer->multipliers[idx].changed = pinfo->multiplier_changed[idx];
2591 } multipliers_iterate_end;
2592
2593 /* if the server requests that the client reset, then information about
2594 * connections to this player are lost. If this is the case, insert the
2595 * correct conn back into the player->connections list */
2596 if (conn_list_size(pplayer->connections) == 0) {
2597 conn_list_iterate(game.est_connections, pconn) {
2598 if (pplayer == pconn->playing) {
2599 /* insert the controller into first position */
2600 if (pconn->observer) {
2601 conn_list_append(pplayer->connections, pconn);
2602 } else {
2603 conn_list_prepend(pplayer->connections, pconn);
2604 }
2605 }
2606 } conn_list_iterate_end;
2607 }
2608
2609
2610 /* The player information is now fully set. Update the GUI. */
2611
2612 if (pplayer == my_player && can_client_change_view()) {
2613 if (turn_done_changed) {
2614 update_turn_done_button_state();
2615 }
2616 science_report_dialog_update();
2617 economy_report_dialog_update();
2618 units_report_dialog_update();
2619 city_report_dialog_update();
2620 multipliers_dialog_update();
2621 update_info_label();
2622 menus_update();
2623 }
2624
2625 upgrade_canvas_clipboard();
2626
2627 players_dialog_update();
2628 update_start_page();
2629
2630 if (is_new_nation) {
2631 races_toggles_set_sensitive();
2632
2633 /* When changing nation during a running game, some refreshing is needed.
2634 * This may not be the only one! */
2635 update_map_canvas_visible();
2636 }
2637
2638 if (can_client_change_view()) {
2639 /* Just about any changes above require an update to the intelligence
2640 * dialog. */
2641 update_intel_dialog(pplayer);
2642 }
2643
2644 editgui_refresh();
2645 editgui_notify_object_changed(OBJTYPE_PLAYER, player_number(pplayer),
2646 FALSE);
2647}
2648
2649/************************************************************************/
2652 void handle_research_info(const struct packet_research_info *packet)
2653{
2654 struct research *presearch;
2655 bool tech_changed = FALSE;
2656 bool poptechup = FALSE;
2657 Tech_type_id gained_techs[advance_count()];
2658 int gained_techs_num = 0, i;
2659 enum tech_state newstate, oldstate;
2660
2661#ifdef FREECIV_DEBUG
2662 log_verbose("Research nb %d inventions: %s",
2663 packet->id,
2664 packet->inventions);
2665#endif
2666 presearch = research_by_number(packet->id);
2667 fc_assert_ret(NULL != presearch);
2668
2669 poptechup = (presearch->researching != packet->researching
2670 || presearch->tech_goal != packet->tech_goal);
2671 presearch->techs_researched = packet->techs_researched;
2672 if (presearch->future_tech == 0 && packet->future_tech > 0) {
2673 gained_techs[gained_techs_num++] = A_FUTURE;
2674 }
2675 presearch->future_tech = packet->future_tech;
2676 presearch->researching = packet->researching;
2677 presearch->client.researching_cost = packet->researching_cost;
2678 presearch->bulbs_researched = packet->bulbs_researched;
2679 presearch->tech_goal = packet->tech_goal;
2680 presearch->client.total_bulbs_prod = packet->total_bulbs_prod;
2681
2682 advance_index_iterate(A_NONE, advi) {
2683 newstate = packet->inventions[advi] - '0';
2684 oldstate = research_invention_set(presearch, advi, newstate);
2685
2686 if (newstate != oldstate) {
2687 if (TECH_KNOWN == newstate) {
2688 tech_changed = TRUE;
2689 if (A_NONE != advi) {
2690 gained_techs[gained_techs_num++] = advi;
2691 }
2692 } else if (TECH_KNOWN == oldstate) {
2693 tech_changed = TRUE;
2694 }
2695 }
2696 } advance_index_iterate_end;
2697
2698 research_update(presearch);
2699
2700 if (C_S_RUNNING == client_state()) {
2701 if (presearch == research_get(client_player())) {
2702 if (poptechup && is_human(client_player())) {
2703 science_report_dialog_popup(FALSE);
2704 }
2705 science_report_dialog_update();
2706 if (tech_changed) {
2707 /* Some ways a new or lost tech can affect menus:
2708 * - If tech is needed for certain governments, the government
2709 * switching menus need updating.
2710 * - If we just learned/lost bridge building and focus is on a
2711 * worker on a river, the road menu item needs updating. */
2712 menus_update();
2713
2714 script_client_signal_emit("new_tech");
2715
2716 /* If we got a new tech the tech tree news an update. */
2717 science_report_dialog_redraw();
2718 }
2719 for (i = 0; i < gained_techs_num; i++) {
2720 show_tech_gained_dialog(gained_techs[i]);
2721 }
2722 }
2723 if (editor_is_active()) {
2724 editgui_refresh();
2725 research_players_iterate(presearch, pplayer) {
2726 editgui_notify_object_changed(OBJTYPE_PLAYER, player_number(pplayer),
2727 FALSE);
2728 } research_players_iterate_end;
2729 }
2730 }
2731}
2732
2733/************************************************************************/
2736 void handle_unknown_research(int id)
2737{
2738 struct research *presearch = research_by_number(id);
2739
2740 if (presearch == NULL) {
2741 log_error("Received unknown research for clearing: %d.", id);
2742 return;
2743 }
2744
2745 /* Do we need to set other fields? */
2746 presearch->researching = A_UNKNOWN;
2747 presearch->future_tech = 0;
2748 presearch->tech_goal = A_UNKNOWN;
2749
2750 advance_index_iterate(A_NONE, advi) {
2751 research_invention_set(presearch, advi, TECH_UNKNOWN);
2752 } advance_index_iterate_end;
2753
2754 if (editor_is_active()) {
2755 editgui_refresh();
2756 research_players_iterate(presearch, pplayer) {
2757 editgui_notify_object_changed(OBJTYPE_PLAYER, player_number(pplayer),
2758 FALSE);
2759 } research_players_iterate_end;
2760 }
2761}
2762
2763/************************************************************************/
2766 void handle_player_diplstate(const struct packet_player_diplstate *packet)
2767{
2768 struct player *plr1 = player_by_number(packet->plr1);
2769 struct player *plr2 = player_by_number(packet->plr2);
2770 struct player *my_player = client_player();
2771 struct player_diplstate *ds = player_diplstate_get(plr1, plr2);
2772 bool need_players_dialog_update = FALSE;
2773
2774 fc_assert_ret(ds != NULL);
2775
2776 if (client_has_player() && my_player == plr2) {
2777 if (ds->type != packet->type) {
2778 need_players_dialog_update = TRUE;
2779 }
2780
2781 /* Check if we detect change to armistice with us. If so,
2782 * ready all units for movement out of the territory in
2783 * question; otherwise they will be disbanded. */
2784 if (DS_ARMISTICE != player_diplstate_get(plr1, my_player)->type
2785 && DS_ARMISTICE == packet->type) {
2786 unit_list_iterate(my_player->units, punit) {
2787 if (!tile_owner(unit_tile(punit))
2788 || tile_owner(unit_tile(punit)) != plr1) {
2789 continue;
2790 }
2791 if (punit->client.focus_status == FOCUS_WAIT) {
2792 punit->client.focus_status = FOCUS_AVAIL;
2793 }
2794 if (punit->activity != ACTIVITY_IDLE) {
2795 request_new_unit_activity(punit, ACTIVITY_IDLE);
2796 }
2797 } unit_list_iterate_end;
2798 }
2799 }
2800
2801 ds->type = packet->type;
2802 ds->turns_left = packet->turns_left;
2803 ds->has_reason_to_cancel = packet->has_reason_to_cancel;
2804 ds->contact_turns_left = packet->contact_turns_left;
2805
2806 if (need_players_dialog_update) {
2807 players_dialog_update();
2808 }
2809
2810 if (need_players_dialog_update
2811 && action_selection_actor_unit() != IDENTITY_NUMBER_ZERO) {
2812 /* An action selection dialog is open and our diplomatic state just
2813 * changed. Find out if the relationship that changed was to a
2814 * potential target. */
2815 struct tile *tgt_tile = NULL;
2816
2817 /* Is a refresh needed because of a unit target? */
2818 if (action_selection_target_unit() != IDENTITY_NUMBER_ZERO) {
2819 struct unit *tgt_unit;
2820
2821 tgt_unit = game_unit_by_number(action_selection_target_unit());
2822
2823 if (tgt_unit != NULL && tgt_unit->owner == plr1) {
2824 /* An update is needed because of this unit target. */
2825 tgt_tile = unit_tile(tgt_unit);
2826 fc_assert(tgt_tile != NULL);
2827 }
2828 }
2829
2830 /* Is a refresh needed because of a city target? */
2831 if (action_selection_target_city() != IDENTITY_NUMBER_ZERO) {
2832 struct city *tgt_city;
2833
2834 tgt_city = game_city_by_number(action_selection_target_city());
2835
2836 if (tgt_city != NULL && tgt_city->owner == plr1) {
2837 /* An update is needed because of this city target.
2838 * Overwrites any target tile from a unit. */
2839 tgt_tile = city_tile(tgt_city);
2840 fc_assert(tgt_tile != NULL);
2841 }
2842 }
2843
2844 if (tgt_tile
2845 || ((tgt_tile = index_to_tile(&(wld.map),
2846 action_selection_target_tile()))
2847 && tile_owner(tgt_tile) == plr1)) {
2848 /* The diplomatic relationship to the target in an open action
2849 * selection dialog have changed. This probably changes
2850 * the set of available actions. */
2851 dsend_packet_unit_get_actions(&client.conn,
2852 action_selection_actor_unit(),
2853 action_selection_target_unit(),
2854 tgt_tile->index,
2855 action_selection_target_extra(),
2856 REQEST_BACKGROUND_REFRESH);
2857 }
2858 }
2859}
2860
2861/************************************************************************/
2867 void handle_conn_info(const struct packet_conn_info *pinfo)
2868{
2869 struct connection *pconn = conn_by_number(pinfo->id);
2870 bool preparing_client_state = FALSE;
2871
2872 log_debug("conn_info id%d used%d est%d plr%d obs%d acc%d",
2873 pinfo->id, pinfo->used, pinfo->established, pinfo->player_num,
2874 pinfo->observer, (int) pinfo->access_level);
2875 log_debug("conn_info \"%s\" \"%s\" \"%s\"",
2876 pinfo->username, pinfo->addr, pinfo->capability);
2877
2878 if (!pinfo->used) {
2879 /* Forget the connection */
2880 if (!pconn) {
2881 log_verbose("Server removed unknown connection %d", pinfo->id);
2882 return;
2883 }
2884 client_remove_cli_conn(pconn);
2885 pconn = NULL;
2886 } else {
2887 struct player_slot *pslot = player_slot_by_number(pinfo->player_num);
2888 struct player *pplayer = NULL;
2889
2890 if (NULL != pslot) {
2891 pplayer = player_slot_get_player(pslot);
2892 }
2893
2894 if (!pconn) {
2895 log_verbose("Server reports new connection %d %s",
2896 pinfo->id, pinfo->username);
2897
2898 pconn = fc_calloc(1, sizeof(struct connection));
2899 pconn->buffer = NULL;
2900 pconn->send_buffer = NULL;
2901 pconn->ping_time = -1.0;
2902 if (pplayer) {
2903 conn_list_append(pplayer->connections, pconn);
2904 }
2905 conn_list_append(game.all_connections, pconn);
2906 conn_list_append(game.est_connections, pconn);
2907 } else {
2908 log_packet("Server reports updated connection %d %s",
2909 pinfo->id, pinfo->username);
2910 if (pplayer != pconn->playing) {
2911 if (NULL != pconn->playing) {
2912 conn_list_remove(pconn->playing->connections, pconn);
2913 }
2914 if (pplayer) {
2915 conn_list_append(pplayer->connections, pconn);
2916 }
2917 }
2918 }
2919
2920 pconn->id = pinfo->id;
2921 pconn->established = pinfo->established;
2922 pconn->observer = pinfo->observer;
2923 pconn->access_level = pinfo->access_level;
2924 pconn->playing = pplayer;
2925
2926 sz_strlcpy(pconn->username, pinfo->username);
2927 sz_strlcpy(pconn->addr, pinfo->addr);
2928 sz_strlcpy(pconn->capability, pinfo->capability);
2929
2930 if (pinfo->id == client.conn.id) {
2931 /* NB: In this case, pconn is not a duplication of client.conn.
2932 *
2933 * pconn->addr is our address that the server knows whereas
2934 * client.conn.addr is the address to the server. Also,
2935 * pconn->capability stores our capabilites known at server side
2936 * whereas client.conn.capability represents the capabilities of the
2937 * server. */
2938 if (client.conn.playing != pplayer
2939 || client.conn.observer != pinfo->observer) {
2940 /* Our connection state changed, let prepare the changes and reset
2941 * the game. */
2942 preparing_client_state = TRUE;
2943 }
2944
2945 /* Copy our current state into the static structure (our connection
2946 * to the server). */
2947 client.conn.established = pinfo->established;
2948 client.conn.observer = pinfo->observer;
2949 client.conn.access_level = pinfo->access_level;
2950 client.conn.playing = pplayer;
2951 sz_strlcpy(client.conn.username, pinfo->username);
2952 }
2953 }
2954
2955 players_dialog_update();
2956 conn_list_dialog_update();
2957
2958 if (pinfo->used && pinfo->id == client.conn.id) {
2959 /* For updating the sensitivity of the "Edit Mode" menu item,
2960 * among other things. */
2961 menus_update();
2962 }
2963
2964 if (preparing_client_state) {
2965 set_client_state(C_S_PREPARING);
2966 }
2967}
2968
2969/************************************************************************/
2973 void handle_conn_ping_info(int connections, const int *conn_id,
2974 const float *ping_time)
2975{
2976 int i;
2977
2978 for (i = 0; i < connections; i++) {
2979 struct connection *pconn = conn_by_number(conn_id[i]);
2980
2981 if (!pconn) {
2982 continue;
2983 }
2984
2985 pconn->ping_time = ping_time[i];
2986 log_debug("conn-id=%d, ping=%fs", pconn->id, pconn->ping_time);
2987 }
2988 /* The old_ping_time data is ignored. */
2989
2990 players_dialog_update();
2991}
2992
2993/************************************************************************/
2996 void handle_achievement_info(int id, bool gained, bool first)
2997{
2998 struct achievement *pach;
2999
3000 if (id < 0 || id >= game.control.num_achievement_types) {
3001 log_error("Received illegal achievement info %d", id);
3002 return;
3003 }
3004
3005 pach = achievement_by_number(id);
3006
3007 if (gained) {
3008 BV_SET(pach->achievers, player_index(client_player()));
3009 } else {
3010 BV_CLR(pach->achievers, player_index(client_player()));
3011 }
3012
3013 if (first) {
3014 pach->first = client_player();
3015 }
3016}
3017
3018/************************************************************************/
3033 static bool spaceship_autoplace(struct player *pplayer,
3034 struct player_spaceship *ship)
3035{
3036 if (can_client_issue_orders()) {
3037 struct spaceship_component place;
3038
3039 if (next_spaceship_component(pplayer, ship, &place)) {
3040 dsend_packet_spaceship_place(&client.conn, place.type, place.num);
3041
3042 return TRUE;
3043 }
3044 }
3045
3046 return FALSE;
3047}
3048
3049/************************************************************************/
3052 void handle_spaceship_info(const struct packet_spaceship_info *p)
3053{
3054 struct player_spaceship *ship;
3055 struct player *pplayer = player_by_number(p->player_num);
3056
3057 fc_assert_ret_msg(NULL != pplayer, "Invalid player number %d.",
3058 p->player_num);
3059
3060 ship = &pplayer->spaceship;
3061 ship->state = p->sship_state;
3062 ship->structurals = p->structurals;
3063 ship->components = p->components;
3064 ship->modules = p->modules;
3065 ship->fuel = p->fuel;
3066 ship->propulsion = p->propulsion;
3067 ship->habitation = p->habitation;
3068 ship->life_support = p->life_support;
3069 ship->solar_panels = p->solar_panels;
3070 ship->launch_year = p->launch_year;
3071 ship->population = p->population;
3072 ship->mass = p->mass;
3073 ship->support_rate = p->support_rate;
3074 ship->energy_rate = p->energy_rate;
3075 ship->success_rate = p->success_rate;
3076 ship->travel_time = p->travel_time;
3077 ship->structure = p->structure;
3078
3079 if (pplayer != client_player()) {
3080 refresh_spaceship_dialog(pplayer);
3081 menus_update();
3082 return;
3083 }
3084
3085 if (!spaceship_autoplace(pplayer, ship)) {
3086 /* We refresh the dialog when the packet did *not* cause placing
3087 * of new part. That's because those cases where part is placed, are
3088 * followed by exactly one case where there's no more parts to place -
3089 * we want to refresh the dialog only when that last packet comes. */
3090 refresh_spaceship_dialog(pplayer);
3091 }
3092}
3093
3094/************************************************************************/
3097 void handle_tile_info(const struct packet_tile_info *packet)
3098{
3099 enum known_type new_known;
3100 enum known_type old_known;
3101 bool known_changed = FALSE;
3102 bool tile_changed = FALSE;
3103 struct player *powner = player_by_number(packet->owner);
3104 struct player *eowner = player_by_number(packet->extras_owner);
3105 struct extra_type *presource = NULL;
3106 struct terrain *pterrain = terrain_by_number(packet->terrain);
3107 struct tile *ptile = index_to_tile(&(wld.map), packet->tile);
3108
3109 fc_assert_ret_msg(NULL != ptile, "Invalid tile index %d.", packet->tile);
3110 old_known = client_tile_get_known(ptile);
3111
3112 if (packet->resource != MAX_EXTRA_TYPES) {
3113 presource = extra_by_number(packet->resource);
3114 }
3115
3116 if (NULL == tile_terrain(ptile) || pterrain != tile_terrain(ptile)) {
3117 tile_changed = TRUE;
3118 switch (old_known) {
3119 case TILE_UNKNOWN:
3120 tile_set_terrain(ptile, pterrain);
3121 break;
3122 case TILE_KNOWN_UNSEEN:
3123 case TILE_KNOWN_SEEN:
3124 if (NULL != pterrain || TILE_UNKNOWN == packet->known) {
3125 tile_set_terrain(ptile, pterrain);
3126 } else {
3127 tile_changed = FALSE;
3128 log_error("handle_tile_info() unknown terrain (%d, %d).",
3129 TILE_XY(ptile));
3130 }
3131 break;
3132 };
3133 }
3134
3135 if (!BV_ARE_EQUAL(ptile->extras, packet->extras)) {
3136 ptile->extras = packet->extras;
3137 tile_changed = TRUE;
3138 }
3139
3140 tile_changed = tile_changed || (tile_resource(ptile) != presource);
3141
3142 /* always called after setting terrain */
3143 tile_set_resource(ptile, presource);
3144
3145 if (tile_owner(ptile) != powner) {
3146 tile_set_owner(ptile, powner, NULL);
3147 tile_changed = TRUE;
3148 }
3149 if (extra_owner(ptile) != eowner) {
3150 ptile->extras_owner = eowner;
3151 tile_changed = TRUE;
3152 }
3153
3154 if (packet->placing < 0) {
3155 if (ptile->placing != NULL) {
3156 tile_changed = TRUE;
3157 ptile->placing = NULL;
3158 ptile->infra_turns = 0;
3159 }
3160 } else {
3161 struct extra_type *old = ptile->placing;
3162
3163 ptile->placing = extra_by_number(packet->placing);
3164 if (ptile->placing != old
3165 || ptile->infra_turns != packet->place_turn - game.info.turn) {
3166 tile_changed = TRUE;
3167 }
3168 ptile->infra_turns = packet->place_turn - game.info.turn;
3169 }
3170
3171 if (NULL == tile_worked(ptile)
3172 || tile_worked(ptile)->id != packet->worked) {
3173 if (IDENTITY_NUMBER_ZERO != packet->worked) {
3174 struct city *pwork = game_city_by_number(packet->worked);
3175
3176 if (NULL == pwork) {
3177 char named[MAX_LEN_CITYNAME];
3178
3179 /* New unseen ("invisible") city, or before city_info */
3180 fc_snprintf(named, sizeof(named), "%06u", packet->worked);
3181
3182 pwork = create_city_virtual(invisible.placeholder, NULL, named);
3183 pwork->id = packet->worked;
3184 idex_register_city(&wld, pwork);
3185
3186 city_list_prepend(invisible.cities, pwork);
3187
3188 log_debug("(%d,%d) invisible city %d, %s",
3189 TILE_XY(ptile), pwork->id, city_name_get(pwork));
3190 } else if (NULL == city_tile(pwork)) {
3191 /* Old unseen ("invisible") city, or before city_info */
3192 if (NULL != powner && city_owner(pwork) != powner) {
3193 /* Update placeholder with current owner */
3194 pwork->owner = powner;
3195 pwork->original = NULL;
3196 }
3197 } else {
3198 /* We have a real (not invisible) city record for this ID, but
3199 * perhaps our info about that city is out of date. */
3200 int dist_sq = sq_map_distance(city_tile(pwork), ptile);
3201
3202 if (dist_sq > city_map_radius_sq_get(pwork)) {
3203 /* This is probably enemy city which has grown in diameter since we
3204 * last saw it. We need city_radius_sq to be at least big enough so
3205 * that all workers fit in, so set it so. */
3206 city_map_radius_sq_set(pwork, dist_sq);
3207 }
3208 /* This might be a known city that is open in a dialog.
3209 * (And this might be our only prompt to refresh the worked tiles
3210 * display in its city map, if a worker rearrangement does not
3211 * change anything else about the city such as output.) */
3212 {
3213 struct city *oldwork = tile_worked(ptile);
3214 if (oldwork && NULL != city_tile(oldwork)) {
3215 /* Refresh previous city too if it's real and different */
3216 refresh_city_dialog(oldwork);
3217 }
3218 /* Refresh new city working tile (which we already know is real) */
3219 refresh_city_dialog(pwork);
3220 }
3221 }
3222
3223 /* This marks tile worked by (possibly invisible) city. Other
3224 * parts of the code have to handle invisible cities correctly
3225 * (ptile->worked->tile == NULL) */
3226 tile_set_worked(ptile, pwork);
3227 } else {
3228 /* Tile is no longer being worked by a city.
3229 * (Again, this might be our only prompt to refresh the worked tiles
3230 * display for the previous working city.) */
3231 if (tile_worked(ptile) && NULL != city_tile(tile_worked(ptile))) {
3232 refresh_city_dialog(tile_worked(ptile));
3233 }
3234 tile_set_worked(ptile, NULL);
3235 }
3236
3237 tile_changed = TRUE;
3238 }
3239
3240 if (old_known != packet->known) {
3241 known_changed = TRUE;
3242 }
3243
3244 if (NULL != client.conn.playing) {
3245 dbv_clr(&client.conn.playing->tile_known, tile_index(ptile));
3246 vision_layer_iterate(v) {
3247 dbv_clr(&client.conn.playing->client.tile_vision[v], tile_index(ptile));
3248 } vision_layer_iterate_end;
3249
3250 switch (packet->known) {
3251 case TILE_KNOWN_SEEN:
3252 dbv_set(&client.conn.playing->tile_known, tile_index(ptile));
3253 vision_layer_iterate(v) {
3254 dbv_set(&client.conn.playing->client.tile_vision[v], tile_index(ptile));
3255 } vision_layer_iterate_end;
3256 break;
3257 case TILE_KNOWN_UNSEEN:
3258 dbv_set(&client.conn.playing->tile_known, tile_index(ptile));
3259 break;
3260 case TILE_UNKNOWN:
3261 break;
3262 default:
3263 log_error("handle_tile_info() invalid known (%d).", packet->known);
3264 break;
3265 };
3266 }
3267 new_known = client_tile_get_known(ptile);
3268
3269 if (packet->spec_sprite[0] != '\0') {
3270 if (!ptile->spec_sprite
3271 || strcmp(ptile->spec_sprite, packet->spec_sprite) != 0) {
3272 if (ptile->spec_sprite) {
3273 free(ptile->spec_sprite);
3274 }
3275 ptile->spec_sprite = fc_strdup(packet->spec_sprite);
3276 tile_changed = TRUE;
3277 }
3278 } else {
3279 if (ptile->spec_sprite) {
3280 free(ptile->spec_sprite);
3281 ptile->spec_sprite = NULL;
3282 tile_changed = TRUE;
3283 }
3284 }
3285
3286 if (TILE_KNOWN_SEEN == old_known && TILE_KNOWN_SEEN != new_known) {
3287 /* This is an error. So first we log the error,
3288 * then make an assertion. */
3289 unit_list_iterate(ptile->units, punit) {
3290 log_error("%p %d %s at (%d,%d) %s", punit, punit->id,
3291 unit_rule_name(punit), TILE_XY(unit_tile(punit)),
3292 player_name(unit_owner(punit)));
3293 } unit_list_iterate_end;
3294 fc_assert_msg(0 == unit_list_size(ptile->units), "Ghost units seen");
3295 /* Repairing... */
3296 unit_list_clear(ptile->units);
3297 }
3298
3299 ptile->continent = packet->continent;
3300 wld.map.num_continents = MAX(ptile->continent, wld.map.num_continents);
3301
3302 if (packet->label[0] == '\0') {
3303 if (ptile->label != NULL) {
3304 FC_FREE(ptile->label);
3305 ptile->label = NULL;
3306 tile_changed = TRUE;
3307 }
3308 } else if (ptile->label == NULL || strcmp(packet->label, ptile->label)) {
3309 tile_set_label(ptile, packet->label);
3310 tile_changed = TRUE;
3311 }
3312
3313 if (known_changed || tile_changed) {
3314 /*
3315 * A tile can only change if it was known before and is still
3316 * known. In the other cases the tile is new or removed.
3317 */
3318 if (known_changed && TILE_KNOWN_SEEN == new_known) {
3319 agents_tile_new(ptile);
3320 } else if (known_changed && TILE_KNOWN_UNSEEN == new_known) {
3321 agents_tile_remove(ptile);
3322 } else {
3323 agents_tile_changed(ptile);
3324 }
3325 editgui_notify_object_changed(OBJTYPE_TILE, tile_index(ptile), FALSE);
3326 }
3327
3328 /* refresh tiles */
3329 if (can_client_change_view()) {
3330 /* the tile itself (including the necessary parts of adjacent tiles) */
3331 if (tile_changed || old_known != new_known) {
3332 refresh_tile_mapcanvas(ptile, TRUE, FALSE);
3333 }
3334 }
3335
3336 /* update menus if the focus unit is on the tile. */
3337 if (tile_changed) {
3338 if (get_focus_unit_on_tile(ptile)) {
3339 menus_update();
3340 }
3341 }
3342
3343 /* FIXME: we really ought to call refresh_city_dialog() for any city
3344 * whose radii include this tile, to update the city map display.
3345 * But that would be expensive. We deal with the (common) special
3346 * case of changes in worked tiles above. */
3347}
3348
3349/************************************************************************/
3352 void handle_scenario_info(const struct packet_scenario_info *packet)
3353{
3354 game.scenario.is_scenario = packet->is_scenario;
3355 sz_strlcpy(game.scenario.name, packet->name);
3356 sz_strlcpy(game.scenario.authors, packet->authors);
3357 game.scenario.players = packet->players;
3358 game.scenario.startpos_nations = packet->startpos_nations;
3359 game.scenario.prevent_new_cities = packet->prevent_new_cities;
3360 game.scenario.lake_flooding = packet->lake_flooding;
3361 game.scenario.have_resources = packet->have_resources;
3362 game.scenario.ruleset_locked = packet->ruleset_locked;
3363 game.scenario.save_random = packet->save_random;
3364 game.scenario.handmade = packet->handmade;
3365 game.scenario.allow_ai_type_fallback = packet->allow_ai_type_fallback;
3366
3367 editgui_notify_object_changed(OBJTYPE_GAME, 1, FALSE);
3368}
3369
3370/************************************************************************/
3373 void handle_scenario_description(const char *description)
3374{
3375 sz_strlcpy(game.scenario_desc.description, description);
3376
3377 editgui_notify_object_changed(OBJTYPE_GAME, 1, FALSE);
3378}
3379
3380/************************************************************************/
3385 void handle_ruleset_control(const struct packet_ruleset_control *packet)
3386{
3387 /* The ruleset is going to load new nations. So close
3388 * the nation selection dialog if it is open. */
3389 popdown_races_dialog();
3390
3391 game.client.ruleset_init = FALSE;
3392 game.client.ruleset_ready = FALSE;
3393 game_ruleset_free();
3394 game_ruleset_init();
3395 game.client.ruleset_init = TRUE;
3396 game.control = *packet;
3397
3398 /* check the values! */
3399#define VALIDATE(_count, _maximum, _string) \
3400 if (game.control._count > _maximum) { \
3401 log_error("handle_ruleset_control(): Too many " _string \
3402 "; using %d of %d", _maximum, game.control._count); \
3403 game.control._count = _maximum; \
3404 }
3405
3406 VALIDATE(num_unit_classes, UCL_LAST, "unit classes");
3407 VALIDATE(num_unit_types, U_LAST, "unit types");
3408 VALIDATE(num_impr_types, B_LAST, "improvements");
3409 VALIDATE(num_tech_types, A_LAST, "advances");
3410 VALIDATE(num_base_types, MAX_EXTRA_TYPES, "bases");
3411 VALIDATE(num_road_types, MAX_EXTRA_TYPES, "roads");
3412 VALIDATE(num_resource_types, MAX_EXTRA_TYPES, "resources");
3413 VALIDATE(num_disaster_types, MAX_DISASTER_TYPES, "disasters");
3414 VALIDATE(num_achievement_types, MAX_ACHIEVEMENT_TYPES, "achievements");
3415 VALIDATE(num_counters, MAX_COUNTERS, "counters");
3416
3417 /* game.control.government_count, game.control.nation_count and
3418 * game.control.num_city_styles are allocated dynamically, and do
3419 * not need a size check. See the allocation below. */
3420
3421 VALIDATE(terrain_count, MAX_NUM_TERRAINS, "terrains");
3422
3423 VALIDATE(num_specialist_types, SP_MAX, "specialists");
3424#undef VALIDATE
3425
3426 governments_alloc(game.control.government_count);
3427 nations_alloc(game.control.nation_count);
3428 styles_alloc(game.control.num_styles);
3429 city_styles_alloc(game.control.num_city_styles);
3430 music_styles_alloc(game.control.num_music_styles);
3431
3432 if (game.control.desc_length > 0) {
3433 game.ruleset_description = fc_malloc(game.control.desc_length + 1);
3434 game.ruleset_description[0] = '\0';
3435 }
3436
3437 if (packet->preferred_tileset[0] != '\0') {
3438 /* There is tileset suggestion */
3439 if (strcmp(packet->preferred_tileset, tileset_basename(tileset))) {
3440 /* It's not currently in use */
3441 if (gui_options.autoaccept_tileset_suggestion) {
3442 tilespec_reread(game.control.preferred_tileset, TRUE, 1.0f);
3443 } else {
3444 popup_tileset_suggestion_dialog();
3445 }
3446 }
3447 }
3448
3449 if (packet->preferred_soundset[0] != '\0') {
3450 /* There is soundset suggestion */
3451 if (strcmp(packet->preferred_soundset, sound_set_name)) {
3452 /* It's not currently in use */
3453 if (gui_options.autoaccept_soundset_suggestion) {
3454 audio_restart(game.control.preferred_soundset, music_set_name);
3455 } else {
3456 popup_soundset_suggestion_dialog();
3457 }
3458 }
3459 }
3460
3461 if (packet->preferred_musicset[0] != '\0') {
3462 /* There is musicset suggestion */
3463 if (strcmp(packet->preferred_musicset, music_set_name)) {
3464 /* It's not currently in use */
3465 if (gui_options.autoaccept_musicset_suggestion) {
3466 audio_restart(sound_set_name, game.control.preferred_musicset);
3467 } else {
3468 popup_musicset_suggestion_dialog();
3469 }
3470 }
3471 }
3472
3473 tileset_ruleset_reset(tileset);
3474
3475 resend_desired_settable_options();
3476}
3477
3478/************************************************************************/
3481 void handle_ruleset_summary(const struct packet_ruleset_summary *packet)
3482{
3483 int len;
3484
3485 if (game.ruleset_summary != NULL) {
3486 free(game.ruleset_summary);
3487 }
3488
3489 len = strlen(packet->text);
3490
3491 game.ruleset_summary = fc_malloc(len + 1);
3492
3493 fc_strlcpy(game.ruleset_summary, packet->text, len + 1);
3494}
3495
3496/************************************************************************/
3499 void handle_ruleset_description_part(
3500 const struct packet_ruleset_description_part *packet)
3501{
3502 fc_strlcat(game.ruleset_description, packet->text,
3503 game.control.desc_length + 1);
3504}
3505
3506/************************************************************************/
3509 void handle_rulesets_ready(void)
3510{
3511 /* Setup extra hiders caches */
3512 extra_type_iterate(pextra) {
3513 pextra->hiders = extra_type_list_new();
3514 extra_type_iterate(phider) {
3515 if (BV_ISSET(pextra->hidden_by, extra_index(phider))) {
3516 extra_type_list_append(pextra->hiders, phider);
3517 }
3518 } extra_type_iterate_end;
3519 pextra->bridged = extra_type_list_new();
3520 extra_type_iterate(pbridged) {
3521 if (BV_ISSET(pextra->bridged_over, extra_index(pbridged))) {
3522 extra_type_list_append(pextra->bridged, pbridged);
3523 }
3524 } extra_type_iterate_end;
3525 } extra_type_iterate_end;
3526
3527 unit_class_iterate(pclass) {
3528 set_unit_class_caches(pclass);
3529 set_unit_move_type(pclass);
3530 } unit_class_iterate_end;
3531
3532 /* Setup improvement feature caches */
3533 improvement_feature_cache_init();
3534
3535 /* Setup road integrators caches */
3536 road_integrators_cache_init();
3537
3538 /* Pre calculate action related data. */
3539 actions_rs_pre_san_gen();
3540
3541 /* Setup unit unknown move cost caches */
3542 unit_type_iterate(ptype) {
3543 ptype->unknown_move_cost = utype_unknown_move_cost(ptype);
3544 set_unit_type_caches(ptype);
3545 unit_type_action_cache_set(ptype);
3546 } unit_type_iterate_end;
3547
3548 /* Cache what city production can receive help from caravans. */
3549 city_production_caravan_shields_init();
3550
3551 /* Adjust editor for changed ruleset. */
3552 editor_ruleset_changed();
3553
3554 /* We are not going to crop any more sprites from big sprites, free them. */
3555 finish_loading_sprites(tileset);
3556
3557 game.client.ruleset_ready = TRUE;
3558}
3559
3560/************************************************************************/
3563 void handle_ruleset_unit_class(const struct packet_ruleset_unit_class *p)
3564{
3565 struct unit_class *c = uclass_by_number(p->id);
3566
3567 fc_assert_ret_msg(NULL != c, "Bad unit_class %d.", p->id);
3568
3569 names_set(&c->name, NULL, p->name, p->rule_name);
3570 c->min_speed = p->min_speed;
3571 c->hp_loss_pct = p->hp_loss_pct;
3572 c->non_native_def_pct = p->non_native_def_pct;
3573 c->flags = p->flags;
3574
3575 PACKET_STRVEC_EXTRACT(c->helptext, p->helptext);
3576}
3577
3578/************************************************************************/
3581 void handle_ruleset_unit(const struct packet_ruleset_unit *p)
3582{
3583 int i;
3584 struct unit_type *u = utype_by_number(p->id);
3585
3586 fc_assert_ret_msg(NULL != u, "Bad unit_type %d.", p->id);
3587
3588 names_set(&u->name, NULL, p->name, p->rule_name);
3589 sz_strlcpy(u->graphic_str, p->graphic_str);
3590 sz_strlcpy(u->graphic_alt, p->graphic_alt);
3591 sz_strlcpy(u->graphic_alt2, p->graphic_alt2);
3592 sz_strlcpy(u->sound_move, p->sound_move);
3593 sz_strlcpy(u->sound_move_alt, p->sound_move_alt);
3594 sz_strlcpy(u->sound_fight, p->sound_fight);
3595 sz_strlcpy(u->sound_fight_alt, p->sound_fight_alt);
3596
3597 u->uclass = uclass_by_number(p->unit_class_id);
3598 u->build_cost = p->build_cost;
3599 u->pop_cost = p->pop_cost;
3600 u->attack_strength = p->attack_strength;
3601 u->defense_strength = p->defense_strength;
3602 u->move_rate = p->move_rate;
3603 for (i = 0; i < p->build_reqs_count; i++) {
3604 requirement_vector_append(&u->build_reqs, p->build_reqs[i]);
3605 }
3606 u->vision_radius_sq = p->vision_radius_sq;
3607 u->transport_capacity = p->transport_capacity;
3608 u->hp = p->hp;
3609 u->firepower = p->firepower;
3610 u->obsoleted_by = utype_by_number(p->obsoleted_by);
3611 u->converted_to = utype_by_number(p->converted_to);
3612 u->convert_time = p->convert_time;
3613 u->fuel = p->fuel;
3614 u->flags = p->flags;
3615 u->roles = p->roles;
3616 u->happy_cost = p->happy_cost;
3617 output_type_iterate(o) {
3618 u->upkeep[o] = p->upkeep[o];
3619 } output_type_iterate_end;
3620 u->paratroopers_range = p->paratroopers_range;
3621 u->bombard_rate = p->bombard_rate;
3622 u->city_size = p->city_size;
3623 u->city_slots = p->city_slots;
3624 u->tp_defense = p->tp_defense;
3625 u->cargo = p->cargo;
3626 u->targets = p->targets;
3627 u->embarks = p->embarks;
3628 u->disembarks = p->disembarks;
3629 u->vlayer = p->vlayer;
3630
3631 if (p->veteran_levels == 0) {
3632 u->veteran = NULL;
3633 } else {
3634 u->veteran = veteran_system_new(p->veteran_levels);
3635
3636 for (i = 0; i < p->veteran_levels; i++) {
3637 veteran_system_definition(u->veteran, i, p->veteran_name[i],
3638 p->power_fact[i], p->move_bonus[i],
3639 p->base_raise_chance[i],
3640 p->work_raise_chance[i]);
3641 }
3642 }
3643
3644 PACKET_STRVEC_EXTRACT(u->helptext, p->helptext);
3645
3646 u->adv.worker = p->worker;
3647
3648 tileset_setup_unit_type(tileset, u);
3649}
3650
3651/************************************************************************/
3654 void handle_ruleset_unit_bonus(const struct packet_ruleset_unit_bonus *p)
3655{
3656 struct unit_type *u = utype_by_number(p->unit);
3657 struct combat_bonus *bonus;
3658
3659 fc_assert_ret_msg(NULL != u, "Bad unit_type %d.", p->unit);
3660
3661 bonus = malloc(sizeof(*bonus));
3662
3663 bonus->flag = p->flag;
3664 bonus->type = p->type;
3665 bonus->value = p->value;
3666 bonus->quiet = p->quiet;
3667
3668 combat_bonus_list_append(u->bonuses, bonus);
3669}
3670
3671/************************************************************************/
3674 void handle_ruleset_unit_flag(const struct packet_ruleset_unit_flag *p)
3675{
3676 const char *flagname;
3677 const char *helptxt;
3678
3679 fc_assert_ret_msg(p->id >= UTYF_USER_FLAG_1 && p->id <= UTYF_LAST_USER_FLAG, "Bad user flag %d.", p->id);
3680
3681 if (p->name[0] == '\0') {
3682 flagname = NULL;
3683 } else {
3684 flagname = p->name;
3685 }
3686
3687 if (p->helptxt[0] == '\0') {
3688 helptxt = NULL;
3689 } else {
3690 helptxt = p->helptxt;
3691 }
3692
3693 set_user_unit_type_flag_name(p->id, flagname, helptxt);
3694}
3695
3696/************************************************************************/
3699 void handle_ruleset_unit_class_flag(
3700 const struct packet_ruleset_unit_class_flag *p)
3701{
3702 const char *flagname;
3703 const char *helptxt;
3704
3705 fc_assert_ret_msg(p->id >= UCF_USER_FLAG_1 && p->id <= UCF_LAST_USER_FLAG,
3706 "Bad user flag %d.", p->id);
3707
3708 if (p->name[0] == '\0') {
3709 flagname = NULL;
3710 } else {
3711 flagname = p->name;
3712 }
3713
3714 if (p->helptxt[0] == '\0') {
3715 helptxt = NULL;
3716 } else {
3717 helptxt = p->helptxt;
3718 }
3719
3720 set_user_unit_class_flag_name(p->id, flagname, helptxt);
3721}
3722
3723/************************************************************************/
3731 static int unpack_tech_req(const enum tech_req r_num,
3732 const int reqs_size,
3733 const struct requirement *reqs,
3734 struct advance *a,
3735 int i)
3736{
3737 if (i < reqs_size
3738 && reqs[i].source.kind == VUT_ADVANCE) {
3739 /* Extract the tech req so the old code can reason about it. */
3740
3741 /* This IS a traditional tech req... right? */
3742 fc_assert(reqs[i].present);
3743 fc_assert(reqs[i].range == REQ_RANGE_PLAYER);
3744
3745 /* Put it in the advance structure. */
3746 a->require[r_num] = reqs[i].source.value.advance;
3747
3748 /* Move on in the requirement vector. */
3749 i++;
3750 } else {
3751 /* No tech req. */
3752 a->require[r_num] = advance_by_number(A_NONE);
3753 }
3754
3755 return i;
3756}
3757
3758/************************************************************************/
3761 void handle_ruleset_tech(const struct packet_ruleset_tech *p)
3762{
3763 int i;
3764 struct advance *a = advance_by_number(p->id);
3765
3766 fc_assert_ret_msg(NULL != a, "Bad advance %d.", p->id);
3767
3768 names_set(&a->name, NULL, p->name, p->rule_name);
3769 sz_strlcpy(a->graphic_str, p->graphic_str);
3770 sz_strlcpy(a->graphic_alt, p->graphic_alt);
3771
3772 i = 0;
3773
3774 fc_assert(game.control.num_tech_classes == 0 || p->tclass < game.control.num_tech_classes);
3775 if (p->tclass >= 0) {
3776 a->tclass = tech_class_by_number(p->tclass);
3777 } else {
3778 a->tclass = NULL;
3779 }
3780
3781 /* The tech requirements req1 and req2 are send inside research_reqs
3782 * since they too are required to be fulfilled before the tech can be
3783 * researched. */
3784
3785 if (p->removed) {
3786 /* The Freeciv data structures currently records that a tech is removed
3787 * by setting req1 and req2 to "Never". */
3788 a->require[AR_ONE] = A_NEVER;
3789 a->require[AR_TWO] = A_NEVER;
3790 } else {
3791 /* Unpack req1 and req2 from the research_reqs requirement vector. */
3792 i = unpack_tech_req(AR_ONE, p->research_reqs_count, p->research_reqs, a, i);
3793 i = unpack_tech_req(AR_TWO, p->research_reqs_count, p->research_reqs, a, i);
3794 }
3795
3796 /* Any remaining requirements are a part of the research_reqs requirement
3797 * vector. */
3798 for (; i < p->research_reqs_count; i++) {
3799 requirement_vector_append(&a->research_reqs, p->research_reqs[i]);
3800 }
3801
3802 /* The packet's research_reqs should contain req1, req2 and the
3803 * requirements of the tech's research_reqs. */
3804 fc_assert((a->research_reqs.size
3805 + ((a->require[AR_ONE]
3806 && (advance_number(a->require[AR_ONE]) != A_NONE)) ?
3807 1 : 0)
3808 + ((a->require[AR_TWO]
3809 && (advance_number(a->require[AR_TWO]) != A_NONE)) ?
3810 1 : 0))
3811 == p->research_reqs_count);
3812
3813 a->require[AR_ROOT] = advance_by_number(p->root_req);
3814
3815 a->flags = p->flags;
3816 a->cost = p->cost;
3817 a->num_reqs = p->num_reqs;
3818 PACKET_STRVEC_EXTRACT(a->helptext, p->helptext);
3819
3820 tileset_setup_tech_type(tileset, a);
3821}
3822
3823/************************************************************************/
3826 void handle_ruleset_tech_class(const struct packet_ruleset_tech_class *p)
3827{
3828 struct tech_class *ptclass = tech_class_by_number(p->id);
3829
3830 fc_assert_ret_msg(NULL != ptclass, "Bad tech_class %d.", p->id);
3831
3832 names_set(&ptclass->name, NULL, p->name, p->rule_name);
3833 ptclass->cost_pct = p->cost_pct;
3834}
3835
3836/************************************************************************/
3839 void handle_ruleset_tech_flag(const struct packet_ruleset_tech_flag *p)
3840{
3841 const char *flagname;
3842 const char *helptxt;
3843
3844 fc_assert_ret_msg(p->id >= TECH_USER_1 && p->id <= TECH_USER_LAST, "Bad user flag %d.", p->id);
3845
3846 if (p->name[0] == '\0') {
3847 flagname = NULL;
3848 } else {
3849 flagname = p->name;
3850 }
3851
3852 if (p->helptxt[0] == '\0') {
3853 helptxt = NULL;
3854 } else {
3855 helptxt = p->helptxt;
3856 }
3857
3858 set_user_tech_flag_name(p->id, flagname, helptxt);
3859}
3860
3861/************************************************************************/
3864 void handle_ruleset_building(const struct packet_ruleset_building *p)
3865{
3866 int i;
3867 struct impr_type *b = improvement_by_number(p->id);
3868
3869 fc_assert_ret_msg(NULL != b, "Bad improvement %d.", p->id);
3870
3871 b->genus = p->genus;
3872 names_set(&b->name, NULL, p->name, p->rule_name);
3873 sz_strlcpy(b->graphic_str, p->graphic_str);
3874 sz_strlcpy(b->graphic_alt, p->graphic_alt);
3875 sz_strlcpy(b->graphic_alt2, p->graphic_alt2);
3876 for (i = 0; i < p->reqs_count; i++) {
3877 requirement_vector_append(&b->reqs, p->reqs[i]);
3878 }
3879 fc_assert(b->reqs.size == p->reqs_count);
3880 for (i = 0; i < p->obs_count; i++) {
3881 requirement_vector_append(&b->obsolete_by, p->obs_reqs[i]);
3882 }
3883 fc_assert(b->obsolete_by.size == p->obs_count);
3884 b->build_cost = p->build_cost;
3885 b->upkeep = p->upkeep;
3886 b->sabotage = p->sabotage;
3887 b->flags = p->flags;
3888 PACKET_STRVEC_EXTRACT(b->helptext, p->helptext);
3889 sz_strlcpy(b->soundtag, p->soundtag);
3890 sz_strlcpy(b->soundtag_alt, p->soundtag_alt);
3891 sz_strlcpy(b->soundtag_alt2, p->soundtag_alt2);
3892
3893#ifdef FREECIV_DEBUG
3894 if (p->id == improvement_count() - 1) {
3895 improvement_iterate(bdbg) {
3896 log_debug("Improvement: %s...", improvement_rule_name(bdbg));
3897 log_debug(" build_cost %3d", bdbg->build_cost);
3898 log_debug(" upkeep %2d", bdbg->upkeep);
3899 log_debug(" sabotage %3d", bdbg->sabotage);
3900 if (NULL != bdbg->helptext) {
3901 strvec_iterate(bdbg->helptext, text) {
3902 log_debug(" helptext %s", text);
3903 } strvec_iterate_end;
3904 }
3905 } improvement_iterate_end;
3906 }
3907#endif /* FREECIV_DEBUG */
3908
3909 tileset_setup_impr_type(tileset, b);
3910}
3911
3912/************************************************************************/
3915 void handle_ruleset_impr_flag(const struct packet_ruleset_impr_flag *p)
3916{
3917 const char *flagname;
3918 const char *helptxt;
3919
3920 fc_assert_ret_msg(p->id >= IF_USER_FLAG_1 && p->id <= IF_LAST_USER_FLAG,
3921 "Bad user flag %d.", p->id);
3922
3923 if (p->name[0] == '\0') {
3924 flagname = NULL;
3925 } else {
3926 flagname = p->name;
3927 }
3928
3929 if (p->helptxt[0] == '\0') {
3930 helptxt = NULL;
3931 } else {
3932 helptxt = p->helptxt;
3933 }
3934
3935 set_user_impr_flag_name(p->id, flagname, helptxt);
3936}
3937
3938/************************************************************************/
3941 void handle_ruleset_multiplier(const struct packet_ruleset_multiplier *p)
3942{
3943 struct multiplier *pmul = multiplier_by_number(p->id);
3944 int j;
3945
3946 fc_assert_ret_msg(NULL != pmul, "Bad multiplier %d.", p->id);
3947
3948 pmul->start = p->start;
3949 pmul->stop = p->stop;
3950 pmul->step = p->step;
3951 pmul->def = p->def;
3952 pmul->offset = p->offset;
3953 pmul->factor = p->factor;
3954 pmul->minimum_turns = p->minimum_turns;
3955
3956 names_set(&pmul->name, NULL, p->name, p->rule_name);
3957
3958 for (j = 0; j < p->reqs_count; j++) {
3959 requirement_vector_append(&pmul->reqs, p->reqs[j]);
3960 }
3961 fc_assert(pmul->reqs.size == p->reqs_count);
3962
3963 PACKET_STRVEC_EXTRACT(pmul->helptext, p->helptext);
3964}
3965
3966/************************************************************************/
3969 void handle_ruleset_government(const struct packet_ruleset_government *p)
3970{
3971 int j;
3972 struct government *gov = government_by_number(p->id);
3973
3974 fc_assert_ret_msg(NULL != gov, "Bad government %d.", p->id);
3975
3976 gov->item_number = p->id;
3977
3978 for (j = 0; j < p->reqs_count; j++) {
3979 requirement_vector_append(&gov->reqs, p->reqs[j]);
3980 }
3981 fc_assert(gov->reqs.size == p->reqs_count);
3982
3983 names_set(&gov->name, NULL, p->name, p->rule_name);
3984 sz_strlcpy(gov->graphic_str, p->graphic_str);
3985 sz_strlcpy(gov->graphic_alt, p->graphic_alt);
3986
3987 PACKET_STRVEC_EXTRACT(gov->helptext, p->helptext);
3988
3989 tileset_setup_government(tileset, gov);
3990}
3991
3992/************************************************************************/
3995 void handle_ruleset_government_ruler_title
3996 (const struct packet_ruleset_government_ruler_title *packet)
3997{
3998 struct government *gov = government_by_number(packet->gov);
3999
4000 fc_assert_ret_msg(NULL != gov, "Bad government %d.", packet->gov);
4001
4002 (void) government_ruler_title_new(gov, nation_by_number(packet->nation),
4003 packet->male_title,
4004 packet->female_title);
4005}
4006
4007/************************************************************************/
4010 void handle_ruleset_terrain(const struct packet_ruleset_terrain *p)
4011{
4012 int j;
4013 struct terrain *pterrain = terrain_by_number(p->id);
4014
4015 fc_assert_ret_msg(NULL != pterrain, "Bad terrain %d.", p->id);
4016
4017 pterrain->tclass = p->tclass;
4018 pterrain->native_to = p->native_to;
4019 names_set(&pterrain->name, NULL, p->name, p->rule_name);
4020 sz_strlcpy(pterrain->graphic_str, p->graphic_str);
4021 sz_strlcpy(pterrain->graphic_alt, p->graphic_alt);
4022 sz_strlcpy(pterrain->graphic_alt2, p->graphic_alt2);
4023 pterrain->movement_cost = p->movement_cost;
4024 pterrain->defense_bonus = p->defense_bonus;
4025
4026 output_type_iterate(o) {
4027 pterrain->output[o] = p->output[o];
4028 } output_type_iterate_end;
4029
4030 if (pterrain->resources != NULL) {
4031 free(pterrain->resources);
4032 }
4033 pterrain->resources = fc_calloc(p->num_resources + 1,
4034 sizeof(*pterrain->resources));
4035 if (pterrain->resource_freq != NULL) {
4036 free(pterrain->resource_freq);
4037 }
4038 pterrain->resource_freq = fc_calloc(p->num_resources + 1,
4039 sizeof(*pterrain->resource_freq));
4040 for (j = 0; j < p->num_resources; j++) {
4041 pterrain->resources[j] = extra_by_number(p->resources[j]);
4042 if (!pterrain->resources[j]) {
4043 log_error("handle_ruleset_terrain() "
4044 "Mismatched resource %d for terrain \"%s\".",
4045 p->resources[j], terrain_rule_name(pterrain));
4046 }
4047 pterrain->resource_freq[j] = p->resource_freq[j];
4048 }
4049 pterrain->resources[p->num_resources] = NULL;
4050 pterrain->resource_freq[p->num_resources] = 0;
4051
4052 output_type_iterate(o) {
4053 pterrain->road_output_incr_pct[o] = p->road_output_incr_pct[o];
4054 } output_type_iterate_end;
4055
4056 pterrain->base_time = p->base_time;
4057 pterrain->road_time = p->road_time;
4058 pterrain->cultivate_result = terrain_by_number(p->cultivate_result);
4059 pterrain->cultivate_time = p->cultivate_time;
4060 pterrain->plant_result = terrain_by_number(p->plant_result);
4061 pterrain->plant_time = p->plant_time;
4062 pterrain->irrigation_food_incr = p->irrigation_food_incr;
4063 pterrain->irrigation_time = p->irrigation_time;
4064 pterrain->mining_shield_incr = p->mining_shield_incr;
4065 pterrain->mining_time = p->mining_time;
4066 if (p->animal < 0) {
4067 pterrain->animal = NULL;
4068 } else {
4069 pterrain->animal = utype_by_number(p->animal);
4070 }
4071 pterrain->transform_result = terrain_by_number(p->transform_result);
4072 pterrain->transform_time = p->transform_time;
4073 pterrain->placing_time = p->placing_time;
4074 pterrain->pillage_time = p->pillage_time;
4075
4076 for (j = 0; j < p->extra_count; j++) {
4077 pterrain->extra_removal_times[j] = p->extra_removal_times[j];
4078 }
4079
4080 pterrain->flags = p->flags;
4081
4082 fc_assert_ret(pterrain->rgb == NULL);
4083 pterrain->rgb = rgbcolor_new(p->color_red, p->color_green, p->color_blue);
4084
4085 PACKET_STRVEC_EXTRACT(pterrain->helptext, p->helptext);
4086
4087 tileset_setup_tile_type(tileset, pterrain);
4088}
4089
4090/************************************************************************/
4093 void handle_ruleset_terrain_flag(const struct packet_ruleset_terrain_flag *p)
4094{
4095 const char *flagname;
4096 const char *helptxt;
4097
4098 fc_assert_ret_msg(p->id >= TER_USER_1 && p->id <= TER_USER_LAST, "Bad user flag %d.", p->id);
4099
4100 if (p->name[0] == '\0') {
4101 flagname = NULL;
4102 } else {
4103 flagname = p->name;
4104 }
4105
4106 if (p->helptxt[0] == '\0') {
4107 helptxt = NULL;
4108 } else {
4109 helptxt = p->helptxt;
4110 }
4111
4112 set_user_terrain_flag_name(p->id, flagname, helptxt);
4113}
4114
4115/************************************************************************/
4118 void handle_ruleset_resource(const struct packet_ruleset_resource *p)
4119{
4120 struct resource_type *presource;
4121
4122 if (p->id < 0 || p->id > MAX_EXTRA_TYPES) {
4123 log_error("Bad resource %d.", p->id);
4124 return;
4125 }
4126
4127 presource = resource_type_init(extra_by_number(p->id));
4128
4129 output_type_iterate(o) {
4130 presource->output[o] = p->output[o];
4131 } output_type_iterate_end;
4132}
4133
4134/************************************************************************/
4137 void handle_ruleset_extra(const struct packet_ruleset_extra *p)
4138{
4139 struct extra_type *pextra = extra_by_number(p->id);
4140 int i;
4141 bool cbase;
4142 bool croad;
4143 bool cres;
4144
4145 fc_assert_ret_msg(NULL != pextra, "Bad extra %d.", p->id);
4146
4147 names_set(&pextra->name, NULL, p->name, p->rule_name);
4148
4149 pextra->category = p->category;
4150
4151 pextra->causes = 0;
4152 for (i = 0; i < EC_COUNT; i++) {
4153 if (BV_ISSET(p->causes, i)) {
4154 pextra->causes |= (1 << i);
4155 }
4156 }
4157
4158 pextra->rmcauses = 0;
4159 for (i = 0; i < ERM_COUNT; i++) {
4160 if (BV_ISSET(p->rmcauses, i)) {
4161 pextra->rmcauses |= (1 << i);
4162 }
4163 }
4164
4165 if (pextra->causes == 0) {
4166 extra_to_caused_by_list(pextra, EC_NONE);
4167 } else {
4168 for (i = 0; i < EC_COUNT; i++) {
4169 if (is_extra_caused_by(pextra, i)) {
4170 extra_to_caused_by_list(pextra, i);
4171 }
4172 }
4173 }
4174
4175 cbase = is_extra_caused_by(pextra, EC_BASE);
4176 croad = is_extra_caused_by(pextra, EC_ROAD);
4177 cres = is_extra_caused_by(pextra, EC_RESOURCE);
4178 if (cbase) {
4179 /* Index is one less than size of list when this base is already added. */
4180 base_type_init(pextra, extra_type_list_size(extra_type_list_by_cause(EC_BASE)) - 1);
4181 }
4182 if (croad) {
4183 /* Index is one less than size of list when this road is already added. */
4184 road_type_init(pextra, extra_type_list_size(extra_type_list_by_cause(EC_ROAD)) - 1);
4185 }
4186 if (!cbase && !croad && !cres) {
4187 pextra->data.special_idx = extra_type_list_size(extra_type_list_by_cause(EC_SPECIAL));
4188 extra_to_caused_by_list(pextra, EC_SPECIAL);
4189 }
4190
4191 for (i = 0; i < ERM_COUNT; i++) {
4192 if (is_extra_removed_by(pextra, i)) {
4193 extra_to_removed_by_list(pextra, i);
4194 }
4195 }
4196
4197 sz_strlcpy(pextra->activity_gfx, p->activity_gfx);
4198 sz_strlcpy(pextra->act_gfx_alt, p->act_gfx_alt);
4199 sz_strlcpy(pextra->act_gfx_alt2, p->act_gfx_alt2);
4200 sz_strlcpy(pextra->rmact_gfx, p->rmact_gfx);
4201 sz_strlcpy(pextra->rmact_gfx_alt, p->rmact_gfx_alt);
4202 sz_strlcpy(pextra->rmact_gfx_alt2, p->rmact_gfx_alt2);
4203 sz_strlcpy(pextra->graphic_str, p->graphic_str);
4204 sz_strlcpy(pextra->graphic_alt, p->graphic_alt);
4205
4206 for (i = 0; i < p->reqs_count; i++) {
4207 requirement_vector_append(&pextra->reqs, p->reqs[i]);
4208 }
4209 fc_assert(pextra->reqs.size == p->reqs_count);
4210
4211 for (i = 0; i < p->rmreqs_count; i++) {
4212 requirement_vector_append(&pextra->rmreqs, p->rmreqs[i]);
4213 }
4214 fc_assert(pextra->rmreqs.size == p->rmreqs_count);
4215
4216 pextra->appearance_chance = p->appearance_chance;
4217 for (i = 0; i < p->appearance_reqs_count; i++) {
4218 requirement_vector_append(&pextra->appearance_reqs, p->appearance_reqs[i]);
4219 }
4220 fc_assert(pextra->appearance_reqs.size == p->appearance_reqs_count);
4221
4222 pextra->disappearance_chance = p->disappearance_chance;
4223 for (i = 0; i < p->disappearance_reqs_count; i++) {
4224 requirement_vector_append(&pextra->disappearance_reqs, p->disappearance_reqs[i]);
4225 }
4226 fc_assert(pextra->disappearance_reqs.size == p->disappearance_reqs_count);
4227
4228 pextra->visibility_req = p->visibility_req;
4229 pextra->buildable = p->buildable;
4230 pextra->generated = p->generated;
4231 pextra->build_time = p->build_time;
4232 pextra->build_time_factor = p->build_time_factor;
4233 pextra->removal_time = p->removal_time;
4234 pextra->removal_time_factor = p->removal_time_factor;
4235 pextra->infracost = p->infracost;
4236 pextra->defense_bonus = p->defense_bonus;
4237
4238 if (pextra->defense_bonus != 0) {
4239 if (extra_has_flag(pextra, EF_NATURAL_DEFENSE)) {
4240 extra_to_caused_by_list(pextra, EC_NATURAL_DEFENSIVE);
4241 } else {
4242 extra_to_caused_by_list(pextra, EC_DEFENSIVE);
4243 }
4244 }
4245
4246 pextra->no_aggr_near_city = p->no_aggr_near_city;
4247
4248 pextra->eus = p->eus;
4249 if (pextra->eus == EUS_HIDDEN) {
4250 extra_type_list_append(extra_type_list_of_unit_hiders(), pextra);
4251 }
4252
4253 pextra->native_to = p->native_to;
4254
4255 pextra->flags = p->flags;
4256 if (pextra->no_aggr_near_city >= 0) {
4257 extra_to_caused_by_list(pextra, EC_NOT_AGGRESSIVE);
4258 }
4259 if (extra_has_flag(pextra, EF_CAUSE_ZOC)) {
4260 extra_type_list_append(extra_type_list_of_zoccers(), pextra);
4261 }
4262
4263 pextra->hidden_by = p->hidden_by;
4264 pextra->bridged_over = p->bridged_over;
4265 pextra->conflicts = p->conflicts;
4266
4267 PACKET_STRVEC_EXTRACT(pextra->helptext, p->helptext);
4268
4269 tileset_setup_extra(tileset, pextra);
4270}
4271
4272/************************************************************************/
4275 void handle_ruleset_extra_flag(const struct packet_ruleset_extra_flag *p)
4276{
4277 const char *flagname;
4278 const char *helptxt;
4279
4280 fc_assert_ret_msg(p->id >= EF_USER_FLAG_1 && p->id <= EF_LAST_USER_FLAG,
4281 "Bad user flag %d.", p->id);
4282
4283 if (p->name[0] == '\0') {
4284 flagname = NULL;
4285 } else {
4286 flagname = p->name;
4287 }
4288
4289 if (p->helptxt[0] == '\0') {
4290 helptxt = NULL;
4291 } else {
4292 helptxt = p->helptxt;
4293 }
4294
4295 set_user_extra_flag_name(p->id, flagname, helptxt);
4296}
4297
4298/************************************************************************/
4301 void handle_ruleset_base(const struct packet_ruleset_base *p)
4302{
4303 struct base_type *pbase = base_by_number(p->id);
4304
4305 fc_assert_ret_msg(NULL != pbase, "Bad base %d.", p->id);
4306
4307 pbase->gui_type = p->gui_type;
4308 pbase->border_sq = p->border_sq;
4309 pbase->vision_main_sq = p->vision_main_sq;
4310 pbase->vision_invis_sq = p->vision_invis_sq;
4311 pbase->vision_subs_sq = p->vision_subs_sq;
4312
4313 if (territory_claiming_base(pbase)) {
4314 extra_type_list_append(extra_type_list_of_terr_claimers(),
4315 base_extra_get(pbase));
4316 }
4317}
4318
4319/************************************************************************/
4322 void handle_ruleset_road(const struct packet_ruleset_road *p)
4323{
4324 int i;
4325 struct road_type *proad = road_by_number(p->id);
4326
4327 fc_assert_ret_msg(NULL != proad, "Bad road %d.", p->id);
4328
4329 proad->gui_type = p->gui_type;
4330
4331 for (i = 0; i < p->first_reqs_count; i++) {
4332 requirement_vector_append(&proad->first_reqs, p->first_reqs[i]);
4333 }
4334 fc_assert(proad->first_reqs.size == p->first_reqs_count);
4335
4336 proad->move_cost = p->move_cost;
4337 proad->move_mode = p->move_mode;
4338
4339 output_type_iterate(o) {
4340 proad->tile_incr_const[o] = p->tile_incr_const[o];
4341 proad->tile_incr[o] = p->tile_incr[o];
4342 proad->tile_bonus[o] = p->tile_bonus[o];
4343 } output_type_iterate_end;
4344
4345 proad->compat = p->compat;
4346 proad->integrates = p->integrates;
4347 proad->flags = p->flags;
4348}
4349
4350/************************************************************************/
4353 void handle_ruleset_goods(const struct packet_ruleset_goods *p)
4354{
4355 struct goods_type *pgood = goods_by_number(p->id);
4356 int i;
4357
4358 fc_assert_ret_msg(NULL != pgood, "Bad goods %d.", p->id);
4359
4360 names_set(&pgood->name, NULL, p->name, p->rule_name);
4361
4362 for (i = 0; i < p->reqs_count; i++) {
4363 requirement_vector_append(&pgood->reqs, p->reqs[i]);
4364 }
4365 fc_assert(pgood->reqs.size == p->reqs_count);
4366
4367 pgood->from_pct = p->from_pct;
4368 pgood->to_pct = p->to_pct;
4369 pgood->onetime_pct = p->onetime_pct;
4370 pgood->flags = p->flags;
4371
4372 PACKET_STRVEC_EXTRACT(pgood->helptext, p->helptext);
4373}
4374
4375/************************************************************************/
4378 void handle_ruleset_action(const struct packet_ruleset_action *p)
4379{
4380 struct action *act;
4381
4382 if (!action_id_exists(p->id)) {
4383 /* Action id out of range */
4384 log_error("handle_ruleset_action() the action id %d is out of range.",
4385 p->id);
4386
4387 return;
4388 }
4389
4390 act = action_by_number(p->id);
4391
4392 sz_strlcpy(act->ui_name, p->ui_name);
4393 act->quiet = p->quiet;
4394
4395 act->result = p->result;
4396 act->sub_results = p->sub_results;
4397 act->actor_consuming_always = p->actor_consuming_always;
4398
4399 act->actor_kind = p->act_kind;
4400 act->target_kind = p->tgt_kind;
4401 act->sub_target_kind = p->sub_tgt_kind;
4402
4403 act->min_distance = p->min_distance;
4404 act->max_distance = p->max_distance;
4405 act->blocked_by = p->blocked_by;
4406}
4407
4408/************************************************************************/
4411void
4412handle_ruleset_action_enabler(const struct packet_ruleset_action_enabler *p)
4413{
4414 struct action_enabler *enabler;
4415 int i;
4416
4417 if (!action_id_exists(p->enabled_action)) {
4418 /* Non existing action */
4419 log_error("handle_ruleset_action_enabler() the action %d "
4420 "doesn't exist.",
4421 p->enabled_action);
4422
4423 return;
4424 }
4425
4426 enabler = action_enabler_new();
4427
4428 enabler->action = p->enabled_action;
4429
4430 for (i = 0; i < p->actor_reqs_count; i++) {
4431 requirement_vector_append(&enabler->actor_reqs, p->actor_reqs[i]);
4432 }
4433 fc_assert(enabler->actor_reqs.size == p->actor_reqs_count);
4434
4435 for (i = 0; i < p->target_reqs_count; i++) {
4436 requirement_vector_append(&enabler->target_reqs, p->target_reqs[i]);
4437 }
4438 fc_assert(enabler->target_reqs.size == p->target_reqs_count);
4439
4440 action_enabler_add(enabler);
4441}
4442
4443/************************************************************************/
4446 void handle_ruleset_action_auto(const struct packet_ruleset_action_auto *p)
4447{
4448 struct action_auto_perf *auto_perf;
4449 int i;
4450
4451 auto_perf = action_auto_perf_slot_number(p->id);
4452
4453 auto_perf->cause = p->cause;
4454
4455 for (i = 0; i < p->reqs_count; i++) {
4456 requirement_vector_append(&auto_perf->reqs, p->reqs[i]);
4457 }
4458 fc_assert(auto_perf->reqs.size == p->reqs_count);
4459
4460 for (i = 0; i < p->alternatives_count; i++) {
4461 auto_perf->alternatives[i] = p->alternatives[i];
4462 }
4463}
4464
4465/************************************************************************/
4468 void handle_ruleset_disaster(const struct packet_ruleset_disaster *p)
4469{
4470 struct disaster_type *pdis = disaster_by_number(p->id);
4471 int i;
4472
4473 fc_assert_ret_msg(NULL != pdis, "Bad disaster %d.", p->id);
4474
4475 names_set(&pdis->name, NULL, p->name, p->rule_name);
4476
4477 for (i = 0; i < p->reqs_count; i++) {
4478 requirement_vector_append(&pdis->reqs, p->reqs[i]);
4479 }
4480 fc_assert(pdis->reqs.size == p->reqs_count);
4481
4482 pdis->frequency = p->frequency;
4483
4484 pdis->effects = p->effects;
4485}
4486
4487/************************************************************************/
4490 void handle_ruleset_achievement(const struct packet_ruleset_achievement *p)
4491{
4492 struct achievement *pach = achievement_by_number(p->id);
4493
4494 fc_assert_ret_msg(NULL != pach, "Bad achievement %d.", p->id);
4495
4496 names_set(&pach->name, NULL, p->name, p->rule_name);
4497
4498 pach->type = p->type;
4499 pach->unique = p->unique;
4500 pach->value = p->value;
4501}
4502
4503/************************************************************************/
4506 void handle_ruleset_trade(const struct packet_ruleset_trade *p)
4507{
4508 struct trade_route_settings *pset = trade_route_settings_by_type(p->id);
4509
4510 if (pset != NULL) {
4511 pset->trade_pct = p->trade_pct;
4512 pset->cancelling = p->cancelling;
4513 pset->bonus_type = p->bonus_type;
4514 }
4515}
4516
4517/************************************************************************/
4520 void handle_ruleset_terrain_control
4521 (const struct packet_ruleset_terrain_control *p)
4522{
4523 /* Since terrain_control is the same as packet_ruleset_terrain_control
4524 * we can just copy the data directly. */
4525 terrain_control = *p;
4526 /* terrain_control.move_fragments likely changed */
4527 init_move_fragments();
4528}
4529
4530/************************************************************************/
4533 void handle_ruleset_nation_sets
4534 (const struct packet_ruleset_nation_sets *packet)
4535{
4536 int i;
4537
4538 for (i = 0; i < packet->nsets; i++) {
4539 struct nation_set *pset =
4540 nation_set_new(packet->names[i], packet->rule_names[i],
4541 packet->descriptions[i]);
4542
4543 if (pset == NULL) {
4544 break;
4545 } else {
4546 fc_assert(i == nation_set_index(pset));
4547 }
4548 }
4549}
4550
4551/************************************************************************/
4554 void handle_ruleset_nation_groups
4555 (const struct packet_ruleset_nation_groups *packet)
4556{
4557 int i;
4558
4559 for (i = 0; i < packet->ngroups; i++) {
4560 struct nation_group *pgroup;
4561
4562 pgroup = nation_group_new(packet->groups[i]);
4563
4564 if (pgroup != NULL) {
4565 fc_assert(i == nation_group_index(pgroup));
4566 pgroup->hidden = packet->hidden[i];
4567 } else {
4568 break;
4569 }
4570 }
4571}
4572
4573/************************************************************************/
4576 void handle_ruleset_nation(const struct packet_ruleset_nation *packet)
4577{
4578 struct nation_type *pnation = nation_by_number(packet->id);
4579 int i;
4580
4581 fc_assert_ret_msg(NULL != pnation, "Bad nation %d.", packet->id);
4582
4583 if (packet->translation_domain[0] != '\0') {
4584 size_t len = strlen(packet->translation_domain) + 1;
4585 pnation->translation_domain = fc_malloc(len);
4586 fc_strlcpy(pnation->translation_domain, packet->translation_domain, len);
4587 } else {
4588 pnation->translation_domain = NULL;
4589 }
4590 names_set(&pnation->adjective, pnation->translation_domain,
4591 packet->adjective, packet->rule_name);
4592 name_set(&pnation->noun_plural, pnation->translation_domain, packet->noun_plural);
4593 sz_strlcpy(pnation->flag_graphic_str, packet->graphic_str);
4594 sz_strlcpy(pnation->flag_graphic_alt, packet->graphic_alt);
4595 pnation->style = style_by_number(packet->style);
4596 for (i = 0; i < packet->leader_count; i++) {
4597 (void) nation_leader_new(pnation, packet->leader_name[i],
4598 packet->leader_is_male[i]);
4599 }
4600
4601 /* set later by PACKET_NATION_AVAILABILITY */
4602 pnation->client.is_pickable = FALSE;
4603 pnation->is_playable = packet->is_playable;
4604 pnation->barb_type = packet->barbarian_type;
4605
4606 if ('\0' != packet->legend[0]) {
4607 pnation->legend = fc_strdup(nation_legend_translation(pnation, packet->legend));
4608 } else {
4609 pnation->legend = fc_strdup("");
4610 }
4611
4612 for (i = 0; i < packet->nsets; i++) {
4613 struct nation_set *pset = nation_set_by_number(packet->sets[i]);
4614
4615 if (NULL != pset) {
4616 nation_set_list_append(pnation->sets, pset);
4617 } else {
4618 log_error("handle_ruleset_nation() \"%s\" have unknown set %d.",
4619 nation_rule_name(pnation), packet->sets[i]);
4620 }
4621 }
4622
4623 for (i = 0; i < packet->ngroups; i++) {
4624 struct nation_group *pgroup = nation_group_by_number(packet->groups[i]);
4625
4626 if (NULL != pgroup) {
4627 nation_group_list_append(pnation->groups, pgroup);
4628 } else {
4629 log_error("handle_ruleset_nation() \"%s\" have unknown group %d.",
4630 nation_rule_name(pnation), packet->groups[i]);
4631 }
4632 }
4633
4634 /* init_government may be NULL */
4635 pnation->init_government = government_by_number(packet->init_government_id);
4636 for (i = 0; i < MAX_NUM_TECH_LIST; i++) {
4637 if (i < packet->init_techs_count) {
4638 pnation->init_techs[i] = packet->init_techs[i];
4639 } else {
4640 pnation->init_techs[i] = A_LAST;
4641 }
4642 }
4643 for (i = 0; i < MAX_NUM_UNIT_LIST; i++) {
4644 if (i < packet->init_units_count) {
4645 pnation->init_units[i] = utype_by_number(packet->init_units[i]);
4646 } else {
4647 /* TODO: should init_units be initialized in common/nation.c? */
4648 pnation->init_units[i] = utype_by_number(U_LAST);
4649 }
4650 }
4651 for (i = 0; i < MAX_NUM_BUILDING_LIST; i++) {
4652 if (i < packet->init_buildings_count) {
4653 pnation->init_buildings[i] = packet->init_buildings[i];
4654 } else {
4655 pnation->init_buildings[i] = B_LAST;
4656 }
4657 }
4658
4659 tileset_setup_nation_flag(tileset, pnation);
4660}
4661
4662/************************************************************************/
4666 void handle_nation_availability(int ncount, const bool *is_pickable,
4667 bool nationset_change)
4668{
4669 int i;
4670
4671 fc_assert_action(ncount == nation_count(),
4672 ncount = MIN(ncount, nation_count()));
4673
4674 for (i = 0; i < ncount; i++) {
4675 nation_by_number(i)->client.is_pickable = is_pickable[i];
4676 }
4677
4678 races_update_pickable(nationset_change);
4679}
4680
4681/************************************************************************/
4684 void handle_ruleset_style(const struct packet_ruleset_style *p)
4685{
4686 struct nation_style *pstyle = style_by_number(p->id);
4687
4688 fc_assert_ret_msg(NULL != pstyle, "Bad style %d.", p->id);
4689
4690 names_set(&pstyle->name, NULL, p->name, p->rule_name);
4691}
4692
4693/************************************************************************/
4696 void handle_ruleset_clause(const struct packet_ruleset_clause *p)
4697{
4698 struct clause_info *info = clause_info_get(p->type);
4699 int i;
4700
4701 fc_assert_ret_msg(NULL != info, "Bad clause %d.", p->type);
4702
4703 info->enabled = p->enabled;
4704
4705 for (i = 0; i < p->giver_reqs_count; i++) {
4706 requirement_vector_append(&info->giver_reqs, p->giver_reqs[i]);
4707 }
4708 fc_assert(info->giver_reqs.size == p->giver_reqs_count);
4709
4710 for (i = 0; i < p->receiver_reqs_count; i++) {
4711 requirement_vector_append(&info->receiver_reqs, p->receiver_reqs[i]);
4712 }
4713 fc_assert(info->receiver_reqs.size == p->receiver_reqs_count);
4714}
4715
4716/************************************************************************/
4719 void handle_ruleset_city(const struct packet_ruleset_city *packet)
4720{
4721 int id, j;
4722 struct citystyle *cs;
4723
4724 id = packet->style_id;
4725 fc_assert_ret_msg(0 <= id && game.control.num_city_styles > id,
4726 "Bad citystyle %d.", id);
4727 cs = &city_styles[id];
4728
4729 for (j = 0; j < packet->reqs_count; j++) {
4730 requirement_vector_append(&cs->reqs, packet->reqs[j]);
4731 }
4732 fc_assert(cs->reqs.size == packet->reqs_count);
4733
4734 names_set(&cs->name, NULL, packet->name, packet->rule_name);
4735 sz_strlcpy(cs->graphic, packet->graphic);
4736 sz_strlcpy(cs->graphic_alt, packet->graphic_alt);
4737 sz_strlcpy(cs->citizens_graphic, packet->citizens_graphic);
4738
4739 tileset_setup_city_tiles(tileset, id);
4740}
4741
4742/************************************************************************/
4745 void handle_ruleset_music(const struct packet_ruleset_music *packet)
4746{
4747 int id, j;
4748 struct music_style *pmus;
4749
4750 id = packet->id;
4751 fc_assert_ret_msg(0 <= id && game.control.num_music_styles > id,
4752 "Bad music_style %d.", id);
4753
4754 pmus = music_style_by_number(id);
4755
4756 for (j = 0; j < packet->reqs_count; j++) {
4757 requirement_vector_append(&pmus->reqs, packet->reqs[j]);
4758 }
4759 fc_assert(pmus->reqs.size == packet->reqs_count);
4760
4761 sz_strlcpy(pmus->music_peaceful, packet->music_peaceful);
4762 sz_strlcpy(pmus->music_combat, packet->music_combat);
4763}
4764
4765/************************************************************************/
4768 void handle_ruleset_game(const struct packet_ruleset_game *packet)
4769{
4770 int i;
4771
4772 /* Must set num_specialist_types before iterating over them. */
4773 DEFAULT_SPECIALIST = packet->default_specialist;
4774
4775 fc_assert_ret(packet->veteran_levels > 0);
4776
4777 game.veteran = veteran_system_new(packet->veteran_levels);
4778 game.veteran->levels = packet->veteran_levels;
4779
4780 for (i = 0; i < MAX_NUM_TECH_LIST; i++) {
4781 if (i < packet->global_init_techs_count) {
4782 game.rgame.global_init_techs[i] = packet->global_init_techs[i];
4783 } else {
4784 game.rgame.global_init_techs[i] = A_LAST;
4785 }
4786 }
4787 for (i = 0; i < MAX_NUM_BUILDING_LIST; i++) {
4788 if (i < packet->global_init_buildings_count) {
4789 game.rgame.global_init_buildings[i] = packet->global_init_buildings[i];
4790 } else {
4791 game.rgame.global_init_buildings[i] = B_LAST;
4792 }
4793 }
4794
4795 for (i = 0; i < packet->veteran_levels; i++) {
4796 veteran_system_definition(game.veteran, i, packet->veteran_name[i],
4797 packet->power_fact[i], packet->move_bonus[i],
4798 packet->base_raise_chance[i],
4799 packet->work_raise_chance[i]);
4800 }
4801
4802 fc_assert(game.plr_bg_color == NULL);
4803 game.plr_bg_color = rgbcolor_new(packet->background_red,
4804 packet->background_green,
4805 packet->background_blue);
4806
4807 tileset_background_init(tileset);
4808}
4809
4810/************************************************************************/
4813 void handle_ruleset_specialist(const struct packet_ruleset_specialist *p)
4814{
4815 int j;
4816 struct specialist *s = specialist_by_number(p->id);
4817
4818 fc_assert_ret_msg(NULL != s, "Bad specialist %d.", p->id);
4819
4820 names_set(&s->name, NULL, p->plural_name, p->rule_name);
4821 name_set(&s->abbreviation, NULL, p->short_name);
4822
4823 sz_strlcpy(s->graphic_str, p->graphic_str);
4824 sz_strlcpy(s->graphic_alt, p->graphic_alt);
4825
4826 for (j = 0; j < p->reqs_count; j++) {
4827 requirement_vector_append(&s->reqs, p->reqs[j]);
4828 }
4829 fc_assert(s->reqs.size == p->reqs_count);
4830
4831 PACKET_STRVEC_EXTRACT(s->helptext, p->helptext);
4832
4833 tileset_setup_specialist_type_default_set(tileset, p->id);
4834}
4835
4836/************************************************************************/
4839 void handle_city_name_suggestion_info(int unit_id, const char *name)
4840{
4841 struct unit *punit = player_unit_by_number(client_player(), unit_id);
4842
4843 if (!can_client_issue_orders()) {
4844 return;
4845 }
4846
4847 if (punit) {
4848 if (gui_options.ask_city_name) {
4849 bool other_asking = FALSE;
4850
4851 unit_list_iterate(unit_tile(punit)->units, other) {
4852 if (other->client.asking_city_name) {
4853 other_asking = TRUE;
4854 }
4855 } unit_list_iterate_end;
4856 punit->client.asking_city_name = TRUE;
4857
4858 if (!other_asking) {
4859 popup_newcity_dialog(punit, name);
4860 }
4861 } else {
4862 request_do_action(ACTION_FOUND_CITY,
4863 unit_id, tile_index(unit_tile(punit)),
4864 0, name);
4865 }
4866 }
4867}
4868
4869/************************************************************************/
4875 void handle_unit_action_answer(int actor_id, int target_id, int cost,
4876 action_id action_type,
4877 int request_kind)
4878{
4879 struct city *pcity = game_city_by_number(target_id);
4880 struct unit *punit = game_unit_by_number(target_id);
4881 struct unit *pactor = player_unit_by_number(client_player(), actor_id);
4882 struct action *paction = action_by_number(action_type);
4883
4884 if (ACTION_NONE != action_type
4885 && !action_id_exists(action_type)) {
4886 /* Non existing action */
4887 log_error("handle_unit_action_answer() the action %d doesn't exist.",
4888 action_type);
4889
4890 if (request_kind == REQEST_PLAYER_INITIATED) {
4891 action_selection_no_longer_in_progress(actor_id);
4892 action_decision_clear_want(actor_id);
4893 action_selection_next_in_focus(actor_id);
4894 }
4895
4896 return;
4897 }
4898
4899 if (!pactor) {
4900 log_debug("Bad actor %d.", actor_id);
4901
4902 if (request_kind == REQEST_PLAYER_INITIATED) {
4903 action_selection_no_longer_in_progress(actor_id);
4904 action_selection_next_in_focus(actor_id);
4905 }
4906
4907 return;
4908 }
4909
4910 switch ((enum gen_action)action_type) {
4911 case ACTION_SPY_BRIBE_UNIT:
4912 if (punit && client.conn.playing
4913 && is_human(client.conn.playing)) {
4914 if (request_kind == REQEST_PLAYER_INITIATED) {
4915 /* Focus on the unit so the player knows where it is */
4916 unit_focus_set(pactor);
4917
4918 popup_bribe_dialog(pactor, punit, cost, paction);
4919 } else {
4920 /* Not in use (yet). */
4921 log_error("Unimplemented: received background unit bribe cost.");
4922 }
4923 } else {
4924 log_debug("Bad target %d.", target_id);
4925 if (request_kind == REQEST_PLAYER_INITIATED) {
4926 action_selection_no_longer_in_progress(actor_id);
4927 action_decision_clear_want(actor_id);
4928 action_selection_next_in_focus(actor_id);
4929 }
4930 }
4931 break;
4932 case ACTION_SPY_INCITE_CITY:
4933 case ACTION_SPY_INCITE_CITY_ESC:
4934 if (pcity && client.conn.playing
4935 && is_human(client.conn.playing)) {
4936 if (request_kind == REQEST_PLAYER_INITIATED) {
4937 /* Focus on the unit so the player knows where it is */
4938 unit_focus_set(pactor);
4939
4940 popup_incite_dialog(pactor, pcity, cost, paction);
4941 } else {
4942 /* Not in use (yet). */
4943 log_error("Unimplemented: received background city incite cost.");
4944 }
4945 } else {
4946 log_debug("Bad target %d.", target_id);
4947 if (request_kind == REQEST_PLAYER_INITIATED) {
4948 action_selection_no_longer_in_progress(actor_id);
4949 action_decision_clear_want(actor_id);
4950 action_selection_next_in_focus(actor_id);
4951 }
4952 }
4953 break;
4954 case ACTION_UPGRADE_UNIT:
4955 if (pcity && client.conn.playing
4956 && is_human(client.conn.playing)) {
4957 /* TODO: The bundled clients will have to start showing the upgrade
4958 * price sent from the server before it can be allowed to rely on
4959 * things the player can't see. (Example: it becomes legal to upgrade
4960 * a unit in a foreign city.) */
4961
4962 /* Getting unit upgrade cost from the server is currently only used by
4963 * Freeciv-web. */
4964 log_error("Received upgrade unit price but can't forward it.");
4965 }
4966 break;
4967 case ACTION_NONE:
4968 log_debug("Server didn't respond to query.");
4969 if (request_kind == REQEST_PLAYER_INITIATED) {
4970 action_selection_no_longer_in_progress(actor_id);
4971 action_decision_clear_want(actor_id);
4972 action_selection_next_in_focus(actor_id);
4973 }
4974 break;
4975 default:
4976 log_error("handle_unit_action_answer() invalid action_type (%d).",
4977 action_type);
4978 if (request_kind == REQEST_PLAYER_INITIATED) {
4979 action_selection_no_longer_in_progress(actor_id);
4980 action_decision_clear_want(actor_id);
4981 action_selection_next_in_focus(actor_id);
4982 }
4983 break;
4984 };
4985}
4986
4987/************************************************************************/
4991 static action_id auto_attack_act(const struct act_prob *act_probs)
4992{
4993 action_id attack_action = ACTION_NONE;
4994
4995 action_array_iterate(auto_attack_actions, act_id) {
4996 if (action_prob_possible(act_probs[act_id])) {
4997 /* An attack. */
4998 if (attack_action == ACTION_NONE) {
4999 /* No previous attack action found. */
5000 attack_action = act_id;
5001 } else {
5002 /* More than one legal attack action found. */
5003 return ACTION_NONE;
5004 }
5005 }
5006 } action_array_iterate_end;
5007 action_array_iterate(auto_attack_blockers, act_id) {
5008 if (action_prob_possible(act_probs[act_id])) {
5009 /* An interesting non attack action has been found. */
5010 return ACTION_NONE;
5011 }
5012 } action_array_iterate_end;
5013
5014 return attack_action;
5015}
5016
5017/**********************************************************************/
5021 static void action_decision_maybe_auto(struct unit *actor_unit,
5022 const struct act_prob *act_probs,
5023 struct unit *target_unit,
5024 struct city *target_city,
5025 struct tile *target_tile)
5026{
5027 action_id auto_action;
5028
5029 fc_assert_ret(actor_unit != NULL);
5030
5031 auto_action = auto_attack_act(act_probs);
5032
5033 if (auto_action != ACTION_NONE) {
5034 /* No interesting actions except a single attack action has been
5035 * found. The player wants it performed without questions. */
5036
5037 /* The order requests below doesn't send additional details. */
5038 fc_assert(!action_id_requires_details(auto_action));
5039
5040 /* Give the order. */
5041 switch (action_id_get_target_kind(auto_action)) {
5042 case ATK_TILE:
5043 case ATK_UNITS:
5044 case ATK_EXTRAS:
5045 if (target_tile != NULL) {
5046 request_do_action(auto_action,
5047 actor_unit->id, tile_index(target_tile),
5048 0, "");
5049 }
5050 break;
5051 case ATK_CITY:
5052 if (target_city != NULL) {
5053 request_do_action(auto_action,
5054 actor_unit->id, target_city->id,
5055 0, "");
5056 }
5057 break;
5058 case ATK_UNIT:
5059 if (target_unit != NULL) {
5060 request_do_action(auto_action,
5061 actor_unit->id, target_unit->id,
5062 0, "");
5063 }
5064 break;
5065 case ATK_SELF:
5066 request_do_action(auto_action,
5067 actor_unit->id, actor_unit->id,
5068 0, "");
5069 break;
5070 case ATK_COUNT:
5071 fc_assert(action_id_get_target_kind(auto_action) != ATK_COUNT);
5072 break;
5073 }
5074
5075 /* Clean up. */
5076 action_decision_clear_want(actor_unit->id);
5077 } else {
5078 /* This should be done in the foreground */
5079 action_decision_request(actor_unit);
5080 }
5081}
5082
5083/************************************************************************/
5089 void handle_unit_actions(const struct packet_unit_actions *packet)
5090{
5091 struct unit *actor_unit = game_unit_by_number(packet->actor_unit_id);
5092
5093 struct tile *target_tile = index_to_tile(&(wld.map), packet->target_tile_id);
5094 struct extra_type *target_extra = packet->target_extra_id == EXTRA_NONE ?
5095 NULL : extra_by_number(packet->target_extra_id);
5096 struct city *target_city = game_city_by_number(packet->target_city_id);
5097 struct unit *target_unit = game_unit_by_number(packet->target_unit_id);
5098
5099 const struct act_prob *act_probs = packet->action_probabilities;
5100
5101 int request_kind = packet->request_kind;
5102 bool valid = FALSE;
5103
5104 /* The dead can't act */
5105 if (actor_unit && (target_tile || target_city || target_unit)) {
5106 /* At least one action must be possible */
5107 action_iterate(act) {
5108 if (action_prob_possible(act_probs[act])) {
5109 valid = TRUE;
5110 break;
5111 }
5112 } action_iterate_end;
5113 }
5114
5115 switch (request_kind) {
5116 case REQEST_PLAYER_INITIATED:
5117 if (valid) {
5118 /* The player can select an action and should be informed. */
5119
5120 /* Show the client specific action dialog */
5121 popup_action_selection(actor_unit,
5122 target_city, target_unit,
5123 target_tile, target_extra,
5124 act_probs);
5125 } else {
5126 /* Nothing to do. */
5127 action_selection_no_longer_in_progress(packet->actor_unit_id);
5128 action_decision_clear_want(packet->actor_unit_id);
5129 action_selection_next_in_focus(packet->actor_unit_id);
5130 }
5131 break;
5132 case REQEST_BACKGROUND_REFRESH:
5133 /* This was a background action selection dialog refresh. */
5134
5135 if (actor_unit != NULL
5136 && action_selection_actor_unit() == actor_unit->id) {
5137 /* The situation may have changed. */
5138 action_selection_refresh(actor_unit,
5139 target_city, target_unit,
5140 target_tile, target_extra,
5141 act_probs);
5142 }
5143 break;
5144 case REQEST_BACKGROUND_FAST_AUTO_ATTACK:
5145 if (actor_unit != NULL) {
5146 action_decision_maybe_auto(actor_unit, act_probs,
5147 target_unit, target_city, target_tile);
5148 }
5149 break;
5150 default:
5151 log_warn("Unknown request_kind %d in reply", request_kind);
5152 break;
5153 }
5154}
5155
5156/************************************************************************/
5159 void handle_city_sabotage_list(int actor_id, int city_id,
5160 bv_imprs improvements,
5161 action_id act_id,
5162 int request_kind)
5163{
5164 struct city *pcity = game_city_by_number(city_id);
5165 struct unit *pactor = player_unit_by_number(client_player(), actor_id);
5166 struct action *paction = action_by_number(act_id);
5167
5168 if (!pactor) {
5169 log_debug("Bad diplomat %d.", actor_id);
5170
5171 if (request_kind == REQEST_PLAYER_INITIATED) {
5172 action_selection_no_longer_in_progress(actor_id);
5173 action_selection_next_in_focus(actor_id);
5174 }
5175
5176 return;
5177 }
5178
5179 if (!pcity) {
5180 log_debug("Bad city %d.", city_id);
5181
5182 if (request_kind == REQEST_PLAYER_INITIATED) {
5183 action_selection_no_longer_in_progress(actor_id);
5184 action_decision_clear_want(actor_id);
5185 action_selection_next_in_focus(actor_id);
5186 }
5187
5188 return;
5189 }
5190
5191 if (can_client_issue_orders()) {
5192 improvement_iterate(pimprove) {
5193 update_improvement_from_packet(pcity, pimprove,
5194 BV_ISSET(improvements,
5195 improvement_index(pimprove)));
5196 } improvement_iterate_end;
5197
5198 if (request_kind == REQEST_PLAYER_INITIATED) {
5199 /* Focus on the unit so the player knows where it is */
5200 unit_focus_set(pactor);
5201
5202 popup_sabotage_dialog(pactor, pcity, paction);
5203 } else {
5204 /* Not in use (yet). */
5205 log_error("Unimplemented: received background city building list.");
5206 }
5207 } else {
5208 log_debug("Can't issue orders");
5209 if (request_kind == REQEST_PLAYER_INITIATED) {
5210 action_selection_no_longer_in_progress(actor_id);
5211 action_decision_clear_want(actor_id);
5212 }
5213 }
5214}
5215
5216/************************************************************************/
5220 void handle_endgame_report(const struct packet_endgame_report *packet)
5221{
5222 set_client_state(C_S_OVER);
5223 endgame_report_dialog_start(packet);
5224}
5225
5226/************************************************************************/
5229 void handle_endgame_player(const struct packet_endgame_player *packet)
5230{
5231 if (client_has_player()
5232 && packet->player_id == player_number(client_player())) {
5233 if (packet->winner) {
5234 start_menu_music("music_victory", NULL);
5235 } else {
5236 start_menu_music("music_defeat", NULL);
5237 }
5238 }
5239 endgame_report_dialog_player(packet);
5240}
5241
5242/************************************************************************/
5245 void handle_player_attribute_chunk
5246 (const struct packet_player_attribute_chunk *packet)
5247{
5248 if (!client_has_player()) {
5249 return;
5250 }
5251
5252 generic_handle_player_attribute_chunk(client_player(), packet);
5253
5254 if (packet->offset + packet->chunk_length == packet->total_length) {
5255 /* We successful received the last chunk. The attribute block is
5256 now complete. */
5257 attribute_restore();
5258 }
5259}
5260
5261/************************************************************************/
5264 void handle_processing_started(void)
5265{
5266 agents_processing_started();
5267
5268 fc_assert(client.conn.client.request_id_of_currently_handled_packet == 0);
5269 client.conn.client.request_id_of_currently_handled_packet =
5270 get_next_request_id(client.conn.
5271 client.last_processed_request_id_seen);
5272 update_queue_processing_started(client.conn.client.
5273 request_id_of_currently_handled_packet);
5274
5275 log_debug("start processing packet %d",
5276 client.conn.client.request_id_of_currently_handled_packet);
5277}
5278
5279/************************************************************************/
5282 void handle_processing_finished(void)
5283{
5284 log_debug("finish processing packet %d",
5285 client.conn.client.request_id_of_currently_handled_packet);
5286
5287 fc_assert(client.conn.client.request_id_of_currently_handled_packet != 0);
5288
5289 client.conn.client.last_processed_request_id_seen =
5290 client.conn.client.request_id_of_currently_handled_packet;
5291 update_queue_processing_finished(client.conn.client.
5292 last_processed_request_id_seen);
5293
5294 client.conn.client.request_id_of_currently_handled_packet = 0;
5295
5296 agents_processing_finished();
5297}
5298
5299/************************************************************************/
5302 void notify_about_incoming_packet(struct connection *pc,
5303 int packet_type, int size)
5304{
5305 fc_assert(pc == &client.conn);
5306 log_debug("incoming packet={type=%d, size=%d}", packet_type, size);
5307}
5308
5309/************************************************************************/
5312 void notify_about_outgoing_packet(struct connection *pc,
5313 int packet_type, int size,
5314 int request_id)
5315{
5316 fc_assert(pc == &client.conn);
5317 log_debug("outgoing packet={type=%d, size=%d, request_id=%d}",
5318 packet_type, size, request_id);
5319
5320 fc_assert(request_id);
5321}
5322
5323/************************************************************************/
5326 void handle_freeze_client(void)
5327{
5328 log_debug("handle_freeze_client");
5329
5330 agents_freeze_hint();
5331}
5332
5333/************************************************************************/
5336 void handle_thaw_client(void)
5337{
5338 log_debug("handle_thaw_client");
5339
5340 agents_thaw_hint();
5341 update_turn_done_button_state();
5342}
5343
5344/************************************************************************/
5347 void handle_conn_ping(void)
5348{
5349 send_packet_conn_pong(&client.conn);
5350}
5351
5352/************************************************************************/
5355 void handle_server_shutdown(void)
5356{
5357 log_verbose("server shutdown");
5358}
5359
5360/************************************************************************/
5363 void handle_ruleset_effect(const struct packet_ruleset_effect *packet)
5364{
5365 recv_ruleset_effect(packet);
5366}
5367
5368/************************************************************************/
5374 void handle_edit_object_created(int tag, int id)
5375{
5376 editgui_notify_object_created(tag, id);
5377}
5378
5379/************************************************************************/
5382 void handle_edit_startpos(const struct packet_edit_startpos *packet)
5383{
5384 struct tile *ptile = index_to_tile(&(wld.map), packet->id);
5385 bool changed = FALSE;
5386
5387 /* Check. */
5388 if (NULL == ptile) {
5389 log_error("%s(): invalid tile index %d.", __FUNCTION__, packet->id);
5390 return;
5391 }
5392
5393 /* Handle. */
5394 if (packet->removal) {
5395 changed = map_startpos_remove(ptile);
5396 } else {
5397 if (NULL != map_startpos_get(ptile)) {
5398 changed = FALSE;
5399 } else {
5400 map_startpos_new(ptile);
5401 changed = TRUE;
5402 }
5403 }
5404
5405 /* Notify. */
5406 if (changed && can_client_change_view()) {
5407 refresh_tile_mapcanvas(ptile, TRUE, FALSE);
5408 if (packet->removal) {
5409 editgui_notify_object_changed(OBJTYPE_STARTPOS,
5410 packet->id, TRUE);
5411 } else {
5412 editgui_notify_object_created(packet->tag, packet->id);
5413 }
5414 }
5415}
5416
5417/************************************************************************/
5420 void handle_edit_startpos_full(const struct packet_edit_startpos_full *
5421 packet)
5422{
5423 struct tile *ptile = index_to_tile(&(wld.map), packet->id);
5424 struct startpos *psp;
5425
5426 /* Check. */
5427 if (NULL == ptile) {
5428 log_error("%s(): invalid tile index %d.", __FUNCTION__, packet->id);
5429 return;
5430 }
5431
5432 psp = map_startpos_get(ptile);
5433 if (NULL == psp) {
5434 log_error("%s(): no start position at (%d, %d)",
5435 __FUNCTION__, TILE_XY(ptile));
5436 return;
5437 }
5438
5439 /* Handle. */
5440 if (startpos_unpack(psp, packet) && can_client_change_view()) {
5441 /* Notify. */
5442 refresh_tile_mapcanvas(ptile, TRUE, FALSE);
5443 editgui_notify_object_changed(OBJTYPE_STARTPOS, startpos_number(psp),
5444 FALSE);
5445 }
5446}
5447
5448/************************************************************************/
5451 void handle_vote_remove(int vote_no)
5452{
5453 voteinfo_queue_delayed_remove(vote_no);
5454 voteinfo_gui_update();
5455}
5456
5457/************************************************************************/
5460 void handle_vote_update(int vote_no, int yes, int no, int abstain,
5461 int num_voters)
5462{
5463 struct voteinfo *vi;
5464
5465 vi = voteinfo_queue_find(vote_no);
5466 fc_assert_ret_msg(NULL != vi,
5467 "Got packet_vote_update for non-existant vote %d!",
5468 vote_no);
5469
5470 vi->yes = yes;
5471 vi->no = no;
5472 vi->abstain = abstain;
5473 vi->num_voters = num_voters;
5474
5475 voteinfo_gui_update();
5476}
5477
5478/************************************************************************/
5481 void handle_vote_new(const struct packet_vote_new *packet)
5482{
5483 fc_assert_ret_msg(NULL == voteinfo_queue_find(packet->vote_no),
5484 "Got a packet_vote_new for already existing "
5485 "vote %d!", packet->vote_no);
5486
5487 voteinfo_queue_add(packet->vote_no,
5488 packet->user,
5489 packet->desc,
5490 packet->percent_required,
5491 packet->flags);
5492 voteinfo_gui_update();
5493}
5494
5495/************************************************************************/
5498 void handle_vote_resolve(int vote_no, bool passed)
5499{
5500 struct voteinfo *vi;
5501
5502 vi = voteinfo_queue_find(vote_no);
5503 fc_assert_ret_msg(NULL != vi,
5504 "Got packet_vote_resolve for non-existant vote %d!",
5505 vote_no);
5506
5507 vi->resolved = TRUE;
5508 vi->passed = passed;
5509
5510 voteinfo_gui_update();
5511}
5512
5513/************************************************************************/
5516 void handle_play_music(const char *tag)
5517{
5518 play_single_track(tag);
5519}
5520
5521/************************************************************************/
5524 void handle_diplomacy_init_meeting(int counterpart, int initiated_from)
5525{
5526 client_init_meeting(counterpart, initiated_from);
5527}
5528
5529/************************************************************************/
5532 void handle_diplomacy_accept_treaty(int counterpart, bool I_accepted,
5533 bool other_accepted)
5534{
5535 client_recv_accept_treaty(counterpart, I_accepted, other_accepted);
5536}
5537
5538/************************************************************************/
5541 void handle_diplomacy_cancel_meeting(int counterpart, int initiated_from)
5542{
5543 client_recv_cancel_meeting(counterpart, initiated_from);
5544}
5545
5546/************************************************************************/
5549 void handle_diplomacy_create_clause(int counterpart, int giver,
5550 enum clause_type type, int value)
5551{
5552 client_recv_create_clause(counterpart, giver, type, value);
5553}
5554
5555/************************************************************************/
5558 void handle_diplomacy_remove_clause(int counterpart, int giver,
5559 enum clause_type type, int value)
5560{
5561 client_recv_remove_clause(counterpart, giver, type, value);
5562}
5563
5564/**********************************************************************/
5568 void handle_ruleset_counter(const struct packet_ruleset_counter *packet)
5569{
5570 int counter_count = counters_get_city_counters_count();
5571 struct counter *curr = counter_by_id(counter_count);
5572
5573 names_set(&curr->name, NULL, packet->name, packet->rule_name);
5574 curr->checkpoint = packet->checkpoint;
5575 curr->type = packet->behaviour;
5576 curr->target = packet->type;
5577 curr->def = packet->def;
5578
5579 if (!counter_behaviour_is_valid(curr->type)
5580 || curr->target != CTGT_CITY) {
5581 return;
5582 }
5583
5584 PACKET_STRVEC_EXTRACT(curr->helptext, packet->helptext);
5585 attach_city_counter(curr);
5586}
5587
5588/**********************************************************************/
5591 void handle_city_update_counters(const struct packet_city_update_counters *packet)
5592{
5593 int i;
5594 int counters_count;
5595 struct city *pcity = game_city_by_number(packet->city);
5596
5597 if (NULL == pcity) {
5598 return;
5599 }
5600
5601 counters_count = counters_get_city_counters_count();
5602 if (counters_count != packet->count) {
5603 return;
5604 }
5605
5606 for (i = 0; i < counters_count; i++) {
5607 pcity->counter_values[i] = packet->counters[i];
5608 }
5609
5610 if (pcity->tile != NULL) {
5611 /* City's location known */
5612 update_city_description(pcity);
5613 }
5614
5615 city_report_dialog_update_city(pcity);
5616}
achievement_by_number
struct achievement * achievement_by_number(int id)
Definition achievements.c:96
achievements.h
action_auto_perf_slot_number
struct action_auto_perf * action_auto_perf_slot_number(const int num)
Definition actions.c:6423
action_prob_possible
bool action_prob_possible(const struct act_prob probability)
Definition actions.c:5823
actions_rs_pre_san_gen
void actions_rs_pre_san_gen(void)
Definition actions.c:1645
action_enabler_add
void action_enabler_add(struct action_enabler *enabler)
Definition actions.c:2273
action_enabler_new
struct action_enabler * action_enabler_new(void)
Definition actions.c:2227
action_id_exists
bool action_id_exists(const action_id act_id)
Definition actions.c:1820
actions.h
action_by_number
static struct action * action_by_number(action_id act_id)
Definition actions.h:633
action_array_iterate
#define action_array_iterate(_act_array_, _act_id_)
Definition actions.h:495
action_id_requires_details
#define action_id_requires_details(act_id)
Definition actions.h:671
action_array_iterate_end
#define action_array_iterate_end
Definition actions.h:507
action_iterate_end
#define action_iterate_end
Definition actions.h:463
action_iterate
#define action_iterate(_act_)
Definition actions.h:459
action_id_get_target_kind
#define action_id_get_target_kind(act_id)
Definition actions.h:650
ACTION_NONE
#define ACTION_NONE
Definition actions.h:309
agents_unit_changed
void agents_unit_changed(struct unit *punit)
Definition agents.c:511
agents_city_remove
void agents_city_remove(struct city *pcity)
Definition agents.c:640
agents_thaw_hint
void agents_thaw_hint(void)
Definition agents.c:440
agents_tile_remove
void agents_tile_remove(struct tile *ptile)
Definition agents.c:667
agents_city_new
void agents_city_new(struct city *pcity)
Definition agents.c:614
agents_start_turn
void agents_start_turn(void)
Definition agents.c:474
agents_tile_changed
void agents_tile_changed(struct tile *ptile)
Definition agents.c:691
agents_unit_new
void agents_unit_new(struct unit *punit)
Definition agents.c:536
agents_unit_remove
void agents_unit_remove(struct unit *punit)
Definition agents.c:562
agents_processing_started
void agents_processing_started(void)
Definition agents.c:413
agents_tile_new
void agents_tile_new(struct tile *ptile)
Definition agents.c:715
agents_processing_finished
void agents_processing_finished(void)
Definition agents.c:422
agents_new_turn
void agents_new_turn(void)
Definition agents.c:483
agents_city_changed
void agents_city_changed(struct city *pcity)
Definition agents.c:588
agents_game_joined
void agents_game_joined(void)
Definition agents.c:449
agents_freeze_hint
void agents_freeze_hint(void)
Definition agents.c:431
agents_before_new_turn
void agents_before_new_turn(void)
Definition agents.c:466
agents.h
attribute_restore
void attribute_restore(void)
Definition attribute.c:355
attribute.h
audio_restart
void audio_restart(const char *soundset_name, const char *musicset_name)
Definition audio.c:376
audio_play_sound
void audio_play_sound(const char *const tag, const char *const alt_tag, const char *const alt_tag2)
Definition audio.c:528
audio.h
base_type_init
void base_type_init(struct extra_type *pextra, int idx)
Definition base.c:117
base_extra_get
struct extra_type * base_extra_get(const struct base_type *pbase)
Definition base.c:101
base_by_number
struct base_type * base_by_number(const Base_type_id id)
Definition base.c:76
territory_claiming_base
bool territory_claiming_base(const struct base_type *pbase)
Definition base.c:158
dbv_set
void dbv_set(struct dbv *pdbv, int bit)
Definition bitvector.c:144
dbv_clr
void dbv_clr(struct dbv *pdbv, int bit)
Definition bitvector.c:167
bitvector.h
BV_SET_VAL
#define BV_SET_VAL(bv, bit, val)
Definition bitvector.h:91
BV_SET
#define BV_SET(bv, bit)
Definition bitvector.h:81
BV_ARE_EQUAL
#define BV_ARE_EQUAL(vec1, vec2)
Definition bitvector.h:113
BV_ISSET
#define BV_ISSET(bv, bit)
Definition bitvector.h:78
BV_CLR
#define BV_CLR(bv, bit)
Definition bitvector.h:86
capability.h
our_capability
const char *const our_capability
Definition capstr.c:32
capstr.h
output_window_append
void output_window_append(const struct ft_color color, const char *featured_text)
Definition chatline_common.c:104
output_window_printf
void output_window_printf(const struct ft_color color, const char *format,...)
Definition chatline_common.c:153
chatline_g.h
citizens_nation_set
void citizens_nation_set(struct city *pcity, const struct player_slot *pslot, citizens count)
Definition citizens.c:145
citizens_count
citizens citizens_count(const struct city *pcity)
Definition citizens.c:162
citizens_init
void citizens_init(struct city *pcity)
Definition citizens.c:32
citizens.h
city_map_radius_sq_set
void city_map_radius_sq_set(struct city *pcity, int radius_sq)
Definition city.c:147
city_name_set
void city_name_set(struct city *pcity, const char *new_name)
Definition city.c:1136
city_styles_alloc
void city_styles_alloc(int num)
Definition city.c:3384
city_name_get
const char * city_name_get(const struct city *pcity)
Definition city.c:1128
city_production_caravan_shields_init
void city_production_caravan_shields_init(void)
Definition city.c:1770
city_remove_improvement
void city_remove_improvement(struct city *pcity, const struct impr_type *pimprove)
Definition city.c:3359
city_size_add
void city_size_add(struct city *pcity, int add)
Definition city.c:1155
free_city_map_index
void free_city_map_index(void)
Definition city.c:608
city_unhappy
bool city_unhappy(const struct city *pcity)
Definition city.c:1618
create_city_virtual
struct city * create_city_virtual(struct player *pplayer, struct tile *ptile, const char *name)
Definition city.c:3418
city_happy
bool city_happy(const struct city *pcity)
Definition city.c:1606
city_size_set
void city_size_set(struct city *pcity, citizens size)
Definition city.c:1171
city_add_improvement
void city_add_improvement(struct city *pcity, const struct impr_type *pimprove)
Definition city.c:3345
city_map_radius_sq_get
int city_map_radius_sq_get(const struct city *pcity)
Definition city.c:136
destroy_city_virtual
void destroy_city_virtual(struct city *pcity)
Definition city.c:3504
city_rally_point_receive
void city_rally_point_receive(const struct packet_city_rally_point *packet, struct city *pcity)
Definition city.c:3629
city_styles
static const struct city struct citystyle * city_styles
Definition city.c:83
city_list_iterate
#define city_list_iterate(citylist, pcity)
Definition city.h:508
city_tile
#define city_tile(_pcity_)
Definition city.h:564
city_size_get
static citizens city_size_get(const struct city *pcity)
Definition city.h:569
city_tile_iterate_skip_free_worked
#define city_tile_iterate_skip_free_worked(_nmap, _radius_sq, _city_tile, _tile, _index, _x, _y)
Definition city.h:214
CITIZEN_LAST
@ CITIZEN_LAST
Definition city.h:272
CITIZEN_ANGRY
@ CITIZEN_ANGRY
Definition city.h:271
CITIZEN_HAPPY
@ CITIZEN_HAPPY
Definition city.h:268
CITIZEN_CONTENT
@ CITIZEN_CONTENT
Definition city.h:269
CITIZEN_UNHAPPY
@ CITIZEN_UNHAPPY
Definition city.h:270
output_type_iterate
#define output_type_iterate(output)
Definition city.h:833
city_owner
#define city_owner(_pcity_)
Definition city.h:563
city_tile_iterate_skip_free_worked_end
#define city_tile_iterate_skip_free_worked_end
Definition city.h:222
city_list_iterate_end
#define city_list_iterate_end
Definition city.h:510
I_NEVER
#define I_NEVER
Definition city.h:247
FEELING_FINAL
@ FEELING_FINAL
Definition city.h:284
FEELING_LAST
@ FEELING_LAST
Definition city.h:285
output_type_iterate_end
#define output_type_iterate_end
Definition city.h:839
generate_citydlg_dimensions
void generate_citydlg_dimensions(void)
Definition citydlg_common.c:67
citydlg_g.h
popup_city_dialog
void popup_city_dialog(struct city *pcity)
Definition update_queue.c:623
refresh_city_dialog
void refresh_city_dialog(struct city *pcity)
Definition update_queue.c:632
cityrep_g.h
city_report_dialog_update_city
void city_report_dialog_update_city(struct city *pcity)
Definition update_queue.c:641
city_report_dialog_update
void city_report_dialog_update(void)
Definition update_queue.c:666
music_set_name
char music_set_name[512]
Definition client_main.c:140
start_turn_change_wait
void start_turn_change_wait(void)
Definition client_main.c:1135
client_is_global_observer
bool client_is_global_observer(void)
Definition client_main.c:1345
client_remove_cli_conn
void client_remove_cli_conn(struct connection *pconn)
Definition client_main.c:1034
client_is_observer
bool client_is_observer(void)
Definition client_main.c:1083
stop_turn_change_wait
void stop_turn_change_wait(void)
Definition client_main.c:1148
set_server_busy
void set_server_busy(bool busy)
Definition client_main.c:1323
user_ended_turn
void user_ended_turn(void)
Definition client_main.c:798
client
struct civclient client
Definition client_main.c:150
auto_connect
bool auto_connect
Definition client_main.c:146
client_state
enum client_states client_state(void)
Definition client_main.c:1026
set_seconds_to_turndone
void set_seconds_to_turndone(double seconds)
Definition client_main.c:1110
sound_set_name
char sound_set_name[512]
Definition client_main.c:139
can_client_issue_orders
bool can_client_issue_orders(void)
Definition client_main.c:1264
client_has_player
bool client_has_player(void)
Definition client_main.c:1364
set_client_state
void set_client_state(enum client_states newstate)
Definition client_main.c:844
can_client_change_view
bool can_client_change_view(void)
Definition client_main.c:1312
client_main.h
client_player
#define client_player()
Definition client_main.h:106
C_S_PREPARING
@ C_S_PREPARING
Definition client_main.h:46
C_S_RUNNING
@ C_S_RUNNING
Definition client_main.h:47
C_S_OVER
@ C_S_OVER
Definition client_main.h:48
client_tile_get_known
enum known_type client_tile_get_known(const struct tile *ptile)
Definition climap.c:36
climap.h
create_event
void create_event(struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
Definition climisc.c:1081
client_player_init
void client_player_init(struct player *pplayer)
Definition climisc.c:1361
client_remove_city
void client_remove_city(struct city *pcity)
Definition climisc.c:134
client_player_maps_reset
void client_player_maps_reset(void)
Definition climisc.c:1372
client_remove_unit
void client_remove_unit(struct unit *punit)
Definition climisc.c:72
unit_focus_set_status
void unit_focus_set_status(struct player *pplayer)
Definition climisc.c:1351
handle_event
void handle_event(const char *featured_text, struct tile *ptile, enum event_type event, int turn, int phase, int conn_id)
Definition climisc.c:956
climisc.h
client_recv_remove_clause
void client_recv_remove_clause(int counterpart, int giver, enum clause_type type, int value)
Definition clitreaty.c:131
client_recv_create_clause
void client_recv_create_clause(int counterpart, int giver, enum clause_type type, int value)
Definition clitreaty.c:105
client_recv_accept_treaty
void client_recv_accept_treaty(int counterpart, bool I_accepted, bool other_accepted)
Definition clitreaty.c:59
client_recv_cancel_meeting
void client_recv_cancel_meeting(int counterpart, int initiated_from)
Definition clitreaty.c:83
client_init_meeting
void client_init_meeting(int counterpart, int initiated_from)
Definition clitreaty.c:33
clitreaty.h
city_changed
static void city_changed(int city_id)
Definition cma_core.c:447
incite_cost
char * incite_cost
Definition comments.c:74
send_client_wants_hack
void send_client_wants_hack(const char *filename)
Definition connectdlg_common.c:671
connectdlg_common.h
connectdlg_g.h
get_next_request_id
int get_next_request_id(int old_request_id)
Definition connection.c:530
conn_set_capability
void conn_set_capability(struct connection *pconn, const char *capability)
Definition connection.c:661
conn_by_number
struct connection * conn_by_number(int id)
Definition connection.c:421
conn_list_iterate
#define conn_list_iterate(connlist, pconn)
Definition connection.h:108
conn_list_iterate_end
#define conn_list_iterate_end
Definition connection.h:110
do_move_unit
void do_move_unit(struct unit *punit, struct unit *target_unit)
Definition control.c:2773
unit_is_in_focus
bool unit_is_in_focus(const struct unit *punit)
Definition control.c:383
action_selection_no_longer_in_progress
void action_selection_no_longer_in_progress(const int old_actor_id)
Definition control.c:1033
get_focus_unit_on_tile
struct unit * get_focus_unit_on_tile(const struct tile *ptile)
Definition control.c:391
action_decision_request
void action_decision_request(struct unit *actor_unit)
Definition control.c:1084
set_units_in_combat
void set_units_in_combat(struct unit *pattacker, struct unit *pdefender)
Definition control.c:1014
clear_hover_state
void clear_hover_state(void)
Definition control.c:323
unit_focus_set
void unit_focus_set(struct unit *punit)
Definition control.c:501
should_ask_server_for_actions
bool should_ask_server_for_actions(const struct unit *punit)
Definition control.c:334
get_units_in_focus
struct unit_list * get_units_in_focus(void)
Definition control.c:177
request_do_action
void request_do_action(action_id action, int actor_id, int target_id, int sub_tgt, const char *name)
Definition control.c:1704
unit_focus_urgent
void unit_focus_urgent(struct unit *punit)
Definition control.c:207
unit_change_battlegroup
void unit_change_battlegroup(struct unit *punit, int battlegroup)
Definition control.c:250
non_ai_unit_focus
bool non_ai_unit_focus
Definition control.c:125
action_decision_clear_want
void action_decision_clear_want(const int old_actor_id)
Definition control.c:1054
get_num_units_in_focus
int get_num_units_in_focus(void)
Definition control.c:185
unit_register_battlegroup
void unit_register_battlegroup(struct unit *punit)
Definition control.c:270
unit_focus_update
void unit_focus_update(void)
Definition control.c:771
auto_center_on_focus_unit
void auto_center_on_focus_unit(void)
Definition control.c:429
request_new_unit_activity
void request_new_unit_activity(struct unit *punit, enum unit_activity act)
Definition control.c:1903
action_selection_next_in_focus
void action_selection_next_in_focus(const int old_actor_id)
Definition control.c:1066
control.h
counters_get_city_counters_count
int counters_get_city_counters_count(void)
Definition counters.c:74
counter_by_id
struct counter * counter_by_id(int id)
Definition counters.c:82
attach_city_counter
void attach_city_counter(struct counter *counter)
Definition counters.c:94
counters.h
dialogs_g.h
target_unit
struct unit struct city struct unit * target_unit
Definition dialogs_g.h:56
popup_action_selection
popup_action_selection
Definition dialogs_g.h:55
actor_unit
struct unit * actor_unit
Definition dialogs_g.h:55
popup_bribe_dialog
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id popup_bribe_dialog
Definition dialogs_g.h:73
caption
const char * caption
Definition dialogs_g.h:37
headline
const char const char * headline
Definition dialogs_g.h:38
popup_notify_dialog
popup_notify_dialog
Definition dialogs_g.h:37
target_tile
struct unit struct city struct unit struct tile * target_tile
Definition dialogs_g.h:57
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:74
target_city
struct unit struct city * target_city
Definition dialogs_g.h:56
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:74
target_extra
struct unit struct city struct unit struct tile struct extra_type * target_extra
Definition dialogs_g.h:57
clause_info_get
struct clause_info * clause_info_get(enum clause_type type)
Definition diptreaty.c:276
disaster_by_number
struct disaster_type * disaster_by_number(Disaster_type_id id)
Definition disaster.c:87
editgui_g.h
editgui_notify_object_changed
editgui_notify_object_changed
Definition editgui_g.h:27
id
int int id
Definition editgui_g.h:28
editor_is_active
bool editor_is_active(void)
Definition editor.c:346
editor_ruleset_changed
void editor_ruleset_changed(void)
Definition editor.c:180
editor.h
OBJTYPE_PLAYER
@ OBJTYPE_PLAYER
Definition editor.h:30
OBJTYPE_UNIT
@ OBJTYPE_UNIT
Definition editor.h:28
OBJTYPE_STARTPOS
@ OBJTYPE_STARTPOS
Definition editor.h:27
OBJTYPE_GAME
@ OBJTYPE_GAME
Definition editor.h:31
OBJTYPE_CITY
@ OBJTYPE_CITY
Definition editor.h:29
OBJTYPE_TILE
@ OBJTYPE_TILE
Definition editor.h:26
recv_ruleset_effect
void recv_ruleset_effect(const struct packet_ruleset_effect *packet)
Definition effects.c:591
reqs
struct @21::@22 reqs
event
enum event_type event
Definition events.c:81
get_event_tag
const char * get_event_tag(enum event_type event)
Definition events.c:276
events.h
extra_owner
struct player * extra_owner(const struct tile *ptile)
Definition extras.c:1114
set_user_extra_flag_name
void set_user_extra_flag_name(enum extra_flag_id id, const char *name, const char *helptxt)
Definition extras.c:933
extra_type_list_of_zoccers
struct extra_type_list * extra_type_list_of_zoccers(void)
Definition extras.c:267
extra_has_flag
bool extra_has_flag(const struct extra_type *pextra, enum extra_flag_id flag)
Definition extras.c:861
extra_type_list_by_cause
struct extra_type_list * extra_type_list_by_cause(enum extra_cause cause)
Definition extras.c:249
extra_to_caused_by_list
void extra_to_caused_by_list(struct extra_type *pextra, enum extra_cause cause)
Definition extras.c:312
extra_by_number
struct extra_type * extra_by_number(int id)
Definition extras.c:183
extra_type_list_of_terr_claimers
struct extra_type_list * extra_type_list_of_terr_claimers(void)
Definition extras.c:275
is_extra_removed_by
bool is_extra_removed_by(const struct extra_type *pextra, enum extra_rmcause rmcause)
Definition extras.c:353
extra_type_list_of_unit_hiders
struct extra_type_list * extra_type_list_of_unit_hiders(void)
Definition extras.c:259
extras.h
extra_type_iterate
#define extra_type_iterate(_p)
Definition extras.h:315
extra_to_removed_by_list
static void extra_to_removed_by_list(struct extra_type *pextra, enum extra_rmcause rmcause)
Definition extras.h:214
extra_type_iterate_end
#define extra_type_iterate_end
Definition extras.h:321
is_extra_caused_by
#define is_extra_caused_by(e, c)
Definition extras.h:203
extra_index
#define extra_index(_e_)
Definition extras.h:183
EXTRA_NONE
#define EXTRA_NONE
Definition extras.h:85
EF_LAST_USER_FLAG
#define EF_LAST_USER_FLAG
Definition extras.h:82
MAX_DISASTER_TYPES
#define MAX_DISASTER_TYPES
Definition fc_types.h:52
MAX_GRANARY_INIS
#define MAX_GRANARY_INIS
Definition fc_types.h:72
MAX_NUM_BUILDING_LIST
#define MAX_NUM_BUILDING_LIST
Definition fc_types.h:46
Tech_type_id
int Tech_type_id
Definition fc_types.h:380
EC_NATURAL_DEFENSIVE
#define EC_NATURAL_DEFENSIVE
Definition fc_types.h:1117
EC_SPECIAL
#define EC_SPECIAL
Definition fc_types.h:1115
action_id
int action_id
Definition fc_types.h:392
SP_MAX
#define SP_MAX
Definition fc_types.h:412
EC_NONE
#define EC_NONE
Definition fc_types.h:1114
EC_NOT_AGGRESSIVE
#define EC_NOT_AGGRESSIVE
Definition fc_types.h:1118
EC_DEFENSIVE
#define EC_DEFENSIVE
Definition fc_types.h:1116
IF_LAST_USER_FLAG
#define IF_LAST_USER_FLAG
Definition fc_types.h:680
MAX_NUM_UNIT_LIST
#define MAX_NUM_UNIT_LIST
Definition fc_types.h:45
MAX_EXTRA_TYPES
#define MAX_EXTRA_TYPES
Definition fc_types.h:50
CTGT_CITY
@ CTGT_CITY
Definition fc_types.h:126
MAX_ACHIEVEMENT_TYPES
#define MAX_ACHIEVEMENT_TYPES
Definition fc_types.h:53
MAX_NUM_TECH_LIST
#define MAX_NUM_TECH_LIST
Definition fc_types.h:44
O_SHIELD
@ O_SHIELD
Definition fc_types.h:101
O_FOOD
@ O_FOOD
Definition fc_types.h:101
O_SCIENCE
@ O_SCIENCE
Definition fc_types.h:101
O_GOLD
@ O_GOLD
Definition fc_types.h:101
MAX_LEN_CITYNAME
#define MAX_LEN_CITYNAME
Definition fc_types.h:67
MAX_COUNTERS
#define MAX_COUNTERS
Definition fc_types.h:106
UCL_LAST
#define UCL_LAST
Definition fc_types.h:420
IDENTITY_NUMBER_ZERO
#define IDENTITY_NUMBER_ZERO
Definition fc_types.h:92
fcintl.h
_
#define _(String)
Definition fcintl.h:67
ftc_client
const struct ft_color ftc_client
Definition featured_text.c:78
game
struct civ_game game
Definition game.c:62
game_ruleset_init
void game_ruleset_init(void)
Definition game.c:510
is_player_phase
bool is_player_phase(const struct player *pplayer, int phase)
Definition game.c:705
current_turn_timeout
int current_turn_timeout(void)
Definition game.c:846
game_ruleset_free
void game_ruleset_free(void)
Definition game.c:559
wld
struct world wld
Definition game.c:63
game_unit_by_number
struct unit * game_unit_by_number(int id)
Definition game.c:116
game_city_by_number
struct city * game_city_by_number(int id)
Definition game.c:107
game.h
init_client_goto
void init_client_goto(void)
Definition goto.c:152
goto.h
government_ruler_title_new
struct ruler_title * government_ruler_title_new(struct government *pgovern, const struct nation_type *pnation, const char *ruler_male_title, const char *ruler_female_title)
Definition government.c:325
government_by_number
struct government * government_by_number(const Government_type_id gov)
Definition government.c:103
government_of_player
struct government * government_of_player(const struct player *pplayer)
Definition government.c:114
governments_alloc
void governments_alloc(int num)
Definition government.c:528
government_number
Government_type_id government_number(const struct government *pgovern)
Definition government.c:91
government.h
action_selection_target_extra
int action_selection_target_extra(void)
Definition action_dialog.c:1641
action_selection_target_tile
int action_selection_target_tile(void)
Definition action_dialog.c:1626
action_selection_actor_unit
int action_selection_actor_unit(void)
Definition action_dialog.c:1583
action_selection_close
void action_selection_close(void)
Definition action_dialog.c:1732
action_selection_target_city
int action_selection_target_city(void)
Definition action_dialog.c:1597
action_selection_refresh
void action_selection_refresh(struct unit *actor_unit, struct city *target_city, struct unit *target_unit, struct tile *target_tile, struct extra_type *target_extra, const struct act_prob *act_probs)
Definition action_dialog.c:1653
popup_sabotage_dialog
void popup_sabotage_dialog(struct unit *actor, struct city *pcity, const struct action *paction)
Definition action_dialog.c:931
action_selection_target_unit
int action_selection_target_unit(void)
Definition action_dialog.c:1611
popup_incite_dialog
void popup_incite_dialog(struct unit *actor, struct city *pcity, int cost, const struct action *paction)
Definition action_dialog.c:966
city_dialog_is_open
bool city_dialog_is_open(struct city *pcity)
Definition citydlg.c:579
popdown_all_city_dialogs
void popdown_all_city_dialogs(void)
Definition citydlg.c:599
refresh_unit_city_dialogs
void refresh_unit_city_dialogs(struct unit *punit)
Definition citydlg.c:538
server_connect
void server_connect(void)
Definition connectdlg.c:60
close_connection_dialog
void close_connection_dialog(void)
Definition connectdlg.c:52
races_update_pickable
void races_update_pickable(bool nationset_change)
Definition dialogs.c:731
show_tech_gained_dialog
void show_tech_gained_dialog(Tech_type_id tech)
Definition dialogs.c:1524
popdown_races_dialog
void popdown_races_dialog(void)
Definition dialogs.c:1230
popup_connect_msg
void popup_connect_msg(const char *headline, const char *message)
Definition dialogs.c:239
handmade_scenario_warning
bool handmade_scenario_warning(void)
Definition dialogs.c:1573
races_toggles_set_sensitive
void races_toggles_set_sensitive(void)
Definition dialogs.c:1245
popup_combat_info
void popup_combat_info(int attacker_unit_id, int defender_unit_id, int attacker_hp, int defender_hp, bool make_att_veteran, bool make_def_veteran)
Definition dialogs.c:1583
editgui_notify_object_created
void editgui_notify_object_created(int tag, int id)
Definition editgui.c:1922
editgui_refresh
void editgui_refresh(void)
Definition editgui.c:1796
source
static GtkWidget * source
Definition gotodlg.c:58
get_gui_type
enum gui_type get_gui_type(void)
Definition gui_main.c:2099
update_infra_dialog
void update_infra_dialog(void)
Definition infradlg.c:138
close_intel_dialog
void close_intel_dialog(struct player *p)
Definition inteldlg.c:223
update_intel_dialog
void update_intel_dialog(struct player *p)
Definition inteldlg.c:462
popup_newcity_dialog
void popup_newcity_dialog(struct unit *punit, const char *suggestname)
Definition mapctrl.c:197
update_info_label
void update_info_label(void)
Definition mapview.c:138
start_turn
void start_turn(void)
Definition mapview.c:805
update_unit_info_label
void update_unit_info_label(struct unit_list *punits)
Definition mapview.c:275
update_city_descriptions
void update_city_descriptions(void)
Definition mapview.c:488
update_start_page
void update_start_page(void)
Definition pages.c:1659
science_report_dialog_popup
void science_report_dialog_popup(bool raise)
Definition repodlgs.c:716
endgame_report_dialog_start
void endgame_report_dialog_start(const struct packet_endgame_report *packet)
Definition repodlgs.c:1983
type
GType type
Definition repodlgs.c:1313
science_report_dialog_redraw
void science_report_dialog_redraw(void)
Definition repodlgs.c:761
popup_musicset_suggestion_dialog
void popup_musicset_suggestion_dialog(void)
Definition soundset_dlg.c:109
popup_soundset_suggestion_dialog
void popup_soundset_suggestion_dialog(void)
Definition soundset_dlg.c:55
refresh_spaceship_dialog
void refresh_spaceship_dialog(struct player *pplayer)
Definition spaceshipdlg.c:117
popup_tileset_suggestion_dialog
void popup_tileset_suggestion_dialog(void)
Definition tileset_dlg.c:58
voteinfo_gui_update
void voteinfo_gui_update(void)
Definition voteinfo_bar.c:214
gui_main_g.h
conn_list_dialog_update
void conn_list_dialog_update(void)
Definition update_queue.c:650
boot_help_texts
void boot_help_texts(void)
Definition helpdata.c:710
helpdata.h
idex_register_unit
void idex_register_unit(struct world *iworld, struct unit *punit)
Definition idex.c:82
idex_unregister_city
void idex_unregister_city(struct world *iworld, struct city *pcity)
Definition idex.c:97
idex_register_city
void idex_register_city(struct world *iworld, struct city *pcity)
Definition idex.c:67
idex.h
improvement_by_number
struct impr_type * improvement_by_number(const Impr_type_id id)
Definition improvement.c:194
improvement_rule_name
const char * improvement_rule_name(const struct impr_type *pimprove)
Definition improvement.c:252
is_improvement_visible
bool is_improvement_visible(const struct impr_type *pimprove)
Definition improvement.c:393
improvement_index
Impr_type_id improvement_index(const struct impr_type *pimprove)
Definition improvement.c:175
improvement_feature_cache_init
void improvement_feature_cache_init(void)
Definition improvement.c:92
set_user_impr_flag_name
void set_user_impr_flag_name(enum impr_flag_id id, const char *name, const char *helptxt)
Definition improvement.c:1184
improvement_count
Impr_type_id improvement_count(void)
Definition improvement.c:164
improvement_iterate_end
#define improvement_iterate_end
Definition improvement.h:205
improvement_iterate
#define improvement_iterate(_p)
Definition improvement.h:199
B_LAST
#define B_LAST
Definition improvement.h:42
name
const char * name
Definition inputfile.c:127
inteldlg_g.h
log.h
fc_assert_msg
#define fc_assert_msg(condition, message,...)
Definition log.h:181
fc_assert_ret
#define fc_assert_ret(condition)
Definition log.h:191
log_packet
#define log_packet
Definition log.h:137
log_warn
#define log_warn(message,...)
Definition log.h:105
log_verbose
#define log_verbose(message,...)
Definition log.h:109
fc_assert
#define fc_assert(condition)
Definition log.h:176
fc_assert_ret_msg
#define fc_assert_ret_msg(condition, message,...)
Definition log.h:205
fc_assert_ret_val
#define fc_assert_ret_val(condition, val)
Definition log.h:194
fc_assert_action
#define fc_assert_action(condition, action)
Definition log.h:187
log_debug
#define log_debug(message,...)
Definition log.h:115
log_normal
#define log_normal(message,...)
Definition log.h:107
LOG_NORMAL
@ LOG_NORMAL
Definition log.h:32
log_error
#define log_error(message,...)
Definition log.h:103
map_startpos_get
struct startpos * map_startpos_get(const struct tile *ptile)
Definition map.c:1883
startpos_number
int startpos_number(const struct startpos *psp)
Definition map.c:1633
map_free
void map_free(struct civ_map *fmap)
Definition map.c:530
sq_map_distance
int sq_map_distance(const struct tile *tile0, const struct tile *tile1)
Definition map.c:641
map_startpos_new
struct startpos * map_startpos_new(struct tile *ptile)
Definition map.c:1866
main_map_allocate
void main_map_allocate(void)
Definition map.c:519
index_to_tile
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
Definition map.c:456
map_startpos_remove
bool map_startpos_remove(struct tile *ptile)
Definition map.c:1899
same_pos
bool same_pos(const struct tile *tile1, const struct tile *tile2)
Definition map.c:940
startpos_unpack
bool startpos_unpack(struct startpos *psp, const struct packet_edit_startpos_full *packet)
Definition map.c:1726
terrain_control
struct terrain_misc terrain_control
Definition map.c:69
map_is_empty
bool map_is_empty(void)
Definition map.c:149
map_init_topology
void map_init_topology(void)
Definition map.c:303
map.h
whole_map_iterate
#define whole_map_iterate(_map, _tile)
Definition map.h:545
whole_map_iterate_end
#define whole_map_iterate_end
Definition map.h:554
upgrade_canvas_clipboard
void upgrade_canvas_clipboard(void)
Definition mapctrl_common.c:470
update_turn_done_button_state
void update_turn_done_button_state(void)
Definition mapctrl_common.c:648
city_workers_display
struct city * city_workers_display
Definition mapctrl_common.c:74
mapctrl_g.h
put_nuke_mushroom_pixmaps
void put_nuke_mushroom_pixmaps(struct tile *ptile)
Definition mapview_common.c:1525
update_map_canvas_visible
void update_map_canvas_visible(void)
Definition mapview_common.c:1860
tile_visible_mapcanvas
bool tile_visible_mapcanvas(struct tile *ptile)
Definition mapview_common.c:1264
tileset_map_topo_compatible
enum topo_comp_lvl tileset_map_topo_compatible(int topology_id, struct tileset *tset, int *tset_topo)
Definition mapview_common.c:4042
refresh_city_mapcanvas
void refresh_city_mapcanvas(struct city *pcity, struct tile *ptile, bool full_refresh, bool write_to_screen)
Definition mapview_common.c:541
mapdeco_init
void mapdeco_init(void)
Definition mapview_common.c:3321
center_tile_mapcanvas
void center_tile_mapcanvas(const struct tile *ptile)
Definition mapview_common.c:1237
link_marks_decrease_turn_counters
void link_marks_decrease_turn_counters(void)
Definition mapview_common.c:3986
update_city_description
void update_city_description(struct city *pcity)
Definition mapview_common.c:1880
describe_topology
const char * describe_topology(int topo)
Definition mapview_common.c:4088
refresh_tile_mapcanvas
void refresh_tile_mapcanvas(struct tile *ptile, bool full_refresh, bool write_to_screen)
Definition mapview_common.c:504
refresh_unit_mapcanvas
void refresh_unit_mapcanvas(struct unit *punit, struct tile *ptile, bool full_refresh, bool write_to_screen)
Definition mapview_common.c:520
decrease_unit_hp_smooth
void decrease_unit_hp_smooth(struct unit *punit0, int hp0, struct unit *punit1, int hp1)
Definition mapview_common.c:2564
mapview_common.h
TOPO_INCOMP_HARD
@ TOPO_INCOMP_HARD
Definition mapview_common.h:365
mapview_g.h
mem.h
fc_calloc
#define fc_calloc(n, esz)
Definition mem.h:38
FC_FREE
#define FC_FREE(ptr)
Definition mem.h:41
fc_strdup
#define fc_strdup(str)
Definition mem.h:43
fc_malloc
#define fc_malloc(sz)
Definition mem.h:34
menu_g.h
menus_update
void menus_update(void)
Definition update_queue.c:562
meswin_clear_older
void meswin_clear_older(int turn, int phase)
Definition messagewin_common.c:65
messagewin_g.h
utype_unknown_move_cost
int utype_unknown_move_cost(const struct unit_type *utype)
Definition movement.c:105
init_move_fragments
void init_move_fragments(void)
Definition movement.c:927
movement.h
multiplier_count
Multiplier_type_id multiplier_count(void)
Definition multipliers.c:88
multiplier_by_number
struct multiplier * multiplier_by_number(Multiplier_type_id id)
Definition multipliers.c:57
multiplier_index
Multiplier_type_id multiplier_index(const struct multiplier *pmul)
Definition multipliers.c:80
multipliers.h
multipliers_iterate
#define multipliers_iterate(_mul_)
Definition multipliers.h:61
multipliers_iterate_end
#define multipliers_iterate_end
Definition multipliers.h:67
play_single_track
void play_single_track(const char *const tag)
Definition music.c:116
start_menu_music
void start_menu_music(const char *const tag, char *const alt_tag)
Definition music.c:98
start_style_music
void start_style_music(void)
Definition music.c:44
music.h
name_translation.h
name_set
static void name_set(struct name_translation *ptrans, const char *domain, const char *vernacular_name)
Definition name_translation.h:88
names_set
static void names_set(struct name_translation *ptrans, const char *domain, const char *vernacular_name, const char *rule_name)
Definition name_translation.h:60
nation_rule_name
const char * nation_rule_name(const struct nation_type *pnation)
Definition nation.c:138
nation_group_index
int nation_group_index(const struct nation_group *pgroup)
Definition nation.c:943
nation_count
Nation_type_id nation_count(void)
Definition nation.c:507
nation_group_new
struct nation_group * nation_group_new(const char *name)
Definition nation.c:960
nation_of_unit
struct nation_type * nation_of_unit(const struct unit *punit)
Definition nation.c:463
nation_set_new
struct nation_set * nation_set_new(const char *set_name, const char *set_rule_name, const char *set_description)
Definition nation.c:716
nation_by_number
struct nation_type * nation_by_number(const Nation_type_id nation)
Definition nation.c:475
nation_set_index
int nation_set_index(const struct nation_set *pset)
Definition nation.c:699
nation_of_city
struct nation_type * nation_of_city(const struct city *pcity)
Definition nation.c:454
nation_set_by_number
struct nation_set * nation_set_by_number(int id)
Definition nation.c:762
nation_group_by_number
struct nation_group * nation_group_by_number(int id)
Definition nation.c:1004
nation_leader_new
struct nation_leader * nation_leader_new(struct nation_type *pnation, const char *name, bool is_male)
Definition nation.c:239
nations_alloc
void nations_alloc(int num)
Definition nation.c:622
nation_legend_translation
const char * nation_legend_translation(const struct nation_type *pnation, const char *legend)
Definition nation.c:299
nation.h
resend_desired_settable_options
void resend_desired_settable_options(void)
Definition options.c:5756
tileset_name_for_topology
const char * tileset_name_for_topology(int topology_id)
Definition options.c:6524
gui_options
struct client_options gui_options
Definition options.c:71
options.h
calculate_overview_dimensions
void calculate_overview_dimensions(void)
Definition overview_common.c:449
overview_common.h
generic_handle_player_attribute_chunk
void generic_handle_player_attribute_chunk(struct player *pplayer, const struct packet_player_attribute_chunk *chunk)
Definition packets.c:690
packets.h
PACKET_STRVEC_EXTRACT
#define PACKET_STRVEC_EXTRACT(strvec, str)
Definition packets.h:188
REQEST_PLAYER_INITIATED
#define REQEST_PLAYER_INITIATED
Definition packets.h:63
UNIT_INFO_CITY_PRESENT
@ UNIT_INFO_CITY_PRESENT
Definition packets.h:69
UNIT_INFO_CITY_SUPPORTED
@ UNIT_INFO_CITY_SUPPORTED
Definition packets.h:68
dsend_packet_spaceship_place
int dsend_packet_spaceship_place(struct connection *pc, enum spaceship_place_type type, int num)
Definition packets_gen.c:39171
send_packet_conn_pong
int send_packet_conn_pong(struct connection *pc)
Definition packets_gen.c:38003
dsend_packet_unit_get_actions
int dsend_packet_unit_get_actions(struct connection *pc, int actor_unit_id, int target_unit_id, int target_tile_id, int target_extra_id, int request_kind)
Definition packets_gen.c:32832
dsend_packet_player_change_government
int dsend_packet_player_change_government(struct connection *pc, Government_type_id government)
Definition packets_gen.c:24978
send_packet_client_info
int send_packet_client_info(struct connection *pc, const struct packet_client_info *packet)
Definition packets_gen.c:38287
packet_type
packet_type
Definition packets_gen.h:1893
handle_ruleset_game
void handle_ruleset_game(const struct packet_ruleset_game *packet)
Definition packhand.c:4768
handle_player_diplstate
void handle_player_diplstate(const struct packet_player_diplstate *packet)
Definition packhand.c:2766
auto_attack_act
static action_id auto_attack_act(const struct act_prob *act_probs)
Definition packhand.c:4991
handle_ruleset_nation_sets
void handle_ruleset_nation_sets(const struct packet_ruleset_nation_sets *packet)
Definition packhand.c:4534
handle_ruleset_nation
void handle_ruleset_nation(const struct packet_ruleset_nation *packet)
Definition packhand.c:4576
handle_city_name_suggestion_info
void handle_city_name_suggestion_info(int unit_id, const char *name)
Definition packhand.c:4839
unpackage_short_unit
static struct unit * unpackage_short_unit(const struct packet_unit_short_info *packet)
Definition packhand.c:363
handle_nuke_tile_info
void handle_nuke_tile_info(int tile)
Definition packhand.c:545
handle_unknown_research
void handle_unknown_research(int id)
Definition packhand.c:2736
auto_attack_blockers
const action_id auto_attack_blockers[]
Definition packhand.c:162
handle_ruleset_government_ruler_title
void handle_ruleset_government_ruler_title(const struct packet_ruleset_government_ruler_title *packet)
Definition packhand.c:3996
handle_city_info
void handle_city_info(const struct packet_city_info *packet)
Definition packhand.c:650
handle_end_turn
void handle_end_turn(void)
Definition packhand.c:1484
unpackage_unit
static struct unit * unpackage_unit(const struct packet_unit_info *packet)
Definition packhand.c:264
invisible
static struct @226 invisible
caption
char * caption
Definition packhand.c:129
event
enum event_type event
Definition packhand.c:128
handle_conn_info
void handle_conn_info(const struct packet_conn_info *pinfo)
Definition packhand.c:2867
handle_vote_remove
void handle_vote_remove(int vote_no)
Definition packhand.c:5451
handle_investigate_finished
void handle_investigate_finished(const struct packet_investigate_finished *packet)
Definition packhand.c:2138
handle_page_msg_part
void handle_page_msg_part(const char *lines)
Definition packhand.c:1614
handle_unit_combat_info
void handle_unit_combat_info(const struct packet_unit_combat_info *packet)
Definition packhand.c:568
handle_ruleset_style
void handle_ruleset_style(const struct packet_ruleset_style *p)
Definition packhand.c:4684
handle_unit_remove
void handle_unit_remove(int unit_id)
Definition packhand.c:491
handle_vote_update
void handle_vote_update(int vote_no, int yes, int no, int abstain, int num_voters)
Definition packhand.c:5460
last_turn
static int last_turn
Definition packhand.c:137
handle_ruleset_multiplier
void handle_ruleset_multiplier(const struct packet_ruleset_multiplier *p)
Definition packhand.c:3941
handle_player_info
void handle_player_info(const struct packet_player_info *pinfo)
Definition packhand.c:2426
handle_ruleset_extra
void handle_ruleset_extra(const struct packet_ruleset_extra *p)
Definition packhand.c:4137
handle_ruleset_action_auto
void handle_ruleset_action_auto(const struct packet_ruleset_action_auto *p)
Definition packhand.c:4446
handle_map_info
void handle_map_info(const struct packet_map_info *packet)
Definition packhand.c:2216
handle_ruleset_unit_bonus
void handle_ruleset_unit_bonus(const struct packet_ruleset_unit_bonus *p)
Definition packhand.c:3654
handle_start_phase
void handle_start_phase(int phase)
Definition packhand.c:1411
start_revolution
void start_revolution(void)
Definition packhand.c:2370
handle_timeout_info
void handle_timeout_info(float seconds_to_phasedone, float last_turn_change_time)
Definition packhand.c:2340
handle_ruleset_terrain_control
void handle_ruleset_terrain_control(const struct packet_ruleset_terrain_control *p)
Definition packhand.c:4521
auto_attack_actions
const action_id auto_attack_actions[]
Definition packhand.c:145
handle_play_music
void handle_play_music(const char *tag)
Definition packhand.c:5516
handle_investigate_started
void handle_investigate_started(const struct packet_investigate_started *packet)
Definition packhand.c:2114
handle_edit_object_created
void handle_edit_object_created(int tag, int id)
Definition packhand.c:5374
parts
int parts
Definition packhand.c:132
handle_conn_ping
void handle_conn_ping(void)
Definition packhand.c:5347
handle_ruleset_tech_class
void handle_ruleset_tech_class(const struct packet_ruleset_tech_class *p)
Definition packhand.c:3826
handle_diplomacy_init_meeting
void handle_diplomacy_init_meeting(int counterpart, int initiated_from)
Definition packhand.c:5524
handle_ruleset_control
void handle_ruleset_control(const struct packet_ruleset_control *packet)
Definition packhand.c:3385
handle_end_phase
void handle_end_phase(void)
Definition packhand.c:1400
handle_ruleset_counter
void handle_ruleset_counter(const struct packet_ruleset_counter *packet)
Definition packhand.c:5568
handle_server_info
void handle_server_info(const char *version_label, int major_version, int minor_version, int patch_version, int emerg_version)
Definition packhand.c:1567
handle_ruleset_nation_groups
void handle_ruleset_nation_groups(const struct packet_ruleset_nation_groups *packet)
Definition packhand.c:4555
handle_ruleset_effect
void handle_ruleset_effect(const struct packet_ruleset_effect *packet)
Definition packhand.c:5363
handle_new_year
void handle_new_year(int year, int fragments, int turn)
Definition packhand.c:1351
headline
char * headline
Definition packhand.c:130
handle_research_info
void handle_research_info(const struct packet_research_info *packet)
Definition packhand.c:2652
handle_ruleset_goods
void handle_ruleset_goods(const struct packet_ruleset_goods *p)
Definition packhand.c:4353
handle_unit_info
void handle_unit_info(const struct packet_unit_info *packet)
Definition packhand.c:1640
handle_ruleset_city
void handle_ruleset_city(const struct packet_ruleset_city *packet)
Definition packhand.c:4719
handle_ruleset_unit_class
void handle_ruleset_unit_class(const struct packet_ruleset_unit_class *p)
Definition packhand.c:3563
handle_ruleset_government
void handle_ruleset_government(const struct packet_ruleset_government *p)
Definition packhand.c:3969
handle_ruleset_terrain_flag
void handle_ruleset_terrain_flag(const struct packet_ruleset_terrain_flag *p)
Definition packhand.c:4093
handle_connect_msg
void handle_connect_msg(const char *message)
Definition packhand.c:1558
REQEST_BACKGROUND_REFRESH
#define REQEST_BACKGROUND_REFRESH
Definition packhand.c:140
handle_rulesets_ready
void handle_rulesets_ready(void)
Definition packhand.c:3509
handle_tile_info
void handle_tile_info(const struct packet_tile_info *packet)
Definition packhand.c:3097
handle_ruleset_action
void handle_ruleset_action(const struct packet_ruleset_action *p)
Definition packhand.c:4378
action_decision_handle
static void action_decision_handle(struct unit *punit)
Definition packhand.c:1656
handle_achievement_info
void handle_achievement_info(int id, bool gained, bool first)
Definition packhand.c:2996
handle_scenario_description
void handle_scenario_description(const char *description)
Definition packhand.c:3373
play_sound_for_event
void play_sound_for_event(enum event_type type)
Definition packhand.c:1511
handle_edit_startpos
void handle_edit_startpos(const struct packet_edit_startpos *packet)
Definition packhand.c:5382
handle_processing_finished
void handle_processing_finished(void)
Definition packhand.c:5282
unpack_tech_req
static int unpack_tech_req(const enum tech_req r_num, const int reqs_size, const struct requirement *reqs, struct advance *a, int i)
Definition packhand.c:3731
handle_diplomacy_cancel_meeting
void handle_diplomacy_cancel_meeting(int counterpart, int initiated_from)
Definition packhand.c:5541
handle_city_short_info
void handle_city_short_info(const struct packet_city_short_info *packet)
Definition packhand.c:1154
handle_diplomacy_create_clause
void handle_diplomacy_create_clause(int counterpart, int giver, enum clause_type type, int value)
Definition packhand.c:5549
handle_endgame_player
void handle_endgame_player(const struct packet_endgame_player *packet)
Definition packhand.c:5229
handle_ruleset_resource
void handle_ruleset_resource(const struct packet_ruleset_resource *p)
Definition packhand.c:4118
handle_unit_action_answer
void handle_unit_action_answer(int actor_id, int target_id, int cost, action_id action_type, int request_kind)
Definition packhand.c:4875
handle_ruleset_tech
void handle_ruleset_tech(const struct packet_ruleset_tech *p)
Definition packhand.c:3761
handle_team_name_info
void handle_team_name_info(int team_id, const char *team_name)
Definition packhand.c:553
page_msg_report
static struct @227 page_msg_report
handle_thaw_client
void handle_thaw_client(void)
Definition packhand.c:5336
handle_calendar_info
void handle_calendar_info(const struct packet_calendar_info *pcalendar)
Definition packhand.c:2332
packhand_free
void packhand_free(void)
Definition packhand.c:218
set_government_choice
void set_government_choice(struct government *government)
Definition packhand.c:2357
handle_city_rally_point
void handle_city_rally_point(const struct packet_city_rally_point *packet)
Definition packhand.c:1003
handle_ruleset_disaster
void handle_ruleset_disaster(const struct packet_ruleset_disaster *p)
Definition packhand.c:4468
handle_unit_packet_common
static bool handle_unit_packet_common(struct unit *packet_unit)
Definition packhand.c:1694
handle_ruleset_unit_class_flag
void handle_ruleset_unit_class_flag(const struct packet_ruleset_unit_class_flag *p)
Definition packhand.c:3699
handle_server_join_reply
void handle_server_join_reply(bool you_can_join, const char *message, const char *capability, const char *challenge_file, int conn_id)
Definition packhand.c:400
handle_ruleset_summary
void handle_ruleset_summary(const struct packet_ruleset_summary *packet)
Definition packhand.c:3481
handle_set_topology
void handle_set_topology(int topology_id, int wrap_id)
Definition packhand.c:2193
handle_ruleset_impr_flag
void handle_ruleset_impr_flag(const struct packet_ruleset_impr_flag *p)
Definition packhand.c:3915
handle_page_msg
void handle_page_msg(const char *caption, const char *headline, enum event_type event, int len, int parts)
Definition packhand.c:1583
handle_city_update_counters
void handle_city_update_counters(const struct packet_city_update_counters *packet)
Definition packhand.c:5591
handle_edit_startpos_full
void handle_edit_startpos_full(const struct packet_edit_startpos_full *packet)
Definition packhand.c:5420
handle_conn_ping_info
void handle_conn_ping_info(int connections, const int *conn_id, const float *ping_time)
Definition packhand.c:2973
handle_diplomacy_remove_clause
void handle_diplomacy_remove_clause(int counterpart, int giver, enum clause_type type, int value)
Definition packhand.c:5558
spaceship_autoplace
static bool spaceship_autoplace(struct player *pplayer, struct player_spaceship *ship)
Definition packhand.c:3033
handle_player_remove
void handle_player_remove(int playerno)
Definition packhand.c:2381
handle_processing_started
void handle_processing_started(void)
Definition packhand.c:5264
handle_begin_turn
void handle_begin_turn(void)
Definition packhand.c:1470
handle_endgame_report
void handle_endgame_report(const struct packet_endgame_report *packet)
Definition packhand.c:5220
handle_early_chat_msg
void handle_early_chat_msg(const struct packet_early_chat_msg *packet)
Definition packhand.c:1544
handle_ruleset_clause
void handle_ruleset_clause(const struct packet_ruleset_clause *p)
Definition packhand.c:4696
handle_ruleset_road
void handle_ruleset_road(const struct packet_ruleset_road *p)
Definition packhand.c:4322
handle_unit_actions
void handle_unit_actions(const struct packet_unit_actions *packet)
Definition packhand.c:5089
handle_ruleset_music
void handle_ruleset_music(const struct packet_ruleset_music *packet)
Definition packhand.c:4745
handle_ruleset_base
void handle_ruleset_base(const struct packet_ruleset_base *p)
Definition packhand.c:4301
notify_about_incoming_packet
void notify_about_incoming_packet(struct connection *pc, int packet_type, int size)
Definition packhand.c:5302
handle_freeze_client
void handle_freeze_client(void)
Definition packhand.c:5326
handle_city_remove
void handle_city_remove(int city_id)
Definition packhand.c:468
handle_chat_msg
void handle_chat_msg(const struct packet_chat_msg *packet)
Definition packhand.c:1524
city_packet_common
static void city_packet_common(struct city *pcity, struct tile *pcenter, struct player *powner, struct tile_list *worked_tiles, bool is_new, bool popup, bool investigate)
Definition packhand.c:1017
handle_trade_route_info
void handle_trade_route_info(const struct packet_trade_route_info *packet)
Definition packhand.c:1119
handle_player_attribute_chunk
void handle_player_attribute_chunk(const struct packet_player_attribute_chunk *packet)
Definition packhand.c:5246
handle_vote_new
void handle_vote_new(const struct packet_vote_new *packet)
Definition packhand.c:5481
packhand_init
static void packhand_init(void)
Definition packhand.c:239
handle_scenario_info
void handle_scenario_info(const struct packet_scenario_info *packet)
Definition packhand.c:3352
handle_ruleset_extra_flag
void handle_ruleset_extra_flag(const struct packet_ruleset_extra_flag *p)
Definition packhand.c:4275
lines
char * lines
Definition packhand.c:131
notify_about_outgoing_packet
void notify_about_outgoing_packet(struct connection *pc, int packet_type, int size, int request_id)
Definition packhand.c:5312
VALIDATE
#define VALIDATE(_count, _maximum, _string)
forced_tileset_name
const char forced_tileset_name[]
Definition client_main.c:137
cities
struct city_list * cities
Definition packhand.c:119
handle_ruleset_tech_flag
void handle_ruleset_tech_flag(const struct packet_ruleset_tech_flag *p)
Definition packhand.c:3839
handle_nation_availability
void handle_nation_availability(int ncount, const bool *is_pickable, bool nationset_change)
Definition packhand.c:4666
handle_spaceship_info
void handle_spaceship_info(const struct packet_spaceship_info *p)
Definition packhand.c:3052
handle_ruleset_specialist
void handle_ruleset_specialist(const struct packet_ruleset_specialist *p)
Definition packhand.c:4813
handle_unit_short_info
void handle_unit_short_info(const struct packet_unit_short_info *packet)
Definition packhand.c:2145
handle_diplomacy_accept_treaty
void handle_diplomacy_accept_treaty(int counterpart, bool I_accepted, bool other_accepted)
Definition packhand.c:5532
handle_ruleset_unit_flag
void handle_ruleset_unit_flag(const struct packet_ruleset_unit_flag *p)
Definition packhand.c:3674
handle_city_nationalities
void handle_city_nationalities(const struct packet_city_nationalities *packet)
Definition packhand.c:983
handle_server_shutdown
void handle_server_shutdown(void)
Definition packhand.c:5355
handle_ruleset_building
void handle_ruleset_building(const struct packet_ruleset_building *p)
Definition packhand.c:3864
update_improvement_from_packet
static bool update_improvement_from_packet(struct city *pcity, struct impr_type *pimprove, bool have_impr)
Definition packhand.c:628
handle_ruleset_unit
void handle_ruleset_unit(const struct packet_ruleset_unit *p)
Definition packhand.c:3581
handle_ruleset_terrain
void handle_ruleset_terrain(const struct packet_ruleset_terrain *p)
Definition packhand.c:4010
action_decision_maybe_auto
static void action_decision_maybe_auto(struct unit *actor_unit, const struct act_prob *act_probs, struct unit *target_unit, struct city *target_city, struct tile *target_tile)
Definition packhand.c:5021
REQEST_BACKGROUND_FAST_AUTO_ATTACK
#define REQEST_BACKGROUND_FAST_AUTO_ATTACK
Definition packhand.c:142
handle_city_sabotage_list
void handle_city_sabotage_list(int actor_id, int city_id, bv_imprs improvements, action_id act_id, int request_kind)
Definition packhand.c:5159
handle_ruleset_action_enabler
void handle_ruleset_action_enabler(const struct packet_ruleset_action_enabler *p)
Definition packhand.c:4412
handle_ruleset_achievement
void handle_ruleset_achievement(const struct packet_ruleset_achievement *p)
Definition packhand.c:4490
handle_game_info
void handle_game_info(const struct packet_game_info *pinfo)
Definition packhand.c:2256
placeholder
struct player * placeholder
Definition packhand.c:120
handle_vote_resolve
void handle_vote_resolve(int vote_no, bool passed)
Definition packhand.c:5498
handle_worker_task
void handle_worker_task(const struct packet_worker_task *packet)
Definition packhand.c:1294
handle_ruleset_description_part
void handle_ruleset_description_part(const struct packet_ruleset_description_part *packet)
Definition packhand.c:3499
handle_ruleset_trade
void handle_ruleset_trade(const struct packet_ruleset_trade *p)
Definition packhand.c:4506
len
int len
Definition packhand.c:127
packhand.h
pages_g.h
set_client_page
void set_client_page(enum client_pages page)
Definition update_queue.c:496
get_client_page
enum client_pages get_client_page(void)
Definition update_queue.c:520
player_slot_is_used
bool player_slot_is_used(const struct player_slot *pslot)
Definition player.c:448
player_unit_by_number
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
Definition player.c:1229
player_new
struct player * player_new(struct player_slot *pslot)
Definition player.c:493
player_by_number
struct player * player_by_number(const int player_id)
Definition player.c:849
player_count
int player_count(void)
Definition player.c:817
player_slot_by_number
struct player_slot * player_slot_by_number(int player_id)
Definition player.c:463
player_number
int player_number(const struct player *pplayer)
Definition player.c:837
player_name
const char * player_name(const struct player *pplayer)
Definition player.c:895
player_set_color
void player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
Definition player.c:648
player_index
int player_index(const struct player *pplayer)
Definition player.c:829
player_set_nation
bool player_set_nation(struct player *pplayer, struct nation_type *pnation)
Definition player.c:861
player_diplstate_get
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:324
can_player_see_units_in_city
bool can_player_see_units_in_city(const struct player *pplayer, const struct city *pcity)
Definition player.c:1133
player_slot_get_player
struct player * player_slot_get_player(const struct player_slot *pslot)
Definition player.c:437
can_player_see_city_internals
bool can_player_see_city_internals(const struct player *pplayer, const struct city *pcity)
Definition player.c:1149
player_destroy
void player_destroy(struct player *pplayer)
Definition player.c:756
player.h
players_iterate_end
#define players_iterate_end
Definition player.h:537
players_iterate
#define players_iterate(_pplayer)
Definition player.h:532
ANON_USER_NAME
#define ANON_USER_NAME
Definition player.h:48
is_ai
#define is_ai(plr)
Definition player.h:230
ANON_PLAYER_NAME
#define ANON_PLAYER_NAME
Definition player.h:43
is_human
#define is_human(plr)
Definition player.h:229
plrdlg_g.h
players_dialog_update
void players_dialog_update(void)
Definition update_queue.c:658
rand.h
fc_rand
#define fc_rand(_size)
Definition rand.h:56
ratesdlg_g.h
multipliers_dialog_update
void multipliers_dialog_update(void)
Definition update_queue.c:572
repodlgs_g.h
science_report_dialog_update
const struct packet_endgame_player *packet void science_report_dialog_update(void)
Definition update_queue.c:674
economy_report_dialog_update
void economy_report_dialog_update(void)
Definition update_queue.c:682
units_report_dialog_update
void units_report_dialog_update(void)
Definition update_queue.c:690
endgame_report_dialog_player
endgame_report_dialog_player
Definition repodlgs_g.h:33
universal_by_number
struct universal universal_by_number(const enum universals_n kind, const int value)
Definition requirements.c:621
are_universals_equal
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
Definition requirements.c:6466
research_invention_set
enum tech_state research_invention_set(struct research *presearch, Tech_type_id tech, enum tech_state value)
Definition research.c:637
research_by_number
struct research * research_by_number(int number)
Definition research.c:118
research_get
struct research * research_get(const struct player *pplayer)
Definition research.c:128
research_update
void research_update(struct research *presearch)
Definition research.c:501
research.h
research_players_iterate
#define research_players_iterate(_presearch, _pplayer)
Definition research.h:166
research_players_iterate_end
#define research_players_iterate_end
Definition research.h:170
rgbcolor_destroy
void rgbcolor_destroy(struct rgbcolor *prgbcolor)
Definition rgbcolor.c:74
rgbcolor_new
struct rgbcolor * rgbcolor_new(int r, int g, int b)
Definition rgbcolor.c:34
rgbcolor.h
road_integrators_cache_init
void road_integrators_cache_init(void)
Definition road.c:111
road_by_number
struct road_type * road_by_number(Road_type_id id)
Definition road.c:58
road_type_init
void road_type_init(struct extra_type *pextra, int idx)
Definition road.c:93
road.h
script_client_signal_emit
void script_client_signal_emit(const char *signal_name,...)
Definition script_client.c:320
script_client.h
connections
static struct connection connections[MAX_NUM_CONNECTIONS]
Definition sernet.c:94
ARRAY_SIZE
#define ARRAY_SIZE(x)
Definition shared.h:85
MIN
#define MIN(x, y)
Definition shared.h:55
MAX
#define MAX(x, y)
Definition shared.h:54
next_spaceship_component
bool next_spaceship_component(struct player *pplayer, struct player_spaceship *ship, struct spaceship_component *fill)
Definition spaceship.c:130
spaceship.h
spaceshipdlg_g.h
specialist_by_number
struct specialist * specialist_by_number(const Specialist_type_id id)
Definition specialist.c:100
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
size
size_t size
Definition specvec.h:72
string_vector.h
strvec_iterate
#define strvec_iterate(psv, str)
Definition string_vector.h:61
strvec_iterate_end
#define strvec_iterate_end
Definition string_vector.h:68
achievement
Definition achievements.h:26
achievement::first
struct player * first
Definition achievements.h:34
act_prob
Definition fc_types.h:1241
action_auto_perf
Definition actions.h:559
action_enabler
Definition actions.h:419
action
Definition actions.h:360
action::actor_consuming_always
bool actor_consuming_always
Definition actions.h:393
action::max_distance
int max_distance
Definition actions.h:376
action::quiet
bool quiet
Definition actions.h:383
action::sub_target_kind
enum action_sub_target_kind sub_target_kind
Definition actions.h:368
action::result
enum action_result result
Definition actions.h:363
action::ui_name
char ui_name[MAX_LEN_NAME]
Definition actions.h:379
action::sub_results
bv_action_sub_results sub_results
Definition actions.h:364
action::actor_kind
enum action_actor_kind actor_kind
Definition actions.h:366
action::blocked_by
bv_actions blocked_by
Definition actions.h:387
action::target_kind
enum action_target_kind target_kind
Definition actions.h:367
action::min_distance
int min_distance
Definition actions.h:376
advance
Definition tech.h:124
advance::research_reqs
struct requirement_vector research_reqs
Definition tech.h:137
advance::tclass
struct tech_class * tclass
Definition tech.h:130
advance::cost
double cost
Definition tech.h:150
advance::require
struct advance * require[AR_SIZE]
Definition tech.h:132
advance::name
struct name_translation name
Definition tech.h:126
advance::helptext
struct strvec * helptext
Definition tech.h:140
advance::flags
bv_tech_flags flags
Definition tech.h:139
advance::num_reqs
int num_reqs
Definition tech.h:156
advance::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition tech.h:128
advance::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition tech.h:129
base_type
Definition base.h:41
built_status::turn
int turn
Definition city.h:246
city
Definition city.h:320
city::task_reqs
struct worker_task_list * task_reqs
Definition city.h:412
city::turn_last_built
int turn_last_built
Definition city.h:387
city::surplus
int surplus[O_LAST]
Definition city.h:355
city::food_stock
int food_stock
Definition city.h:367
city::built
struct built_status built[B_LAST]
Definition city.h:394
city::original
struct player * original
Definition city.h:324
city::history
int history
Definition city.h:410
city::counter_values
int * counter_values
Definition city.h:408
city::pollution
int pollution
Definition city.h:369
city::did_sell
bool did_sell
Definition city.h:380
city::id
int id
Definition city.h:326
city::last_turns_shield_surplus
int last_turns_shield_surplus
Definition city.h:392
city::capital
enum capital_type capital
Definition city.h:328
city::disbanded_shields
int disbanded_shields
Definition city.h:391
city::waste
int waste[O_LAST]
Definition city.h:356
city::info_units_present
struct unit_list * info_units_present
Definition city.h:474
city::city_options
bv_city_options city_options
Definition city.h:403
city::city_radius_sq
int city_radius_sq
Definition city.h:375
city::was_happy
bool was_happy
Definition city.h:381
city::owner
struct player * owner
Definition city.h:323
city::turn_founded
int turn_founded
Definition city.h:386
city::airlift
int airlift
Definition city.h:378
city::citizen_base
int citizen_base[O_LAST]
Definition city.h:359
city::caravan_shields
int caravan_shields
Definition city.h:390
city::did_buy
bool did_buy
Definition city.h:379
city::info_units_supported
struct unit_list * info_units_supported
Definition city.h:473
city::name
char * name
Definition city.h:321
city::routes
struct trade_route_list * routes
Definition city.h:344
city::occupied
bool occupied
Definition city.h:460
city::usage
int usage[O_LAST]
Definition city.h:360
city::worklist
struct worklist worklist
Definition city.h:401
city::production
struct universal production
Definition city.h:396
city::walls
int walls
Definition city.h:461
city::happy
bool happy
Definition city.h:462
city::collecting_info_units_supported
struct unit_list * collecting_info_units_supported
Definition city.h:477
city::steal
int steal
Definition city.h:414
city::unhappy_penalty
int unhappy_penalty[O_LAST]
Definition city.h:357
city::first_citizen_index
unsigned char first_citizen_index
Definition city.h:483
city::before_change_shields
int before_change_shields
Definition city.h:389
city::culture
int culture
Definition city.h:465
city::style
int style
Definition city.h:327
city::had_famine
bool had_famine
Definition city.h:382
city::collecting_info_units_present
struct unit_list * collecting_info_units_present
Definition city.h:478
city::buy_cost
int buy_cost
Definition city.h:466
city::feel
citizens feel[CITIZEN_LAST][FEELING_LAST]
Definition city.h:333
city::specialists
citizens specialists[SP_MAX]
Definition city.h:336
city::tile
struct tile * tile
Definition city.h:322
city::shield_stock
int shield_stock
Definition city.h:368
city::prod
int prod[O_LAST]
Definition city.h:358
city::city_image
int city_image
Definition city.h:464
city::changed_from
struct universal changed_from
Definition city.h:399
city::unhappy
bool unhappy
Definition city.h:463
city::units_supported
struct unit_list * units_supported
Definition city.h:406
city::illness_trade
int illness_trade
Definition city.h:370
city::client
struct city::@17::@20 client
citystyle
Definition city.h:491
civ_game::plr_bg_color
struct rgbcolor * plr_bg_color
Definition game.h:103
civ_game::scenario_desc
struct packet_scenario_description scenario_desc
Definition game.h:88
civ_game::control
struct packet_ruleset_control control
Definition game.h:83
civ_game::ruleset_summary
char * ruleset_summary
Definition game.h:84
civ_game::est_connections
struct conn_list * est_connections
Definition game.h:97
civ_game::global_init_techs
int global_init_techs[MAX_NUM_TECH_LIST]
Definition game.h:108
civ_game::info
struct packet_game_info info
Definition game.h:89
civ_game::ruleset_ready
bool ruleset_ready
Definition game.h:117
civ_game::global_init_buildings
int global_init_buildings[MAX_NUM_BUILDING_LIST]
Definition game.h:109
civ_game::scenario
struct packet_scenario_info scenario
Definition game.h:87
civ_game::ruleset_description
char * ruleset_description
Definition game.h:85
civ_game::all_connections
struct conn_list * all_connections
Definition game.h:96
civ_game::ruleset_init
bool ruleset_init
Definition game.h:116
civ_game::rgame
struct civ_game::@30 rgame
civ_game::tinfo
struct packet_timeout_info tinfo
Definition game.h:91
civ_game::veteran
struct veteran_system * veteran
Definition game.h:101
civ_game::calendar
struct packet_calendar_info calendar
Definition game.h:90
civ_game::default_government
struct government * default_government
Definition game.h:93
civ_game::client
struct civ_game::@31::@34 client
civ_game::government_during_revolution
struct government * government_during_revolution
Definition game.h:94
civ_map::xsize
int xsize
Definition map_types.h:78
civ_map::ysize
int ysize
Definition map_types.h:78
civ_map::num_continents
int num_continents
Definition map_types.h:81
civ_map::north_latitude
int north_latitude
Definition map_types.h:79
civ_map::south_latitude
int south_latitude
Definition map_types.h:80
civ_map::topology_id
int topology_id
Definition map_types.h:72
civ_map::wrap_id
int wrap_id
Definition map_types.h:73
civclient::conn
struct connection conn
Definition client_main.h:96
clause_info
Definition diptreaty.h:55
clause_info::receiver_reqs
struct requirement_vector receiver_reqs
Definition diptreaty.h:59
clause_info::giver_reqs
struct requirement_vector giver_reqs
Definition diptreaty.h:58
clause_info::enabled
bool enabled
Definition diptreaty.h:57
client_options::sound_bell_at_new_turn
bool sound_bell_at_new_turn
Definition options.h:150
client_options::autoaccept_tileset_suggestion
bool autoaccept_tileset_suggestion
Definition options.h:183
client_options::autoaccept_musicset_suggestion
bool autoaccept_musicset_suggestion
Definition options.h:185
client_options::draw_city_names
bool draw_city_names
Definition options.h:196
client_options::draw_city_productions
bool draw_city_productions
Definition options.h:198
client_options::popup_new_cities
bool popup_new_cities
Definition options.h:167
client_options::draw_city_trade_routes
bool draw_city_trade_routes
Definition options.h:200
client_options::wakeup_focus
bool wakeup_focus
Definition options.h:159
client_options::autoaccept_soundset_suggestion
bool autoaccept_soundset_suggestion
Definition options.h:184
client_options::ask_city_name
bool ask_city_name
Definition options.h:166
client_options::draw_city_growth
bool draw_city_growth
Definition options.h:197
client_options::ai_manual_turn_done
bool ai_manual_turn_done
Definition options.h:154
client_options::smooth_combat_step_msec
int smooth_combat_step_msec
Definition options.h:153
client_options::draw_full_citybar
bool draw_full_citybar
Definition options.h:216
client_options::auto_center_on_combat
bool auto_center_on_combat
Definition options.h:157
client_options::popup_attack_actions
bool popup_attack_actions
Definition options.h:169
combat_bonus
Definition unittype.h:466
combat_bonus::value
int value
Definition unittype.h:469
combat_bonus::flag
enum unit_type_flag_id flag
Definition unittype.h:467
combat_bonus::quiet
bool quiet
Definition unittype.h:472
combat_bonus::type
enum combat_bonus_type type
Definition unittype.h:468
connection
Definition connection.h:136
connection::established
bool established
Definition connection.h:140
connection::playing
struct player * playing
Definition connection.h:151
connection::request_id_of_currently_handled_packet
int request_id_of_currently_handled_packet
Definition connection.h:193
connection::client
struct connection::@58::@63 client
connection::access_level
enum cmdlevel access_level
Definition connection.h:177
connection::observer
bool observer
Definition connection.h:147
connection::username
char username[MAX_LEN_NAME]
Definition connection.h:164
connection::capability
char capability[MAX_LEN_CAPSTR]
Definition connection.h:171
connection::last_processed_request_id_seen
int last_processed_request_id_seen
Definition connection.h:190
connection::ping_time
double ping_time
Definition connection.h:161
connection::id
int id
Definition connection.h:137
counter
Definition counters.h:27
disaster_type
Definition disaster.h:46
extra_type
Definition extras.h:88
extra_type::native_to
bv_unit_classes native_to
Definition extras.h:130
extra_type::rmact_gfx
char rmact_gfx[MAX_LEN_NAME]
Definition extras.h:102
extra_type::conflicts
bv_extras conflicts
Definition extras.h:133
extra_type::rmcauses
uint8_t rmcauses
Definition extras.h:95
extra_type::act_gfx_alt
char act_gfx_alt[MAX_LEN_NAME]
Definition extras.h:100
extra_type::appearance_reqs
struct requirement_vector appearance_reqs
Definition extras.h:108
extra_type::helptext
struct strvec * helptext
Definition extras.h:149
extra_type::flags
bv_extra_flags flags
Definition extras.h:132
extra_type::rmact_gfx_alt
char rmact_gfx_alt[MAX_LEN_NAME]
Definition extras.h:103
extra_type::causes
uint16_t causes
Definition extras.h:94
extra_type::bridged_over
bv_extras bridged_over
Definition extras.h:135
extra_type::data
struct extra_type::@25 data
extra_type::removal_time
int removal_time
Definition extras.h:120
extra_type::rmact_gfx_alt2
char rmact_gfx_alt2[MAX_LEN_NAME]
Definition extras.h:104
extra_type::build_time_factor
int build_time_factor
Definition extras.h:119
extra_type::disappearance_reqs
struct requirement_vector disappearance_reqs
Definition extras.h:109
extra_type::generated
bool generated
Definition extras.h:117
extra_type::special_idx
int special_idx
Definition extras.h:153
extra_type::rmreqs
struct requirement_vector rmreqs
Definition extras.h:107
extra_type::visibility_req
Tech_type_id visibility_req
Definition extras.h:139
extra_type::category
enum extra_category category
Definition extras.h:93
extra_type::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition extras.h:98
extra_type::activity_gfx
char activity_gfx[MAX_LEN_NAME]
Definition extras.h:99
extra_type::disappearance_chance
int disappearance_chance
Definition extras.h:126
extra_type::removal_time_factor
int removal_time_factor
Definition extras.h:121
extra_type::act_gfx_alt2
char act_gfx_alt2[MAX_LEN_NAME]
Definition extras.h:101
extra_type::reqs
struct requirement_vector reqs
Definition extras.h:106
extra_type::buildable
bool buildable
Definition extras.h:116
extra_type::eus
enum extra_unit_seen_type eus
Definition extras.h:128
extra_type::defense_bonus
int defense_bonus
Definition extras.h:124
extra_type::appearance_chance
int appearance_chance
Definition extras.h:125
extra_type::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition extras.h:97
extra_type::build_time
int build_time
Definition extras.h:118
extra_type::infracost
int infracost
Definition extras.h:122
extra_type::no_aggr_near_city
int no_aggr_near_city
Definition extras.h:137
extra_type::hidden_by
bv_extras hidden_by
Definition extras.h:134
extra_type::name
struct name_translation name
Definition extras.h:90
goods_type
Definition traderoutes.h:183
government
Definition government.h:52
government::helptext
struct strvec * helptext
Definition government.h:61
government::reqs
struct requirement_vector reqs
Definition government.h:58
government::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition government.h:57
government::item_number
Government_type_id item_number
Definition government.h:53
government::name
struct name_translation name
Definition government.h:54
government::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition government.h:56
impr_type
Definition improvement.h:50
impr_type::build_cost
int build_cost
Definition improvement.h:60
impr_type::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition improvement.h:55
impr_type::upkeep
int upkeep
Definition improvement.h:61
impr_type::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition improvement.h:57
impr_type::genus
enum impr_genus_id genus
Definition improvement.h:63
impr_type::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition improvement.h:56
impr_type::obsolete_by
struct requirement_vector obsolete_by
Definition improvement.h:59
impr_type::sabotage
int sabotage
Definition improvement.h:62
impr_type::soundtag_alt
char soundtag_alt[MAX_LEN_NAME]
Definition improvement.h:67
impr_type::soundtag_alt2
char soundtag_alt2[MAX_LEN_NAME]
Definition improvement.h:68
impr_type::reqs
struct requirement_vector reqs
Definition improvement.h:58
impr_type::helptext
struct strvec * helptext
Definition improvement.h:65
impr_type::name
struct name_translation name
Definition improvement.h:52
impr_type::flags
bv_impr_flags flags
Definition improvement.h:64
impr_type::soundtag
char soundtag[MAX_LEN_NAME]
Definition improvement.h:66
message
Definition messagewin_common.h:29
multiplier_value::value
int value
Definition player.h:239
multiplier_value::target
int target
Definition player.h:241
multiplier_value::changed
int changed
Definition player.h:243
multiplier
Definition multipliers.h:31
multiplier::start
int start
Definition multipliers.h:35
multiplier::reqs
struct requirement_vector reqs
Definition multipliers.h:42
multiplier::step
int step
Definition multipliers.h:37
multiplier::def
int def
Definition multipliers.h:38
multiplier::helptext
struct strvec * helptext
Definition multipliers.h:43
multiplier::offset
int offset
Definition multipliers.h:39
multiplier::minimum_turns
int minimum_turns
Definition multipliers.h:41
multiplier::factor
int factor
Definition multipliers.h:40
multiplier::stop
int stop
Definition multipliers.h:36
multiplier::name
struct name_translation name
Definition multipliers.h:33
music_style
Definition style.h:29
nation_group
Definition nation.h:167
nation_set
Definition nation.c:41
nation_style
Definition style.h:22
nation_type
Definition nation.h:98
nation_type::init_buildings
int init_buildings[MAX_NUM_BUILDING_LIST]
Definition nation.h:123
nation_type::groups
struct nation_group_list * groups
Definition nation.h:116
nation_type::noun_plural
struct name_translation noun_plural
Definition nation.h:102
nation_type::sets
struct nation_set_list * sets
Definition nation.h:113
nation_type::flag_graphic_str
char flag_graphic_str[MAX_LEN_NAME]
Definition nation.h:103
nation_type::adjective
struct name_translation adjective
Definition nation.h:101
nation_type::flag_graphic_alt
char flag_graphic_alt[MAX_LEN_NAME]
Definition nation.h:104
nation_type::init_government
struct government * init_government
Definition nation.h:124
nation_type::is_pickable
bool is_pickable
Definition nation.h:161
nation_type::init_units
struct unit_type * init_units[MAX_NUM_UNIT_LIST]
Definition nation.h:125
nation_type::legend
char * legend
Definition nation.h:107
nation_type::barb_type
enum barbarian_type barb_type
Definition nation.h:110
nation_type::client
struct nation_type::@51::@54 client
nation_type::translation_domain
char * translation_domain
Definition nation.h:100
nation_type::style
struct nation_style * style
Definition nation.h:106
nation_type::init_techs
int init_techs[MAX_NUM_TECH_LIST]
Definition nation.h:122
nation_type::is_playable
bool is_playable
Definition nation.h:109
packet_calendar_info
Definition packets_gen.h:254
packet_chat_msg
Definition packets_gen.h:291
packet_chat_msg::phase
int phase
Definition packets_gen.h:296
packet_chat_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:292
packet_chat_msg::conn_id
int conn_id
Definition packets_gen.h:297
packet_chat_msg::event
enum event_type event
Definition packets_gen.h:294
packet_chat_msg::turn
int turn
Definition packets_gen.h:295
packet_chat_msg::tile
int tile
Definition packets_gen.h:293
packet_city_info
Definition packets_gen.h:329
packet_city_info::style
int style
Definition packets_gen.h:336
packet_city_info::last_turns_shield_surplus
int last_turns_shield_surplus
Definition packets_gen.h:367
packet_city_info::usage
int usage[O_LAST]
Definition packets_gen.h:352
packet_city_info::before_change_shields
int before_change_shields
Definition packets_gen.h:364
packet_city_info::ppl_content
int ppl_content[FEELING_LAST]
Definition packets_gen.h:339
packet_city_info::city_options
bv_city_options city_options
Definition packets_gen.h:379
packet_city_info::capital
enum capital_type capital
Definition packets_gen.h:337
packet_city_info::surplus
int surplus[O_LAST]
Definition packets_gen.h:347
packet_city_info::had_famine
bool had_famine
Definition packets_gen.h:372
packet_city_info::ppl_unhappy
int ppl_unhappy[FEELING_LAST]
Definition packets_gen.h:340
packet_city_info::original
int original
Definition packets_gen.h:333
packet_city_info::citizen_base
int citizen_base[O_LAST]
Definition packets_gen.h:351
packet_city_info::changed_from_kind
int changed_from_kind
Definition packets_gen.h:362
packet_city_info::specialists
int specialists[SP_MAX]
Definition packets_gen.h:343
packet_city_info::changed_from_value
int changed_from_value
Definition packets_gen.h:363
packet_city_info::ppl_angry
int ppl_angry[FEELING_LAST]
Definition packets_gen.h:341
packet_city_info::food_stock
int food_stock
Definition packets_gen.h:353
packet_city_info::id
int id
Definition packets_gen.h:330
packet_city_info::owner
int owner
Definition packets_gen.h:332
packet_city_info::walls
int walls
Definition packets_gen.h:374
packet_city_info::improvements
bv_imprs improvements
Definition packets_gen.h:378
packet_city_info::shield_stock
int shield_stock
Definition packets_gen.h:354
packet_city_info::was_happy
bool was_happy
Definition packets_gen.h:371
packet_city_info::worklist
struct worklist worklist
Definition packets_gen.h:377
packet_city_info::steal
int steal
Definition packets_gen.h:376
packet_city_info::airlift
int airlift
Definition packets_gen.h:368
packet_city_info::did_buy
bool did_buy
Definition packets_gen.h:369
packet_city_info::turn_founded
int turn_founded
Definition packets_gen.h:360
packet_city_info::buy_cost
int buy_cost
Definition packets_gen.h:346
packet_city_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:380
packet_city_info::pollution
int pollution
Definition packets_gen.h:356
packet_city_info::trade_route_count
int trade_route_count
Definition packets_gen.h:355
packet_city_info::ppl_happy
int ppl_happy[FEELING_LAST]
Definition packets_gen.h:338
packet_city_info::did_sell
bool did_sell
Definition packets_gen.h:370
packet_city_info::production_value
int production_value
Definition packets_gen.h:359
packet_city_info::prod
int prod[O_LAST]
Definition packets_gen.h:350
packet_city_info::caravan_shields
int caravan_shields
Definition packets_gen.h:366
packet_city_info::illness_trade
int illness_trade
Definition packets_gen.h:357
packet_city_info::culture
int culture
Definition packets_gen.h:345
packet_city_info::diplomat_investigate
bool diplomat_investigate
Definition packets_gen.h:373
packet_city_info::unhappy_penalty
int unhappy_penalty[O_LAST]
Definition packets_gen.h:349
packet_city_info::history
int history
Definition packets_gen.h:344
packet_city_info::turn_last_built
int turn_last_built
Definition packets_gen.h:361
packet_city_info::city_image
int city_image
Definition packets_gen.h:375
packet_city_info::disbanded_shields
int disbanded_shields
Definition packets_gen.h:365
packet_city_info::production_kind
int production_kind
Definition packets_gen.h:358
packet_city_info::tile
int tile
Definition packets_gen.h:331
packet_city_info::size
int size
Definition packets_gen.h:334
packet_city_info::city_radius_sq
int city_radius_sq
Definition packets_gen.h:335
packet_city_info::waste
int waste[O_LAST]
Definition packets_gen.h:348
packet_city_nationalities
Definition packets_gen.h:383
packet_city_nationalities::nation_id
int nation_id[MAX_CITY_NATIONALITIES]
Definition packets_gen.h:386
packet_city_nationalities::id
int id
Definition packets_gen.h:384
packet_city_nationalities::nation_citizens
int nation_citizens[MAX_CITY_NATIONALITIES]
Definition packets_gen.h:387
packet_city_nationalities::nationalities_count
int nationalities_count
Definition packets_gen.h:385
packet_city_rally_point
Definition packets_gen.h:488
packet_city_rally_point::id
int id
Definition packets_gen.h:489
packet_city_short_info
Definition packets_gen.h:396
packet_city_short_info::walls
int walls
Definition packets_gen.h:404
packet_city_short_info::style
int style
Definition packets_gen.h:401
packet_city_short_info::size
int size
Definition packets_gen.h:400
packet_city_short_info::improvements
bv_imprs improvements
Definition packets_gen.h:408
packet_city_short_info::capital
enum capital_type capital
Definition packets_gen.h:402
packet_city_short_info::owner
int owner
Definition packets_gen.h:399
packet_city_short_info::id
int id
Definition packets_gen.h:397
packet_city_short_info::city_image
int city_image
Definition packets_gen.h:407
packet_city_short_info::happy
bool happy
Definition packets_gen.h:405
packet_city_short_info::unhappy
bool unhappy
Definition packets_gen.h:406
packet_city_short_info::tile
int tile
Definition packets_gen.h:398
packet_city_short_info::occupied
bool occupied
Definition packets_gen.h:403
packet_city_short_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:409
packet_city_update_counters
Definition packets_gen.h:390
packet_city_update_counters::count
int count
Definition packets_gen.h:392
packet_city_update_counters::counters
int counters[MAX_COUNTERS]
Definition packets_gen.h:393
packet_city_update_counters::city
int city
Definition packets_gen.h:391
packet_client_info
Definition packets_gen.h:878
packet_conn_info
Definition packets_gen.h:848
packet_early_chat_msg
Definition packets_gen.h:300
packet_early_chat_msg::event
enum event_type event
Definition packets_gen.h:303
packet_early_chat_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:301
packet_early_chat_msg::phase
int phase
Definition packets_gen.h:305
packet_early_chat_msg::conn_id
int conn_id
Definition packets_gen.h:306
packet_early_chat_msg::turn
int turn
Definition packets_gen.h:304
packet_early_chat_msg::tile
int tile
Definition packets_gen.h:302
packet_edit_startpos_full
Definition packets_gen.h:1694
packet_edit_startpos_full::id
int id
Definition packets_gen.h:1695
packet_edit_startpos
Definition packets_gen.h:1688
packet_edit_startpos::removal
bool removal
Definition packets_gen.h:1690
packet_edit_startpos::tag
int tag
Definition packets_gen.h:1691
packet_edit_startpos::id
int id
Definition packets_gen.h:1689
packet_endgame_player
Definition packets_gen.h:91
packet_endgame_player::winner
bool winner
Definition packets_gen.h:96
packet_endgame_player::player_id
int player_id
Definition packets_gen.h:93
packet_endgame_report
Definition packets_gen.h:85
packet_game_info
Definition packets_gen.h:115
packet_game_info::aifill
int aifill
Definition packets_gen.h:117
packet_game_info::government_during_revolution_id
Government_type_id government_during_revolution_id
Definition packets_gen.h:171
packet_game_info::citizen_nationality
bool citizen_nationality
Definition packets_gen.h:140
packet_game_info::init_city_radius_sq
int init_city_radius_sq
Definition packets_gen.h:184
packet_game_info::is_edit_mode
bool is_edit_mode
Definition packets_gen.h:185
packet_game_info::fragment_count
int fragment_count
Definition packets_gen.h:246
packet_game_info::skill_level
enum ai_level skill_level
Definition packets_gen.h:222
packet_game_info::phase_mode
enum phase_mode_type phase_mode
Definition packets_gen.h:207
packet_game_info::turn
int turn
Definition packets_gen.h:241
packet_game_info::year
int year
Definition packets_gen.h:243
packet_game_info::phase
int phase
Definition packets_gen.h:206
packet_game_info::victory_conditions
enum victory_condition_type victory_conditions
Definition packets_gen.h:223
packet_game_info::default_government_id
Government_type_id default_government_id
Definition packets_gen.h:170
packet_investigate_finished
Definition packets_gen.h:37
packet_investigate_started
Definition packets_gen.h:32
packet_investigate_started::city_id
int city_id
Definition packets_gen.h:34
packet_map_info
Definition packets_gen.h:267
packet_map_info::wrap_id
int wrap_id
Definition packets_gen.h:271
packet_map_info::south_latitude
int south_latitude
Definition packets_gen.h:273
packet_map_info::ysize
int ysize
Definition packets_gen.h:269
packet_map_info::topology_id
int topology_id
Definition packets_gen.h:270
packet_map_info::xsize
int xsize
Definition packets_gen.h:268
packet_map_info::north_latitude
int north_latitude
Definition packets_gen.h:272
packet_player_attribute_chunk
Definition packets_gen.h:582
packet_player_attribute_chunk::chunk_length
int chunk_length
Definition packets_gen.h:585
packet_player_attribute_chunk::total_length
int total_length
Definition packets_gen.h:584
packet_player_attribute_chunk::offset
int offset
Definition packets_gen.h:583
packet_player_diplstate
Definition packets_gen.h:589
packet_player_diplstate::plr1
int plr1
Definition packets_gen.h:591
packet_player_diplstate::type
enum diplstate_type type
Definition packets_gen.h:593
packet_player_diplstate::has_reason_to_cancel
int has_reason_to_cancel
Definition packets_gen.h:595
packet_player_diplstate::turns_left
int turns_left
Definition packets_gen.h:594
packet_player_diplstate::plr2
int plr2
Definition packets_gen.h:592
packet_player_diplstate::contact_turns_left
int contact_turns_left
Definition packets_gen.h:596
packet_player_info
Definition packets_gen.h:508
packet_research_info
Definition packets_gen.h:604
packet_research_info::tech_goal
int tech_goal
Definition packets_gen.h:611
packet_research_info::researching
int researching
Definition packets_gen.h:608
packet_research_info::inventions
char inventions[A_LAST+1]
Definition packets_gen.h:613
packet_research_info::techs_researched
int techs_researched
Definition packets_gen.h:606
packet_research_info::id
int id
Definition packets_gen.h:605
packet_research_info::future_tech
int future_tech
Definition packets_gen.h:607
packet_research_info::bulbs_researched
int bulbs_researched
Definition packets_gen.h:610
packet_research_info::researching_cost
int researching_cost
Definition packets_gen.h:609
packet_research_info::total_bulbs_prod
int total_bulbs_prod
Definition packets_gen.h:612
packet_ruleset_achievement
Definition packets_gen.h:1357
packet_ruleset_achievement::id
int id
Definition packets_gen.h:1358
packet_ruleset_achievement::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1360
packet_ruleset_achievement::unique
bool unique
Definition packets_gen.h:1362
packet_ruleset_achievement::value
int value
Definition packets_gen.h:1363
packet_ruleset_achievement::type
enum achievement_type type
Definition packets_gen.h:1361
packet_ruleset_achievement::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1359
packet_ruleset_action_auto
Definition packets_gen.h:1396
packet_ruleset_action_auto::id
int id
Definition packets_gen.h:1397
packet_ruleset_action_auto::alternatives
action_id alternatives[MAX_NUM_ACTIONS]
Definition packets_gen.h:1402
packet_ruleset_action_auto::reqs_count
int reqs_count
Definition packets_gen.h:1399
packet_ruleset_action_auto::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1400
packet_ruleset_action_auto::alternatives_count
int alternatives_count
Definition packets_gen.h:1401
packet_ruleset_action_auto::cause
enum action_auto_perf_cause cause
Definition packets_gen.h:1398
packet_ruleset_action_enabler
Definition packets_gen.h:1388
packet_ruleset_action_enabler::enabled_action
action_id enabled_action
Definition packets_gen.h:1389
packet_ruleset_action_enabler::actor_reqs_count
int actor_reqs_count
Definition packets_gen.h:1390
packet_ruleset_action_enabler::actor_reqs
struct requirement actor_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1391
packet_ruleset_action_enabler::target_reqs
struct requirement target_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1393
packet_ruleset_action_enabler::target_reqs_count
int target_reqs_count
Definition packets_gen.h:1392
packet_ruleset_action
Definition packets_gen.h:1373
packet_ruleset_action::quiet
bool quiet
Definition packets_gen.h:1376
packet_ruleset_action::sub_tgt_kind
enum action_sub_target_kind sub_tgt_kind
Definition packets_gen.h:1382
packet_ruleset_action::act_kind
enum action_actor_kind act_kind
Definition packets_gen.h:1380
packet_ruleset_action::actor_consuming_always
bool actor_consuming_always
Definition packets_gen.h:1379
packet_ruleset_action::blocked_by
bv_actions blocked_by
Definition packets_gen.h:1385
packet_ruleset_action::max_distance
int max_distance
Definition packets_gen.h:1384
packet_ruleset_action::id
action_id id
Definition packets_gen.h:1374
packet_ruleset_action::min_distance
int min_distance
Definition packets_gen.h:1383
packet_ruleset_action::sub_results
bv_action_sub_results sub_results
Definition packets_gen.h:1378
packet_ruleset_action::ui_name
char ui_name[MAX_LEN_NAME]
Definition packets_gen.h:1375
packet_ruleset_action::tgt_kind
enum action_target_kind tgt_kind
Definition packets_gen.h:1381
packet_ruleset_action::result
enum action_result result
Definition packets_gen.h:1377
packet_ruleset_base
Definition packets_gen.h:1310
packet_ruleset_base::vision_subs_sq
int vision_subs_sq
Definition packets_gen.h:1316
packet_ruleset_base::vision_invis_sq
int vision_invis_sq
Definition packets_gen.h:1315
packet_ruleset_base::border_sq
int border_sq
Definition packets_gen.h:1313
packet_ruleset_base::vision_main_sq
int vision_main_sq
Definition packets_gen.h:1314
packet_ruleset_base::gui_type
enum base_gui_type gui_type
Definition packets_gen.h:1312
packet_ruleset_base::id
int id
Definition packets_gen.h:1311
packet_ruleset_building
Definition packets_gen.h:1175
packet_ruleset_building::flags
bv_impr_flags flags
Definition packets_gen.h:1190
packet_ruleset_building::id
Impr_type_id id
Definition packets_gen.h:1176
packet_ruleset_building::build_cost
int build_cost
Definition packets_gen.h:1187
packet_ruleset_building::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1194
packet_ruleset_building::obs_reqs
struct requirement obs_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1186
packet_ruleset_building::upkeep
int upkeep
Definition packets_gen.h:1188
packet_ruleset_building::soundtag_alt
char soundtag_alt[MAX_LEN_NAME]
Definition packets_gen.h:1192
packet_ruleset_building::reqs_count
int reqs_count
Definition packets_gen.h:1183
packet_ruleset_building::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1184
packet_ruleset_building::genus
enum impr_genus_id genus
Definition packets_gen.h:1177
packet_ruleset_building::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1178
packet_ruleset_building::soundtag
char soundtag[MAX_LEN_NAME]
Definition packets_gen.h:1191
packet_ruleset_building::sabotage
int sabotage
Definition packets_gen.h:1189
packet_ruleset_building::soundtag_alt2
char soundtag_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1193
packet_ruleset_building::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1179
packet_ruleset_building::obs_count
int obs_count
Definition packets_gen.h:1185
packet_ruleset_building::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1182
packet_ruleset_building::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1180
packet_ruleset_building::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1181
packet_ruleset_city
Definition packets_gen.h:1164
packet_ruleset_city::citizens_graphic
char citizens_graphic[MAX_LEN_NAME]
Definition packets_gen.h:1168
packet_ruleset_city::style_id
int style_id
Definition packets_gen.h:1165
packet_ruleset_city::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1166
packet_ruleset_city::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1167
packet_ruleset_city::reqs_count
int reqs_count
Definition packets_gen.h:1169
packet_ruleset_city::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1172
packet_ruleset_city::graphic
char graphic[MAX_LEN_NAME]
Definition packets_gen.h:1171
packet_ruleset_city::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1170
packet_ruleset_clause
Definition packets_gen.h:1439
packet_ruleset_clause::type
enum clause_type type
Definition packets_gen.h:1440
packet_ruleset_clause::receiver_reqs
struct requirement receiver_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1445
packet_ruleset_clause::receiver_reqs_count
int receiver_reqs_count
Definition packets_gen.h:1444
packet_ruleset_clause::giver_reqs_count
int giver_reqs_count
Definition packets_gen.h:1442
packet_ruleset_clause::enabled
bool enabled
Definition packets_gen.h:1441
packet_ruleset_clause::giver_reqs
struct requirement giver_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1443
packet_ruleset_control
Definition packets_gen.h:1448
packet_ruleset_control::preferred_soundset
char preferred_soundset[MAX_LEN_NAME]
Definition packets_gen.h:1472
packet_ruleset_control::num_styles
int num_styles
Definition packets_gen.h:1462
packet_ruleset_control::nation_count
int nation_count
Definition packets_gen.h:1465
packet_ruleset_control::preferred_tileset
char preferred_tileset[MAX_LEN_NAME]
Definition packets_gen.h:1471
packet_ruleset_control::num_music_styles
int num_music_styles
Definition packets_gen.h:1463
packet_ruleset_control::government_count
int government_count
Definition packets_gen.h:1464
packet_ruleset_control::num_achievement_types
int num_achievement_types
Definition packets_gen.h:1460
packet_ruleset_control::preferred_musicset
char preferred_musicset[MAX_LEN_NAME]
Definition packets_gen.h:1473
packet_ruleset_control::num_tech_classes
int num_tech_classes
Definition packets_gen.h:1452
packet_ruleset_control::num_city_styles
int num_city_styles
Definition packets_gen.h:1466
packet_ruleset_control::num_multipliers
int num_multipliers
Definition packets_gen.h:1461
packet_ruleset_control::desc_length
int desc_length
Definition packets_gen.h:1478
packet_ruleset_counter
Definition packets_gen.h:1405
packet_ruleset_counter::checkpoint
int checkpoint
Definition packets_gen.h:1410
packet_ruleset_counter::behaviour
enum counter_behaviour behaviour
Definition packets_gen.h:1412
packet_ruleset_counter::type
enum counter_target type
Definition packets_gen.h:1411
packet_ruleset_counter::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1406
packet_ruleset_counter::def
int def
Definition packets_gen.h:1409
packet_ruleset_counter::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1407
packet_ruleset_counter::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1408
packet_ruleset_description_part
Definition packets_gen.h:1486
packet_ruleset_description_part::text
char text[MAX_LEN_CONTENT]
Definition packets_gen.h:1487
packet_ruleset_disaster
Definition packets_gen.h:1347
packet_ruleset_disaster::frequency
int frequency
Definition packets_gen.h:1353
packet_ruleset_disaster::id
int id
Definition packets_gen.h:1348
packet_ruleset_disaster::reqs_count
int reqs_count
Definition packets_gen.h:1351
packet_ruleset_disaster::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1350
packet_ruleset_disaster::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1352
packet_ruleset_disaster::effects
bv_disaster_effects effects
Definition packets_gen.h:1354
packet_ruleset_disaster::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1349
packet_ruleset_effect
Definition packets_gen.h:1589
packet_ruleset_extra_flag
Definition packets_gen.h:1304
packet_ruleset_extra_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1307
packet_ruleset_extra_flag::id
int id
Definition packets_gen.h:1305
packet_ruleset_extra_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1306
packet_ruleset_extra
Definition packets_gen.h:1260
packet_ruleset_extra::id
int id
Definition packets_gen.h:1261
packet_ruleset_extra::removal_time
int removal_time
Definition packets_gen.h:1290
packet_ruleset_extra::defense_bonus
int defense_bonus
Definition packets_gen.h:1293
packet_ruleset_extra::infracost
int infracost
Definition packets_gen.h:1292
packet_ruleset_extra::native_to
bv_unit_classes native_to
Definition packets_gen.h:1295
packet_ruleset_extra::appearance_reqs_count
int appearance_reqs_count
Definition packets_gen.h:1280
packet_ruleset_extra::build_time_factor
int build_time_factor
Definition packets_gen.h:1289
packet_ruleset_extra::rmact_gfx_alt2
char rmact_gfx_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1272
packet_ruleset_extra::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1276
packet_ruleset_extra::generated
bool generated
Definition packets_gen.h:1287
packet_ruleset_extra::disappearance_reqs_count
int disappearance_reqs_count
Definition packets_gen.h:1283
packet_ruleset_extra::appearance_chance
int appearance_chance
Definition packets_gen.h:1279
packet_ruleset_extra::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1274
packet_ruleset_extra::rmcauses
bv_rmcauses rmcauses
Definition packets_gen.h:1266
packet_ruleset_extra::act_gfx_alt2
char act_gfx_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1269
packet_ruleset_extra::removal_time_factor
int removal_time_factor
Definition packets_gen.h:1291
packet_ruleset_extra::reqs_count
int reqs_count
Definition packets_gen.h:1275
packet_ruleset_extra::buildable
bool buildable
Definition packets_gen.h:1286
packet_ruleset_extra::disappearance_reqs
struct requirement disappearance_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1284
packet_ruleset_extra::flags
bv_extra_flags flags
Definition packets_gen.h:1296
packet_ruleset_extra::act_gfx_alt
char act_gfx_alt[MAX_LEN_NAME]
Definition packets_gen.h:1268
packet_ruleset_extra::hidden_by
bv_extras hidden_by
Definition packets_gen.h:1297
packet_ruleset_extra::activity_gfx
char activity_gfx[MAX_LEN_NAME]
Definition packets_gen.h:1267
packet_ruleset_extra::build_time
int build_time
Definition packets_gen.h:1288
packet_ruleset_extra::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1263
packet_ruleset_extra::eus
enum extra_unit_seen_type eus
Definition packets_gen.h:1294
packet_ruleset_extra::appearance_reqs
struct requirement appearance_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1281
packet_ruleset_extra::category
int category
Definition packets_gen.h:1264
packet_ruleset_extra::disappearance_chance
int disappearance_chance
Definition packets_gen.h:1282
packet_ruleset_extra::rmreqs_count
int rmreqs_count
Definition packets_gen.h:1277
packet_ruleset_extra::bridged_over
bv_extras bridged_over
Definition packets_gen.h:1298
packet_ruleset_extra::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1262
packet_ruleset_extra::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1273
packet_ruleset_extra::no_aggr_near_city
int no_aggr_near_city
Definition packets_gen.h:1300
packet_ruleset_extra::rmact_gfx_alt
char rmact_gfx_alt[MAX_LEN_NAME]
Definition packets_gen.h:1271
packet_ruleset_extra::rmact_gfx
char rmact_gfx[MAX_LEN_NAME]
Definition packets_gen.h:1270
packet_ruleset_extra::conflicts
bv_extras conflicts
Definition packets_gen.h:1299
packet_ruleset_extra::rmreqs
struct requirement rmreqs[MAX_NUM_REQS]
Definition packets_gen.h:1278
packet_ruleset_extra::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1301
packet_ruleset_extra::visibility_req
int visibility_req
Definition packets_gen.h:1285
packet_ruleset_extra::causes
bv_causes causes
Definition packets_gen.h:1265
packet_ruleset_game
Definition packets_gen.h:1015
packet_ruleset_game::work_raise_chance
int work_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:1026
packet_ruleset_game::base_raise_chance
int base_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:1025
packet_ruleset_game::global_init_techs
int global_init_techs[MAX_NUM_TECH_LIST]
Definition packets_gen.h:1018
packet_ruleset_game::veteran_levels
int veteran_levels
Definition packets_gen.h:1021
packet_ruleset_game::move_bonus
int move_bonus[MAX_VET_LEVELS]
Definition packets_gen.h:1024
packet_ruleset_game::background_red
int background_red
Definition packets_gen.h:1027
packet_ruleset_game::veteran_name
char veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]
Definition packets_gen.h:1022
packet_ruleset_game::global_init_buildings
Impr_type_id global_init_buildings[MAX_NUM_BUILDING_LIST]
Definition packets_gen.h:1020
packet_ruleset_game::default_specialist
int default_specialist
Definition packets_gen.h:1016
packet_ruleset_game::background_green
int background_green
Definition packets_gen.h:1028
packet_ruleset_game::power_fact
int power_fact[MAX_VET_LEVELS]
Definition packets_gen.h:1023
packet_ruleset_game::background_blue
int background_blue
Definition packets_gen.h:1029
packet_ruleset_goods
Definition packets_gen.h:1334
packet_ruleset_goods::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1344
packet_ruleset_goods::flags
bv_goods_flags flags
Definition packets_gen.h:1343
packet_ruleset_goods::from_pct
int from_pct
Definition packets_gen.h:1340
packet_ruleset_goods::onetime_pct
int onetime_pct
Definition packets_gen.h:1342
packet_ruleset_goods::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1336
packet_ruleset_goods::reqs_count
int reqs_count
Definition packets_gen.h:1338
packet_ruleset_goods::to_pct
int to_pct
Definition packets_gen.h:1341
packet_ruleset_goods::id
int id
Definition packets_gen.h:1335
packet_ruleset_goods::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1337
packet_ruleset_goods::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1339
packet_ruleset_government_ruler_title
Definition packets_gen.h:1044
packet_ruleset_government_ruler_title::nation
Nation_type_id nation
Definition packets_gen.h:1046
packet_ruleset_government_ruler_title::female_title
char female_title[MAX_LEN_NAME]
Definition packets_gen.h:1048
packet_ruleset_government_ruler_title::gov
Government_type_id gov
Definition packets_gen.h:1045
packet_ruleset_government_ruler_title::male_title
char male_title[MAX_LEN_NAME]
Definition packets_gen.h:1047
packet_ruleset_government
Definition packets_gen.h:1081
packet_ruleset_government::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1088
packet_ruleset_government::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1086
packet_ruleset_government::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1085
packet_ruleset_government::id
Government_type_id id
Definition packets_gen.h:1082
packet_ruleset_government::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1087
packet_ruleset_government::reqs_count
int reqs_count
Definition packets_gen.h:1083
packet_ruleset_government::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1084
packet_ruleset_government::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1089
packet_ruleset_impr_flag
Definition packets_gen.h:1197
packet_ruleset_impr_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1199
packet_ruleset_impr_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1200
packet_ruleset_impr_flag::id
int id
Definition packets_gen.h:1198
packet_ruleset_multiplier
Definition packets_gen.h:1423
packet_ruleset_multiplier::stop
int stop
Definition packets_gen.h:1426
packet_ruleset_multiplier::step
int step
Definition packets_gen.h:1427
packet_ruleset_multiplier::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1432
packet_ruleset_multiplier::id
Multiplier_type_id id
Definition packets_gen.h:1424
packet_ruleset_multiplier::offset
int offset
Definition packets_gen.h:1429
packet_ruleset_multiplier::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1435
packet_ruleset_multiplier::def
int def
Definition packets_gen.h:1428
packet_ruleset_multiplier::start
int start
Definition packets_gen.h:1425
packet_ruleset_multiplier::minimum_turns
int minimum_turns
Definition packets_gen.h:1431
packet_ruleset_multiplier::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1433
packet_ruleset_multiplier::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1436
packet_ruleset_multiplier::factor
int factor
Definition packets_gen.h:1430
packet_ruleset_multiplier::reqs_count
int reqs_count
Definition packets_gen.h:1434
packet_ruleset_music
Definition packets_gen.h:1415
packet_ruleset_music::music_combat
char music_combat[MAX_LEN_NAME]
Definition packets_gen.h:1418
packet_ruleset_music::id
int id
Definition packets_gen.h:1416
packet_ruleset_music::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1420
packet_ruleset_music::reqs_count
int reqs_count
Definition packets_gen.h:1419
packet_ruleset_music::music_peaceful
char music_peaceful[MAX_LEN_NAME]
Definition packets_gen.h:1417
packet_ruleset_nation_groups
Definition packets_gen.h:1118
packet_ruleset_nation_groups::ngroups
int ngroups
Definition packets_gen.h:1119
packet_ruleset_nation_groups::groups
char groups[MAX_NUM_NATION_GROUPS][MAX_LEN_NAME]
Definition packets_gen.h:1120
packet_ruleset_nation_groups::hidden
bool hidden[MAX_NUM_NATION_GROUPS]
Definition packets_gen.h:1121
packet_ruleset_nation_sets
Definition packets_gen.h:1111
packet_ruleset_nation_sets::rule_names
char rule_names[MAX_NUM_NATION_SETS][MAX_LEN_NAME]
Definition packets_gen.h:1114
packet_ruleset_nation_sets::names
char names[MAX_NUM_NATION_SETS][MAX_LEN_NAME]
Definition packets_gen.h:1113
packet_ruleset_nation_sets::nsets
int nsets
Definition packets_gen.h:1112
packet_ruleset_nation_sets::descriptions
char descriptions[MAX_NUM_NATION_SETS][MAX_LEN_MSG]
Definition packets_gen.h:1115
packet_ruleset_nation
Definition packets_gen.h:1124
packet_ruleset_nation::ngroups
int ngroups
Definition packets_gen.h:1141
packet_ruleset_nation::init_techs
int init_techs[MAX_NUM_TECH_LIST]
Definition packets_gen.h:1145
packet_ruleset_nation::leader_name
char leader_name[MAX_NUM_LEADERS][MAX_LEN_NAME]
Definition packets_gen.h:1135
packet_ruleset_nation::style
int style
Definition packets_gen.h:1133
packet_ruleset_nation::is_playable
bool is_playable
Definition packets_gen.h:1137
packet_ruleset_nation::id
Nation_type_id id
Definition packets_gen.h:1125
packet_ruleset_nation::noun_plural
char noun_plural[MAX_LEN_NAME]
Definition packets_gen.h:1129
packet_ruleset_nation::adjective
char adjective[MAX_LEN_NAME]
Definition packets_gen.h:1127
packet_ruleset_nation::init_buildings
Impr_type_id init_buildings[MAX_NUM_BUILDING_LIST]
Definition packets_gen.h:1149
packet_ruleset_nation::init_units
Unit_type_id init_units[MAX_NUM_UNIT_LIST]
Definition packets_gen.h:1147
packet_ruleset_nation::leader_is_male
bool leader_is_male[MAX_NUM_LEADERS]
Definition packets_gen.h:1136
packet_ruleset_nation::translation_domain
char translation_domain[MAX_LEN_NAME]
Definition packets_gen.h:1126
packet_ruleset_nation::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1130
packet_ruleset_nation::init_government_id
Government_type_id init_government_id
Definition packets_gen.h:1143
packet_ruleset_nation::leader_count
int leader_count
Definition packets_gen.h:1134
packet_ruleset_nation::groups
int groups[MAX_NUM_NATION_GROUPS]
Definition packets_gen.h:1142
packet_ruleset_nation::barbarian_type
enum barbarian_type barbarian_type
Definition packets_gen.h:1138
packet_ruleset_nation::sets
int sets[MAX_NUM_NATION_SETS]
Definition packets_gen.h:1140
packet_ruleset_nation::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1131
packet_ruleset_nation::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1128
packet_ruleset_nation::legend
char legend[MAX_LEN_MSG]
Definition packets_gen.h:1132
packet_ruleset_nation::nsets
int nsets
Definition packets_gen.h:1139
packet_ruleset_resource
Definition packets_gen.h:1598
packet_ruleset_resource::id
int id
Definition packets_gen.h:1599
packet_ruleset_resource::output
int output[O_LAST]
Definition packets_gen.h:1600
packet_ruleset_road
Definition packets_gen.h:1319
packet_ruleset_road::flags
bv_road_flags flags
Definition packets_gen.h:1331
packet_ruleset_road::tile_incr_const
int tile_incr_const[O_LAST]
Definition packets_gen.h:1326
packet_ruleset_road::gui_type
enum road_gui_type gui_type
Definition packets_gen.h:1321
packet_ruleset_road::integrates
bv_max_extras integrates
Definition packets_gen.h:1330
packet_ruleset_road::move_cost
int move_cost
Definition packets_gen.h:1324
packet_ruleset_road::compat
enum road_compat compat
Definition packets_gen.h:1329
packet_ruleset_road::move_mode
enum road_move_mode move_mode
Definition packets_gen.h:1325
packet_ruleset_road::first_reqs_count
int first_reqs_count
Definition packets_gen.h:1322
packet_ruleset_road::tile_bonus
int tile_bonus[O_LAST]
Definition packets_gen.h:1328
packet_ruleset_road::tile_incr
int tile_incr[O_LAST]
Definition packets_gen.h:1327
packet_ruleset_road::id
int id
Definition packets_gen.h:1320
packet_ruleset_road::first_reqs
struct requirement first_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1323
packet_ruleset_specialist
Definition packets_gen.h:1032
packet_ruleset_specialist::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1035
packet_ruleset_specialist::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1038
packet_ruleset_specialist::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1040
packet_ruleset_specialist::id
Specialist_type_id id
Definition packets_gen.h:1033
packet_ruleset_specialist::reqs_count
int reqs_count
Definition packets_gen.h:1039
packet_ruleset_specialist::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1041
packet_ruleset_specialist::short_name
char short_name[MAX_LEN_NAME]
Definition packets_gen.h:1036
packet_ruleset_specialist::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1037
packet_ruleset_specialist::plural_name
char plural_name[MAX_LEN_NAME]
Definition packets_gen.h:1034
packet_ruleset_style
Definition packets_gen.h:1158
packet_ruleset_style::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1160
packet_ruleset_style::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1161
packet_ruleset_style::id
int id
Definition packets_gen.h:1159
packet_ruleset_summary
Definition packets_gen.h:1482
packet_ruleset_summary::text
char text[MAX_LEN_CONTENT]
Definition packets_gen.h:1483
packet_ruleset_tech_class
Definition packets_gen.h:1068
packet_ruleset_tech_class::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1070
packet_ruleset_tech_class::id
int id
Definition packets_gen.h:1069
packet_ruleset_tech_class::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1071
packet_ruleset_tech_class::cost_pct
int cost_pct
Definition packets_gen.h:1072
packet_ruleset_tech_flag
Definition packets_gen.h:1075
packet_ruleset_tech_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1077
packet_ruleset_tech_flag::id
int id
Definition packets_gen.h:1076
packet_ruleset_tech_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1078
packet_ruleset_tech
Definition packets_gen.h:1051
packet_ruleset_tech::research_reqs_count
int research_reqs_count
Definition packets_gen.h:1054
packet_ruleset_tech::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1061
packet_ruleset_tech::removed
bool removed
Definition packets_gen.h:1057
packet_ruleset_tech::research_reqs
struct requirement research_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1055
packet_ruleset_tech::id
int id
Definition packets_gen.h:1052
packet_ruleset_tech::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1064
packet_ruleset_tech::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1062
packet_ruleset_tech::num_reqs
int num_reqs
Definition packets_gen.h:1060
packet_ruleset_tech::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1065
packet_ruleset_tech::flags
bv_tech_flags flags
Definition packets_gen.h:1058
packet_ruleset_tech::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1063
packet_ruleset_tech::tclass
int tclass
Definition packets_gen.h:1056
packet_ruleset_tech::root_req
int root_req
Definition packets_gen.h:1053
packet_ruleset_tech::cost
float cost
Definition packets_gen.h:1059
packet_ruleset_terrain_control
Definition packets_gen.h:1092
packet_ruleset_terrain_flag
Definition packets_gen.h:1243
packet_ruleset_terrain_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1245
packet_ruleset_terrain_flag::id
int id
Definition packets_gen.h:1244
packet_ruleset_terrain_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1246
packet_ruleset_terrain
Definition packets_gen.h:1203
packet_ruleset_terrain::extra_removal_times
int extra_removal_times[MAX_EXTRA_TYPES]
Definition packets_gen.h:1236
packet_ruleset_terrain::cultivate_time
int cultivate_time
Definition packets_gen.h:1223
packet_ruleset_terrain::irrigation_food_incr
int irrigation_food_incr
Definition packets_gen.h:1226
packet_ruleset_terrain::base_time
int base_time
Definition packets_gen.h:1220
packet_ruleset_terrain::transform_result
Terrain_type_id transform_result
Definition packets_gen.h:1231
packet_ruleset_terrain::tclass
int tclass
Definition packets_gen.h:1205
packet_ruleset_terrain::extra_count
int extra_count
Definition packets_gen.h:1235
packet_ruleset_terrain::mining_shield_incr
int mining_shield_incr
Definition packets_gen.h:1228
packet_ruleset_terrain::resource_freq
int resource_freq[MAX_EXTRA_TYPES]
Definition packets_gen.h:1218
packet_ruleset_terrain::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1240
packet_ruleset_terrain::resources
Resource_type_id resources[MAX_EXTRA_TYPES]
Definition packets_gen.h:1217
packet_ruleset_terrain::irrigation_time
int irrigation_time
Definition packets_gen.h:1227
packet_ruleset_terrain::placing_time
int placing_time
Definition packets_gen.h:1233
packet_ruleset_terrain::flags
bv_terrain_flags flags
Definition packets_gen.h:1206
packet_ruleset_terrain::transform_time
int transform_time
Definition packets_gen.h:1232
packet_ruleset_terrain::defense_bonus
int defense_bonus
Definition packets_gen.h:1214
packet_ruleset_terrain::plant_time
int plant_time
Definition packets_gen.h:1225
packet_ruleset_terrain::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1210
packet_ruleset_terrain::num_resources
int num_resources
Definition packets_gen.h:1216
packet_ruleset_terrain::output
int output[O_LAST]
Definition packets_gen.h:1215
packet_ruleset_terrain::animal
int animal
Definition packets_gen.h:1230
packet_ruleset_terrain::color_red
int color_red
Definition packets_gen.h:1237
packet_ruleset_terrain::native_to
bv_unit_classes native_to
Definition packets_gen.h:1207
packet_ruleset_terrain::pillage_time
int pillage_time
Definition packets_gen.h:1234
packet_ruleset_terrain::cultivate_result
Terrain_type_id cultivate_result
Definition packets_gen.h:1222
packet_ruleset_terrain::color_green
int color_green
Definition packets_gen.h:1238
packet_ruleset_terrain::road_time
int road_time
Definition packets_gen.h:1221
packet_ruleset_terrain::plant_result
Terrain_type_id plant_result
Definition packets_gen.h:1224
packet_ruleset_terrain::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1208
packet_ruleset_terrain::road_output_incr_pct
int road_output_incr_pct[O_LAST]
Definition packets_gen.h:1219
packet_ruleset_terrain::movement_cost
int movement_cost
Definition packets_gen.h:1213
packet_ruleset_terrain::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1211
packet_ruleset_terrain::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1212
packet_ruleset_terrain::mining_time
int mining_time
Definition packets_gen.h:1229
packet_ruleset_terrain::id
Terrain_type_id id
Definition packets_gen.h:1204
packet_ruleset_terrain::color_blue
int color_blue
Definition packets_gen.h:1239
packet_ruleset_terrain::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1209
packet_ruleset_trade
Definition packets_gen.h:1366
packet_ruleset_trade::cancelling
enum trade_route_illegal_cancelling cancelling
Definition packets_gen.h:1369
packet_ruleset_trade::trade_pct
int trade_pct
Definition packets_gen.h:1368
packet_ruleset_trade::id
int id
Definition packets_gen.h:1367
packet_ruleset_trade::bonus_type
enum trade_route_bonus_type bonus_type
Definition packets_gen.h:1370
packet_ruleset_unit_bonus
Definition packets_gen.h:995
packet_ruleset_unit_bonus::type
enum combat_bonus_type type
Definition packets_gen.h:998
packet_ruleset_unit_bonus::unit
Unit_type_id unit
Definition packets_gen.h:996
packet_ruleset_unit_bonus::quiet
bool quiet
Definition packets_gen.h:1000
packet_ruleset_unit_bonus::value
int value
Definition packets_gen.h:999
packet_ruleset_unit_bonus::flag
enum unit_type_flag_id flag
Definition packets_gen.h:997
packet_ruleset_unit_class_flag
Definition packets_gen.h:1009
packet_ruleset_unit_class_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1011
packet_ruleset_unit_class_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1012
packet_ruleset_unit_class_flag::id
int id
Definition packets_gen.h:1010
packet_ruleset_unit_class
Definition packets_gen.h:1249
packet_ruleset_unit_class::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1252
packet_ruleset_unit_class::flags
bv_unit_class_flags flags
Definition packets_gen.h:1256
packet_ruleset_unit_class::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1251
packet_ruleset_unit_class::non_native_def_pct
int non_native_def_pct
Definition packets_gen.h:1255
packet_ruleset_unit_class::hp_loss_pct
int hp_loss_pct
Definition packets_gen.h:1254
packet_ruleset_unit_class::id
int id
Definition packets_gen.h:1250
packet_ruleset_unit_class::min_speed
int min_speed
Definition packets_gen.h:1253
packet_ruleset_unit_class::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1257
packet_ruleset_unit_flag
Definition packets_gen.h:1003
packet_ruleset_unit_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1005
packet_ruleset_unit_flag::id
int id
Definition packets_gen.h:1004
packet_ruleset_unit_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1006
packet_ruleset_unit
Definition packets_gen.h:944
packet_ruleset_unit::paratroopers_range
int paratroopers_range
Definition packets_gen.h:973
packet_ruleset_unit::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:949
packet_ruleset_unit::vlayer
enum vision_layer vlayer
Definition packets_gen.h:988
packet_ruleset_unit::tp_defense
enum transp_def_type tp_defense
Definition packets_gen.h:983
packet_ruleset_unit::unit_class_id
int unit_class_id
Definition packets_gen.h:955
packet_ruleset_unit::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:947
packet_ruleset_unit::vision_radius_sq
int vision_radius_sq
Definition packets_gen.h:963
packet_ruleset_unit::obsoleted_by
int obsoleted_by
Definition packets_gen.h:967
packet_ruleset_unit::upkeep
int upkeep[O_LAST]
Definition packets_gen.h:972
packet_ruleset_unit::power_fact
int power_fact[MAX_VET_LEVELS]
Definition packets_gen.h:976
packet_ruleset_unit::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:946
packet_ruleset_unit::hp
int hp
Definition packets_gen.h:965
packet_ruleset_unit::pop_cost
int pop_cost
Definition packets_gen.h:957
packet_ruleset_unit::city_slots
int city_slots
Definition packets_gen.h:982
packet_ruleset_unit::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition packets_gen.h:950
packet_ruleset_unit::firepower
int firepower
Definition packets_gen.h:966
packet_ruleset_unit::fuel
int fuel
Definition packets_gen.h:970
packet_ruleset_unit::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:948
packet_ruleset_unit::convert_time
int convert_time
Definition packets_gen.h:969
packet_ruleset_unit::sound_fight_alt
char sound_fight_alt[MAX_LEN_NAME]
Definition packets_gen.h:954
packet_ruleset_unit::disembarks
bv_unit_classes disembarks
Definition packets_gen.h:987
packet_ruleset_unit::veteran_levels
int veteran_levels
Definition packets_gen.h:974
packet_ruleset_unit::move_rate
int move_rate
Definition packets_gen.h:960
packet_ruleset_unit::attack_strength
int attack_strength
Definition packets_gen.h:958
packet_ruleset_unit::cargo
bv_unit_classes cargo
Definition packets_gen.h:984
packet_ruleset_unit::build_cost
int build_cost
Definition packets_gen.h:956
packet_ruleset_unit::transport_capacity
int transport_capacity
Definition packets_gen.h:964
packet_ruleset_unit::flags
bv_unit_type_flags flags
Definition packets_gen.h:990
packet_ruleset_unit::sound_move_alt
char sound_move_alt[MAX_LEN_NAME]
Definition packets_gen.h:952
packet_ruleset_unit::happy_cost
int happy_cost
Definition packets_gen.h:971
packet_ruleset_unit::worker
bool worker
Definition packets_gen.h:992
packet_ruleset_unit::targets
bv_unit_classes targets
Definition packets_gen.h:985
packet_ruleset_unit::defense_strength
int defense_strength
Definition packets_gen.h:959
packet_ruleset_unit::build_reqs
struct requirement build_reqs[MAX_NUM_REQS]
Definition packets_gen.h:962
packet_ruleset_unit::base_raise_chance
int base_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:978
packet_ruleset_unit::work_raise_chance
int work_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:979
packet_ruleset_unit::sound_fight
char sound_fight[MAX_LEN_NAME]
Definition packets_gen.h:953
packet_ruleset_unit::embarks
bv_unit_classes embarks
Definition packets_gen.h:986
packet_ruleset_unit::build_reqs_count
int build_reqs_count
Definition packets_gen.h:961
packet_ruleset_unit::city_size
int city_size
Definition packets_gen.h:981
packet_ruleset_unit::bombard_rate
int bombard_rate
Definition packets_gen.h:980
packet_ruleset_unit::veteran_name
char veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]
Definition packets_gen.h:975
packet_ruleset_unit::converted_to
int converted_to
Definition packets_gen.h:968
packet_ruleset_unit::sound_move
char sound_move[MAX_LEN_NAME]
Definition packets_gen.h:951
packet_ruleset_unit::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:989
packet_ruleset_unit::roles
bv_unit_type_roles roles
Definition packets_gen.h:991
packet_ruleset_unit::id
Unit_type_id id
Definition packets_gen.h:945
packet_ruleset_unit::move_bonus
int move_bonus[MAX_VET_LEVELS]
Definition packets_gen.h:977
packet_scenario_description::description
char description[MAX_LEN_CONTENT]
Definition packets_gen.h:1621
packet_scenario_info
Definition packets_gen.h:1603
packet_scenario_info::lake_flooding
bool lake_flooding
Definition packets_gen.h:1611
packet_scenario_info::have_resources
bool have_resources
Definition packets_gen.h:1616
packet_scenario_info::is_scenario
bool is_scenario
Definition packets_gen.h:1604
packet_scenario_info::ruleset_locked
bool ruleset_locked
Definition packets_gen.h:1614
packet_scenario_info::allow_ai_type_fallback
bool allow_ai_type_fallback
Definition packets_gen.h:1613
packet_scenario_info::players
bool players
Definition packets_gen.h:1607
packet_scenario_info::authors
char authors[MAX_LEN_PACKET/3]
Definition packets_gen.h:1606
packet_scenario_info::name
char name[256]
Definition packets_gen.h:1605
packet_scenario_info::prevent_new_cities
bool prevent_new_cities
Definition packets_gen.h:1610
packet_scenario_info::handmade
bool handmade
Definition packets_gen.h:1612
packet_scenario_info::startpos_nations
bool startpos_nations
Definition packets_gen.h:1608
packet_scenario_info::save_random
bool save_random
Definition packets_gen.h:1609
packet_spaceship_info
Definition packets_gen.h:923
packet_spaceship_info::sship_state
int sship_state
Definition packets_gen.h:925
packet_spaceship_info::propulsion
int propulsion
Definition packets_gen.h:930
packet_spaceship_info::habitation
int habitation
Definition packets_gen.h:931
packet_spaceship_info::mass
int mass
Definition packets_gen.h:936
packet_spaceship_info::life_support
int life_support
Definition packets_gen.h:932
packet_spaceship_info::structure
bv_spaceship_structure structure
Definition packets_gen.h:937
packet_spaceship_info::structurals
int structurals
Definition packets_gen.h:926
packet_spaceship_info::fuel
int fuel
Definition packets_gen.h:929
packet_spaceship_info::population
int population
Definition packets_gen.h:935
packet_spaceship_info::success_rate
float success_rate
Definition packets_gen.h:940
packet_spaceship_info::player_num
int player_num
Definition packets_gen.h:924
packet_spaceship_info::launch_year
int launch_year
Definition packets_gen.h:934
packet_spaceship_info::travel_time
float travel_time
Definition packets_gen.h:941
packet_spaceship_info::energy_rate
float energy_rate
Definition packets_gen.h:939
packet_spaceship_info::solar_panels
int solar_panels
Definition packets_gen.h:933
packet_spaceship_info::support_rate
float support_rate
Definition packets_gen.h:938
packet_spaceship_info::modules
int modules
Definition packets_gen.h:928
packet_spaceship_info::components
int components
Definition packets_gen.h:927
packet_tile_info
Definition packets_gen.h:99
packet_tile_info::resource
Resource_type_id resource
Definition packets_gen.h:107
packet_tile_info::extras
bv_extras extras
Definition packets_gen.h:108
packet_tile_info::place_turn
int place_turn
Definition packets_gen.h:110
packet_tile_info::placing
int placing
Definition packets_gen.h:109
packet_tile_info::owner
int owner
Definition packets_gen.h:103
packet_tile_info::known
enum known_type known
Definition packets_gen.h:102
packet_tile_info::label
char label[MAX_LEN_MAP_LABEL]
Definition packets_gen.h:112
packet_tile_info::extras_owner
int extras_owner
Definition packets_gen.h:104
packet_tile_info::tile
int tile
Definition packets_gen.h:100
packet_tile_info::continent
Continent_id continent
Definition packets_gen.h:101
packet_tile_info::terrain
Terrain_type_id terrain
Definition packets_gen.h:106
packet_tile_info::worked
int worked
Definition packets_gen.h:105
packet_tile_info::spec_sprite
char spec_sprite[MAX_LEN_NAME]
Definition packets_gen.h:111
packet_timeout_info::last_turn_change_time
float last_turn_change_time
Definition packets_gen.h:264
packet_trade_route_info
Definition packets_gen.h:412
packet_trade_route_info::city
int city
Definition packets_gen.h:413
packet_trade_route_info::value
int value
Definition packets_gen.h:416
packet_trade_route_info::partner
int partner
Definition packets_gen.h:415
packet_trade_route_info::goods
Goods_type_id goods
Definition packets_gen.h:418
packet_trade_route_info::direction
enum route_direction direction
Definition packets_gen.h:417
packet_trade_route_info::index
int index
Definition packets_gen.h:414
packet_unit_actions
Definition packets_gen.h:755
packet_unit_actions::target_unit_id
int target_unit_id
Definition packets_gen.h:757
packet_unit_actions::target_city_id
int target_city_id
Definition packets_gen.h:758
packet_unit_actions::action_probabilities
struct act_prob action_probabilities[MAX_NUM_ACTIONS]
Definition packets_gen.h:762
packet_unit_actions::target_extra_id
int target_extra_id
Definition packets_gen.h:760
packet_unit_actions::request_kind
int request_kind
Definition packets_gen.h:761
packet_unit_actions::actor_unit_id
int actor_unit_id
Definition packets_gen.h:756
packet_unit_actions::target_tile_id
int target_tile_id
Definition packets_gen.h:759
packet_unit_combat_info
Definition packets_gen.h:690
packet_unit_combat_info::defender_hp
int defender_hp
Definition packets_gen.h:694
packet_unit_combat_info::attacker_hp
int attacker_hp
Definition packets_gen.h:693
packet_unit_combat_info::make_att_veteran
bool make_att_veteran
Definition packets_gen.h:695
packet_unit_combat_info::make_def_veteran
bool make_def_veteran
Definition packets_gen.h:696
packet_unit_combat_info::attacker_unit_id
int attacker_unit_id
Definition packets_gen.h:691
packet_unit_combat_info::defender_unit_id
int defender_unit_id
Definition packets_gen.h:692
packet_unit_info
Definition packets_gen.h:632
packet_unit_info::movesleft
int movesleft
Definition packets_gen.h:652
packet_unit_info::upkeep
int upkeep[O_LAST]
Definition packets_gen.h:639
packet_unit_info::carrying
int carrying
Definition packets_gen.h:651
packet_unit_info::action_decision_want
enum action_decision action_decision_want
Definition packets_gen.h:669
packet_unit_info::owner
int owner
Definition packets_gen.h:634
packet_unit_info::has_orders
bool has_orders
Definition packets_gen.h:663
packet_unit_info::orders
struct unit_order orders[MAX_LEN_ROUTE]
Definition packets_gen.h:668
packet_unit_info::fuel
int fuel
Definition packets_gen.h:654
packet_unit_info::activity
enum unit_activity activity
Definition packets_gen.h:658
packet_unit_info::activity_tgt
int activity_tgt
Definition packets_gen.h:659
packet_unit_info::current_form_turn
int current_form_turn
Definition packets_gen.h:648
packet_unit_info::nationality
int nationality
Definition packets_gen.h:635
packet_unit_info::transported
bool transported
Definition packets_gen.h:644
packet_unit_info::goto_tile
int goto_tile
Definition packets_gen.h:657
packet_unit_info::orders_index
int orders_index
Definition packets_gen.h:665
packet_unit_info::type
Unit_type_id type
Definition packets_gen.h:649
packet_unit_info::changed_from
enum unit_activity changed_from
Definition packets_gen.h:660
packet_unit_info::homecity
int homecity
Definition packets_gen.h:638
packet_unit_info::orders_length
int orders_length
Definition packets_gen.h:664
packet_unit_info::transported_by
int transported_by
Definition packets_gen.h:650
packet_unit_info::veteran
int veteran
Definition packets_gen.h:640
packet_unit_info::orders_repeat
bool orders_repeat
Definition packets_gen.h:666
packet_unit_info::activity_count
int activity_count
Definition packets_gen.h:655
packet_unit_info::id
int id
Definition packets_gen.h:633
packet_unit_info::occupied
bool occupied
Definition packets_gen.h:643
packet_unit_info::action_decision_tile
int action_decision_tile
Definition packets_gen.h:670
packet_unit_info::battlegroup
int battlegroup
Definition packets_gen.h:662
packet_unit_info::facing
enum direction8 facing
Definition packets_gen.h:637
packet_unit_info::orders_vigilant
bool orders_vigilant
Definition packets_gen.h:667
packet_unit_info::hp
int hp
Definition packets_gen.h:653
packet_unit_info::changed_from_count
int changed_from_count
Definition packets_gen.h:656
packet_unit_info::stay
bool stay
Definition packets_gen.h:646
packet_unit_info::tile
int tile
Definition packets_gen.h:636
packet_unit_info::birth_turn
int birth_turn
Definition packets_gen.h:647
packet_unit_info::ssa_controller
enum server_side_agent ssa_controller
Definition packets_gen.h:641
packet_unit_info::done_moving
bool done_moving
Definition packets_gen.h:645
packet_unit_info::paradropped
bool paradropped
Definition packets_gen.h:642
packet_unit_info::changed_from_tgt
int changed_from_tgt
Definition packets_gen.h:661
packet_unit_short_info
Definition packets_gen.h:673
packet_unit_short_info::activity
int activity
Definition packets_gen.h:683
packet_unit_short_info::packet_use
int packet_use
Definition packets_gen.h:686
packet_unit_short_info::tile
int tile
Definition packets_gen.h:676
packet_unit_short_info::transported
bool transported
Definition packets_gen.h:681
packet_unit_short_info::hp
int hp
Definition packets_gen.h:682
packet_unit_short_info::id
int id
Definition packets_gen.h:674
packet_unit_short_info::veteran
int veteran
Definition packets_gen.h:679
packet_unit_short_info::info_city_id
int info_city_id
Definition packets_gen.h:687
packet_unit_short_info::type
Unit_type_id type
Definition packets_gen.h:678
packet_unit_short_info::owner
int owner
Definition packets_gen.h:675
packet_unit_short_info::occupied
bool occupied
Definition packets_gen.h:680
packet_unit_short_info::transported_by
int transported_by
Definition packets_gen.h:685
packet_unit_short_info::facing
enum direction8 facing
Definition packets_gen.h:677
packet_unit_short_info::activity_tgt
int activity_tgt
Definition packets_gen.h:684
packet_vote_new
Definition packets_gen.h:1628
packet_vote_new::flags
int flags
Definition packets_gen.h:1633
packet_vote_new::vote_no
int vote_no
Definition packets_gen.h:1629
packet_vote_new::desc
char desc[512]
Definition packets_gen.h:1631
packet_vote_new::percent_required
int percent_required
Definition packets_gen.h:1632
packet_vote_new::user
char user[MAX_LEN_NAME]
Definition packets_gen.h:1630
packet_worker_task
Definition packets_gen.h:496
packet_worker_task::city_id
int city_id
Definition packets_gen.h:497
packet_worker_task::tile_id
int tile_id
Definition packets_gen.h:498
packet_worker_task::activity
enum unit_activity activity
Definition packets_gen.h:499
packet_worker_task::want
int want
Definition packets_gen.h:501
packet_worker_task::tgt
int tgt
Definition packets_gen.h:500
player_ai::skill_level
enum ai_level skill_level
Definition player.h:114
player_ai::barbarian_type
enum barbarian_type barbarian_type
Definition player.h:120
player_ai::science_cost
int science_cost
Definition player.h:117
player_ai::love
int love[MAX_NUM_PLAYER_SLOTS]
Definition player.h:122
player_diplstate
Definition player.h:196
player_economic::luxury
int luxury
Definition player.h:64
player_economic::science
int science
Definition player.h:63
player_economic::tax
int tax
Definition player.h:62
player_economic::infra_points
int infra_points
Definition player.h:65
player_economic::gold
int gold
Definition player.h:61
player_score::game
int game
Definition player.h:108
player_slot
Definition player.c:46
player_spaceship
Definition spaceship.h:94
player_spaceship::state
enum spaceship_state state
Definition spaceship.h:108
player
Definition player.h:247
player::cities
struct city_list * cities
Definition player.h:279
player::ai_common
struct player_ai ai_common
Definition player.h:286
player::flags
bv_plr_flags flags
Definition player.h:290
player::tile_vision
struct dbv tile_vision[V_COUNT]
Definition player.h:357
player::primary_capital_id
int primary_capital_id
Definition player.h:273
player::is_male
bool is_male
Definition player.h:255
player::wonders
int wonders[B_LAST]
Definition player.h:303
player::target_government
struct government * target_government
Definition player.h:257
player::autoselect_weight
int autoselect_weight
Definition player.h:297
player::username
char username[MAX_LEN_NAME]
Definition player.h:250
player::is_connected
bool is_connected
Definition player.h:294
player::revolution_finishes
int revolution_finishes
Definition player.h:271
player::nturns_idle
int nturns_idle
Definition player.h:263
player::government
struct government * government
Definition player.h:256
player::tile_known
struct dbv tile_known
Definition player.h:308
player::turns_alive
int turns_alive
Definition player.h:264
player::was_created
bool was_created
Definition player.h:292
player::tech_upkeep
int tech_upkeep
Definition player.h:361
player::units
struct unit_list * units
Definition player.h:280
player::connections
struct conn_list * connections
Definition player.h:296
player::is_alive
bool is_alive
Definition player.h:266
player::real_embassy
bv_player real_embassy
Definition player.h:275
player::client
struct player::@70::@73 client
player::economic
struct player_economic economic
Definition player.h:282
player::culture
int culture
Definition player.h:365
player::spaceship
struct player_spaceship spaceship
Definition player.h:284
player::name
char name[MAX_LEN_NAME]
Definition player.h:249
player::gives_shared_vision
bv_player gives_shared_vision
Definition player.h:300
player::mood
enum mood_type mood
Definition player.h:359
player::score
struct player_score score
Definition player.h:281
player::multipliers
struct multiplier_value multipliers[MAX_NUM_MULTIPLIERS]
Definition player.h:312
player::color_changeable
bool color_changeable
Definition player.h:363
player::music_style
int music_style
Definition player.h:278
player::style
struct nation_style * style
Definition player.h:277
player::phase_done
bool phase_done
Definition player.h:261
player::gives_shared_tiles
bv_player gives_shared_tiles
Definition player.h:302
player::is_ready
bool is_ready
Definition player.h:260
player::history
int history
Definition player.h:314
player::rgb
struct rgbcolor * rgb
Definition player.h:310
player::unassigned_user
bool unassigned_user
Definition player.h:251
range
Definition unittype.c:879
requirement
Definition requirements.h:81
research
Definition research.h:39
resource_type
Definition terrain.h:43
resource_type::output
int output[O_LAST]
Definition terrain.h:49
rgbcolor
Definition rgbcolor.h:33
rgbcolor::g
int g
Definition rgbcolor.h:34
rgbcolor::b
int b
Definition rgbcolor.h:34
rgbcolor::r
int r
Definition rgbcolor.h:34
road_type
Definition road.h:71
spaceship_component
Definition spaceship.h:132
specialist
Definition specialist.h:29
specialist::reqs
struct requirement_vector reqs
Definition specialist.h:38
specialist::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition specialist.h:36
specialist::helptext
struct strvec * helptext
Definition specialist.h:40
specialist::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition specialist.h:35
specialist::name
struct name_translation name
Definition specialist.h:31
specialist::abbreviation
struct name_translation abbreviation
Definition specialist.h:32
startpos
Definition map.c:41
team_slot
Definition team.c:31
tech_class
Definition tech.h:117
terrain
Definition terrain.h:182
terrain::cultivate_result
struct terrain * cultivate_result
Definition terrain.h:215
terrain::placing_time
int placing_time
Definition terrain.h:227
terrain::resources
struct extra_type ** resources
Definition terrain.h:204
terrain::helptext
struct strvec * helptext
Definition terrain.h:263
terrain::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition terrain.h:189
terrain::flags
bv_terrain_flags flags
Definition terrain.h:259
terrain::resource_freq
int * resource_freq
Definition terrain.h:205
terrain::native_to
bv_unit_classes native_to
Definition terrain.h:257
terrain::road_time
int road_time
Definition terrain.h:213
terrain::name
struct name_translation name
Definition terrain.h:184
terrain::plant_time
int plant_time
Definition terrain.h:219
terrain::plant_result
struct terrain * plant_result
Definition terrain.h:218
terrain::irrigation_food_incr
int irrigation_food_incr
Definition terrain.h:221
terrain::defense_bonus
int defense_bonus
Definition terrain.h:200
terrain::cultivate_time
int cultivate_time
Definition terrain.h:216
terrain::movement_cost
int movement_cost
Definition terrain.h:199
terrain::animal
const struct unit_type * animal
Definition terrain.h:237
terrain::pillage_time
int pillage_time
Definition terrain.h:232
terrain::output
int output[O_LAST]
Definition terrain.h:202
terrain::transform_time
int transform_time
Definition terrain.h:231
terrain::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition terrain.h:188
terrain::mining_time
int mining_time
Definition terrain.h:225
terrain::rgb
struct rgbcolor * rgb
Definition terrain.h:261
terrain::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition terrain.h:187
terrain::tclass
enum terrain_class tclass
Definition terrain.h:197
terrain::road_output_incr_pct
int road_output_incr_pct[O_LAST]
Definition terrain.h:211
terrain::extra_removal_times
int extra_removal_times[MAX_EXTRA_TYPES]
Definition terrain.h:235
terrain::transform_result
struct terrain * transform_result
Definition terrain.h:229
terrain::irrigation_time
int irrigation_time
Definition terrain.h:222
terrain::base_time
int base_time
Definition terrain.h:212
terrain::mining_shield_incr
int mining_shield_incr
Definition terrain.h:224
tile
Definition tile.h:50
tile::spec_sprite
char * spec_sprite
Definition tile.h:66
tile::label
char * label
Definition tile.h:65
tile::extras
bv_extras extras
Definition tile.h:55
tile::units
struct unit_list * units
Definition tile.h:58
tile::extras_owner
struct player * extras_owner
Definition tile.h:63
tile::infra_turns
int infra_turns
Definition tile.h:62
tile::placing
struct extra_type * placing
Definition tile.h:61
tile::continent
Continent_id continent
Definition tile.h:54
tileset
Definition tilespec.c:481
trade_route_settings
Definition traderoutes.h:75
trade_route
Definition traderoutes.h:83
unit_class
Definition unittype.h:149
unit_class::hp_loss_pct
int hp_loss_pct
Definition unittype.h:155
unit_class::non_native_def_pct
int non_native_def_pct
Definition unittype.h:156
unit_class::min_speed
int min_speed
Definition unittype.h:154
unit_class::name
struct name_translation name
Definition unittype.h:151
unit_class::helptext
struct strvec * helptext
Definition unittype.h:159
unit_class::flags
bv_unit_class_flags flags
Definition unittype.h:157
unit_order::order
enum unit_orders order
Definition unit.h:93
unit_order::action
int action
Definition unit.h:100
unit_type
Definition unittype.h:500
unit_type::transport_capacity
int transport_capacity
Definition unittype.h:523
unit_type::adv
struct unit_type::@87 adv
unit_type::uclass
struct unit_class * uclass
Definition unittype.h:556
unit_type::pop_cost
int pop_cost
Definition unittype.h:513
unit_type::build_reqs
struct requirement_vector build_reqs
Definition unittype.h:520
unit_type::defense_strength
int defense_strength
Definition unittype.h:516
unit_type::cargo
bv_unit_classes cargo
Definition unittype.h:558
unit_type::firepower
int firepower
Definition unittype.h:525
unit_type::paratroopers_range
int paratroopers_range
Definition unittype.h:541
unit_type::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition unittype.h:506
unit_type::worker
bool worker
Definition unittype.h:575
unit_type::sound_move_alt
char sound_move_alt[MAX_LEN_NAME]
Definition unittype.h:509
unit_type::build_cost
int build_cost
Definition unittype.h:512
unit_type::convert_time
int convert_time
Definition unittype.h:531
unit_type::city_size
int city_size
Definition unittype.h:550
unit_type::veteran
struct veteran_system * veteran
Definition unittype.h:544
unit_type::obsoleted_by
const struct unit_type * obsoleted_by
Definition unittype.h:529
unit_type::vision_radius_sq
int vision_radius_sq
Definition unittype.h:522
unit_type::move_rate
int move_rate
Definition unittype.h:517
unit_type::targets
bv_unit_classes targets
Definition unittype.h:561
unit_type::vlayer
enum vision_layer vlayer
Definition unittype.h:569
unit_type::helptext
struct strvec * helptext
Definition unittype.h:571
unit_type::bombard_rate
int bombard_rate
Definition unittype.h:547
unit_type::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition unittype.h:505
unit_type::city_slots
int city_slots
Definition unittype.h:552
unit_type::sound_move
char sound_move[MAX_LEN_NAME]
Definition unittype.h:508
unit_type::hp
int hp
Definition unittype.h:524
unit_type::sound_fight_alt
char sound_fight_alt[MAX_LEN_NAME]
Definition unittype.h:511
unit_type::name
struct name_translation name
Definition unittype.h:502
unit_type::fuel
int fuel
Definition unittype.h:532
unit_type::roles
bv_unit_type_roles roles
Definition unittype.h:535
unit_type::tp_defense
enum transp_def_type tp_defense
Definition unittype.h:554
unit_type::upkeep
int upkeep[O_LAST]
Definition unittype.h:538
unit_type::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition unittype.h:507
unit_type::disembarks
bv_unit_classes disembarks
Definition unittype.h:567
unit_type::converted_to
const struct unit_type * converted_to
Definition unittype.h:530
unit_type::flags
bv_unit_type_flags flags
Definition unittype.h:534
unit_type::sound_fight
char sound_fight[MAX_LEN_NAME]
Definition unittype.h:510
unit_type::embarks
bv_unit_classes embarks
Definition unittype.h:564
unit_type::attack_strength
int attack_strength
Definition unittype.h:515
unit_type::happy_cost
int happy_cost
Definition unittype.h:537
unit_type::bonuses
struct combat_bonus_list * bonuses
Definition unittype.h:526
unit
Definition unit.h:138
unit::length
int length
Definition unit.h:195
unit::upkeep
int upkeep[O_LAST]
Definition unit.h:148
unit::has_orders
bool has_orders
Definition unit.h:193
unit::orders
struct unit::@80 orders
unit::occupied
bool occupied
Definition unit.h:219
unit::action_decision_want
enum action_decision action_decision_want
Definition unit.h:202
unit::battlegroup
int battlegroup
Definition unit.h:191
unit::activity
enum unit_activity activity
Definition unit.h:157
unit::moves_left
int moves_left
Definition unit.h:150
unit::client
struct unit::@81::@83 client
unit::id
int id
Definition unit.h:145
unit::moved
bool moved
Definition unit.h:173
unit::index
int index
Definition unit.h:195
unit::vigilant
bool vigilant
Definition unit.h:197
unit::hp
int hp
Definition unit.h:151
unit::fuel
int fuel
Definition unit.h:153
unit::changed_from_target
struct extra_type * changed_from_target
Definition unit.h:170
unit::current_form_turn
int current_form_turn
Definition unit.h:208
unit::stay
bool stay
Definition unit.h:205
unit::colored
bool colored
Definition unit.h:222
unit::facing
enum direction8 facing
Definition unit.h:142
unit::asking_city_name
bool asking_city_name
Definition unit.h:225
unit::activity_target
struct extra_type * activity_target
Definition unit.h:164
unit::activity_count
int activity_count
Definition unit.h:162
unit::list
struct unit_order * list
Definition unit.h:198
unit::changed_from
enum unit_activity changed_from
Definition unit.h:168
unit::nationality
struct player * nationality
Definition unit.h:144
unit::transported_by
int transported_by
Definition unit.h:216
unit::repeat
bool repeat
Definition unit.h:196
unit::homecity
int homecity
Definition unit.h:146
unit::paradropped
bool paradropped
Definition unit.h:174
unit::done_moving
bool done_moving
Definition unit.h:181
unit::birth_turn
int birth_turn
Definition unit.h:207
unit::carrying
struct goods_type * carrying
Definition unit.h:186
unit::goto_tile
struct tile * goto_tile
Definition unit.h:155
unit::action_decision_tile
struct tile * action_decision_tile
Definition unit.h:203
unit::utype
const struct unit_type * utype
Definition unit.h:139
unit::veteran
int veteran
Definition unit.h:152
unit::changed_from_count
int changed_from_count
Definition unit.h:169
unit::focus_status
enum unit_focus_status focus_status
Definition unit.h:214
unit::ssa_controller
enum server_side_agent ssa_controller
Definition unit.h:172
universal
Definition fc_types.h:901
universal::kind
enum universals_n kind
Definition fc_types.h:903
veteran_system::levels
int levels
Definition unittype.h:495
voteinfo
Definition voteinfo.h:29
voteinfo::yes
int yes
Definition voteinfo.h:36
voteinfo::num_voters
int num_voters
Definition voteinfo.h:39
voteinfo::passed
bool passed
Definition voteinfo.h:41
voteinfo::abstain
int abstain
Definition voteinfo.h:38
voteinfo::vote_no
int vote_no
Definition voteinfo.h:31
voteinfo::no
int no
Definition voteinfo.h:37
worker_task
Definition workertask.h:21
world::map
struct civ_map map
Definition world_object.h:38
style_by_number
struct nation_style * style_by_number(int id)
Definition style.c:88
styles_alloc
void styles_alloc(int count)
Definition style.c:36
music_style_by_number
struct music_style * music_style_by_number(int id)
Definition style.c:171
music_styles_alloc
void music_styles_alloc(int count)
Definition style.c:133
style.h
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:974
fc_strlcpy
size_t fc_strlcpy(char *dest, const char *src, size_t n)
Definition support.c:791
fc_strlcat
size_t fc_strlcat(char *dest, const char *src, size_t n)
Definition support.c:836
support.h
sz_strlcpy
#define sz_strlcpy(dest, src)
Definition support.h:189
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
fc_strncmp
#define fc_strncmp(_s1_, _s2_, _len_)
Definition support.h:154
team_count
int team_count(void)
Definition team.c:375
team_slot_by_number
struct team_slot * team_slot_by_number(int team_id)
Definition team.c:175
team_add_player
bool team_add_player(struct player *pplayer, struct team *pteam)
Definition team.c:467
team_new
struct team * team_new(struct team_slot *tslot)
Definition team.c:317
team_slot_set_defined_name
void team_slot_set_defined_name(struct team_slot *tslot, const char *team_name)
Definition team.c:288
advance_by_number
struct advance * advance_by_number(const Tech_type_id atype)
Definition tech.c:107
set_user_tech_flag_name
void set_user_tech_flag_name(enum tech_flag_id id, const char *name, const char *helptxt)
Definition tech.c:394
tech_class_by_number
struct tech_class * tech_class_by_number(const int idx)
Definition tech.c:320
advance_number
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
A_FUTURE
#define A_FUTURE
Definition tech.h:46
A_NEVER
#define A_NEVER
Definition tech.h:51
advance_index_iterate_end
#define advance_index_iterate_end
Definition tech.h:248
tech_req
tech_req
Definition tech.h:110
AR_TWO
@ AR_TWO
Definition tech.h:112
AR_ROOT
@ AR_ROOT
Definition tech.h:113
AR_ONE
@ AR_ONE
Definition tech.h:111
advance_count
static Tech_type_id advance_count(void)
Definition tech.h:170
A_NONE
#define A_NONE
Definition tech.h:43
A_UNKNOWN
#define A_UNKNOWN
Definition tech.h:49
A_LAST
#define A_LAST
Definition tech.h:45
advance_index_iterate
#define advance_index_iterate(_start, _index)
Definition tech.h:244
terrain_count
Terrain_type_id terrain_count(void)
Definition terrain.c:118
terrain_by_number
struct terrain * terrain_by_number(const Terrain_type_id type)
Definition terrain.c:156
terrain_rule_name
const char * terrain_rule_name(const struct terrain *pterrain)
Definition terrain.c:247
resource_type_init
struct resource_type * resource_type_init(struct extra_type *pextra)
Definition terrain.c:272
set_user_terrain_flag_name
void set_user_terrain_flag_name(enum terrain_flag_id id, const char *name, const char *helptxt)
Definition terrain.c:788
MAX_NUM_TERRAINS
#define MAX_NUM_TERRAINS
Definition terrain.h:64
tile_set_terrain
void tile_set_terrain(struct tile *ptile, struct terrain *pterrain)
Definition tile.c:124
tile_set_owner
void tile_set_owner(struct tile *ptile, struct player *pplayer, struct tile *claimer)
Definition tile.c:69
tile_set_label
bool tile_set_label(struct tile *ptile, const char *label)
Definition tile.c:1095
tile_set_resource
void tile_set_resource(struct tile *ptile, struct extra_type *presource)
Definition tile.c:349
tile_city
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
tile_set_worked
void tile_set_worked(struct tile *ptile, struct city *pcity)
Definition tile.c:106
tile_index
#define tile_index(_pt_)
Definition tile.h:88
tile_worked
#define tile_worked(_tile)
Definition tile.h:114
tile_resource
#define tile_resource(_tile)
Definition tile.h:102
known_type
known_type
Definition tile.h:35
TILE_KNOWN_UNSEEN
@ TILE_KNOWN_UNSEEN
Definition tile.h:37
TILE_UNKNOWN
@ TILE_UNKNOWN
Definition tile.h:36
TILE_KNOWN_SEEN
@ TILE_KNOWN_SEEN
Definition tile.h:38
tile_list_iterate
#define tile_list_iterate(tile_list, ptile)
Definition tile.h:73
tile_terrain
#define tile_terrain(_tile)
Definition tile.h:110
TILE_XY
#define TILE_XY(ptile)
Definition tile.h:43
tile_list_iterate_end
#define tile_list_iterate_end
Definition tile.h:75
tile_owner
#define tile_owner(_tile)
Definition tile.h:96
tileset_setup_unit_type
void tileset_setup_unit_type(struct tileset *t, struct unit_type *ut)
Definition tilespec.c:3810
tileset_setup_government
void tileset_setup_government(struct tileset *t, struct government *gov)
Definition tilespec.c:4423
tileset_setup_specialist_type_default_set
void tileset_setup_specialist_type_default_set(struct tileset *t, Specialist_type_id id)
Definition tilespec.c:2895
tileset_setup_tile_type
void tileset_setup_tile_type(struct tileset *t, const struct terrain *pterrain)
Definition tilespec.c:4157
tileset_player_init
void tileset_player_init(struct tileset *t, struct player *pplayer)
Definition tilespec.c:7375
unit_drawn_with_city_outline
bool unit_drawn_with_city_outline(const struct unit *punit, bool check_focus)
Definition tilespec.c:5515
tileset_setup_impr_type
void tileset_setup_impr_type(struct tileset *t, struct impr_type *pimprove)
Definition tilespec.c:3844
tileset_background_init
void tileset_background_init(struct tileset *t)
Definition tilespec.c:7455
tileset_setup_tech_type
void tileset_setup_tech_type(struct tileset *t, struct advance *padvance)
Definition tilespec.c:3860
tileset_setup_city_tiles
void tileset_setup_city_tiles(struct tileset *t, int style)
Definition tilespec.c:6458
tilespec_reread_frozen_refresh
void tilespec_reread_frozen_refresh(const char *tname)
Definition tilespec.c:1545
tileset_setup_extra
void tileset_setup_extra(struct tileset *t, struct extra_type *pextra)
Definition tilespec.c:3879
tileset_basename
const char * tileset_basename(const struct tileset *t)
Definition tilespec.c:704
finish_loading_sprites
void finish_loading_sprites(struct tileset *t)
Definition tilespec.c:3616
tileset_name_get
const char * tileset_name_get(struct tileset *t)
Definition tilespec.c:7526
tileset_error
void tileset_error(enum log_level level, const char *tset_name, const char *format,...)
Definition tilespec.c:624
tilespec_reread
bool tilespec_reread(const char *new_tileset_name, bool game_fully_initialized, float scale)
Definition tilespec.c:1355
tileset_setup_nation_flag
void tileset_setup_nation_flag(struct tileset *t, struct nation_type *nation)
Definition tilespec.c:4438
tileset_ruleset_reset
void tileset_ruleset_reset(struct tileset *t)
Definition tilespec.c:7490
tilespec.h
MAX_NUM_CITIZEN_SPRITES
#define MAX_NUM_CITIZEN_SPRITES
Definition tilespec.h:197
NUM_WALL_TYPES
#define NUM_WALL_TYPES
Definition tilespec.h:359
city_num_trade_routes
int city_num_trade_routes(const struct city *pcity)
Definition traderoutes.c:383
trade_route_settings_by_type
struct trade_route_settings * trade_route_settings_by_type(enum trade_route_type type)
Definition traderoutes.c:201
goods_by_number
struct goods_type * goods_by_number(Goods_type_id id)
Definition traderoutes.c:604
traderoutes.h
unit_transport_load
bool unit_transport_load(struct unit *pcargo, struct unit *ptrans, bool force)
Definition unit.c:2366
unit_transport_get
struct unit * unit_transport_get(const struct unit *pcargo)
Definition unit.c:2437
unit_transport_unload
bool unit_transport_unload(struct unit *pcargo)
Definition unit.c:2386
unit_virtual_create
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
Definition unit.c:1620
unit_virtual_destroy
void unit_virtual_destroy(struct unit *punit)
Definition unit.c:1725
unit_tile_set
void unit_tile_set(struct unit *punit, struct tile *ptile)
Definition unit.c:1252
unit_transported
bool unit_transported(const struct unit *pcargo)
Definition unit.c:2421
unit_transport_cargo
struct unit_list * unit_transport_cargo(const struct unit *ptrans)
Definition unit.c:2447
unit.h
unit_tile
#define unit_tile(_pu)
Definition unit.h:390
FOCUS_AVAIL
@ FOCUS_AVAIL
Definition unit.h:53
FOCUS_WAIT
@ FOCUS_WAIT
Definition unit.h:53
ORDER_PERFORM_ACTION
@ ORDER_PERFORM_ACTION
Definition unit.h:47
unit_owner
#define unit_owner(_pu)
Definition unit.h:389
unitlist.h
unit_list_iterate
#define unit_list_iterate(unitlist, punit)
Definition unitlist.h:31
unit_list_iterate_end
#define unit_list_iterate_end
Definition unitlist.h:33
set_unit_class_caches
void set_unit_class_caches(struct unit_class *pclass)
Definition unittype.c:2742
unit_type_get
const struct unit_type * unit_type_get(const struct unit *punit)
Definition unittype.c:123
unit_name_translation
const char * unit_name_translation(const struct unit *punit)
Definition unittype.c:1569
unit_rule_name
const char * unit_rule_name(const struct unit *punit)
Definition unittype.c:1587
set_unit_move_type
void set_unit_move_type(struct unit_class *puclass)
Definition unittype.c:2910
set_unit_type_caches
void set_unit_type_caches(struct unit_type *ptype)
Definition unittype.c:2801
uclass_by_number
struct unit_class * uclass_by_number(const Unit_Class_id id)
Definition unittype.c:2476
veteran_system_definition
void veteran_system_definition(struct veteran_system *vsystem, int level, const char *vlist_name, int vlist_power, int vlist_move, int vlist_raise, int vlist_wraise)
Definition unittype.c:2671
utype_by_number
struct unit_type * utype_by_number(const Unit_type_id id)
Definition unittype.c:112
unit_type_action_cache_set
void unit_type_action_cache_set(struct unit_type *ptype)
Definition unittype.c:915
set_user_unit_class_flag_name
void set_user_unit_class_flag_name(enum unit_class_flag_id id, const char *name, const char *helptxt)
Definition unittype.c:1812
veteran_system_new
struct veteran_system * veteran_system_new(int count)
Definition unittype.c:2640
utype_can_do_action
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:371
set_user_unit_type_flag_name
void set_user_unit_type_flag_name(enum unit_type_flag_id id, const char *name, const char *helptxt)
Definition unittype.c:1876
UCF_LAST_USER_FLAG
#define UCF_LAST_USER_FLAG
Definition unittype.h:127
unit_class_iterate
#define unit_class_iterate(_p)
Definition unittype.h:905
UTYF_LAST_USER_FLAG
#define UTYF_LAST_USER_FLAG
Definition unittype.h:331
unit_type_iterate
#define unit_type_iterate(_p)
Definition unittype.h:852
U_LAST
#define U_LAST
Definition unittype.h:40
unit_class_iterate_end
#define unit_class_iterate_end
Definition unittype.h:912
unit_type_iterate_end
#define unit_type_iterate_end
Definition unittype.h:859
update_queue_processing_finished
void update_queue_processing_finished(int request_id)
Definition update_queue.c:288
update_queue_processing_started
void update_queue_processing_started(int request_id)
Definition update_queue.c:279
unit_select_dialog_update
void unit_select_dialog_update(void)
Definition update_queue.c:698
update_queue.h
vision_layer_iterate
#define vision_layer_iterate(v)
Definition vision.h:77
vision_layer_iterate_end
#define vision_layer_iterate_end
Definition vision.h:80
voteinfo_queue_delayed_remove
void voteinfo_queue_delayed_remove(int vote_no)
Definition voteinfo.c:53
voteinfo_queue_find
struct voteinfo * voteinfo_queue_find(int vote_no)
Definition voteinfo.c:150
voteinfo_queue_add
void voteinfo_queue_add(int vote_no, const char *user, const char *desc, int percent_required, int flags)
Definition voteinfo.c:123
voteinfo.h
voteinfo_bar_g.h
wldlg_g.h
worker_task_is_sane
bool worker_task_is_sane(struct worker_task *ptask)
Definition workertask.c:40
worker_task_list_iterate
#define worker_task_list_iterate(tasklist, ptask)
Definition workertask.h:33
worker_task_list_iterate_end
#define worker_task_list_iterate_end
Definition workertask.h:35
worklist_copy
void worklist_copy(struct worklist *dst, const struct worklist *src)
Definition worklist.c:112
worklist_init
void worklist_init(struct worklist *pwl)
Definition worklist.c:38
worklist.h