Freeciv-3.3
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 "modpack.h"
57#include "netintf.h"
58#include "packets.h"
59#include "player.h"
60#include "research.h"
61#include "server_settings.h"
62#include "version.h"
63
64/* client/include */
65#include "chatline_g.h"
66#include "citydlg_g.h"
67#include "connectdlg_g.h"
68#include "dialogs_g.h"
69#include "diplodlg_g.h"
70#include "editgui_g.h"
71#include "graphics_g.h"
72#include "gui_main_g.h"
73#include "mapctrl_g.h"
74#include "mapview_g.h"
75#include "menu_g.h"
76#include "messagewin_g.h"
77#include "pages_g.h"
78#include "plrdlg_g.h"
79#include "repodlgs_g.h"
80#include "voteinfo_bar_g.h"
81
82/* client */
83#include "attribute.h"
84#include "audio.h"
85#include "cityrepdata.h"
86#include "climisc.h"
87#include "clinet.h"
88#include "connectdlg_common.h" /* client_kill_server() */
89#include "control.h"
90#include "editor.h"
91#include "global_worklist.h"
92#include "gui_properties.h"
93#include "helpdata.h" /* boot_help_texts() */
94#include "mapview_common.h"
95#include "music.h"
96#include "options.h"
97#include "overview_common.h"
98#include "packhand.h"
99#include "svgflag.h"
100#include "tilespec.h"
101#include "themes_common.h"
102#include "update_queue.h"
103#include "voteinfo.h"
104#include "zoom.h"
105
106/* client/agents */
107#include "agents.h"
108#include "cma_core.h" /* kludge */
109
110/* client/luascript */
111#include "script_client.h"
112
113#include "client_main.h"
114
115
116static enum known_type mapimg_client_tile_known(const struct tile *ptile,
117 const struct player *pplayer,
118 bool knowledge);
119static struct terrain
120 *mapimg_client_tile_terrain(const struct tile *ptile,
121 const struct player *pplayer, bool knowledge);
122static struct player *mapimg_client_tile_owner(const struct tile *ptile,
123 const struct player *pplayer,
124 bool knowledge);
125static struct player *mapimg_client_tile_city(const struct tile *ptile,
126 const struct player *pplayer,
127 bool knowledge);
128static struct player *mapimg_client_tile_unit(const struct tile *ptile,
129 const struct player *pplayer,
130 bool knowledge);
131static int mapimg_client_plrcolor_count(void);
132static struct rgbcolor *mapimg_client_plrcolor_get(int i);
133
134static void fc_interface_init_client(void);
135
136static void cache_tilesets(void);
137
138char *logfile = NULL;
141char forced_tileset_name[512] = "\0";
142char sound_plugin_name[512] = "\0";
143char sound_set_name[512] = "\0";
144char music_set_name[512] = "\0";
145char server_host[512] = "\0";
146char user_name[512] = "\0";
148char metaserver[512] = "\0";
149int server_port = -1;
150bool auto_connect = FALSE; /* TRUE = skip "Connect to Freeciv Server" dialog */
151bool auto_spawn = FALSE; /* TRUE = skip main menu, start local server */
153
155
157
158/* TRUE if an end turn request is blocked by busy agents */
160
161/*
162 * TRUE between receiving PACKET_END_TURN and PACKET_BEGIN_TURN
163 */
164static bool server_busy = FALSE;
165
166#ifdef FREECIV_DEBUG
167bool hackless = FALSE;
168#endif
169
170static bool client_quitting = FALSE;
171
172/**********************************************************************/
176static char *put_conv(const char *src, size_t *length)
177{
179
180 if (out) {
181 *length = strlen(out);
182 return out;
183 } else {
184 *length = 0;
185 return NULL;
186 }
187}
188
189/**********************************************************************/
194static bool get_conv(char *dst, size_t ndst,
195 const char *src, size_t nsrc)
196{
198 bool ret = TRUE;
199 size_t len;
200
201 if (!out) {
202 dst[0] = '\0';
203 return FALSE;
204 }
205
206 len = strlen(out);
207 if (ndst > 0 && len >= ndst) {
208 ret = FALSE;
209 len = ndst - 1;
210 }
211
212 memcpy(dst, out, len);
213 dst[len] = '\0';
214 free(out);
215
216 return ret;
217}
218
219/**********************************************************************/
227
228/**********************************************************************/
232static void emergency_exit(void)
233{
235}
236
237/**********************************************************************/
240static void at_exit(void)
241{
247}
248
249/**********************************************************************/
271
272/**********************************************************************/
275static void client_game_free(void)
276{
278
280 mapimg_free();
285 control_free();
288 agents_free();
291 game_free();
292 /* update_queue_init() is correct at this point. The queue is reset to
293 a clean state which is also needed if the client is not connected to
294 the server! */
296
299}
300
301/**********************************************************************/
305static void client_game_reset(void)
306{
308
311 control_free();
313 agents_free();
314
315 game_reset();
316 mapimg_reset();
317
319 agents_init();
320 control_init();
322}
323
324/**********************************************************************/
328{
330
331 if (forced_tileset_name[0] != '\0') {
333 log_error(_("Can't load requested tileset %s!"), forced_tileset_name);
335 return EXIT_FAILURE;
336 }
337 } else {
338 if (gui_options.default_tileset_name[0] == '\0') {
339 /* Use topology by default */
341 FALSE, -1, TRUE);
342 } else {
344 }
345 }
346
347 editor_init();
348
349 return EXIT_SUCCESS;
350}
351
352/**********************************************************************/
355int client_main(int argc, char *argv[], bool postpone_tileset)
356{
357 int i;
358 enum log_level loglevel = LOG_NORMAL;
359 int ui_options = 0;
360 bool ui_separator = FALSE;
361 char *option = NULL;
362 int fatal_assertions = -1;
363 int aii;
364 int uret;
365
366 /* Load Windows post-crash debugger */
367#ifdef FREECIV_MSWINDOWS
368# ifndef FREECIV_NDEBUG
369 if (LoadLibrary("exchndl.dll") == NULL) {
370# ifdef FREECIV_DEBUG
371 fprintf(stderr, "exchndl.dll could not be loaded, no crash debugger\n");
372# endif /* FREECIV_DEBUG */
373 }
374# endif /* FREECIV_NDEBUG */
375#endif /* FREECIV_MSWINDOWS */
376
377 /* fc_interface_init_client() includes low level support like
378 * guaranteeing that fc_vsnprintf() will work after it,
379 * so this need to be early. */
381
382 i_am_client(); /* Tell to libfreeciv that we are client */
383
385
386 /* Ensure that all AIs are initialized to unused state
387 * Not using ai_type_iterate as it would stop at
388 * current ai type count, ai_type_get_count(), i.e., 0 */
389 for (aii = 0; aii < FREECIV_AI_MOD_LAST; aii++) {
390 struct ai_type *ai = get_ai_type(aii);
391
392 init_ai(ai);
393 }
394
395#ifdef ENABLE_NLS
396 (void) bindtextdomain("freeciv-nations", get_locale_dir());
397#endif
398
400 audio_init();
402#ifdef ENABLE_NLS
404#endif
405
407
408 i = 1;
409
411
412 while (i < argc) {
413 if (ui_separator) {
414 argv[1 + ui_options] = argv[i];
415 ui_options++;
416 } else if (is_option("--help", argv[i])) {
417 struct cmdhelp *help = cmdhelp_new(argv[0]);
418
419 cmdhelp_add(help, "A",
420 /* TRANS: "Announce" is exactly what user must type, do not translate. */
421 _("Announce PROTO"),
422 _("Announce game in LAN using protocol PROTO "
423 "(IPv4/IPv6/none)"));
424 cmdhelp_add(help, "a", "autoconnect",
425 _("Skip connect dialog"));
426#ifdef 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,d, or "
431 "d:file1,min,max:...)"));
432#else /* FREECIV_DEBUG */
433 cmdhelp_add(help, "d",
434 /* TRANS: "debug" is exactly what user must type, do not translate. */
435 _("debug LEVEL"),
436 _("Set debug log level (one of f,e,w,n,v)"));
437#endif /* FREECIV_DEBUG */
438#ifndef FREECIV_NDEBUG
439 cmdhelp_add(help, "F",
440 /* TRANS: "Fatal" is exactly what user must type, do not translate. */
441 _("Fatal [SIGNAL]"),
442 _("Raise a signal on failed assertion"));
443#endif /* FREECIV_NDEBUG */
444 cmdhelp_add(help, "f",
445 /* TRANS: "file" is exactly what user must type, do not translate. */
446 _("file FILE"),
447 _("Load saved game FILE"));
448 cmdhelp_add(help, "h", "help",
449 _("Print a summary of the options"));
450#ifdef FREECIV_DEBUG
451 cmdhelp_add(help, "H", "Hackless",
452 _("Do not request hack access to local server"));
453#endif /* FREECIV_DEBUG */
454 cmdhelp_add(help, "l",
455 /* TRANS: "log" is exactly what user must type, do not translate. */
456 _("log FILE"),
457 _("Use FILE as logfile (spawned server also uses this)"));
458 cmdhelp_add(help, "M",
459 /* TRANS: "Meta" is exactly what user must type, do not translate. */
460 _("Meta HOST"),
461 _("Connect to the metaserver at HOST"));
462 cmdhelp_add(help, "n",
463 /* TRANS: "name" is exactly what user must type, do not translate. */
464 _("name NAME"),
465 _("Use NAME as username on server"));
466 cmdhelp_add(help, "p",
467 /* TRANS: "port" is exactly what user must type, do not translate. */
468 _("port PORT"),
469 _("Connect to server port PORT (usually with -a)"));
470 cmdhelp_add(help, "P",
471 /* TRANS: "Plugin" is exactly what user must type, do not translate. */
472 _("Plugin PLUGIN"),
473 _("Use PLUGIN for sound output %s"),
475 cmdhelp_add(help, "r",
476 /* TRANS: "read" is exactly what user must type, do not translate. */
477 _("read FILE"),
478 _("Read startup script FILE (for spawned server only)"));
479 cmdhelp_add(help, "s",
480 /* TRANS: "server" is exactly what user must type, do not translate. */
481 _("server HOST"),
482 _("Connect to the server at HOST (usually with -a)"));
483 cmdhelp_add(help, "S",
484 /* TRANS: "Sound" is exactly what user must type, do not translate. */
485 _("Sound FILE"),
486 _("Read sound tags from FILE"));
487 cmdhelp_add(help, "m",
488 /* TRANS: "music" is exactly what user must type, do not translate. */
489 _("music FILE"),
490 _("Read music tags from FILE"));
491 cmdhelp_add(help, "t",
492 /* TRANS: "tiles" is exactly what user must type, do not translate. */
493 _("tiles FILE"),
494 _("Use data file FILE.tilespec for tiles"));
495 cmdhelp_add(help, "v", "version",
496 _("Print the version number"));
497 cmdhelp_add(help, "w", "warnings",
498 _("Warn about deprecated modpack constructs"));
499
500 /* The function below prints a header and footer for the options.
501 * Furthermore, the options are sorted. */
502 cmdhelp_display(help, TRUE, TRUE, TRUE);
503 cmdhelp_destroy(help);
504
506 } else if (is_option("--version", argv[i])) {
509#ifdef FREECIV_DEBUG
510 } else if (is_option("--Hackless", argv[i])) {
511 hackless = TRUE;
512#endif /* FREECIV_DEBUG */
513 } else if ((option = get_option_malloc("--log", argv, &i, argc, TRUE))) {
514 logfile = option;
515#ifndef FREECIV_NDEBUG
516 } else if (is_option("--Fatal", argv[i])) {
517 if (i + 1 >= argc || '-' == argv[i + 1][0]) {
519 } else if (str_to_int(argv[i + 1], &fatal_assertions)) {
520 i++;
521 } else {
522 fc_fprintf(stderr, _("Invalid signal number \"%s\".\n"),
523 argv[i + 1]);
524 fc_fprintf(stderr, _("Try using --help.\n"));
526 }
527#endif /* FREECIV_NDEBUG */
528 } else if ((option = get_option_malloc("--read", argv, &i, argc, TRUE))) {
530 } else if ((option = get_option_malloc("--file", argv, &i, argc, TRUE))) {
533 } else if ((option = get_option_malloc("--name", argv, &i, argc, FALSE))) {
535 free(option);
536 } else if ((option = get_option_malloc("--Meta", argv, &i, argc, FALSE))) {
538 free(option);
539 } else if ((option = get_option_malloc("--Sound", argv, &i, argc, FALSE))) {
541 free(option);
542 } else if ((option = get_option_malloc("--music", argv, &i, argc, FALSE))) {
544 free(option);
545 } else if ((option = get_option_malloc("--Plugin", argv, &i, argc, FALSE))) {
547 free(option);
548 } else if ((option = get_option_malloc("--port", argv, &i, argc, FALSE))) {
549 if (!str_to_int(option, &server_port)) {
551 _("Invalid port \"%s\" specified with --port option.\n"),
552 option);
553 fc_fprintf(stderr, _("Try using --help.\n"));
555 }
556 free(option);
557 } else if ((option = get_option_malloc("--server", argv, &i, argc, FALSE))) {
559 free(option);
560 } else if (is_option("--autoconnect", argv[i])) {
562 } else if ((option = get_option_malloc("--debug", argv, &i, argc, FALSE))) {
563 if (!log_parse_level_str(option, &loglevel)) {
565 _("Invalid debug level \"%s\" specified with --debug "
566 "option.\n"), option);
567 fc_fprintf(stderr, _("Try using --help.\n"));
569 }
570 free(option);
571 } else if ((option = get_option_malloc("--tiles", argv, &i, argc, FALSE))) {
573 free(option);
574 } else if ((option = get_option_malloc("--Announce", argv, &i, argc, FALSE))) {
575 if (!fc_strcasecmp(option, "ipv4")) {
577 } else if (!fc_strcasecmp(option, "none")) {
579#ifdef FREECIV_IPV6_SUPPORT
580 } else if (!fc_strcasecmp(option, "ipv6")) {
582#endif /* IPv6 support */
583 } else {
584 fc_fprintf(stderr, _("Invalid announce protocol \"%s\".\n"), option);
586 }
587 free(option);
588 } else if (is_option("--warnings", argv[i])) {
590 } else if (is_option("--", argv[i])) {
592 } else {
593 fc_fprintf(stderr, _("Unrecognized option: \"%s\"\n"), argv[i]);
595 }
596 i++;
597 } /* of while */
598
599 if (auto_spawn && auto_connect) {
600 /* TRANS: don't translate option names */
601 fc_fprintf(stderr, _("-f/--file and -a/--autoconnect options are "
602 "incompatible\n"));
604 }
605
606 /* Remove all options except those intended for the UI. */
607 argv[1 + ui_options] = NULL;
608 argc = 1 + ui_options;
609
610 /* Disallow running as root -- too dangerous */
611 dont_run_as_root(argv[0], "freeciv_client");
612
615
616 /* After log_init: */
617
620 char buf[sizeof(gui_options.default_user_name)];
621
623 if (is_valid_username(buf)) {
625 } else {
628 "player%d", fc_rand(10000));
629 }
630 }
631
632 /* Initialization */
633
636
637 ui_init();
641
643
644 /* Register exit handler */
647
650 init_themes();
651
652 options_init();
653 options_load();
654
656
657 if (sound_set_name[0] == '\0') {
659 }
660 if (music_set_name[0] == '\0') {
662 }
663 if (sound_plugin_name[0] == '\0') {
665 }
666 if (server_host[0] == '\0') {
668 } else if (gui_options.use_prev_server) {
670 }
671 if (user_name[0] == '\0') {
673 }
674 if (metaserver[0] == '\0') {
677 } else {
679 }
680 }
681 if (server_port == -1) {
683 } else if (gui_options.use_prev_server) {
685 }
686
687 /* This seed is not saved anywhere; randoms in the client should
688 have cosmetic effects only (eg city name suggestions). --dwp */
689 fc_srand(time(NULL));
692
695
697 start_menu_music("music_menu", NULL);
698
699 if (!postpone_tileset) {
701
702 if (tsret != EXIT_SUCCESS) {
703 return tsret;
704 }
705 }
706
707 /* Run gui-specific client */
708 uret = ui_main(argc, argv);
709
711
712 /* Termination */
714
715 /* Not reached */
716 return EXIT_SUCCESS;
717}
718
719/**********************************************************************/
722static void log_option_save_msg(enum log_level lvl, const char *msg, ...)
723{
724 va_list args;
725
726 va_start(args, msg);
727 log_va_list(lvl, msg, args);
728 va_end(args);
729}
730
731/**********************************************************************/
736{
737 if (client_state() >= C_S_PREPARING) {
740 }
741
744 }
745
747 if (unscaled_tileset != NULL) {
749 }
750 if (tileset != NULL) {
752 }
753
754 ui_exit();
755
756 /* Play the exit sound while audio system dependencies still up. */
758
760
761 editor_free();
762 options_free();
763 if (client_state() >= C_S_PREPARING) {
765 }
766
767 helpdata_done(); /* client_exit() unlinks help text list */
770
774
776 log_close();
778
780}
781
782/**********************************************************************/
785void client_packet_input(void *packet, int type)
786{
796 && PACKET_SERVER_INFO != type) {
797 log_error("Received packet %s (%d) before establishing connection!",
800 } else if (!client_handle_packet(type, packet)) {
801 log_error("Received unknown packet (type %d) from server!", type);
803 }
804}
805
806/**********************************************************************/
810{
812}
813
814/**********************************************************************/
818{
819 log_debug("send_turn_done() can_end_turn=%d",
820 can_end_turn());
821
822 if (!can_end_turn()) {
823 /*
824 * The turn done button is disabled but the user may have pressed
825 * the return key.
826 */
827
828 if (agents_busy()) {
830 }
831
832 return;
833 }
834
836
838
840
842}
843
844/**********************************************************************/
851
852/**********************************************************************/
856{
858 struct player *pplayer = client_player();
859
860 if (auto_spawn) {
863 if (!client_start_server()) {
864 log_fatal(_("Failed to start local server; aborting."));
866 }
867 }
868
870 if (oldstate == C_S_DISCONNECTED) {
871 log_fatal(_("There was an error while auto connecting; aborting."));
873 } else {
875 auto_connect = FALSE; /* Don't try this again. */
876 }
877 }
878
881 /* Reset the delta-state. */
883 }
884
885 if (oldstate == newstate) {
886 return;
887 }
888
891
892 if (!is_client_quitting()) {
893 /* Back to menu */
894 start_menu_music("music_menu", NULL);
895 }
896 }
897
899
900 switch (newstate) {
901 case C_S_INITIAL:
902 log_error("%d is not a valid client state to set.", C_S_INITIAL);
903 break;
904
905 case C_S_DISCONNECTED:
910
914 editor_clear();
918 if (oldstate > C_S_PREPARING) {
920 }
921 }
922
924 break;
925
926 case C_S_PREPARING:
931
932 if (oldstate < C_S_PREPARING) {
934 } else {
935 /* From an upper state means that we didn't quit the server,
936 * so a lot of informations are still in effect. */
939 }
940
942
944 && get_client_page() != PAGE_LOAD) {
946 }
947 break;
948
949 case C_S_RUNNING:
950 if (oldstate == C_S_PREPARING) {
952 stop_menu_music(); /* Stop intro sound loop. */
953 }
954
957 create_event(NULL, E_GAME_START, ftc_client, _("Game started."));
958 if (pplayer) {
960 }
962 boot_help_texts(); /* Reboot with player */
966 can_slide = TRUE;
968 /* Find something sensible to display instead of the intro gfx. */
973
975
976 update_info_label(); /* Get initial population right */
979
982 }
984 audio_play_sound("e_enter_game", NULL, NULL);
985 break;
986
987 case C_S_OVER:
988 if (C_S_RUNNING == oldstate) {
989 /* Extra kludge for end-game handling of the CMA. */
990 if (pplayer && pplayer->cities) {
991 city_list_iterate(pplayer->cities, pcity) {
994 }
996 }
1001 } else {
1002 /* From C_S_PREPARING. */
1005 if (pplayer) {
1006 research_update(research_get(pplayer));
1007 }
1009 boot_help_texts(); /* reboot */
1014 }
1016
1020
1021 break;
1022 }
1023
1024 menus_init();
1027 if (can_client_change_view()) {
1029 }
1030
1031 /* If turn was going to change, that is now aborted. */
1033}
1034
1035/**********************************************************************/
1039{
1040 return civclient_state;
1041}
1042
1043/**********************************************************************/
1047{
1049 "Trying to remove a non existing connection");
1050
1051 if (NULL != pconn->playing) {
1052 conn_list_remove(pconn->playing->connections, pconn);
1053 }
1057 free(pconn);
1058}
1059
1060/**********************************************************************/
1065{
1067 "Connection list missing");
1068
1069 while (conn_list_size(game.all_connections) > 0) {
1072 }
1073}
1074
1075/**********************************************************************/
1082
1083/**********************************************************************/
1091
1092/**********************************************************************/
1096{
1098}
1099
1100/* Seconds_to_turndone is the number of seconds the server has told us
1101 * are left. The timer tells exactly how much time has passed since the
1102 * server gave us that data. */
1103static double seconds_to_turndone = 0.0;
1104static struct timer *turndone_timer;
1105
1106/* The timer tells how long since server informed us about starting
1107 * turn-change activities. */
1108static struct timer *between_turns = NULL;
1110
1111/* This value shows what value the timeout label is currently showing for
1112 * the seconds-to-turndone. */
1115
1116/**********************************************************************/
1123{
1124 if (current_turn_timeout() > 0) {
1127 turndone_timer != NULL ? NULL : "turndone");
1129
1130 /* Maybe we should do an update_timeout_label here, but it doesn't
1131 * seem to be necessary. */
1133 }
1134}
1135
1136/**********************************************************************/
1140{
1141 return waiting_turn_change;
1142}
1143
1144/**********************************************************************/
1156
1157/**********************************************************************/
1165
1166/**********************************************************************/
1171{
1172 if (current_turn_timeout() > 0) {
1174 } else {
1175 /* This shouldn't happen. */
1176 return FC_INFINITY;
1177 }
1178}
1179
1180/**********************************************************************/
1185{
1187}
1188
1189/**********************************************************************/
1195{
1196 double time_until_next_call = 1.0;
1197
1199
1200 {
1203 }
1204
1205 if (C_S_RUNNING != client_state()) {
1206 return time_until_next_call;
1207 }
1208
1210
1211 {
1213
1215 }
1216
1220 }
1221
1222 if (get_num_units_in_focus() > 0) {
1223 double blink_time = blink_active_unit();
1224
1226 }
1227
1228 /* It is possible to have current_turn_timeout() > 0 but !turndone_timer,
1229 * in the first moments after the timeout is set. */
1230 if (current_turn_timeout() > 0 && turndone_timer != NULL) {
1232 int iseconds = ceil(seconds + 0.1); /* Turn should end right on 0. */
1233
1237 }
1238
1240 seconds - floor(seconds) + 0.001);
1241 }
1242 if (waiting_turn_change) {
1244 int iseconds = ceil(seconds + 0.1); /* Turn should end right on 0. */
1245
1249 }
1250 }
1251
1252 {
1253 static long counter = 0;
1254
1255 counter++;
1256
1257 if (gui_options.heartbeat_enabled && (counter % (20 * 10) == 0)) {
1259 }
1260 }
1261
1262 /* Make sure we wait at least 50 ms, otherwise we may not give any other
1263 * code time to run. */
1264 return MAX(time_until_next_call, 0.05);
1265}
1266
1267/**********************************************************************/
1271{
1272 return (NULL != client.conn.playing
1273 && !client_is_observer());
1274}
1275
1276/**********************************************************************/
1282{
1283 return (can_client_control()
1284 && C_S_RUNNING == client_state());
1285}
1286
1287/**********************************************************************/
1291bool can_meet_with_player(const struct player *pplayer)
1292{
1293 return (can_client_issue_orders()
1294 /* && NULL != client.conn.playing (above) */
1296}
1297
1298/**********************************************************************/
1302bool can_intel_with_player(const struct player *pplayer)
1303{
1304 return (client_is_observer()
1305 || (NULL != client.conn.playing
1306 && could_intel_with_player(client_player(), pplayer)));
1307}
1308
1309/**********************************************************************/
1313const char *title_for_player(const struct player *pplayer,
1314 char *buf, size_t buf_len)
1315{
1316 if (client_player() == pplayer || can_intel_with_player(pplayer)) {
1317 /* Knows the government to construct correct title */
1318 return ruler_title_for_player(pplayer, buf, buf_len);
1319 }
1320
1321 return default_title_for_player(pplayer, buf, buf_len);
1322}
1323
1324/**********************************************************************/
1330{
1331 return ((NULL != client.conn.playing || client_is_observer())
1332 && (C_S_RUNNING == client_state()
1333 || C_S_OVER == client_state()));
1334}
1335
1336/**********************************************************************/
1341{
1342 if (busy != server_busy) {
1343 /* server_busy value will change */
1344 server_busy = busy;
1345
1346 /* This may mean that we have to change from or to wait cursor */
1348 }
1349}
1350
1351/**********************************************************************/
1355{
1356 return server_busy;
1357}
1358
1359/**********************************************************************/
1363{
1364 return client.conn.playing == NULL && client.conn.observer;
1365}
1366
1367/**********************************************************************/
1371{
1372 if (client.conn.playing == NULL) {
1373 return -1;
1374 }
1376}
1377
1378/**********************************************************************/
1382{
1383 return client.conn.playing != NULL;
1384}
1385
1386/**********************************************************************/
1390bool client_map_is_known_and_seen(const struct tile *ptile,
1391 const struct player *pplayer,
1392 enum vision_layer vlayer)
1393{
1394 return dbv_isset(&pplayer->client.tile_vision[vlayer], tile_index(ptile));
1395}
1396
1397/**********************************************************************/
1400static int client_plr_tile_city_id_get(const struct tile *ptile,
1401 const struct player *pplayer)
1402{
1403 struct city *pcity = tile_city(ptile);
1404
1405 /* Can't look up what other players think. */
1406 fc_assert(pplayer == client_player());
1407
1408 return pcity ? pcity->id : IDENTITY_NUMBER_ZERO;
1409}
1410
1411/**********************************************************************/
1415{
1417
1418 if (pset) {
1419 return option_number(pset);
1420 } else {
1421 log_error("No server setting named %s exists.", name);
1422 return SERVER_SETTING_NONE;
1423 }
1424}
1425
1426/**********************************************************************/
1430{
1432
1433 if (pset) {
1434 return option_name(pset);
1435 } else {
1436 log_error("No server setting with the id %d exists.", id);
1437 return NULL;
1438 }
1439}
1440
1441/**********************************************************************/
1445{
1446 enum option_type opt_type;
1448
1449 if (!pset) {
1450 log_error("No server setting with the id %d exists.", id);
1451 return sset_type_invalid();
1452 }
1453
1455
1456 /* The option type isn't client only. */
1458 && opt_type != OT_COLOR
1459 && opt_type != OT_VIDEO_MODE),
1461 "%s is a client option type but not a server "
1462 "setting type",
1464
1465 /* The option type is valid. */
1468
1469 /* Each server setting type value equals the client option type value with
1470 * the same meaning. */
1472 && (enum sset_type)OT_INTEGER == SST_INT
1473 && (enum sset_type)OT_STRING == SST_STRING
1474 && (enum sset_type)OT_ENUM == SST_ENUM
1475 && (enum sset_type)OT_BITWISE == SST_BITWISE
1476 && SST_COUNT == (enum sset_type)5,
1478
1479 /* Exploit the fact that each server setting type value corresponds to the
1480 * client option type value with the same meaning. */
1481 return (enum sset_type)opt_type;
1482}
1483
1484/**********************************************************************/
1488{
1490
1491 if (pset) {
1492 return option_bool_get(pset);
1493 } else {
1494 log_error("No server setting with the id %d exists.", id);
1495 return FALSE;
1496 }
1497}
1498
1499/**********************************************************************/
1503{
1505
1506 if (pset) {
1507 return option_int_get(pset);
1508 } else {
1509 log_error("No server setting with the id %d exists.", id);
1510 return 0;
1511 }
1512}
1513
1514/**********************************************************************/
1518{
1520
1521 if (pset) {
1522 return option_bitwise_get(pset);
1523 } else {
1524 log_error("No server setting with the id %d exists.", id);
1525 return FALSE;
1526 }
1527}
1528
1529/**********************************************************************/
1533{
1535
1536 funcs->server_setting_by_name = client_ss_by_name;
1537 funcs->server_setting_name_get = client_ss_name_get;
1538 funcs->server_setting_type_get = client_ss_type_get;
1539 funcs->server_setting_val_bool_get = client_ss_val_bool_get;
1540 funcs->server_setting_val_int_get = client_ss_val_int_get;
1541 funcs->server_setting_val_bitwise_get = client_ss_val_bitwise_get;
1542 funcs->create_extra = NULL;
1543 funcs->destroy_extra = NULL;
1544 funcs->destroy_city = NULL;
1545 funcs->player_tile_vision_get = client_map_is_known_and_seen;
1546 funcs->player_tile_city_id_get = client_plr_tile_city_id_get;
1547 funcs->gui_color_free = color_free;
1548
1549 /* Keep this function call at the end. It checks if all required functions
1550 are defined. */
1552}
1553
1554/**********************************************************************/
1557static enum known_type mapimg_client_tile_known(const struct tile *ptile,
1558 const struct player *pplayer,
1559 bool knowledge)
1560{
1562 return TILE_KNOWN_SEEN;
1563 }
1564
1565 return tile_get_known(ptile, pplayer);
1566}
1567
1568/**********************************************************************/
1571static struct terrain *
1573 const struct player *pplayer, bool knowledge)
1574{
1575 return tile_terrain(ptile);
1576}
1577
1578/**********************************************************************/
1581static struct player *mapimg_client_tile_owner(const struct tile *ptile,
1582 const struct player *pplayer,
1583 bool knowledge)
1584{
1585 return tile_owner(ptile);
1586}
1587
1588/**********************************************************************/
1591static struct player *mapimg_client_tile_city(const struct tile *ptile,
1592 const struct player *pplayer,
1593 bool knowledge)
1594{
1595 struct city *pcity = tile_city(ptile);
1596
1597 if (!pcity) {
1598 return NULL;
1599 }
1600
1601 return city_owner(tile_city(ptile));
1602}
1603
1604/**********************************************************************/
1607static struct player *mapimg_client_tile_unit(const struct tile *ptile,
1608 const struct player *pplayer,
1609 bool knowledge)
1610{
1611 int unit_count = unit_list_size(ptile->units);
1612
1613 if (unit_count == 0) {
1614 return NULL;
1615 }
1616
1617 return unit_owner(unit_list_get(ptile->units, 0));
1618}
1619
1620/**********************************************************************/
1624{
1625 return player_count();
1626}
1627
1628/**********************************************************************/
1633{
1634 int count = 0;
1635
1636 if (0 > i || i > player_count()) {
1637 return NULL;
1638 }
1639
1640 players_iterate(pplayer) {
1641 if (count == i) {
1642 return pplayer->rgb;
1643 }
1644 count++;
1646
1647 return NULL;
1648}
1649
1650/**********************************************************************/
1654{
1655 return client_quitting;
1656}
1657
1658/**********************************************************************/
1662{
1664}
1665
1666/************************************************************************/
1669static void cache_tilesets(void)
1670{
1672
1674
1676 struct section_file *sf;
1677
1678 sf = secfile_load(pfile->fullname, FALSE);
1679
1680 if (sf != NULL) {
1682 secfile_destroy(sf);
1683 }
1685
1687}
void agents_free(void)
Definition agents.c:349
void agents_disconnect(void)
Definition agents.c:405
void agents_game_start(void)
Definition agents.c:458
bool agents_busy(void)
Definition agents.c:804
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:333
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:505
#define city_owner(_pcity_)
Definition city.h:560
#define city_list_iterate_end
Definition city.h:507
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)
static void cache_tilesets(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:162
const bool gui_use_transliteration
Definition gui_main.c:163
void create_event(struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
Definition climisc.c:1093
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:76
#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)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
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:778
#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:493
struct civ_game game
Definition game.c:61
int current_turn_timeout(void)
Definition game.c:853
void game_init(bool keep_ruleset_value)
Definition game.c:445
void game_free(void)
Definition game.c:476
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:1888
const char * client_string
Definition gui_main.c:106
void ui_exit(void)
Definition gui_main.c:2067
void ui_init(void)
Definition gui_main.c:1756
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 gui_properties_init(void)
struct client_properties gui_properties
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:182
#define fc_assert_ret(condition)
Definition log.h:192
#define fc_assert(condition)
Definition log.h:177
#define log_va_list(level, msg, args)
Definition log.h:129
#define fc_assert_ret_val(condition, val)
Definition log.h:195
#define log_fatal(message,...)
Definition log.h:101
#define log_debug(message,...)
Definition log.h:116
log_level
Definition log.h:29
@ LOG_NORMAL
Definition log.h:33
#define log_error(message,...)
Definition log.h:104
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:238
#define fc_assert_ret_val_msg(condition, val, message,...)
Definition log.h:209
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 modpacks_free(void)
Definition modpack.c:62
void modpacks_init(void)
Definition modpack.c:50
struct fileinfo_list * get_modpacks_list(void)
Definition modpack.c:127
const char * modpack_cache_tileset(struct section_file *sf)
Definition modpack.c:262
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:6862
const char * tileset_name_for_topology(int topology_id)
Definition options.c:6776
const struct option_set * server_optset
Definition options.c:4278
void options_free(void)
Definition options.c:6578
int option_number(const struct option *poption)
Definition options.c:654
const char * option_name(const struct option *poption)
Definition options.c:664
int option_int_get(const struct option *poption)
Definition options.c:870
void options_init(void)
Definition options.c:6480
struct option * optset_option_by_number(const struct option_set *poptset, int id)
Definition options.c:456
bool option_bool_get(const struct option *poption)
Definition options.c:833
void server_options_init(void)
Definition options.c:4422
enum option_type option_type(const struct option *poption)
Definition options.c:694
void options_dialogs_update(void)
Definition options.c:6097
void server_options_free(void)
Definition options.c:4491
void options_load(void)
Definition options.c:6158
void options_save(option_save_log_callback log_cb)
Definition options.c:6340
struct client_options gui_options
Definition options.c:71
unsigned option_bitwise_get(const struct option *poption)
Definition options.c:1110
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:467
void options_dialogs_set(void)
Definition options.c:6125
#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:47
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)
bool is_valid_username(const char *name)
Definition player.c:1914
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:542
#define players_iterate(_pplayer)
Definition player.h:537
void init_player_dlg_common(void)
void fc_srand(RANDOM_TYPE seed)
Definition rand.c:161
#define fc_rand(_size)
Definition rand.h:56
struct section_file * secfile_load(const char *filename, bool allow_duplicates)
Definition registry.c:51
void registry_module_init(void)
Definition registry.c:31
void registry_module_close(void)
Definition registry.c:41
void secfile_destroy(struct section_file *secfile)
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:704
void dont_run_as_root(const char *argv0, const char *fallback)
Definition shared.c:1542
bool str_to_int(const char *str, int *pint)
Definition shared.c:515
#define MIN(x, y)
Definition shared.h:55
#define FC_INFINITY
Definition shared.h:36
#define MAX(x, y)
Definition shared.h:54
#define fileinfo_list_iterate(list, pnode)
Definition shared.h:182
#define fileinfo_list_iterate_end
Definition shared.h:184
Definition ai.h:50
Definition city.h:317
struct civ_game::@32::@35 client
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 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:159
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:281
struct dbv tile_vision[V_COUNT]
Definition player.h:359
struct player::@73::@76 client
Definition tile.h:50
struct unit_list * units
Definition tile.h:58
Definition timing.c:81
int id
Definition unit.h:147
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:186
int fc_at_quick_exit(void(*func)(void))
Definition support.c:1317
#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:89
known_type
Definition tile.h:35
@ TILE_KNOWN_SEEN
Definition tile.h:38
#define tile_terrain(_tile)
Definition tile.h:111
#define tile_owner(_tile)
Definition tile.h:97
void advance_global_anim_state(void)
Definition tilespec.c:6755
bool tilespec_try_read(const char *tileset_name, bool verbose, int topo_id, bool global_default)
Definition tilespec.c:1360
struct tileset * unscaled_tileset
Definition tilespec.c:592
int index_ts_topology(int idx)
Definition tilespec.c:1111
void tileset_free(struct tileset *t)
Definition tilespec.c:1315
void timer_start(struct timer *t)
Definition timing.c:263
double timer_read_seconds(struct timer *t)
Definition timing.c:379
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:403
void role_unit_precalcs(void)
Definition unittype.c:2181
void update_queue_free(void)
void set_client_page(enum client_pages page)
void update_queue_init(void)
enum client_pages get_client_page(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