Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/packhand.c Source File

Freeciv-3.1

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