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

Freeciv-3.1

Loading...
Searching...
No Matches
client_main.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 "fc_prehdrs.h"
19
20#ifdef FREECIV_MSWINDOWS
21#include <windows.h> /* LoadLibrary() */
22#endif
23
24#include <math.h>
25#include <signal.h>
26#include <stdarg.h>
27#include <stdio.h>
28#include <stdlib.h>
29#include <time.h>
30
31/* utility */
32#include "bitvector.h"
33#include "capstr.h"
34#include "dataio.h"
35#include "deprecations.h"
36#include "fcbacktrace.h"
37#include "fc_cmdline.h"
38#include "fciconv.h"
39#include "fcintl.h"
40#include "log.h"
41#include "mem.h"
42#include "rand.h"
43#include "registry.h"
44#include "support.h"
45#include "timing.h"
46
47/* common */
48#include "ai.h"
49#include "diptreaty.h"
50#include "fc_cmdhelp.h"
51#include "fc_interface.h"
52#include "game.h"
53#include "idex.h"
54#include "map.h"
55#include "mapimg.h"
56#include "netintf.h"
57#include "packets.h"
58#include "player.h"
59#include "research.h"
60#include "server_settings.h"
61#include "version.h"
62
63/* client/include */
64#include "chatline_g.h"
65#include "citydlg_g.h"
66#include "connectdlg_g.h"
67#include "dialogs_g.h"
68#include "diplodlg_g.h"
69#include "editgui_g.h"
70#include "graphics_g.h"
71#include "gui_main_g.h"
72#include "mapctrl_g.h"
73#include "mapview_g.h"
74#include "menu_g.h"
75#include "messagewin_g.h"
76#include "pages_g.h"
77#include "plrdlg_g.h"
78#include "repodlgs_g.h"
79#include "voteinfo_bar_g.h"
80
81/* client */
82#include "attribute.h"
83#include "audio.h"
84#include "cityrepdata.h"
85#include "climisc.h"
86#include "clinet.h"
87#include "connectdlg_common.h" /* client_kill_server() */
88#include "control.h"
89#include "editor.h"
90#include "global_worklist.h"
91#include "helpdata.h" /* boot_help_texts() */
92#include "mapview_common.h"
93#include "music.h"
94#include "options.h"
95#include "overview_common.h"
96#include "packhand.h"
97#include "tilespec.h"
98#include "themes_common.h"
99#include "update_queue.h"
100#include "voteinfo.h"
101#include "zoom.h"
102
103/* client/agents */
104#include "agents.h"
105#include "cma_core.h" /* kludge */
106
107/* client/luascript */
108#include "script_client.h"
109
110#include "client_main.h"
111
112
113static enum known_type mapimg_client_tile_known(const struct tile *ptile,
114 const struct player *pplayer,
115 bool knowledge);
116static struct terrain
117 *mapimg_client_tile_terrain(const struct tile *ptile,
118 const struct player *pplayer, bool knowledge);
119static struct player *mapimg_client_tile_owner(const struct tile *ptile,
120 const struct player *pplayer,
121 bool knowledge);
122static struct player *mapimg_client_tile_city(const struct tile *ptile,
123 const struct player *pplayer,
124 bool knowledge);
125static struct player *mapimg_client_tile_unit(const struct tile *ptile,
126 const struct player *pplayer,
127 bool knowledge);
128static int mapimg_client_plrcolor_count(void);
129static struct rgbcolor *mapimg_client_plrcolor_get(int i);
130
131static void fc_interface_init_client(void);
132
133 char *logfile = NULL;
134 char *scriptfile = NULL;
135 char *savefile = NULL;
136 char forced_tileset_name[512] = "\0";
137 char sound_plugin_name[512] = "\0";
138 char sound_set_name[512] = "\0";
139 char music_set_name[512] = "\0";
140 char server_host[512] = "\0";
141 char user_name[512] = "\0";
142 char fc_password[MAX_LEN_PASSWORD] = "\0";
143 char metaserver[512] = "\0";
144 int server_port = -1;
145 bool auto_connect = FALSE; /* TRUE = skip "Connect to Freeciv Server" dialog */
146 bool auto_spawn = FALSE; /* TRUE = skip main menu, start local server */
147 enum announce_type announce;
148
149 struct civclient client;
150
151 static enum client_states civclient_state = C_S_INITIAL;
152
153/* TRUE if an end turn request is blocked by busy agents */
154 bool waiting_for_end_turn = FALSE;
155
156/*
157 * TRUE between receiving PACKET_END_TURN and PACKET_BEGIN_TURN
158 */
159 static bool server_busy = FALSE;
160
161#ifdef FREECIV_DEBUG
162bool hackless = FALSE;
163#endif
164
165 static bool client_quitting = FALSE;
166
167/**********************************************************************/
171 static char *put_conv(const char *src, size_t *length)
172{
173 char *out = internal_to_data_string_malloc(src);
174
175 if (out) {
176 *length = strlen(out);
177 return out;
178 } else {
179 *length = 0;
180 return NULL;
181 }
182}
183
184/**********************************************************************/
189 static bool get_conv(char *dst, size_t ndst,
190 const char *src, size_t nsrc)
191{
192 char *out = data_to_internal_string_malloc(src);
193 bool ret = TRUE;
194 size_t len;
195
196 if (!out) {
197 dst[0] = '\0';
198 return FALSE;
199 }
200
201 len = strlen(out);
202 if (ndst > 0 && len >= ndst) {
203 ret = FALSE;
204 len = ndst - 1;
205 }
206
207 memcpy(dst, out, len);
208 dst[len] = '\0';
209 free(out);
210
211 return ret;
212}
213
214/**********************************************************************/
217 static void charsets_init(void)
218{
219 dio_set_put_conv_callback(put_conv);
220 dio_set_get_conv_callback(get_conv);
221}
222
223/**********************************************************************/
227 static void emergency_exit(void)
228{
229 client_kill_server(TRUE);
230}
231
232/**********************************************************************/
235 static void at_exit(void)
236{
237 emergency_exit();
238 packets_deinit();
239 fc_shutdown_network();
240 update_queue_free();
241 fc_destroy_ow_mutex();
242}
243
244/**********************************************************************/
247 static void client_game_init(void)
248{
249 client.conn.playing = NULL;
250 client.conn.observer = FALSE;
251
252 game_init(FALSE);
253 attribute_init();
254 agents_init();
255 control_init();
256 link_marks_init();
257 voteinfo_queue_init();
258 server_options_init();
259 update_queue_init();
260 mapimg_init(mapimg_client_tile_known, mapimg_client_tile_terrain,
261 mapimg_client_tile_owner, mapimg_client_tile_city,
262 mapimg_client_tile_unit, mapimg_client_plrcolor_count,
263 mapimg_client_plrcolor_get);
264 animations_init();
265}
266
267/**********************************************************************/
270 static void client_game_free(void)
271{
272 editgui_popdown_all();
273
274 animations_free();
275 mapimg_free();
276 packhand_free();
277 server_options_free();
278 voteinfo_queue_free();
279 link_marks_free();
280 control_free();
281 free_help_texts();
282 attribute_free();
283 agents_free();
284 game.client.ruleset_init = FALSE;
285 game.client.ruleset_ready = FALSE;
286 game_free();
287 /* update_queue_init() is correct at this point. The queue is reset to
288 a clean state which is also needed if the client is not connected to
289 the server! */
290 update_queue_init();
291
292 client.conn.playing = NULL;
293 client.conn.observer = FALSE;
294}
295
296/**********************************************************************/
300 static void client_game_reset(void)
301{
302 editgui_popdown_all();
303
304 packhand_free();
305 link_marks_free();
306 control_free();
307 attribute_free();
308 agents_free();
309
310 game_reset();
311 mapimg_reset();
312
313 attribute_init();
314 agents_init();
315 control_init();
316 link_marks_init();
317}
318
319/**********************************************************************/
322 int default_tileset_select(void)
323{
324 fill_topo_ts_default();
325
326 if (forced_tileset_name[0] != '\0') {
327 if (!tilespec_try_read(forced_tileset_name, TRUE, -1, TRUE)) {
328 log_error(_("Can't load requested tileset %s!"), forced_tileset_name);
329 client_exit(EXIT_FAILURE);
330 return EXIT_FAILURE;
331 }
332 } else {
333 tilespec_try_read(gui_options.default_tileset_name, FALSE, -1, TRUE);
334 }
335
336 editor_init();
337
338 return EXIT_SUCCESS;
339}
340
341/**********************************************************************/
344 int client_main(int argc, char *argv[], bool postpone_tileset)
345{
346 int i;
347 enum log_level loglevel = LOG_NORMAL;
348 int ui_options = 0;
349 bool ui_separator = FALSE;
350 char *option = NULL;
351 int fatal_assertions = -1;
352 int aii;
353 int uret;
354
355 /* Load Windows post-crash debugger */
356#ifdef FREECIV_MSWINDOWS
357# ifndef FREECIV_NDEBUG
358 if (LoadLibrary("exchndl.dll") == NULL) {
359# ifdef FREECIV_DEBUG
360 fprintf(stderr, "exchndl.dll could not be loaded, no crash debugger\n");
361# endif /* FREECIV_DEBUG */
362 }
363# endif /* FREECIV_NDEBUG */
364#endif /* FREECIV_MSWINDOWS */
365
366 /* fc_interface_init_client() includes low level support like
367 * guaranteeing that fc_vsnprintf() will work after it,
368 * so this need to be early. */
369 fc_interface_init_client();
370
371 i_am_client(); /* Tell to libfreeciv that we are client */
372
373 game.client.ruleset_init = FALSE;
374
375 /* Ensure that all AIs are initialized to unused state
376 * Not using ai_type_iterate as it would stop at
377 * current ai type count, ai_type_get_count(), i.e., 0 */
378 for (aii = 0; aii < FREECIV_AI_MOD_LAST; aii++) {
379 struct ai_type *ai = get_ai_type(aii);
380
381 init_ai(ai);
382 }
383
384#ifdef ENABLE_NLS
385 (void) bindtextdomain("freeciv-nations", get_locale_dir());
386#endif
387
388 registry_module_init();
389 audio_init();
390 init_character_encodings(gui_character_encoding, gui_use_transliteration);
391#ifdef ENABLE_NLS
392 bind_textdomain_codeset("freeciv-nations", get_internal_encoding());
393#endif
394
395 i = 1;
396
397 announce = ANNOUNCE_DEFAULT;
398
399 while (i < argc) {
400 if (ui_separator) {
401 argv[1 + ui_options] = argv[i];
402 ui_options++;
403 } else if (is_option("--help", argv[i])) {
404 struct cmdhelp *help = cmdhelp_new(argv[0]);
405
406 cmdhelp_add(help, "A",
407 /* TRANS: "Announce" is exactly what user must type, do not translate. */
408 _("Announce PROTO"),
409 _("Announce game in LAN using protocol PROTO "
410 "(IPv4/IPv6/none)"));
411 cmdhelp_add(help, "a", "autoconnect",
412 _("Skip connect dialog"));
413#ifdef FREECIV_DEBUG
414 cmdhelp_add(help, "d",
415 /* TRANS: "debug" is exactly what user must type, do not translate. */
416 _("debug LEVEL"),
417 _("Set debug log level (one of f,e,w,n,v,d, or "
418 "d:file1,min,max:...)"));
419#else /* FREECIV_DEBUG */
420 cmdhelp_add(help, "d",
421 /* TRANS: "debug" is exactly what user must type, do not translate. */
422 _("debug LEVEL"),
423 _("Set debug log level (one of f,e,w,n,v)"));
424#endif /* FREECIV_DEBUG */
425#ifndef FREECIV_NDEBUG
426 cmdhelp_add(help, "F",
427 /* TRANS: "Fatal" is exactly what user must type, do not translate. */
428 _("Fatal [SIGNAL]"),
429 _("Raise a signal on failed assertion"));
430#endif /* FREECIV_NDEBUG */
431 cmdhelp_add(help, "f",
432 /* TRANS: "file" is exactly what user must type, do not translate. */
433 _("file FILE"),
434 _("Load saved game FILE"));
435 cmdhelp_add(help, "h", "help",
436 _("Print a summary of the options"));
437#ifdef FREECIV_DEBUG
438 cmdhelp_add(help, "H", "Hackless",
439 _("Do not request hack access to local, but not spawned, server"));
440#endif /* FREECIV_DEBUG */
441 cmdhelp_add(help, "l",
442 /* TRANS: "log" is exactly what user must type, do not translate. */
443 _("log FILE"),
444 _("Use FILE as logfile (spawned server also uses this)"));
445 cmdhelp_add(help, "M",
446 /* TRANS: "Meta" is exactly what user must type, do not translate. */
447 _("Meta HOST"),
448 _("Connect to the metaserver at HOST"));
449 cmdhelp_add(help, "n",
450 /* TRANS: "name" is exactly what user must type, do not translate. */
451 _("name NAME"),
452 _("Use NAME as username on server"));
453 cmdhelp_add(help, "p",
454 /* TRANS: "port" is exactly what user must type, do not translate. */
455 _("port PORT"),
456 _("Connect to server port PORT (usually with -a)"));
457 cmdhelp_add(help, "P",
458 /* TRANS: "Plugin" is exactly what user must type, do not translate. */
459 _("Plugin PLUGIN"),
460 _("Use PLUGIN for sound output %s"),
461 audio_get_all_plugin_names());
462 cmdhelp_add(help, "r",
463 /* TRANS: "read" is exactly what user must type, do not translate. */
464 _("read FILE"),
465 _("Read startup script FILE (for spawned server only)"));
466 cmdhelp_add(help, "s",
467 /* TRANS: "server" is exactly what user must type, do not translate. */
468 _("server HOST"),
469 _("Connect to the server at HOST (usually with -a)"));
470 cmdhelp_add(help, "S",
471 /* TRANS: "Sound" is exactly what user must type, do not translate. */
472 _("Sound FILE"),
473 _("Read sound tags from FILE"));
474 cmdhelp_add(help, "m",
475 /* TRANS: "music" is exactly what user must type, do not translate. */
476 _("music FILE"),
477 _("Read music tags from FILE"));
478 cmdhelp_add(help, "t",
479 /* TRANS: "tiles" is exactly what user must type, do not translate. */
480 _("tiles FILE"),
481 _("Use data file FILE.tilespec for tiles"));
482 cmdhelp_add(help, "v", "version",
483 _("Print the version number"));
484 cmdhelp_add(help, "w", "warnings",
485 _("Warn about deprecated modpack constructs"));
486
487 /* The function below prints a header and footer for the options.
488 * Furthermore, the options are sorted. */
489 cmdhelp_display(help, TRUE, TRUE, TRUE);
490 cmdhelp_destroy(help);
491
492 exit(EXIT_SUCCESS);
493 } else if (is_option("--version", argv[i])) {
494 fc_fprintf(stderr, "%s %s\n", freeciv_name_version(), client_string);
495 exit(EXIT_SUCCESS);
496#ifdef FREECIV_DEBUG
497 } else if (is_option("--Hackless", argv[i])) {
498 hackless = TRUE;
499#endif /* FREECIV_DEBUG */
500 } else if ((option = get_option_malloc("--log", argv, &i, argc, TRUE))) {
501 logfile = option;
502#ifndef FREECIV_NDEBUG
503 } else if (is_option("--Fatal", argv[i])) {
504 if (i + 1 >= argc || '-' == argv[i + 1][0]) {
505 fatal_assertions = SIGABRT;
506 } else if (str_to_int(argv[i + 1], &fatal_assertions)) {
507 i++;
508 } else {
509 fc_fprintf(stderr, _("Invalid signal number \"%s\".\n"),
510 argv[i + 1]);
511 fc_fprintf(stderr, _("Try using --help.\n"));
512 exit(EXIT_FAILURE);
513 }
514#endif /* FREECIV_NDEBUG */
515 } else if ((option = get_option_malloc("--read", argv, &i, argc, TRUE))) {
516 scriptfile = option;
517 } else if ((option = get_option_malloc("--file", argv, &i, argc, TRUE))) {
518 savefile = option;
519 auto_spawn = TRUE;
520 } else if ((option = get_option_malloc("--name", argv, &i, argc, FALSE))) {
521 sz_strlcpy(user_name, option);
522 free(option);
523 } else if ((option = get_option_malloc("--Meta", argv, &i, argc, FALSE))) {
524 sz_strlcpy(metaserver, option);
525 free(option);
526 } else if ((option = get_option_malloc("--Sound", argv, &i, argc, FALSE))) {
527 sz_strlcpy(sound_set_name, option);
528 free(option);
529 } else if ((option = get_option_malloc("--music", argv, &i, argc, FALSE))) {
530 sz_strlcpy(music_set_name, option);
531 free(option);
532 } else if ((option = get_option_malloc("--Plugin", argv, &i, argc, FALSE))) {
533 sz_strlcpy(sound_plugin_name, option);
534 free(option);
535 } else if ((option = get_option_malloc("--port", argv, &i, argc, FALSE))) {
536 if (!str_to_int(option, &server_port)) {
537 fc_fprintf(stderr,
538 _("Invalid port \"%s\" specified with --port option.\n"),
539 option);
540 fc_fprintf(stderr, _("Try using --help.\n"));
541 exit(EXIT_FAILURE);
542 }
543 free(option);
544 } else if ((option = get_option_malloc("--server", argv, &i, argc, FALSE))) {
545 sz_strlcpy(server_host, option);
546 free(option);
547 } else if (is_option("--autoconnect", argv[i])) {
548 auto_connect = TRUE;
549 } else if ((option = get_option_malloc("--debug", argv, &i, argc, FALSE))) {
550 if (!log_parse_level_str(option, &loglevel)) {
551 fc_fprintf(stderr,
552 _("Invalid debug level \"%s\" specified with --debug "
553 "option.\n"), option);
554 fc_fprintf(stderr, _("Try using --help.\n"));
555 exit(EXIT_FAILURE);
556 }
557 free(option);
558 } else if ((option = get_option_malloc("--tiles", argv, &i, argc, FALSE))) {
559 sz_strlcpy(forced_tileset_name, option);
560 free(option);
561 } else if ((option = get_option_malloc("--Announce", argv, &i, argc, FALSE))) {
562 if (!fc_strcasecmp(option, "ipv4")) {
563 announce = ANNOUNCE_IPV4;
564 } else if (!fc_strcasecmp(option, "none")) {
565 announce = ANNOUNCE_NONE;
566#ifdef FREECIV_IPV6_SUPPORT
567 } else if (!fc_strcasecmp(option, "ipv6")) {
568 announce = ANNOUNCE_IPV6;
569#endif /* IPv6 support */
570 } else {
571 fc_fprintf(stderr, _("Invalid announce protocol \"%s\".\n"), option);
572 exit(EXIT_FAILURE);
573 }
574 free(option);
575 } else if (is_option("--warnings", argv[i])) {
576 deprecation_warnings_enable();
577 } else if (is_option("--", argv[i])) {
578 ui_separator = TRUE;
579 } else {
580 fc_fprintf(stderr, _("Unrecognized option: \"%s\"\n"), argv[i]);
581 exit(EXIT_FAILURE);
582 }
583 i++;
584 } /* of while */
585
586 if (auto_spawn && auto_connect) {
587 /* TRANS: don't translate option names */
588 fc_fprintf(stderr, _("-f/--file and -a/--autoconnect options are "
589 "incompatible\n"));
590 exit(EXIT_FAILURE);
591 }
592
593 /* Remove all options except those intended for the UI. */
594 argv[1 + ui_options] = NULL;
595 argc = 1 + ui_options;
596
597 /* disallow running as root -- too dangerous */
598 dont_run_as_root(argv[0], "freeciv_client");
599
600 log_init(logfile, loglevel, NULL, NULL, fatal_assertions);
601 backtrace_init();
602
603 /* after log_init: */
604
605 (void)user_username(gui_options.default_user_name, MAX_LEN_NAME);
606 if (!is_valid_username(gui_options.default_user_name)) {
607 char buf[sizeof(gui_options.default_user_name)];
608
609 fc_snprintf(buf, sizeof(buf), "_%s", gui_options.default_user_name);
610 if (is_valid_username(buf)) {
611 sz_strlcpy(gui_options.default_user_name, buf);
612 } else {
613 fc_snprintf(gui_options.default_user_name,
614 sizeof(gui_options.default_user_name),
615 "player%d", fc_rand(10000));
616 }
617 }
618
619 /* initialization */
620
621 game.all_connections = conn_list_new();
622 game.est_connections = conn_list_new();
623
624 ui_init();
625 charsets_init();
626 fc_init_network();
627 update_queue_init();
628
629 fc_init_ow_mutex();
630
631 /* register exit handler */
632 atexit(at_exit);
633 fc_at_quick_exit(emergency_exit);
634
635 init_our_capability();
636 init_player_dlg_common();
637 init_themes();
638
639 options_init();
640 options_load();
641
642 script_client_init();
643
644 if (sound_set_name[0] == '\0') {
645 sz_strlcpy(sound_set_name, gui_options.default_sound_set_name);
646 }
647 if (music_set_name[0] == '\0') {
648 sz_strlcpy(music_set_name, gui_options.default_music_set_name);
649 }
650 if (sound_plugin_name[0] == '\0') {
651 sz_strlcpy(sound_plugin_name, gui_options.default_sound_plugin_name);
652 }
653 if (server_host[0] == '\0') {
654 sz_strlcpy(server_host, gui_options.default_server_host);
655 } else if (gui_options.use_prev_server) {
656 sz_strlcpy(gui_options.default_server_host, server_host);
657 }
658 if (user_name[0] == '\0') {
659 sz_strlcpy(user_name, gui_options.default_user_name);
660 }
661 if (metaserver[0] == '\0') {
662 /* FIXME: Find a cleaner way to achieve this. */
663 /* www.cazfi.net/freeciv/metaserver/ was default metaserver
664 * over one release when meta.freeciv.org was unavailable. */
665 const char *oldaddr = "http://www.cazfi.net/freeciv/metaserver/";
666
667 if (0 == strcmp(gui_options.default_metaserver, oldaddr)) {
668 log_normal(_("Updating old metaserver address \"%s\"."), oldaddr);
669 sz_strlcpy(gui_options.default_metaserver, DEFAULT_METASERVER_OPTION);
670 log_normal(_("Default metaserver has been set to value \"%s\"."),
671 DEFAULT_METASERVER_OPTION);
672 }
673 if (0 == strcmp(gui_options.default_metaserver, DEFAULT_METASERVER_OPTION)) {
674 sz_strlcpy(metaserver, FREECIV_META_URL);
675 } else {
676 sz_strlcpy(metaserver, gui_options.default_metaserver);
677 }
678 }
679 if (server_port == -1) {
680 server_port = gui_options.default_server_port;
681 } else if (gui_options.use_prev_server) {
682 gui_options.default_server_port = server_port;
683 }
684
685 /* This seed is not saved anywhere; randoms in the client should
686 have cosmetic effects only (eg city name suggestions). --dwp */
687 fc_srand(time(NULL));
688 helpdata_init();
689 boot_help_texts();
690
691 audio_real_init(sound_set_name, music_set_name, sound_plugin_name);
692 start_menu_music("music_menu", NULL);
693
694 if (!postpone_tileset) {
695 int tsret = default_tileset_select();
696
697 if (tsret != EXIT_SUCCESS) {
698 return tsret;
699 }
700 }
701
702 /* run gui-specific client */
703 uret = ui_main(argc, argv);
704
705 /* termination */
706 client_exit(uret);
707
708 /* not reached */
709 return EXIT_SUCCESS;
710}
711
712/**********************************************************************/
715 static void log_option_save_msg(enum log_level lvl, const char *msg, ...)
716{
717 va_list args;
718
719 va_start(args, msg);
720 log_va_list(lvl, msg, args);
721 va_end(args);
722}
723
724/**********************************************************************/
728 void client_exit(int return_value)
729{
730 if (client_state() >= C_S_PREPARING) {
731 attribute_flush();
732 client_remove_all_cli_conn();
733 }
734
735 if (gui_options.save_options_on_exit) {
736 options_save(log_option_save_msg);
737 }
738
739 overview_free();
740 if (unscaled_tileset != NULL) {
741 tileset_free(unscaled_tileset);
742 }
743 if (tileset != NULL) {
744 tileset_free(tileset);
745 }
746
747 ui_exit();
748
749 /* Play the exit sound while audio system dependencies still up. */
750 audio_shutdown(TRUE);
751
752 script_client_free();
753
754 editor_free();
755 options_free();
756 if (client_state() >= C_S_PREPARING) {
757 client_game_free();
758 }
759
760 helpdata_done(); /* client_exit() unlinks help text list */
761 conn_list_destroy(game.all_connections);
762 conn_list_destroy(game.est_connections);
763
764 registry_module_close();
765 libfreeciv_free();
766
767 backtrace_deinit();
768 log_close();
769 cmdline_option_values_free();
770
771 exit(return_value);
772}
773
774/**********************************************************************/
777 void client_packet_input(void *packet, int type)
778{
779 if (!client.conn.established
780 && PACKET_CONN_PING != type
781 && PACKET_PROCESSING_STARTED != type
782 && PACKET_PROCESSING_FINISHED != type
783 && PACKET_SERVER_JOIN_REPLY != type
784 && PACKET_AUTHENTICATION_REQ != type
785 && PACKET_SERVER_SHUTDOWN != type
786 && PACKET_CONNECT_MSG != type
787 && PACKET_EARLY_CHAT_MSG != type
788 && PACKET_SERVER_INFO != type) {
789 log_error("Received packet %s (%d) before establishing connection!",
790 packet_name(type), type);
791 disconnect_from_server();
792 } else if (!client_handle_packet(type, packet)) {
793 log_error("Received unknown packet (type %d) from server!", type);
794 disconnect_from_server();
795 }
796}
797
798/**********************************************************************/
801 void user_ended_turn(void)
802{
803 send_turn_done();
804}
805
806/**********************************************************************/
809 void send_turn_done(void)
810{
811 log_debug("send_turn_done() can_end_turn=%d",
812 can_end_turn());
813
814 if (!can_end_turn()) {
815 /*
816 * The turn done button is disabled but the user may have pressed
817 * the return key.
818 */
819
820 if (agents_busy()) {
821 waiting_for_end_turn = TRUE;
822 }
823
824 return;
825 }
826
827 waiting_for_end_turn = FALSE;
828
829 attribute_flush();
830
831 dsend_packet_player_phase_done(&client.conn, game.info.turn);
832
833 update_turn_done_button_state();
834}
835
836/**********************************************************************/
839 void send_report_request(enum report_type type)
840{
841 dsend_packet_report_req(&client.conn, type);
842}
843
844/**********************************************************************/
847 void set_client_state(enum client_states newstate)
848{
849 enum client_states oldstate = civclient_state;
850 struct player *pplayer = client_player();
851
852 if (auto_spawn) {
853 fc_assert(!auto_connect);
854 auto_spawn = FALSE;
855 if (!client_start_server()) {
856 log_fatal(_("Failed to start local server; aborting."));
857 exit(EXIT_FAILURE);
858 }
859 }
860
861 if (auto_connect && newstate == C_S_DISCONNECTED) {
862 if (oldstate == C_S_DISCONNECTED) {
863 log_fatal(_("There was an error while auto connecting; aborting."));
864 exit(EXIT_FAILURE);
865 } else {
866 start_autoconnecting_to_server();
867 auto_connect = FALSE; /* Don't try this again. */
868 }
869 }
870
871 if (C_S_PREPARING == newstate
872 && (client_has_player() || client_is_observer())) {
873 /* Reset the delta-state. */
874 conn_reset_delta_state(&client.conn);
875 }
876
877 if (oldstate == newstate) {
878 return;
879 }
880
881 if (oldstate == C_S_RUNNING && newstate != C_S_PREPARING) {
882 stop_style_music();
883
884 if (!is_client_quitting()) {
885 /* Back to menu */
886 start_menu_music("music_menu", NULL);
887 }
888 }
889
890 civclient_state = newstate;
891
892 switch (newstate) {
893 case C_S_INITIAL:
894 log_error("%d is not a valid client state to set.", C_S_INITIAL);
895 break;
896
897 case C_S_DISCONNECTED:
898 popdown_all_city_dialogs();
899 close_all_diplomacy_dialogs();
900 popdown_all_game_dialogs();
901 meswin_clear_older(MESWIN_CLEAR_ALL, 0);
902
903 if (oldstate > C_S_DISCONNECTED) {
904 unit_focus_set(NULL);
905 agents_disconnect();
906 editor_clear();
907 global_worklists_unbuild();
908 client_remove_all_cli_conn();
909 client_game_free();
910 if (oldstate > C_S_PREPARING) {
911 options_dialogs_update();
912 }
913 }
914
915 set_client_page(PAGE_MAIN);
916 break;
917
918 case C_S_PREPARING:
919 popdown_all_city_dialogs();
920 close_all_diplomacy_dialogs();
921 popdown_all_game_dialogs();
922 meswin_clear_older(MESWIN_CLEAR_ALL, 0);
923
924 if (oldstate < C_S_PREPARING) {
925 client_game_init();
926 } else {
927 /* From an upper state means that we didn't quit the server,
928 * so a lot of informations are still in effect. */
929 client_game_reset();
930 options_dialogs_update();
931 }
932
933 unit_focus_set(NULL);
934
935 if (get_client_page() != PAGE_SCENARIO
936 && get_client_page() != PAGE_LOAD) {
937 set_client_page(PAGE_START);
938 }
939 break;
940
941 case C_S_RUNNING:
942 if (oldstate == C_S_PREPARING) {
943 popdown_races_dialog();
944 stop_menu_music(); /* stop intro sound loop. */
945 }
946
947 init_city_report_game_data();
948 options_dialogs_set();
949 create_event(NULL, E_GAME_START, ftc_client, _("Game started."));
950 if (pplayer) {
951 research_update(research_get(pplayer));
952 }
953 role_unit_precalcs();
954 boot_help_texts(); /* reboot with player */
955 global_worklists_build();
956 can_slide = FALSE;
957 unit_focus_update();
958 can_slide = TRUE;
959 set_client_page(PAGE_GAME);
960 /* Find something sensible to display instead of the intro gfx. */
961 center_on_something();
962 agents_game_start();
963 editgui_tileset_changed();
964 voteinfo_gui_update();
965
966 refresh_overview_canvas();
967
968 update_info_label(); /* get initial population right */
969 unit_focus_update();
970 update_unit_info_label(get_units_in_focus());
971
972 if (gui_options.auto_center_each_turn) {
973 center_on_something();
974 }
975 start_style_music();
976 break;
977
978 case C_S_OVER:
979 if (C_S_RUNNING == oldstate) {
980 /* Extra kludge for end-game handling of the CMA. */
981 if (pplayer && pplayer->cities) {
982 city_list_iterate(pplayer->cities, pcity) {
983 if (cma_is_city_under_agent(pcity, NULL)) {
984 cma_release_city(pcity);
985 }
986 } city_list_iterate_end;
987 }
988 popdown_all_city_dialogs();
989 close_all_diplomacy_dialogs();
990 popdown_all_game_dialogs();
991 unit_focus_set(NULL);
992 } else {
993 /* From C_S_PREPARING. */
994 init_city_report_game_data();
995 options_dialogs_set();
996 if (pplayer) {
997 research_update(research_get(pplayer));
998 }
999 role_unit_precalcs();
1000 boot_help_texts(); /* reboot */
1001 global_worklists_build();
1002 unit_focus_set(NULL);
1003 set_client_page(PAGE_GAME);
1004 center_on_something();
1005 }
1006 refresh_overview_canvas();
1007
1008 update_info_label();
1009 unit_focus_update();
1010 update_unit_info_label(NULL);
1011
1012 break;
1013 }
1014
1015 menus_init();
1016 update_turn_done_button_state();
1017 conn_list_dialog_update();
1018 if (can_client_change_view()) {
1019 update_map_canvas_visible();
1020 }
1021
1022 /* If turn was going to change, that is now aborted. */
1023 set_server_busy(FALSE);
1024}
1025
1026/**********************************************************************/
1029 enum client_states client_state(void)
1030{
1031 return civclient_state;
1032}
1033
1034/**********************************************************************/
1037 void client_remove_cli_conn(struct connection *pconn)
1038{
1039 fc_assert_msg(pconn != NULL,
1040 "Trying to remove a non existing connection");
1041
1042 if (NULL != pconn->playing) {
1043 conn_list_remove(pconn->playing->connections, pconn);
1044 }
1045 conn_list_remove(game.all_connections, pconn);
1046 conn_list_remove(game.est_connections, pconn);
1047 fc_assert_ret(pconn != &client.conn);
1048 free(pconn);
1049}
1050
1051/**********************************************************************/
1055 void client_remove_all_cli_conn(void)
1056{
1057 fc_assert_msg(game.all_connections != NULL,
1058 "Connection list missing");
1059
1060 while (conn_list_size(game.all_connections) > 0) {
1061 struct connection *pconn = conn_list_get(game.all_connections, 0);
1062 client_remove_cli_conn(pconn);
1063 }
1064}
1065
1066/**********************************************************************/
1069 void send_attribute_block_request(void)
1070{
1071 send_packet_player_attribute_block(&client.conn);
1072}
1073
1074/**********************************************************************/
1077 void wait_till_request_got_processed(int request_id)
1078{
1079 input_from_server_till_request_got_processed(client.conn.sock,
1080 request_id);
1081}
1082
1083/**********************************************************************/
1086 bool client_is_observer(void)
1087{
1088 return client.conn.established && client.conn.observer;
1089}
1090
1091/* Seconds_to_turndone is the number of seconds the server has told us
1092 * are left. The timer tells exactly how much time has passed since the
1093 * server gave us that data. */
1094 static double seconds_to_turndone = 0.0;
1095 static struct timer *turndone_timer;
1096
1097/* The timer tells how long since server informed us about starting
1098 * turn-change activities. */
1099 static struct timer *between_turns = NULL;
1100 static bool waiting_turn_change = FALSE;
1101
1102/* This value shows what value the timeout label is currently showing for
1103 * the seconds-to-turndone. */
1104 static int seconds_shown_to_turndone;
1105 static int seconds_shown_to_new_turn;
1106
1107/**********************************************************************/
1113 void set_seconds_to_turndone(double seconds)
1114{
1115 if (current_turn_timeout() > 0) {
1116 seconds_to_turndone = seconds;
1117 turndone_timer = timer_renew(turndone_timer, TIMER_USER, TIMER_ACTIVE);
1118 timer_start(turndone_timer);
1119
1120 /* Maybe we should do an update_timeout_label here, but it doesn't
1121 * seem to be necessary. */
1122 seconds_shown_to_turndone = ceil(seconds + 0.1);
1123 }
1124}
1125
1126/**********************************************************************/
1129 bool is_waiting_turn_change(void)
1130{
1131 return waiting_turn_change;
1132}
1133
1134/**********************************************************************/
1137 void start_turn_change_wait(void)
1138{
1139 seconds_shown_to_new_turn = ceil(game.tinfo.last_turn_change_time + 0.1);
1140 between_turns = timer_renew(between_turns, TIMER_USER, TIMER_ACTIVE);
1141 timer_start(between_turns);
1142
1143 waiting_turn_change = TRUE;
1144}
1145
1146/**********************************************************************/
1149 void stop_turn_change_wait(void)
1150{
1151 waiting_turn_change = FALSE;
1152 update_timeout_label();
1153}
1154
1155/**********************************************************************/
1159 int get_seconds_to_turndone(void)
1160{
1161 if (current_turn_timeout() > 0) {
1162 return seconds_shown_to_turndone;
1163 } else {
1164 /* This shouldn't happen. */
1165 return FC_INFINITY;
1166 }
1167}
1168
1169/**********************************************************************/
1173 int get_seconds_to_new_turn(void)
1174{
1175 return seconds_shown_to_new_turn;
1176}
1177
1178/**********************************************************************/
1183 double real_timer_callback(void)
1184{
1185 double time_until_next_call = 1.0;
1186
1187 voteinfo_queue_check_removed();
1188
1189 {
1190 double autoconnect_time = try_to_autoconnect();
1191 time_until_next_call = MIN(time_until_next_call, autoconnect_time);
1192 }
1193
1194 if (C_S_RUNNING != client_state()) {
1195 return time_until_next_call;
1196 }
1197
1198 time_until_next_call = zoom_update(time_until_next_call);
1199
1200 {
1201 double blink_time = blink_turn_done_button();
1202
1203 time_until_next_call = MIN(time_until_next_call, blink_time);
1204 }
1205
1206 if (get_num_units_in_focus() > 0) {
1207 double blink_time = blink_active_unit();
1208
1209 time_until_next_call = MIN(time_until_next_call, blink_time);
1210 }
1211
1212 /* It is possible to have current_turn_timeout() > 0 but !turndone_timer,
1213 * in the first moments after the timeout is set. */
1214 if (current_turn_timeout() > 0 && turndone_timer != NULL) {
1215 double seconds = seconds_to_turndone - timer_read_seconds(turndone_timer);
1216 int iseconds = ceil(seconds + 0.1); /* Turn should end right on 0. */
1217
1218 if (iseconds < seconds_shown_to_turndone) {
1219 seconds_shown_to_turndone = iseconds;
1220 update_timeout_label();
1221 }
1222
1223 time_until_next_call = MIN(time_until_next_call,
1224 seconds - floor(seconds) + 0.001);
1225 }
1226 if (waiting_turn_change) {
1227 double seconds = game.tinfo.last_turn_change_time - timer_read_seconds(between_turns);
1228 int iseconds = ceil(seconds + 0.1); /* Turn should end right on 0. */
1229
1230 if (iseconds < game.tinfo.last_turn_change_time) {
1231 seconds_shown_to_new_turn = iseconds;
1232 update_timeout_label();
1233 }
1234 }
1235
1236 {
1237 static long counter = 0;
1238
1239 counter++;
1240
1241 if (gui_options.heartbeat_enabled && (counter % (20 * 10) == 0)) {
1242 send_packet_client_heartbeat(&client.conn);
1243 }
1244 }
1245
1246 /* Make sure we wait at least 50 ms, otherwise we may not give any other
1247 * code time to run. */
1248 return MAX(time_until_next_call, 0.05);
1249}
1250
1251/**********************************************************************/
1254 bool can_client_control(void)
1255{
1256 return (NULL != client.conn.playing
1257 && !client_is_observer());
1258}
1259
1260/**********************************************************************/
1265 bool can_client_issue_orders(void)
1266{
1267 return (can_client_control()
1268 && C_S_RUNNING == client_state());
1269}
1270
1271/**********************************************************************/
1275 bool can_meet_with_player(const struct player *pplayer)
1276{
1277 return (can_client_issue_orders()
1278 /* && NULL != client.conn.playing (above) */
1279 && could_meet_with_player(client.conn.playing, pplayer));
1280}
1281
1282/**********************************************************************/
1286 bool can_intel_with_player(const struct player *pplayer)
1287{
1288 return (client_is_observer()
1289 || (NULL != client.conn.playing
1290 && could_intel_with_player(client_player(), pplayer)));
1291}
1292
1293/**********************************************************************/
1297 const char *title_for_player(const struct player *pplayer,
1298 char *buf, size_t buf_len)
1299{
1300 if (client_player() == pplayer || can_intel_with_player(pplayer)) {
1301 /* Knows the government to construct correct title */
1302 return ruler_title_for_player(pplayer, buf, buf_len);
1303 }
1304
1305 return default_title_for_player(pplayer, buf, buf_len);
1306}
1307
1308/**********************************************************************/
1313 bool can_client_change_view(void)
1314{
1315 return ((NULL != client.conn.playing || client_is_observer())
1316 && (C_S_RUNNING == client_state()
1317 || C_S_OVER == client_state()));
1318}
1319
1320/**********************************************************************/
1324 void set_server_busy(bool busy)
1325{
1326 if (busy != server_busy) {
1327 /* server_busy value will change */
1328 server_busy = busy;
1329
1330 /* This may mean that we have to change from or to wait cursor */
1331 control_mouse_cursor(NULL);
1332 }
1333}
1334
1335/**********************************************************************/
1338 bool is_server_busy(void)
1339{
1340 return server_busy;
1341}
1342
1343/**********************************************************************/
1346 bool client_is_global_observer(void)
1347{
1348 return client.conn.playing == NULL && client.conn.observer;
1349}
1350
1351/**********************************************************************/
1354 int client_player_number(void)
1355{
1356 if (client.conn.playing == NULL) {
1357 return -1;
1358 }
1359 return player_number(client.conn.playing);
1360}
1361
1362/**********************************************************************/
1365 bool client_has_player(void)
1366{
1367 return client.conn.playing != NULL;
1368}
1369
1370/**********************************************************************/
1374 bool client_map_is_known_and_seen(const struct tile *ptile,
1375 const struct player *pplayer,
1376 enum vision_layer vlayer)
1377{
1378 return dbv_isset(&pplayer->client.tile_vision[vlayer], tile_index(ptile));
1379}
1380
1381/**********************************************************************/
1384 static int client_plr_tile_city_id_get(const struct tile *ptile,
1385 const struct player *pplayer)
1386{
1387 struct city *pcity = tile_city(ptile);
1388
1389 /* Can't look up what other players think. */
1390 fc_assert(pplayer == client_player());
1391
1392 return pcity ? pcity->id : IDENTITY_NUMBER_ZERO;
1393}
1394
1395/**********************************************************************/
1398 static server_setting_id client_ss_by_name(const char *name)
1399{
1400 struct option *pset = optset_option_by_name(server_optset, name);
1401
1402 if (pset) {
1403 return option_number(pset);
1404 } else {
1405 log_error("No server setting named %s exists.", name);
1406 return SERVER_SETTING_NONE;
1407 }
1408}
1409
1410/**********************************************************************/
1413 static const char *client_ss_name_get(server_setting_id id)
1414{
1415 struct option *pset = optset_option_by_number(server_optset, id);
1416
1417 if (pset) {
1418 return option_name(pset);
1419 } else {
1420 log_error("No server setting with the id %d exists.", id);
1421 return NULL;
1422 }
1423}
1424
1425/**********************************************************************/
1428 static enum sset_type client_ss_type_get(server_setting_id id)
1429{
1430 enum option_type opt_type;
1431 struct option *pset = optset_option_by_number(server_optset, id);
1432
1433 if (!pset) {
1434 log_error("No server setting with the id %d exists.", id);
1435 return sset_type_invalid();
1436 }
1437
1438 opt_type = option_type(pset);
1439
1440 /* The option type isn't client only. */
1441 fc_assert_ret_val_msg((opt_type != OT_FONT
1442 && opt_type != OT_COLOR
1443 && opt_type != OT_VIDEO_MODE),
1444 sset_type_invalid(),
1445 "%s is a client option type but not a server "
1446 "setting type",
1447 option_type_name(option_type(pset)));
1448
1449 /* The option type is valid. */
1450 fc_assert_ret_val(sset_type_is_valid((enum sset_type)opt_type),
1451 sset_type_invalid());
1452
1453 /* Each server setting type value equals the client option type value with
1454 * the same meaning. */
1455 FC_STATIC_ASSERT((enum sset_type)OT_BOOLEAN == SST_BOOL
1456 && (enum sset_type)OT_INTEGER == SST_INT
1457 && (enum sset_type)OT_STRING == SST_STRING
1458 && (enum sset_type)OT_ENUM == SST_ENUM
1459 && (enum sset_type)OT_BITWISE == SST_BITWISE
1460 && SST_COUNT == (enum sset_type)5,
1461 server_setting_type_not_equal_to_client_option_type);
1462
1463 /* Exploit the fact that each server setting type value corresponds to the
1464 * client option type value with the same meaning. */
1465 return (enum sset_type)opt_type;
1466}
1467
1468/**********************************************************************/
1471 static bool client_ss_val_bool_get(server_setting_id id)
1472{
1473 struct option *pset = optset_option_by_number(server_optset, id);
1474
1475 if (pset) {
1476 return option_bool_get(pset);
1477 } else {
1478 log_error("No server setting with the id %d exists.", id);
1479 return FALSE;
1480 }
1481}
1482
1483/**********************************************************************/
1486 static int client_ss_val_int_get(server_setting_id id)
1487{
1488 struct option *pset = optset_option_by_number(server_optset, id);
1489
1490 if (pset) {
1491 return option_int_get(pset);
1492 } else {
1493 log_error("No server setting with the id %d exists.", id);
1494 return 0;
1495 }
1496}
1497
1498/**********************************************************************/
1501 static unsigned int client_ss_val_bitwise_get(server_setting_id id)
1502{
1503 struct option *pset = optset_option_by_number(server_optset, id);
1504
1505 if (pset) {
1506 return option_bitwise_get(pset);
1507 } else {
1508 log_error("No server setting with the id %d exists.", id);
1509 return FALSE;
1510 }
1511}
1512
1513/**********************************************************************/
1516 static void fc_interface_init_client(void)
1517{
1518 struct functions *funcs = fc_interface_funcs();
1519
1520 funcs->server_setting_by_name = client_ss_by_name;
1521 funcs->server_setting_name_get = client_ss_name_get;
1522 funcs->server_setting_type_get = client_ss_type_get;
1523 funcs->server_setting_val_bool_get = client_ss_val_bool_get;
1524 funcs->server_setting_val_int_get = client_ss_val_int_get;
1525 funcs->server_setting_val_bitwise_get = client_ss_val_bitwise_get;
1526 funcs->create_extra = NULL;
1527 funcs->destroy_extra = NULL;
1528 funcs->destroy_city = NULL;
1529 funcs->player_tile_vision_get = client_map_is_known_and_seen;
1530 funcs->player_tile_city_id_get = client_plr_tile_city_id_get;
1531 funcs->gui_color_free = color_free;
1532
1533 /* Keep this function call at the end. It checks if all required functions
1534 are defined. */
1535 libfreeciv_init(TRUE);
1536}
1537
1538/**********************************************************************/
1541 static enum known_type mapimg_client_tile_known(const struct tile *ptile,
1542 const struct player *pplayer,
1543 bool knowledge)
1544{
1545 if (client_is_global_observer()) {
1546 return TILE_KNOWN_SEEN;
1547 }
1548
1549 return tile_get_known(ptile, pplayer);
1550}
1551
1552/**********************************************************************/
1555static struct terrain *
1556 mapimg_client_tile_terrain(const struct tile *ptile,
1557 const struct player *pplayer, bool knowledge)
1558{
1559 return tile_terrain(ptile);
1560}
1561
1562/**********************************************************************/
1565 static struct player *mapimg_client_tile_owner(const struct tile *ptile,
1566 const struct player *pplayer,
1567 bool knowledge)
1568{
1569 return tile_owner(ptile);
1570}
1571
1572/**********************************************************************/
1575 static struct player *mapimg_client_tile_city(const struct tile *ptile,
1576 const struct player *pplayer,
1577 bool knowledge)
1578{
1579 struct city *pcity = tile_city(ptile);
1580
1581 if (!pcity) {
1582 return NULL;
1583 }
1584
1585 return city_owner(tile_city(ptile));
1586}
1587
1588/**********************************************************************/
1591 static struct player *mapimg_client_tile_unit(const struct tile *ptile,
1592 const struct player *pplayer,
1593 bool knowledge)
1594{
1595 int unit_count = unit_list_size(ptile->units);
1596
1597 if (unit_count == 0) {
1598 return NULL;
1599 }
1600
1601 return unit_owner(unit_list_get(ptile->units, 0));
1602}
1603
1604/**********************************************************************/
1607 static int mapimg_client_plrcolor_count(void)
1608{
1609 return player_count();
1610}
1611
1612/**********************************************************************/
1616 static struct rgbcolor *mapimg_client_plrcolor_get(int i)
1617{
1618 int count = 0;
1619
1620 if (0 > i || i > player_count()) {
1621 return NULL;
1622 }
1623
1624 players_iterate(pplayer) {
1625 if (count == i) {
1626 return pplayer->rgb;
1627 }
1628 count++;
1629 } players_iterate_end;
1630
1631 return NULL;
1632}
1633
1634/**********************************************************************/
1637 bool is_client_quitting(void)
1638{
1639 return client_quitting;
1640}
1641
1642/**********************************************************************/
1645 void start_quitting(void)
1646{
1647 client_quitting = TRUE;
1648}
agents_free
void agents_free(void)
Definition agents.c:346
agents_disconnect
void agents_disconnect(void)
Definition agents.c:400
agents_game_start
void agents_game_start(void)
Definition agents.c:453
agents_busy
bool agents_busy(void)
Definition agents.c:799
agents_init
void agents_init(void)
Definition agents.c:332
agents.h
init_ai
void init_ai(struct ai_type *ai)
Definition ai.c:264
get_ai_type
struct ai_type * get_ai_type(int id)
Definition ai.c:254
ai.h
attribute_init
void attribute_init(void)
Definition attribute.c:114
attribute_free
void attribute_free(void)
Definition attribute.c:123
attribute_flush
void attribute_flush(void)
Definition attribute.c:327
attribute.h
audio_shutdown
void audio_shutdown(bool play_quit_tag)
Definition audio.c:629
audio_get_all_plugin_names
const char * audio_get_all_plugin_names(void)
Definition audio.c:666
audio_init
void audio_init(void)
Definition audio.c:187
audio_real_init
void audio_real_init(const char *const soundset_name, const char *const musicset_name, const char *const preferred_plugin_name)
Definition audio.c:273
audio.h
dbv_isset
bool dbv_isset(const struct dbv *pdbv, int bit)
Definition bitvector.c:120
bitvector.h
init_our_capability
void init_our_capability(void)
Definition capstr.c:87
capstr.h
fc_destroy_ow_mutex
void fc_destroy_ow_mutex(void)
Definition chatline_common.c:95
fc_init_ow_mutex
void fc_init_ow_mutex(void)
Definition chatline_common.c:87
chatline_g.h
city_list_iterate
#define city_list_iterate(citylist, pcity)
Definition city.h:488
city_owner
#define city_owner(_pcity_)
Definition city.h:543
city_list_iterate_end
#define city_list_iterate_end
Definition city.h:490
citydlg_g.h
init_city_report_game_data
void init_city_report_game_data(void)
Definition cityrepdata.c:830
cityrepdata.h
music_set_name
char music_set_name[512]
Definition client_main.c:139
forced_tileset_name
char forced_tileset_name[512]
Definition client_main.c:136
client_remove_all_cli_conn
void client_remove_all_cli_conn(void)
Definition client_main.c:1055
mapimg_client_tile_city
static struct player * mapimg_client_tile_city(const struct tile *ptile, const struct player *pplayer, bool knowledge)
Definition client_main.c:1575
is_client_quitting
bool is_client_quitting(void)
Definition client_main.c:1637
civclient_state
static enum client_states civclient_state
Definition client_main.c:151
client_ss_by_name
static server_setting_id client_ss_by_name(const char *name)
Definition client_main.c:1398
can_client_control
bool can_client_control(void)
Definition client_main.c:1254
start_turn_change_wait
void start_turn_change_wait(void)
Definition client_main.c:1137
mapimg_client_tile_unit
static struct player * mapimg_client_tile_unit(const struct tile *ptile, const struct player *pplayer, bool knowledge)
Definition client_main.c:1591
client_is_global_observer
bool client_is_global_observer(void)
Definition client_main.c:1346
turndone_timer
static struct timer * turndone_timer
Definition client_main.c:1095
client_remove_cli_conn
void client_remove_cli_conn(struct connection *pconn)
Definition client_main.c:1037
get_seconds_to_new_turn
int get_seconds_to_new_turn(void)
Definition client_main.c:1173
waiting_turn_change
static bool waiting_turn_change
Definition client_main.c:1100
get_seconds_to_turndone
int get_seconds_to_turndone(void)
Definition client_main.c:1159
charsets_init
static void charsets_init(void)
Definition client_main.c:217
client_is_observer
bool client_is_observer(void)
Definition client_main.c:1086
metaserver
char metaserver[512]
Definition client_main.c:143
user_name
char user_name[512]
Definition client_main.c:141
client_plr_tile_city_id_get
static int client_plr_tile_city_id_get(const struct tile *ptile, const struct player *pplayer)
Definition client_main.c:1384
mapimg_client_plrcolor_get
static struct rgbcolor * mapimg_client_plrcolor_get(int i)
Definition client_main.c:1616
can_meet_with_player
bool can_meet_with_player(const struct player *pplayer)
Definition client_main.c:1275
client_packet_input
void client_packet_input(void *packet, int type)
Definition client_main.c:777
real_timer_callback
double real_timer_callback(void)
Definition client_main.c:1183
fc_interface_init_client
static void fc_interface_init_client(void)
Definition client_main.c:1516
at_exit
static void at_exit(void)
Definition client_main.c:235
client_map_is_known_and_seen
bool client_map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
Definition client_main.c:1374
waiting_for_end_turn
bool waiting_for_end_turn
Definition client_main.c:154
put_conv
static char * put_conv(const char *src, size_t *length)
Definition client_main.c:171
client_ss_type_get
static enum sset_type client_ss_type_get(server_setting_id id)
Definition client_main.c:1428
logfile
char * logfile
Definition client_main.c:133
send_attribute_block_request
void send_attribute_block_request(void)
Definition client_main.c:1069
mapimg_client_tile_terrain
static struct terrain * mapimg_client_tile_terrain(const struct tile *ptile, const struct player *pplayer, bool knowledge)
Definition client_main.c:1556
announce
enum announce_type announce
Definition client_main.c:147
client_main
int client_main(int argc, char *argv[], bool postpone_tileset)
Definition client_main.c:344
server_host
char server_host[512]
Definition client_main.c:140
can_intel_with_player
bool can_intel_with_player(const struct player *pplayer)
Definition client_main.c:1286
client_player_number
int client_player_number(void)
Definition client_main.c:1354
mapimg_client_plrcolor_count
static int mapimg_client_plrcolor_count(void)
Definition client_main.c:1607
client_game_free
static void client_game_free(void)
Definition client_main.c:270
mapimg_client_tile_known
static enum known_type mapimg_client_tile_known(const struct tile *ptile, const struct player *pplayer, bool knowledge)
Definition client_main.c:1541
client_quitting
static bool client_quitting
Definition client_main.c:165
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
client_ss_val_bool_get
static bool client_ss_val_bool_get(server_setting_id id)
Definition client_main.c:1471
user_ended_turn
void user_ended_turn(void)
Definition client_main.c:801
get_conv
static bool get_conv(char *dst, size_t ndst, const char *src, size_t nsrc)
Definition client_main.c:189
client_ss_val_int_get
static int client_ss_val_int_get(server_setting_id id)
Definition client_main.c:1486
client_game_reset
static void client_game_reset(void)
Definition client_main.c:300
send_turn_done
void send_turn_done(void)
Definition client_main.c:809
client
struct civclient client
Definition client_main.c:149
auto_connect
bool auto_connect
Definition client_main.c:145
client_ss_val_bitwise_get
static unsigned int client_ss_val_bitwise_get(server_setting_id id)
Definition client_main.c:1501
seconds_shown_to_new_turn
static int seconds_shown_to_new_turn
Definition client_main.c:1105
client_state
enum client_states client_state(void)
Definition client_main.c:1029
is_waiting_turn_change
bool is_waiting_turn_change(void)
Definition client_main.c:1129
sound_plugin_name
char sound_plugin_name[512]
Definition client_main.c:137
emergency_exit
static void emergency_exit(void)
Definition client_main.c:227
seconds_to_turndone
static double seconds_to_turndone
Definition client_main.c:1094
log_option_save_msg
static void log_option_save_msg(enum log_level lvl, const char *msg,...)
Definition client_main.c:715
auto_spawn
bool auto_spawn
Definition client_main.c:146
scriptfile
char * scriptfile
Definition client_main.c:134
set_seconds_to_turndone
void set_seconds_to_turndone(double seconds)
Definition client_main.c:1113
seconds_shown_to_turndone
static int seconds_shown_to_turndone
Definition client_main.c:1104
send_report_request
void send_report_request(enum report_type type)
Definition client_main.c:839
client_game_init
static void client_game_init(void)
Definition client_main.c:247
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
start_quitting
void start_quitting(void)
Definition client_main.c:1645
client_has_player
bool client_has_player(void)
Definition client_main.c:1365
is_server_busy
bool is_server_busy(void)
Definition client_main.c:1338
between_turns
static struct timer * between_turns
Definition client_main.c:1099
mapimg_client_tile_owner
static struct player * mapimg_client_tile_owner(const struct tile *ptile, const struct player *pplayer, bool knowledge)
Definition client_main.c:1565
title_for_player
const char * title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
Definition client_main.c:1297
client_exit
void client_exit(int return_value)
Definition client_main.c:728
fc_password
char fc_password[MAX_LEN_PASSWORD]
Definition client_main.c:142
default_tileset_select
int default_tileset_select(void)
Definition client_main.c:322
wait_till_request_got_processed
void wait_till_request_got_processed(int request_id)
Definition client_main.c:1077
server_port
int server_port
Definition client_main.c:144
server_busy
static bool server_busy
Definition client_main.c:159
client_ss_name_get
static const char * client_ss_name_get(server_setting_id id)
Definition client_main.c:1413
set_client_state
void set_client_state(enum client_states newstate)
Definition client_main.c:847
savefile
char * savefile
Definition client_main.c:135
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
client_states
client_states
Definition client_main.h:43
C_S_PREPARING
@ C_S_PREPARING
Definition client_main.h:46
C_S_DISCONNECTED
@ C_S_DISCONNECTED
Definition client_main.h:45
C_S_INITIAL
@ C_S_INITIAL
Definition client_main.h:44
C_S_RUNNING
@ C_S_RUNNING
Definition client_main.h:47
C_S_OVER
@ C_S_OVER
Definition client_main.h:48
gui_character_encoding
const char *const gui_character_encoding
Definition gui_main.c:160
gui_use_transliteration
const bool gui_use_transliteration
Definition gui_main.c:161
create_event
void create_event(struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
Definition climisc.c:1075
center_on_something
void center_on_something(void)
Definition climisc.c:424
climisc.h
start_autoconnecting_to_server
void start_autoconnecting_to_server(void)
Definition clinet.c:547
try_to_autoconnect
double try_to_autoconnect(void)
Definition clinet.c:492
input_from_server_till_request_got_processed
void input_from_server_till_request_got_processed(int fd, int expected_request_id)
Definition clinet.c:442
disconnect_from_server
void disconnect_from_server(void)
Definition clinet.c:305
clinet.h
cma_is_city_under_agent
bool cma_is_city_under_agent(const struct city *pcity, struct cm_parameter *parameter)
Definition cma_core.c:550
cma_release_city
void cma_release_city(struct city *pcity)
Definition cma_core.c:540
cma_core.h
client_kill_server
void client_kill_server(bool force)
Definition connectdlg_common.c:153
client_start_server
bool client_start_server(void)
Definition connectdlg_common.c:224
connectdlg_common.h
connectdlg_g.h
conn_reset_delta_state
void conn_reset_delta_state(struct connection *pc)
Definition connection.c:670
MAX_LEN_PASSWORD
#define MAX_LEN_PASSWORD
Definition connection.h:58
blink_turn_done_button
double blink_turn_done_button(void)
Definition control.c:907
control_free
void control_free(void)
Definition control.c:154
unit_focus_set
void unit_focus_set(struct unit *punit)
Definition control.c:502
get_units_in_focus
struct unit_list * get_units_in_focus(void)
Definition control.c:177
control_init
void control_init(void)
Definition control.c:137
get_num_units_in_focus
int get_num_units_in_focus(void)
Definition control.c:185
unit_focus_update
void unit_focus_update(void)
Definition control.c:772
control_mouse_cursor
void control_mouse_cursor(struct tile *ptile)
Definition control.c:1188
blink_active_unit
double blink_active_unit(void)
Definition control.c:875
control.h
dataio.h
dio_set_get_conv_callback
void dio_set_get_conv_callback(DIO_GET_CONV_FUN fun)
Definition dataio_raw.c:131
dio_set_put_conv_callback
void dio_set_put_conv_callback(DIO_PUT_CONV_FUN fun)
Definition dataio_raw.c:102
deprecation_warnings_enable
void deprecation_warnings_enable(void)
Definition deprecations.c:35
deprecations.h
dialogs_g.h
diplodlg_g.h
could_intel_with_player
bool could_intel_with_player(const struct player *pplayer, const struct player *aplayer)
Definition diptreaty.c:81
could_meet_with_player
bool could_meet_with_player(const struct player *pplayer, const struct player *aplayer)
Definition diptreaty.c:61
diptreaty.h
editgui_g.h
editor_init
void editor_init(void)
Definition editor.c:193
editor_clear
void editor_clear(void)
Definition editor.c:246
editor_free
void editor_free(void)
Definition editor.c:257
editor.h
cmdhelp_destroy
void cmdhelp_destroy(struct cmdhelp *pcmdhelp)
Definition fc_cmdhelp.c:70
cmdhelp_display
void cmdhelp_display(struct cmdhelp *pcmdhelp, bool sort, bool gui_options, bool report_bugs)
Definition fc_cmdhelp.c:104
cmdhelp_new
struct cmdhelp * cmdhelp_new(const char *cmdname)
Definition fc_cmdhelp.c:57
cmdhelp_add
void cmdhelp_add(struct cmdhelp *pcmdhelp, const char *shortarg, const char *longarg, const char *helpstr,...)
Definition fc_cmdhelp.c:86
fc_cmdhelp.h
is_option
bool is_option(const char *option_name, char *option)
Definition fc_cmdline.c:112
get_option_malloc
char * get_option_malloc(const char *option_name, char **argv, int *i, int argc, bool gc)
Definition fc_cmdline.c:50
cmdline_option_values_free
void cmdline_option_values_free(void)
Definition fc_cmdline.c:97
fc_cmdline.h
i_am_client
void i_am_client(void)
Definition fc_interface.c:65
libfreeciv_init
void libfreeciv_init(bool check_fc_interface)
Definition fc_interface.c:74
libfreeciv_free
void libfreeciv_free(void)
Definition fc_interface.c:103
fc_interface_funcs
struct functions * fc_interface_funcs(void)
Definition fc_interface.c:47
fc_interface.h
fc_prehdrs.h
server_setting_id
int server_setting_id
Definition fc_types.h:924
MAX_LEN_NAME
#define MAX_LEN_NAME
Definition fc_types.h:66
IDENTITY_NUMBER_ZERO
#define IDENTITY_NUMBER_ZERO
Definition fc_types.h:82
backtrace_deinit
void backtrace_deinit(void)
Definition fcbacktrace.c:65
backtrace_init
void backtrace_init(void)
Definition fcbacktrace.c:55
fcbacktrace.h
get_internal_encoding
const char * get_internal_encoding(void)
Definition fciconv.c:182
init_character_encodings
static char void init_character_encodings(const char *my_internal_encoding, bool my_use_transliteration)
Definition fciconv.c:70
fciconv.h
internal_to_data_string_malloc
char * internal_to_data_string_malloc(const char *text)
fc_fprintf
void fc_fprintf(FILE *stream, const char *format,...) fc__attribute((__format__(__printf__
data_to_internal_string_malloc
char * data_to_internal_string_malloc(const char *text)
get_locale_dir
const char * get_locale_dir(void)
Definition fcintl.c:111
fcintl.h
bindtextdomain
#define bindtextdomain(Package, Directory)
Definition fcintl.h:82
_
#define _(String)
Definition fcintl.h:67
ftc_client
const struct ft_color ftc_client
Definition featured_text.c:78
game_reset
void game_reset(void)
Definition game.c:475
game
struct civ_game game
Definition game.c:57
current_turn_timeout
int current_turn_timeout(void)
Definition game.c:828
game_init
void game_init(bool keep_ruleset_value)
Definition game.c:429
game_free
void game_free(void)
Definition game.c:459
game.h
global_worklists_build
void global_worklists_build(void)
Definition global_worklist.c:100
global_worklists_unbuild
void global_worklists_unbuild(void)
Definition global_worklist.c:145
global_worklist.h
default_title_for_player
const char * default_title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
Definition government.c:425
ruler_title_for_player
const char * ruler_title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
Definition government.c:390
graphics_g.h
popdown_all_city_dialogs
void popdown_all_city_dialogs(void)
Definition citydlg.c:599
color_free
void color_free(struct color *color)
Definition colors.c:53
popdown_races_dialog
void popdown_races_dialog(void)
Definition dialogs.c:1238
popdown_all_game_dialogs
void popdown_all_game_dialogs(void)
Definition dialogs.c:1523
close_all_diplomacy_dialogs
void close_all_diplomacy_dialogs(void)
Definition diplodlg.c:1228
editgui_popdown_all
void editgui_popdown_all(void)
Definition editgui.c:1889
editgui_tileset_changed
void editgui_tileset_changed(void)
Definition editgui.c:1861
ui_main
int ui_main(int argc, char **argv)
Definition gui_main.c:1702
client_string
const char * client_string
Definition gui_main.c:104
ui_exit
void ui_exit(void)
Definition gui_main.c:1872
ui_init
void ui_init(void)
Definition gui_main.c:1618
update_timeout_label
void update_timeout_label(void)
Definition mapview.c:101
update_info_label
void update_info_label(void)
Definition mapview.c:121
update_unit_info_label
void update_unit_info_label(struct unit_list *punits)
Definition mapview.c:258
type
GType type
Definition repodlgs.c:1312
voteinfo_gui_update
void voteinfo_gui_update(void)
Definition voteinfo_bar.c:214
funcs
static struct gui_funcs funcs
Definition gui_interface.c:35
gui_main_g.h
conn_list_dialog_update
void conn_list_dialog_update(void)
Definition update_queue.c:650
free_help_texts
void free_help_texts(void)
Definition helpdata.c:117
boot_help_texts
void boot_help_texts(void)
Definition helpdata.c:741
helpdata_init
void helpdata_init(void)
Definition helpdata.c:87
helpdata_done
void helpdata_done(void)
Definition helpdata.c:95
helpdata.h
idex.h
name
const char * name
Definition inputfile.c:127
log_close
void log_close(void)
Definition log.c:270
log_init
void log_init(const char *filename, enum log_level initial_level, log_callback_fn callback, log_prefix_fn prefix, int fatal_assertions)
Definition log.c:245
log_parse_level_str
bool log_parse_level_str(const char *level_str, enum log_level *ret_level)
Definition log.c:86
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
fc_assert
#define fc_assert(condition)
Definition log.h:176
log_va_list
#define log_va_list(level, msg, args)
Definition log.h:128
fc_assert_ret_val
#define fc_assert_ret_val(condition, val)
Definition log.h:194
log_fatal
#define log_fatal(message,...)
Definition log.h:100
log_debug
#define log_debug(message,...)
Definition log.h:115
log_normal
#define log_normal(message,...)
Definition log.h:107
log_level
log_level
Definition log.h:28
LOG_NORMAL
@ LOG_NORMAL
Definition log.h:32
log_error
#define log_error(message,...)
Definition log.h:103
FC_STATIC_ASSERT
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:235
fc_assert_ret_val_msg
#define fc_assert_ret_val_msg(condition, val, message,...)
Definition log.h:208
map.h
update_turn_done_button_state
void update_turn_done_button_state(void)
Definition mapctrl_common.c:644
can_end_turn
bool can_end_turn(void)
Definition mapctrl_common.c:528
mapctrl_g.h
mapimg_free
void mapimg_free(void)
Definition mapimg.c:557
mapimg_init
void mapimg_init(mapimg_tile_known_func mapimg_tile_known, mapimg_tile_terrain_func mapimg_tile_terrain, mapimg_tile_player_func mapimg_tile_owner, mapimg_tile_player_func mapimg_tile_city, mapimg_tile_player_func mapimg_tile_unit, mapimg_plrcolor_count_func mapimg_plrcolor_count, mapimg_plrcolor_get_func mapimg_plrcolor_get)
Definition mapimg.c:505
mapimg_reset
void mapimg_reset(void)
Definition mapimg.c:540
mapimg.h
update_map_canvas_visible
void update_map_canvas_visible(void)
Definition mapview_common.c:1843
animations_init
void animations_init(void)
Definition mapview_common.c:178
link_marks_init
void link_marks_init(void)
Definition mapview_common.c:3918
animations_free
void animations_free(void)
Definition mapview_common.c:186
can_slide
bool can_slide
Definition mapview_common.c:75
link_marks_free
void link_marks_free(void)
Definition mapview_common.c:3930
mapview_common.h
mapview_g.h
mem.h
menu_g.h
menus_init
void menus_init(void)
Definition update_queue.c:554
meswin_clear_older
void meswin_clear_older(int turn, int phase)
Definition messagewin_common.c:65
MESWIN_CLEAR_ALL
#define MESWIN_CLEAR_ALL
Definition messagewin_common.h:41
messagewin_g.h
start_menu_music
void start_menu_music(const char *const tag, char *const alt_tag)
Definition music.c:90
stop_menu_music
void stop_menu_music(void)
Definition music.c:100
start_style_music
void start_style_music(void)
Definition music.c:36
stop_style_music
void stop_style_music(void)
Definition music.c:82
music.h
fc_shutdown_network
void fc_shutdown_network(void)
Definition netintf.c:217
announce_type
announce_type
Definition net_types.h:53
ANNOUNCE_IPV6
@ ANNOUNCE_IPV6
Definition net_types.h:56
ANNOUNCE_IPV4
@ ANNOUNCE_IPV4
Definition net_types.h:55
ANNOUNCE_NONE
@ ANNOUNCE_NONE
Definition net_types.h:54
fc_init_network
void fc_init_network(void)
Definition netintf.c:198
ANNOUNCE_DEFAULT
#define ANNOUNCE_DEFAULT
Definition net_types.h:59
netintf.h
fill_topo_ts_default
void fill_topo_ts_default(void)
Definition options.c:6555
server_optset
const struct option_set * server_optset
Definition options.c:4009
options_free
void options_free(void)
Definition options.c:6271
option_number
int option_number(const struct option *poption)
Definition options.c:593
option_name
const char * option_name(const struct option *poption)
Definition options.c:603
option_int_get
int option_int_get(const struct option *poption)
Definition options.c:809
options_init
void options_init(void)
Definition options.c:6173
optset_option_by_number
struct option * optset_option_by_number(const struct option_set *poptset, int id)
Definition options.c:395
option_bool_get
bool option_bool_get(const struct option *poption)
Definition options.c:772
server_options_init
void server_options_init(void)
Definition options.c:4153
option_type
enum option_type option_type(const struct option *poption)
Definition options.c:633
options_dialogs_update
void options_dialogs_update(void)
Definition options.c:5836
server_options_free
void server_options_free(void)
Definition options.c:4222
options_load
void options_load(void)
Definition options.c:5897
options_save
void options_save(option_save_log_callback log_cb)
Definition options.c:6053
gui_options
struct client_options gui_options
Definition options.c:71
option_bitwise_get
unsigned option_bitwise_get(const struct option *poption)
Definition options.c:1049
optset_option_by_name
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:406
options_dialogs_set
void options_dialogs_set(void)
Definition options.c:5864
options.h
DEFAULT_METASERVER_OPTION
#define DEFAULT_METASERVER_OPTION
Definition options.h:29
refresh_overview_canvas
void refresh_overview_canvas(void)
Definition overview_common.c:375
overview_free
void overview_free(void)
Definition overview_common.c:509
overview_common.h
packets_deinit
void packets_deinit(void)
Definition packets.c:900
packets.h
report_type
report_type
Definition packets.h:73
packet_name
const char * packet_name(enum packet_type type)
Definition packets_gen.c:49
dsend_packet_player_phase_done
int dsend_packet_player_phase_done(struct connection *pc, int turn)
Definition packets_gen.c:35176
send_packet_client_heartbeat
int send_packet_client_heartbeat(struct connection *pc)
Definition packets_gen.c:52116
send_packet_player_attribute_block
int send_packet_player_attribute_block(struct connection *pc)
Definition packets_gen.c:35798
dsend_packet_report_req
int dsend_packet_report_req(struct connection *pc, enum report_type type)
Definition packets_gen.c:51181
PACKET_CONN_PING
@ PACKET_CONN_PING
Definition packets_gen.h:1951
PACKET_PROCESSING_STARTED
@ PACKET_PROCESSING_STARTED
Definition packets_gen.h:1884
PACKET_PROCESSING_FINISHED
@ PACKET_PROCESSING_FINISHED
Definition packets_gen.h:1885
PACKET_AUTHENTICATION_REQ
@ PACKET_AUTHENTICATION_REQ
Definition packets_gen.h:1888
PACKET_SERVER_JOIN_REPLY
@ PACKET_SERVER_JOIN_REPLY
Definition packets_gen.h:1887
PACKET_CONNECT_MSG
@ PACKET_CONNECT_MSG
Definition packets_gen.h:1906
PACKET_EARLY_CHAT_MSG
@ PACKET_EARLY_CHAT_MSG
Definition packets_gen.h:1907
PACKET_SERVER_SHUTDOWN
@ PACKET_SERVER_SHUTDOWN
Definition packets_gen.h:1890
PACKET_SERVER_INFO
@ PACKET_SERVER_INFO
Definition packets_gen.h:1908
packhand_free
void packhand_free(void)
Definition packhand.c:215
len
int len
Definition packhand.c:125
packhand.h
client_handle_packet
bool client_handle_packet(enum packet_type type, const void *packet)
Definition packhand_gen.c:20
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
is_valid_username
bool is_valid_username(const char *name)
Definition player.c:1872
player_count
int player_count(void)
Definition player.c:808
player_number
int player_number(const struct player *pplayer)
Definition player.c:828
player.h
players_iterate_end
#define players_iterate_end
Definition player.h:535
players_iterate
#define players_iterate(_pplayer)
Definition player.h:530
init_player_dlg_common
void init_player_dlg_common(void)
Definition plrdlg_common.c:604
plrdlg_g.h
fc_srand
void fc_srand(RANDOM_TYPE seed)
Definition rand.c:128
rand.h
fc_rand
#define fc_rand(_size)
Definition rand.h:34
registry_module_init
void registry_module_init(void)
Definition registry.c:30
registry_module_close
void registry_module_close(void)
Definition registry.c:40
registry.h
repodlgs_g.h
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
fatal_assertions
static int fatal_assertions
Definition ruledit.cpp:58
script_client_init
bool script_client_init(void)
Definition script_client.c:195
script_client_free
void script_client_free(void)
Definition script_client.c:283
script_client.h
server_settings.h
SERVER_SETTING_NONE
#define SERVER_SETTING_NONE
Definition server_settings.h:26
user_username
char * user_username(char *buf, size_t bufsz)
Definition shared.c:705
dont_run_as_root
void dont_run_as_root(const char *argv0, const char *fallback)
Definition shared.c:1539
str_to_int
bool str_to_int(const char *str, int *pint)
Definition shared.c:512
MIN
#define MIN(x, y)
Definition shared.h:55
FC_INFINITY
#define FC_INFINITY
Definition shared.h:36
MAX
#define MAX(x, y)
Definition shared.h:54
ai_type
Definition ai.h:50
city
Definition city.h:309
city::id
int id
Definition city.h:315
civ_game::est_connections
struct conn_list * est_connections
Definition game.h:97
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::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
civclient
Definition client_main.h:94
civclient::conn
struct connection conn
Definition client_main.h:96
client_options::default_server_port
int default_server_port
Definition options.h:109
client_options::default_sound_set_name
char default_sound_set_name[512]
Definition options.h:116
client_options::use_prev_server
bool use_prev_server
Definition options.h:110
client_options::default_metaserver
char default_metaserver[512]
Definition options.h:112
client_options::default_tileset_name
char default_tileset_name[512]
Definition options.h:126
client_options::auto_center_each_turn
bool auto_center_each_turn
Definition options.h:151
client_options::default_server_host
char default_server_host[512]
Definition options.h:108
client_options::heartbeat_enabled
bool heartbeat_enabled
Definition options.h:111
client_options::save_options_on_exit
bool save_options_on_exit
Definition options.h:121
client_options::default_music_set_name
char default_music_set_name[512]
Definition options.h:117
client_options::default_sound_plugin_name
char default_sound_plugin_name[512]
Definition options.h:118
client_options::default_user_name
char default_user_name[512]
Definition options.h:107
cmdhelp
Definition fc_cmdhelp.c:43
connection
Definition connection.h:141
connection::established
bool established
Definition connection.h:145
connection::playing
struct player * playing
Definition connection.h:156
connection::observer
bool observer
Definition connection.h:152
connection::sock
int sock
Definition connection.h:143
functions
Definition fc_interface.h:33
option
Definition options.c:454
packet_game_info::turn
int turn
Definition packets_gen.h:241
packet_timeout_info::last_turn_change_time
float last_turn_change_time
Definition packets_gen.h:263
player
Definition player.h:249
player::cities
struct city_list * cities
Definition player.h:281
player::tile_vision
struct dbv tile_vision[V_COUNT]
Definition player.h:359
player::client
struct player::@69::@72 client
player::connections
struct conn_list * connections
Definition player.h:298
rgbcolor
Definition rgbcolor.h:33
terrain
Definition terrain.h:176
tile
Definition tile.h:49
tile::units
struct unit_list * units
Definition tile.h:57
tileset
Definition tilespec.c:459
timer
Definition timing.c:81
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
fc_strcasecmp
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:189
fc_at_quick_exit
int fc_at_quick_exit(void(*func)(void))
Definition support.c:1326
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
init_themes
void init_themes(void)
Definition themes_common.c:65
themes_common.h
tile_get_known
enum known_type tile_get_known(const struct tile *ptile, const struct player *pplayer)
Definition tile.c:386
tile_city
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
tile_index
#define tile_index(_pt_)
Definition tile.h:87
known_type
known_type
Definition tile.h:34
TILE_KNOWN_SEEN
@ TILE_KNOWN_SEEN
Definition tile.h:37
tile_terrain
#define tile_terrain(_tile)
Definition tile.h:109
tile_owner
#define tile_owner(_tile)
Definition tile.h:95
tilespec_try_read
bool tilespec_try_read(const char *tileset_name, bool verbose, int topo_id, bool global_default)
Definition tilespec.c:1240
unscaled_tileset
struct tileset * unscaled_tileset
Definition tilespec.c:545
tileset_free
void tileset_free(struct tileset *t)
Definition tilespec.c:1218
tilespec.h
timer_start
void timer_start(struct timer *t)
Definition timing.c:224
timer_read_seconds
double timer_read_seconds(struct timer *t)
Definition timing.c:344
timer_renew
struct timer * timer_renew(struct timer *t, enum timer_timetype type, enum timer_use use)
Definition timing.c:176
timing.h
TIMER_ACTIVE
@ TIMER_ACTIVE
Definition timing.h:45
TIMER_USER
@ TIMER_USER
Definition timing.h:41
unit_owner
#define unit_owner(_pu)
Definition unit.h:387
role_unit_precalcs
void role_unit_precalcs(void)
Definition unittype.c:2223
update_queue_free
void update_queue_free(void)
Definition update_queue.c:190
update_queue_init
void update_queue_init(void)
Definition update_queue.c:169
update_queue.h
freeciv_name_version
const char * freeciv_name_version(void)
Definition version.c:35
version.h
voteinfo_queue_init
void voteinfo_queue_init(void)
Definition voteinfo.c:167
voteinfo_queue_check_removed
void voteinfo_queue_check_removed(void)
Definition voteinfo.c:72
voteinfo_queue_free
void voteinfo_queue_free(void)
Definition voteinfo.c:179
voteinfo.h
voteinfo_bar_g.h
zoom_update
bool zoom_update(double time_until_next_call)
Definition zoom.c:172
zoom.h