Freeciv-3.2
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 "svgflag.h"
98#include "tilespec.h"
99#include "themes_common.h"
100#include "update_queue.h"
101#include "voteinfo.h"
102#include "zoom.h"
103
104/* client/agents */
105#include "agents.h"
106#include "cma_core.h" /* kludge */
107
108/* client/luascript */
109#include "script_client.h"
110
111#include "client_main.h"
112
113
114static enum known_type mapimg_client_tile_known(const struct tile *ptile,
115 const struct player *pplayer,
116 bool knowledge);
117static struct terrain
118 *mapimg_client_tile_terrain(const struct tile *ptile,
119 const struct player *pplayer, bool knowledge);
120static struct player *mapimg_client_tile_owner(const struct tile *ptile,
121 const struct player *pplayer,
122 bool knowledge);
123static struct player *mapimg_client_tile_city(const struct tile *ptile,
124 const struct player *pplayer,
125 bool knowledge);
126static struct player *mapimg_client_tile_unit(const struct tile *ptile,
127 const struct player *pplayer,
128 bool knowledge);
129static int mapimg_client_plrcolor_count(void);
130static struct rgbcolor *mapimg_client_plrcolor_get(int i);
131
132static void fc_interface_init_client(void);
133
134char *logfile = NULL;
137char forced_tileset_name[512] = "\0";
138char sound_plugin_name[512] = "\0";
139char sound_set_name[512] = "\0";
140char music_set_name[512] = "\0";
141char server_host[512] = "\0";
142char user_name[512] = "\0";
144char metaserver[512] = "\0";
145int server_port = -1;
146bool auto_connect = FALSE; /* TRUE = skip "Connect to Freeciv Server" dialog */
147bool auto_spawn = FALSE; /* TRUE = skip main menu, start local server */
149
151
153
154/* TRUE if an end turn request is blocked by busy agents */
156
157/*
158 * TRUE between receiving PACKET_END_TURN and PACKET_BEGIN_TURN
159 */
160static bool server_busy = FALSE;
161
162#ifdef FREECIV_DEBUG
163bool hackless = FALSE;
164#endif
165
166static bool client_quitting = FALSE;
167
168/**********************************************************************/
172static char *put_conv(const char *src, size_t *length)
173{
175
176 if (out) {
177 *length = strlen(out);
178 return out;
179 } else {
180 *length = 0;
181 return NULL;
182 }
183}
184
185/**********************************************************************/
190static bool get_conv(char *dst, size_t ndst,
191 const char *src, size_t nsrc)
192{
194 bool ret = TRUE;
195 size_t len;
196
197 if (!out) {
198 dst[0] = '\0';
199 return FALSE;
200 }
201
202 len = strlen(out);
203 if (ndst > 0 && len >= ndst) {
204 ret = FALSE;
205 len = ndst - 1;
206 }
207
208 memcpy(dst, out, len);
209 dst[len] = '\0';
210 free(out);
211
212 return ret;
213}
214
215/**********************************************************************/
223
224/**********************************************************************/
228static void emergency_exit(void)
229{
231}
232
233/**********************************************************************/
236static void at_exit(void)
237{
243}
244
245/**********************************************************************/
267
268/**********************************************************************/
271static void client_game_free(void)
272{
274
276 mapimg_free();
281 control_free();
284 agents_free();
287 game_free();
288 /* update_queue_init() is correct at this point. The queue is reset to
289 a clean state which is also needed if the client is not connected to
290 the server! */
292
295}
296
297/**********************************************************************/
301static void client_game_reset(void)
302{
304
307 control_free();
309 agents_free();
310
311 game_reset();
312 mapimg_reset();
313
315 agents_init();
316 control_init();
318}
319
320/**********************************************************************/
324{
326
327 if (forced_tileset_name[0] != '\0') {
329 log_error(_("Can't load requested tileset %s!"), forced_tileset_name);
331 return EXIT_FAILURE;
332 }
333 } else {
334 if (gui_options.default_tileset_name[0] == '\0') {
335 /* Use topology by default */
337 FALSE, -1, TRUE);
338 } else {
340 }
341 }
342
343 editor_init();
344
345 return EXIT_SUCCESS;
346}
347
348/**********************************************************************/
351int client_main(int argc, char *argv[], bool postpone_tileset)
352{
353 int i;
354 enum log_level loglevel = LOG_NORMAL;
355 int ui_options = 0;
356 bool ui_separator = FALSE;
357 char *option = NULL;
358 int fatal_assertions = -1;
359 int aii;
360 int uret;
361
362 /* Load Windows post-crash debugger */
363#ifdef FREECIV_MSWINDOWS
364# ifndef FREECIV_NDEBUG
365 if (LoadLibrary("exchndl.dll") == NULL) {
366# ifdef FREECIV_DEBUG
367 fprintf(stderr, "exchndl.dll could not be loaded, no crash debugger\n");
368# endif /* FREECIV_DEBUG */
369 }
370# endif /* FREECIV_NDEBUG */
371#endif /* FREECIV_MSWINDOWS */
372
373 /* fc_interface_init_client() includes low level support like
374 * guaranteeing that fc_vsnprintf() will work after it,
375 * so this need to be early. */
377
378 i_am_client(); /* Tell to libfreeciv that we are client */
379
381
382 /* Ensure that all AIs are initialized to unused state
383 * Not using ai_type_iterate as it would stop at
384 * current ai type count, ai_type_get_count(), i.e., 0 */
385 for (aii = 0; aii < FREECIV_AI_MOD_LAST; aii++) {
386 struct ai_type *ai = get_ai_type(aii);
387
388 init_ai(ai);
389 }
390
391#ifdef ENABLE_NLS
392 (void) bindtextdomain("freeciv-nations", get_locale_dir());
393#endif
394
396 audio_init();
398#ifdef ENABLE_NLS
400#endif
401
402 i = 1;
403
405
406 while (i < argc) {
407 if (ui_separator) {
408 argv[1 + ui_options] = argv[i];
409 ui_options++;
410 } else if (is_option("--help", argv[i])) {
411 struct cmdhelp *help = cmdhelp_new(argv[0]);
412
413 cmdhelp_add(help, "A",
414 /* TRANS: "Announce" is exactly what user must type, do not translate. */
415 _("Announce PROTO"),
416 _("Announce game in LAN using protocol PROTO "
417 "(IPv4/IPv6/none)"));
418 cmdhelp_add(help, "a", "autoconnect",
419 _("Skip connect dialog"));
420#ifdef FREECIV_DEBUG
421 cmdhelp_add(help, "d",
422 /* TRANS: "debug" is exactly what user must type, do not translate. */
423 _("debug LEVEL"),
424 _("Set debug log level (one of f,e,w,n,v,d, or "
425 "d:file1,min,max:...)"));
426#else /* FREECIV_DEBUG */
427 cmdhelp_add(help, "d",
428 /* TRANS: "debug" is exactly what user must type, do not translate. */
429 _("debug LEVEL"),
430 _("Set debug log level (one of f,e,w,n,v)"));
431#endif /* FREECIV_DEBUG */
432#ifndef FREECIV_NDEBUG
433 cmdhelp_add(help, "F",
434 /* TRANS: "Fatal" is exactly what user must type, do not translate. */
435 _("Fatal [SIGNAL]"),
436 _("Raise a signal on failed assertion"));
437#endif /* FREECIV_NDEBUG */
438 cmdhelp_add(help, "f",
439 /* TRANS: "file" is exactly what user must type, do not translate. */
440 _("file FILE"),
441 _("Load saved game FILE"));
442 cmdhelp_add(help, "h", "help",
443 _("Print a summary of the options"));
444#ifdef FREECIV_DEBUG
445 cmdhelp_add(help, "H", "Hackless",
446 _("Do not request hack access to local server"));
447#endif /* FREECIV_DEBUG */
448 cmdhelp_add(help, "l",
449 /* TRANS: "log" is exactly what user must type, do not translate. */
450 _("log FILE"),
451 _("Use FILE as logfile (spawned server also uses this)"));
452 cmdhelp_add(help, "M",
453 /* TRANS: "Meta" is exactly what user must type, do not translate. */
454 _("Meta HOST"),
455 _("Connect to the metaserver at HOST"));
456 cmdhelp_add(help, "n",
457 /* TRANS: "name" is exactly what user must type, do not translate. */
458 _("name NAME"),
459 _("Use NAME as username on server"));
460 cmdhelp_add(help, "p",
461 /* TRANS: "port" is exactly what user must type, do not translate. */
462 _("port PORT"),
463 _("Connect to server port PORT (usually with -a)"));
464 cmdhelp_add(help, "P",
465 /* TRANS: "Plugin" is exactly what user must type, do not translate. */
466 _("Plugin PLUGIN"),
467 _("Use PLUGIN for sound output %s"),
469 cmdhelp_add(help, "r",
470 /* TRANS: "read" is exactly what user must type, do not translate. */
471 _("read FILE"),
472 _("Read startup script FILE (for spawned server only)"));
473 cmdhelp_add(help, "s",
474 /* TRANS: "server" is exactly what user must type, do not translate. */
475 _("server HOST"),
476 _("Connect to the server at HOST (usually with -a)"));
477 cmdhelp_add(help, "S",
478 /* TRANS: "Sound" is exactly what user must type, do not translate. */
479 _("Sound FILE"),
480 _("Read sound tags from FILE"));
481 cmdhelp_add(help, "m",
482 /* TRANS: "music" is exactly what user must type, do not translate. */
483 _("music FILE"),
484 _("Read music tags from FILE"));
485 cmdhelp_add(help, "t",
486 /* TRANS: "tiles" is exactly what user must type, do not translate. */
487 _("tiles FILE"),
488 _("Use data file FILE.tilespec for tiles"));
489 cmdhelp_add(help, "v", "version",
490 _("Print the version number"));
491 cmdhelp_add(help, "w", "warnings",
492 _("Warn about deprecated modpack constructs"));
493
494 /* The function below prints a header and footer for the options.
495 * Furthermore, the options are sorted. */
496 cmdhelp_display(help, TRUE, TRUE, TRUE);
497 cmdhelp_destroy(help);
498
500 } else if (is_option("--version", argv[i])) {
503#ifdef FREECIV_DEBUG
504 } else if (is_option("--Hackless", argv[i])) {
505 hackless = TRUE;
506#endif /* FREECIV_DEBUG */
507 } else if ((option = get_option_malloc("--log", argv, &i, argc, TRUE))) {
508 logfile = option;
509#ifndef FREECIV_NDEBUG
510 } else if (is_option("--Fatal", argv[i])) {
511 if (i + 1 >= argc || '-' == argv[i + 1][0]) {
513 } else if (str_to_int(argv[i + 1], &fatal_assertions)) {
514 i++;
515 } else {
516 fc_fprintf(stderr, _("Invalid signal number \"%s\".\n"),
517 argv[i + 1]);
518 fc_fprintf(stderr, _("Try using --help.\n"));
520 }
521#endif /* FREECIV_NDEBUG */
522 } else if ((option = get_option_malloc("--read", argv, &i, argc, TRUE))) {
524 } else if ((option = get_option_malloc("--file", argv, &i, argc, TRUE))) {
527 } else if ((option = get_option_malloc("--name", argv, &i, argc, FALSE))) {
529 free(option);
530 } else if ((option = get_option_malloc("--Meta", argv, &i, argc, FALSE))) {
532 free(option);
533 } else if ((option = get_option_malloc("--Sound", argv, &i, argc, FALSE))) {
535 free(option);
536 } else if ((option = get_option_malloc("--music", argv, &i, argc, FALSE))) {
538 free(option);
539 } else if ((option = get_option_malloc("--Plugin", argv, &i, argc, FALSE))) {
541 free(option);
542 } else if ((option = get_option_malloc("--port", argv, &i, argc, FALSE))) {
543 if (!str_to_int(option, &server_port)) {
545 _("Invalid port \"%s\" specified with --port option.\n"),
546 option);
547 fc_fprintf(stderr, _("Try using --help.\n"));
549 }
550 free(option);
551 } else if ((option = get_option_malloc("--server", argv, &i, argc, FALSE))) {
553 free(option);
554 } else if (is_option("--autoconnect", argv[i])) {
556 } else if ((option = get_option_malloc("--debug", argv, &i, argc, FALSE))) {
557 if (!log_parse_level_str(option, &loglevel)) {
559 _("Invalid debug level \"%s\" specified with --debug "
560 "option.\n"), option);
561 fc_fprintf(stderr, _("Try using --help.\n"));
563 }
564 free(option);
565 } else if ((option = get_option_malloc("--tiles", argv, &i, argc, FALSE))) {
567 free(option);
568 } else if ((option = get_option_malloc("--Announce", argv, &i, argc, FALSE))) {
569 if (!fc_strcasecmp(option, "ipv4")) {
571 } else if (!fc_strcasecmp(option, "none")) {
573#ifdef FREECIV_IPV6_SUPPORT
574 } else if (!fc_strcasecmp(option, "ipv6")) {
576#endif /* IPv6 support */
577 } else {
578 fc_fprintf(stderr, _("Invalid announce protocol \"%s\".\n"), option);
580 }
581 free(option);
582 } else if (is_option("--warnings", argv[i])) {
584 } else if (is_option("--", argv[i])) {
586 } else {
587 fc_fprintf(stderr, _("Unrecognized option: \"%s\"\n"), argv[i]);
589 }
590 i++;
591 } /* of while */
592
593 if (auto_spawn && auto_connect) {
594 /* TRANS: don't translate option names */
595 fc_fprintf(stderr, _("-f/--file and -a/--autoconnect options are "
596 "incompatible\n"));
598 }
599
600 /* Remove all options except those intended for the UI. */
601 argv[1 + ui_options] = NULL;
602 argc = 1 + ui_options;
603
604 /* disallow running as root -- too dangerous */
605 dont_run_as_root(argv[0], "freeciv_client");
606
609
610 /* after log_init: */
611
614 char buf[sizeof(gui_options.default_user_name)];
615
617 if (is_valid_username(buf)) {
619 } else {
622 "player%d", fc_rand(10000));
623 }
624 }
625
626 /* initialization */
627
630
631 ui_init();
635
637
638 /* register exit handler */
641
644 init_themes();
645
646 options_init();
647 options_load();
648
650
651 if (sound_set_name[0] == '\0') {
653 }
654 if (music_set_name[0] == '\0') {
656 }
657 if (sound_plugin_name[0] == '\0') {
659 }
660 if (server_host[0] == '\0') {
662 } else if (gui_options.use_prev_server) {
664 }
665 if (user_name[0] == '\0') {
667 }
668 if (metaserver[0] == '\0') {
671 } else {
673 }
674 }
675 if (server_port == -1) {
677 } else if (gui_options.use_prev_server) {
679 }
680
681 /* This seed is not saved anywhere; randoms in the client should
682 have cosmetic effects only (eg city name suggestions). --dwp */
686
688 start_menu_music("music_menu", NULL);
689
690 if (!postpone_tileset) {
692
693 if (tsret != EXIT_SUCCESS) {
694 return tsret;
695 }
696 }
697
698 /* run gui-specific client */
699 uret = ui_main(argc, argv);
700
701 /* termination */
703
704 /* not reached */
705 return EXIT_SUCCESS;
706}
707
708/**********************************************************************/
711static void log_option_save_msg(enum log_level lvl, const char *msg, ...)
712{
713 va_list args;
714
715 va_start(args, msg);
716 log_va_list(lvl, msg, args);
717 va_end(args);
718}
719
720/**********************************************************************/
725{
726 if (client_state() >= C_S_PREPARING) {
729 }
730
733 }
734
736 if (unscaled_tileset != NULL) {
738 }
739 if (tileset != NULL) {
741 }
742
743 ui_exit();
744
745 /* Play the exit sound while audio system dependencies still up. */
747
749
750 editor_free();
751 options_free();
752 if (client_state() >= C_S_PREPARING) {
754 }
755
756 helpdata_done(); /* client_exit() unlinks help text list */
759
763
765 log_close();
767
769}
770
771/**********************************************************************/
774void client_packet_input(void *packet, int type)
775{
785 && PACKET_SERVER_INFO != type) {
786 log_error("Received packet %s (%d) before establishing connection!",
789 } else if (!client_handle_packet(type, packet)) {
790 log_error("Received unknown packet (type %d) from server!", type);
792 }
793}
794
795/**********************************************************************/
799{
801}
802
803/**********************************************************************/
807{
808 log_debug("send_turn_done() can_end_turn=%d",
809 can_end_turn());
810
811 if (!can_end_turn()) {
812 /*
813 * The turn done button is disabled but the user may have pressed
814 * the return key.
815 */
816
817 if (agents_busy()) {
819 }
820
821 return;
822 }
823
825
827
829
831}
832
833/**********************************************************************/
840
841/**********************************************************************/
845{
847 struct player *pplayer = client_player();
848
849 if (auto_spawn) {
852 if (!client_start_server()) {
853 log_fatal(_("Failed to start local server; aborting."));
855 }
856 }
857
859 if (oldstate == C_S_DISCONNECTED) {
860 log_fatal(_("There was an error while auto connecting; aborting."));
862 } else {
864 auto_connect = FALSE; /* Don't try this again. */
865 }
866 }
867
870 /* Reset the delta-state. */
872 }
873
874 if (oldstate == newstate) {
875 return;
876 }
877
880
881 if (!is_client_quitting()) {
882 /* Back to menu */
883 start_menu_music("music_menu", NULL);
884 }
885 }
886
888
889 switch (newstate) {
890 case C_S_INITIAL:
891 log_error("%d is not a valid client state to set.", C_S_INITIAL);
892 break;
893
894 case C_S_DISCONNECTED:
899
903 editor_clear();
907 if (oldstate > C_S_PREPARING) {
909 }
910 }
911
913 break;
914
915 case C_S_PREPARING:
920
921 if (oldstate < C_S_PREPARING) {
923 } else {
924 /* From an upper state means that we didn't quit the server,
925 * so a lot of informations are still in effect. */
928 }
929
931
933 && get_client_page() != PAGE_LOAD) {
935 }
936 break;
937
938 case C_S_RUNNING:
939 if (oldstate == C_S_PREPARING) {
941 stop_menu_music(); /* Stop intro sound loop. */
942 }
943
946 create_event(NULL, E_GAME_START, ftc_client, _("Game started."));
947 if (pplayer) {
949 }
951 boot_help_texts(); /* Reboot with player */
955 can_slide = TRUE;
957 /* Find something sensible to display instead of the intro gfx. */
962
964
965 update_info_label(); /* Get initial population right */
968
971 }
973 audio_play_sound("e_enter_game", NULL, NULL);
974 break;
975
976 case C_S_OVER:
977 if (C_S_RUNNING == oldstate) {
978 /* Extra kludge for end-game handling of the CMA. */
979 if (pplayer && pplayer->cities) {
980 city_list_iterate(pplayer->cities, pcity) {
981 if (cma_is_city_under_agent(pcity, NULL)) {
982 cma_release_city(pcity);
983 }
985 }
990 } else {
991 /* From C_S_PREPARING. */
994 if (pplayer) {
996 }
998 boot_help_texts(); /* reboot */
1003 }
1005
1009
1010 break;
1011 }
1012
1013 menus_init();
1016 if (can_client_change_view()) {
1018 }
1019
1020 /* If turn was going to change, that is now aborted. */
1022}
1023
1024/**********************************************************************/
1028{
1029 return civclient_state;
1030}
1031
1032/**********************************************************************/
1036{
1038 "Trying to remove a non existing connection");
1039
1040 if (NULL != pconn->playing) {
1041 conn_list_remove(pconn->playing->connections, pconn);
1042 }
1046 free(pconn);
1047}
1048
1049/**********************************************************************/
1054{
1056 "Connection list missing");
1057
1058 while (conn_list_size(game.all_connections) > 0) {
1061 }
1062}
1063
1064/**********************************************************************/
1071
1072/**********************************************************************/
1080
1081/**********************************************************************/
1085{
1087}
1088
1089/* Seconds_to_turndone is the number of seconds the server has told us
1090 * are left. The timer tells exactly how much time has passed since the
1091 * server gave us that data. */
1092static double seconds_to_turndone = 0.0;
1093static struct timer *turndone_timer;
1094
1095/* The timer tells how long since server informed us about starting
1096 * turn-change activities. */
1097static struct timer *between_turns = NULL;
1099
1100/* This value shows what value the timeout label is currently showing for
1101 * the seconds-to-turndone. */
1104
1105/**********************************************************************/
1112{
1113 if (current_turn_timeout() > 0) {
1116 turndone_timer != NULL ? NULL : "turndone");
1118
1119 /* Maybe we should do an update_timeout_label here, but it doesn't
1120 * seem to be necessary. */
1122 }
1123}
1124
1125/**********************************************************************/
1129{
1130 return waiting_turn_change;
1131}
1132
1133/**********************************************************************/
1145
1146/**********************************************************************/
1154
1155/**********************************************************************/
1160{
1161 if (current_turn_timeout() > 0) {
1163 } else {
1164 /* This shouldn't happen. */
1165 return FC_INFINITY;
1166 }
1167}
1168
1169/**********************************************************************/
1174{
1176}
1177
1178/**********************************************************************/
1184{
1185 double time_until_next_call = 1.0;
1186
1188
1189 {
1192 }
1193
1194 if (C_S_RUNNING != client_state()) {
1195 return time_until_next_call;
1196 }
1197
1199
1200 {
1202
1204 }
1205
1206 if (get_num_units_in_focus() > 0) {
1207 double blink_time = blink_active_unit();
1208
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) {
1216 int iseconds = ceil(seconds + 0.1); /* Turn should end right on 0. */
1217
1221 }
1222
1224 seconds - floor(seconds) + 0.001);
1225 }
1226 if (waiting_turn_change) {
1228 int iseconds = ceil(seconds + 0.1); /* Turn should end right on 0. */
1229
1233 }
1234 }
1235
1236 {
1237 static long counter = 0;
1238
1239 counter++;
1240
1241 if (gui_options.heartbeat_enabled && (counter % (20 * 10) == 0)) {
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/**********************************************************************/
1255{
1256 return (NULL != client.conn.playing
1257 && !client_is_observer());
1258}
1259
1260/**********************************************************************/
1266{
1267 return (can_client_control()
1268 && C_S_RUNNING == client_state());
1269}
1270
1271/**********************************************************************/
1275bool can_meet_with_player(const struct player *pplayer)
1276{
1277 return (can_client_issue_orders()
1278 /* && NULL != client.conn.playing (above) */
1280}
1281
1282/**********************************************************************/
1286bool 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/**********************************************************************/
1297const 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/**********************************************************************/
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/**********************************************************************/
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 */
1332 }
1333}
1334
1335/**********************************************************************/
1339{
1340 return server_busy;
1341}
1342
1343/**********************************************************************/
1347{
1348 return client.conn.playing == NULL && client.conn.observer;
1349}
1350
1351/**********************************************************************/
1355{
1356 if (client.conn.playing == NULL) {
1357 return -1;
1358 }
1360}
1361
1362/**********************************************************************/
1366{
1367 return client.conn.playing != NULL;
1368}
1369
1370/**********************************************************************/
1374bool 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/**********************************************************************/
1384static 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/**********************************************************************/
1399{
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/**********************************************************************/
1414{
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/**********************************************************************/
1429{
1430 enum option_type opt_type;
1432
1433 if (!pset) {
1434 log_error("No server setting with the id %d exists.", id);
1435 return sset_type_invalid();
1436 }
1437
1439
1440 /* The option type isn't client only. */
1442 && opt_type != OT_COLOR
1443 && opt_type != OT_VIDEO_MODE),
1445 "%s is a client option type but not a server "
1446 "setting type",
1448
1449 /* The option type is valid. */
1452
1453 /* Each server setting type value equals the client option type value with
1454 * the same meaning. */
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,
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/**********************************************************************/
1472{
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/**********************************************************************/
1487{
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/**********************************************************************/
1502{
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/**********************************************************************/
1517{
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. */
1536}
1537
1538/**********************************************************************/
1541static enum known_type mapimg_client_tile_known(const struct tile *ptile,
1542 const struct player *pplayer,
1543 bool knowledge)
1544{
1546 return TILE_KNOWN_SEEN;
1547 }
1548
1549 return tile_get_known(ptile, pplayer);
1550}
1551
1552/**********************************************************************/
1555static struct terrain *
1557 const struct player *pplayer, bool knowledge)
1558{
1559 return tile_terrain(ptile);
1560}
1561
1562/**********************************************************************/
1565static 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/**********************************************************************/
1575static 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/**********************************************************************/
1591static 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/**********************************************************************/
1608{
1609 return player_count();
1610}
1611
1612/**********************************************************************/
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++;
1630
1631 return NULL;
1632}
1633
1634/**********************************************************************/
1638{
1639 return client_quitting;
1640}
1641
1642/**********************************************************************/
1646{
1648}
void agents_free(void)
Definition agents.c:349
void agents_disconnect(void)
Definition agents.c:404
void agents_game_start(void)
Definition agents.c:457
bool agents_busy(void)
Definition agents.c:803
void agents_init(void)
Definition agents.c:335
void init_ai(struct ai_type *ai)
Definition ai.c:270
struct ai_type * get_ai_type(int id)
Definition ai.c:260
void attribute_init(void)
Definition attribute.c:114
void attribute_free(void)
Definition attribute.c:123
void attribute_flush(void)
Definition attribute.c:327
void audio_shutdown(bool play_quit_tag)
Definition audio.c:657
const char * audio_get_all_plugin_names(void)
Definition audio.c:694
void audio_init(void)
Definition audio.c:188
void audio_play_sound(const char *const tag, const char *const alt_tag, const char *const alt_tag2)
Definition audio.c:528
void audio_real_init(const char *const soundset_name, const char *const musicset_name, const char *const preferred_plugin_name)
Definition audio.c:274
bool dbv_isset(const struct dbv *pdbv, int bit)
Definition bitvector.c:120
void init_our_capability(void)
Definition capstr.c:87
void fc_destroy_ow_mutex(void)
void fc_init_ow_mutex(void)
#define city_list_iterate(citylist, pcity)
Definition city.h:508
#define city_owner(_pcity_)
Definition city.h:563
#define city_list_iterate_end
Definition city.h:510
void init_city_report_game_data(void)
char music_set_name[512]
char forced_tileset_name[512]
void client_remove_all_cli_conn(void)
static struct player * mapimg_client_tile_city(const struct tile *ptile, const struct player *pplayer, bool knowledge)
bool is_client_quitting(void)
static enum client_states civclient_state
static server_setting_id client_ss_by_name(const char *name)
bool can_client_control(void)
void start_turn_change_wait(void)
void fc__noreturn client_exit(int return_value)
static struct player * mapimg_client_tile_unit(const struct tile *ptile, const struct player *pplayer, bool knowledge)
bool client_is_global_observer(void)
static struct timer * turndone_timer
void client_remove_cli_conn(struct connection *pconn)
int get_seconds_to_new_turn(void)
static bool waiting_turn_change
int get_seconds_to_turndone(void)
static void charsets_init(void)
bool client_is_observer(void)
char metaserver[512]
char user_name[512]
static int client_plr_tile_city_id_get(const struct tile *ptile, const struct player *pplayer)
static struct rgbcolor * mapimg_client_plrcolor_get(int i)
bool can_meet_with_player(const struct player *pplayer)
void client_packet_input(void *packet, int type)
double real_timer_callback(void)
static void fc_interface_init_client(void)
static void at_exit(void)
bool client_map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
bool waiting_for_end_turn
static char * put_conv(const char *src, size_t *length)
static enum sset_type client_ss_type_get(server_setting_id id)
char * logfile
void send_attribute_block_request(void)
static struct terrain * mapimg_client_tile_terrain(const struct tile *ptile, const struct player *pplayer, bool knowledge)
enum announce_type announce
int client_main(int argc, char *argv[], bool postpone_tileset)
char server_host[512]
bool can_intel_with_player(const struct player *pplayer)
int client_player_number(void)
static int mapimg_client_plrcolor_count(void)
static void client_game_free(void)
static enum known_type mapimg_client_tile_known(const struct tile *ptile, const struct player *pplayer, bool knowledge)
static bool client_quitting
void stop_turn_change_wait(void)
void set_server_busy(bool busy)
static bool client_ss_val_bool_get(server_setting_id id)
void user_ended_turn(void)
static bool get_conv(char *dst, size_t ndst, const char *src, size_t nsrc)
static int client_ss_val_int_get(server_setting_id id)
static void client_game_reset(void)
void send_turn_done(void)
struct civclient client
bool auto_connect
static unsigned int client_ss_val_bitwise_get(server_setting_id id)
static int seconds_shown_to_new_turn
enum client_states client_state(void)
bool is_waiting_turn_change(void)
char sound_plugin_name[512]
static void emergency_exit(void)
static double seconds_to_turndone
static void log_option_save_msg(enum log_level lvl, const char *msg,...)
bool auto_spawn
char * scriptfile
void set_seconds_to_turndone(double seconds)
static int seconds_shown_to_turndone
void send_report_request(enum report_type type)
static void client_game_init(void)
char sound_set_name[512]
bool can_client_issue_orders(void)
void start_quitting(void)
bool client_has_player(void)
bool is_server_busy(void)
static struct timer * between_turns
static struct player * mapimg_client_tile_owner(const struct tile *ptile, const struct player *pplayer, bool knowledge)
const char * title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
char fc_password[MAX_LEN_PASSWORD]
int default_tileset_select(void)
void wait_till_request_got_processed(int request_id)
int server_port
static bool server_busy
static const char * client_ss_name_get(server_setting_id id)
void set_client_state(enum client_states newstate)
char * savefile
bool can_client_change_view(void)
#define client_player()
client_states
Definition client_main.h:43
@ C_S_PREPARING
Definition client_main.h:46
@ C_S_DISCONNECTED
Definition client_main.h:45
@ C_S_INITIAL
Definition client_main.h:44
@ C_S_RUNNING
Definition client_main.h:47
@ C_S_OVER
Definition client_main.h:48
const char *const gui_character_encoding
Definition gui_main.c:161
const bool gui_use_transliteration
Definition gui_main.c:162
void create_event(struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
Definition climisc.c:1092
void center_on_something(void)
Definition climisc.c:430
void start_autoconnecting_to_server(void)
Definition clinet.c:553
void disconnect_from_server(bool leaving_sound)
Definition clinet.c:306
double try_to_autoconnect(void)
Definition clinet.c:498
void input_from_server_till_request_got_processed(int fd, int expected_request_id)
Definition clinet.c:447
bool cma_is_city_under_agent(const struct city *pcity, struct cm_parameter *parameter)
Definition cma_core.c:552
void cma_release_city(struct city *pcity)
Definition cma_core.c:542
char * incite_cost
Definition comments.c:75
#define MAX_LEN_PASSWORD
Definition conn_types.h:31
report_type
Definition conn_types.h:49
void client_kill_server(bool force)
bool client_start_server(void)
void conn_reset_delta_state(struct connection *pc)
Definition connection.c:673
double blink_turn_done_button(void)
Definition control.c:925
void control_free(void)
Definition control.c:154
void unit_focus_set(struct unit *punit)
Definition control.c:506
struct unit_list * get_units_in_focus(void)
Definition control.c:177
void control_init(void)
Definition control.c:137
int get_num_units_in_focus(void)
Definition control.c:185
void unit_focus_update(void)
Definition control.c:789
void control_mouse_cursor(struct tile *ptile)
Definition control.c:1215
double blink_active_unit(void)
Definition control.c:892
void dio_set_get_conv_callback(DIO_GET_CONV_FUN fun)
Definition dataio_raw.c:131
void dio_set_put_conv_callback(DIO_PUT_CONV_FUN fun)
Definition dataio_raw.c:102
void deprecation_warnings_enable(void)
bool could_intel_with_player(const struct player *pplayer, const struct player *aplayer)
Definition diptreaty.c:84
bool could_meet_with_player(const struct player *pplayer, const struct player *aplayer)
Definition diptreaty.c:64
void editor_init(void)
Definition editor.c:193
void editor_clear(void)
Definition editor.c:246
void editor_free(void)
Definition editor.c:257
void cmdhelp_destroy(struct cmdhelp *pcmdhelp)
Definition fc_cmdhelp.c:70
void cmdhelp_display(struct cmdhelp *pcmdhelp, bool sort, bool gui_options, bool report_bugs)
Definition fc_cmdhelp.c:104
struct cmdhelp * cmdhelp_new(const char *cmdname)
Definition fc_cmdhelp.c:57
void cmdhelp_add(struct cmdhelp *pcmdhelp, const char *shortarg, const char *longarg, const char *helpstr,...)
Definition fc_cmdhelp.c:86
bool is_option(const char *option_name, char *option)
Definition fc_cmdline.c:112
char * get_option_malloc(const char *option_name, char **argv, int *i, int argc, bool gc)
Definition fc_cmdline.c:50
void cmdline_option_values_free(void)
Definition fc_cmdline.c:97
void i_am_client(void)
void libfreeciv_init(bool check_fc_interface)
void libfreeciv_free(void)
struct functions * fc_interface_funcs(void)
int server_setting_id
Definition fc_types.h:1070
#define MAX_LEN_NAME
Definition fc_types.h:66
#define IDENTITY_NUMBER_ZERO
Definition fc_types.h:92
void backtrace_deinit(void)
Definition fcbacktrace.c:65
void backtrace_init(void)
Definition fcbacktrace.c:55
const char * get_internal_encoding(void)
Definition fciconv.c:182
static char void init_character_encodings(const char *my_internal_encoding, bool my_use_transliteration)
Definition fciconv.c:70
char * internal_to_data_string_malloc(const char *text)
void fc_fprintf(FILE *stream, const char *format,...) fc__attribute((__format__(__printf__
char * data_to_internal_string_malloc(const char *text)
const char * get_locale_dir(void)
Definition fcintl.c:111
#define bindtextdomain(Package, Directory)
Definition fcintl.h:82
#define _(String)
Definition fcintl.h:67
const struct ft_color ftc_client
void game_reset(void)
Definition game.c:488
struct civ_game game
Definition game.c:62
int current_turn_timeout(void)
Definition game.c:848
void game_init(bool keep_ruleset_value)
Definition game.c:438
void game_free(void)
Definition game.c:470
void global_worklists_build(void)
void global_worklists_unbuild(void)
const char * default_title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
Definition government.c:426
const char * ruler_title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
Definition government.c:391
void popdown_all_city_dialogs(void)
Definition citydlg.c:607
void color_free(struct color *color)
Definition colors.c:53
void popdown_races_dialog(void)
Definition dialogs.c:1230
void popdown_all_game_dialogs(void)
Definition dialogs.c:1514
void close_all_diplomacy_dialogs(void)
Definition diplodlg.c:1260
void editgui_popdown_all(void)
Definition editgui.c:1890
void editgui_tileset_changed(void)
Definition editgui.c:1862
int ui_main(int argc, char **argv)
Definition gui_main.c:1887
const char * client_string
Definition gui_main.c:105
void ui_exit(void)
Definition gui_main.c:2066
void ui_init(void)
Definition gui_main.c:1755
void update_timeout_label(void)
Definition mapview.c:118
void update_info_label(void)
Definition mapview.c:138
void update_unit_info_label(struct unit_list *punits)
Definition mapview.c:275
GType type
Definition repodlgs.c:1313
void voteinfo_gui_update(void)
static struct gui_funcs funcs
void conn_list_dialog_update(void)
void free_help_texts(void)
Definition helpdata.c:125
void boot_help_texts(void)
Definition helpdata.c:710
void helpdata_init(void)
Definition helpdata.c:95
void helpdata_done(void)
Definition helpdata.c:103
const char * name
Definition inputfile.c:127
void log_close(void)
Definition log.c:270
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
bool log_parse_level_str(const char *level_str, enum log_level *ret_level)
Definition log.c:86
#define fc_assert_msg(condition, message,...)
Definition log.h:181
#define fc_assert_ret(condition)
Definition log.h:191
#define fc_assert(condition)
Definition log.h:176
#define log_va_list(level, msg, args)
Definition log.h:128
#define fc_assert_ret_val(condition, val)
Definition log.h:194
#define log_fatal(message,...)
Definition log.h:100
#define log_debug(message,...)
Definition log.h:115
log_level
Definition log.h:28
@ LOG_NORMAL
Definition log.h:32
#define log_error(message,...)
Definition log.h:103
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:235
#define fc_assert_ret_val_msg(condition, val, message,...)
Definition log.h:208
void update_turn_done_button_state(void)
bool can_end_turn(void)
void mapimg_free(void)
Definition mapimg.c:558
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:506
void mapimg_reset(void)
Definition mapimg.c:541
void update_map_canvas_visible(void)
void animations_init(void)
void link_marks_init(void)
void animations_free(void)
bool can_slide
void link_marks_free(void)
void menus_init(void)
void meswin_clear_older(int turn, int phase)
#define MESWIN_CLEAR_ALL
void start_menu_music(const char *const tag, char *const alt_tag)
Definition music.c:98
void stop_menu_music(void)
Definition music.c:108
void start_style_music(void)
Definition music.c:44
void stop_style_music(void)
Definition music.c:90
void fc_shutdown_network(void)
Definition netintf.c:217
announce_type
Definition net_types.h:53
@ ANNOUNCE_IPV6
Definition net_types.h:56
@ ANNOUNCE_IPV4
Definition net_types.h:55
@ ANNOUNCE_NONE
Definition net_types.h:54
void fc_init_network(void)
Definition netintf.c:198
#define ANNOUNCE_DEFAULT
Definition net_types.h:59
void fill_topo_ts_default(void)
Definition options.c:6609
const char * tileset_name_for_topology(int topology_id)
Definition options.c:6523
const struct option_set * server_optset
Definition options.c:4016
void options_free(void)
Definition options.c:6325
int option_number(const struct option *poption)
Definition options.c:618
const char * option_name(const struct option *poption)
Definition options.c:628
int option_int_get(const struct option *poption)
Definition options.c:834
void options_init(void)
Definition options.c:6227
struct option * optset_option_by_number(const struct option_set *poptset, int id)
Definition options.c:420
bool option_bool_get(const struct option *poption)
Definition options.c:797
void server_options_init(void)
Definition options.c:4160
enum option_type option_type(const struct option *poption)
Definition options.c:658
void options_dialogs_update(void)
Definition options.c:5849
void server_options_free(void)
Definition options.c:4229
void options_load(void)
Definition options.c:5910
void options_save(option_save_log_callback log_cb)
Definition options.c:6089
struct client_options gui_options
Definition options.c:71
unsigned option_bitwise_get(const struct option *poption)
Definition options.c:1074
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:431
void options_dialogs_set(void)
Definition options.c:5877
#define DEFAULT_METASERVER_OPTION
Definition options.h:29
void refresh_overview_canvas(void)
void overview_free(void)
void packets_deinit(void)
Definition packets.c:900
const char * packet_name(enum packet_type type)
Definition packets_gen.c:48
int dsend_packet_player_phase_done(struct connection *pc, int turn)
int send_packet_client_heartbeat(struct connection *pc)
int send_packet_player_attribute_block(struct connection *pc)
int dsend_packet_report_req(struct connection *pc, enum report_type type)
@ PACKET_CONN_PING
@ PACKET_PROCESSING_STARTED
@ PACKET_PROCESSING_FINISHED
@ PACKET_AUTHENTICATION_REQ
@ PACKET_SERVER_JOIN_REPLY
@ PACKET_CONNECT_MSG
@ PACKET_EARLY_CHAT_MSG
@ PACKET_SERVER_SHUTDOWN
@ PACKET_SERVER_INFO
void packhand_free(void)
Definition packhand.c:218
int len
Definition packhand.c:127
bool client_handle_packet(enum packet_type type, const void *packet)
void set_client_page(enum client_pages page)
enum client_pages get_client_page(void)
bool is_valid_username(const char *name)
Definition player.c:1908
int player_count(void)
Definition player.c:817
int player_number(const struct player *pplayer)
Definition player.c:837
#define players_iterate_end
Definition player.h:537
#define players_iterate(_pplayer)
Definition player.h:532
void init_player_dlg_common(void)
void fc_srand(RANDOM_TYPE seed)
Definition rand.c:161
#define fc_rand(_size)
Definition rand.h:56
void registry_module_init(void)
Definition registry.c:30
void registry_module_close(void)
Definition registry.c:40
struct research * research_get(const struct player *pplayer)
Definition research.c:128
void research_update(struct research *presearch)
Definition research.c:501
static int fatal_assertions
Definition ruledit.cpp:58
bool script_client_init(void)
void script_client_free(void)
#define SERVER_SETTING_NONE
char * user_username(char *buf, size_t bufsz)
Definition shared.c:711
void dont_run_as_root(const char *argv0, const char *fallback)
Definition shared.c:1549
bool str_to_int(const char *str, int *pint)
Definition shared.c:517
#define MIN(x, y)
Definition shared.h:55
#define FC_INFINITY
Definition shared.h:36
#define MAX(x, y)
Definition shared.h:54
Definition ai.h:50
Definition city.h:320
int id
Definition city.h:326
struct conn_list * est_connections
Definition game.h:97
struct packet_game_info info
Definition game.h:89
bool ruleset_ready
Definition game.h:119
struct conn_list * all_connections
Definition game.h:96
bool ruleset_init
Definition game.h:118
struct packet_timeout_info tinfo
Definition game.h:91
struct civ_game::@31::@34 client
struct connection conn
Definition client_main.h:96
int default_server_port
Definition options.h:110
char default_sound_set_name[512]
Definition options.h:119
bool use_prev_server
Definition options.h:111
char default_metaserver[512]
Definition options.h:114
char default_tileset_name[512]
Definition options.h:130
bool auto_center_each_turn
Definition options.h:158
int default_topology
Definition options.h:123
char default_server_host[512]
Definition options.h:109
bool heartbeat_enabled
Definition options.h:112
bool save_options_on_exit
Definition options.h:125
char default_music_set_name[512]
Definition options.h:120
char default_sound_plugin_name[512]
Definition options.h:121
char default_user_name[512]
Definition options.h:108
bool established
Definition connection.h:140
struct player * playing
Definition connection.h:151
bool observer
Definition connection.h:147
struct city_list * cities
Definition player.h:279
struct dbv tile_vision[V_COUNT]
Definition player.h:357
struct player::@70::@73 client
Definition tile.h:50
struct unit_list * units
Definition tile.h:58
Definition timing.c:81
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:974
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:189
int fc_at_quick_exit(void(*func)(void))
Definition support.c:1331
#define sz_strlcpy(dest, src)
Definition support.h:195
#define fc__noreturn
Definition support.h:125
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
void free_svg_flag_API(void)
Definition svgflag.c:109
void init_themes(void)
enum known_type tile_get_known(const struct tile *ptile, const struct player *pplayer)
Definition tile.c:392
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_index(_pt_)
Definition tile.h:88
known_type
Definition tile.h:35
@ TILE_KNOWN_SEEN
Definition tile.h:38
#define tile_terrain(_tile)
Definition tile.h:110
#define tile_owner(_tile)
Definition tile.h:96
bool tilespec_try_read(const char *tileset_name, bool verbose, int topo_id, bool global_default)
Definition tilespec.c:1296
struct tileset * unscaled_tileset
Definition tilespec.c:568
int index_ts_topology(int idx)
Definition tilespec.c:1085
void tileset_free(struct tileset *t)
Definition tilespec.c:1274
void timer_start(struct timer *t)
Definition timing.c:264
double timer_read_seconds(struct timer *t)
Definition timing.c:384
struct timer * timer_renew(struct timer *t, enum timer_timetype type, enum timer_use use, const char *name)
Definition timing.c:180
@ TIMER_ACTIVE
Definition timing.h:46
@ TIMER_USER
Definition timing.h:42
#define unit_owner(_pu)
Definition unit.h:396
void role_unit_precalcs(void)
Definition unittype.c:2175
void update_queue_free(void)
void update_queue_init(void)
const char * freeciv_name_version(void)
Definition version.c:35
void voteinfo_queue_init(void)
Definition voteinfo.c:167
void voteinfo_queue_check_removed(void)
Definition voteinfo.c:72
void voteinfo_queue_free(void)
Definition voteinfo.c:179
bool zoom_update(double time_until_next_call)
Definition zoom.c:172