Freeciv-3.4
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 <math.h>
19#include <signal.h>
20#include <stdarg.h>
21#include <stdlib.h>
22#include <time.h>
23
24/* utility */
25#include "bitvector.h"
26#include "capstr.h"
27#include "dataio.h"
28#include "deprecations.h"
29#include "executable.h"
30#include "fcbacktrace.h"
31#include "fc_cmdline.h"
32#include "fciconv.h"
33#include "fcintl.h"
34#include "log.h"
35#include "mem.h"
36#include "rand.h"
37#include "registry.h"
38#include "support.h"
39#include "timing.h"
40
41/* common */
42#include "ai.h"
43#include "diptreaty.h"
44#include "fc_cmdhelp.h"
45#include "fc_interface.h"
46#include "game.h"
47#include "idex.h"
48#include "map.h"
49#include "mapimg.h"
50#include "modpack.h"
51#include "netintf.h"
52#include "packets.h"
53#include "player.h"
54#include "research.h"
55#include "server_settings.h"
56#include "version.h"
57
58/* client/include */
59#include "chatline_g.h"
60#include "citydlg_g.h"
61#include "connectdlg_g.h"
62#include "dialogs_g.h"
63#include "diplodlg_g.h"
64#include "editgui_g.h"
65#include "graphics_g.h"
66#include "gui_main_g.h"
67#include "mapctrl_g.h"
68#include "mapview_g.h"
69#include "menu_g.h"
70#include "messagewin_g.h"
71#include "pages_g.h"
72#include "plrdlg_g.h"
73#include "repodlgs_g.h"
74#include "voteinfo_bar_g.h"
75
76/* client */
77#include "attribute.h"
78#include "audio.h"
79#include "cityrepdata.h"
80#include "climisc.h"
81#include "clinet.h"
82#include "connectdlg_common.h" /* client_kill_server() */
83#include "control.h"
84#include "editor.h"
85#include "global_worklist.h"
86#include "gui_properties.h"
87#include "helpdata.h" /* boot_help_texts() */
88#include "mapview_common.h"
89#include "music.h"
90#include "options.h"
91#include "overview_common.h"
92#include "packhand.h"
93#include "svgflag.h"
94#include "tilespec.h"
95#include "themes_common.h"
96#include "update_queue.h"
97#include "voteinfo.h"
98#include "zoom.h"
99
100/* client/agents */
101#include "agents.h"
102#include "cma_core.h" /* kludge */
103
104/* client/luascript */
105#include "script_client.h"
106
107#include "client_main.h"
108
109
110static enum known_type mapimg_client_tile_known(const struct tile *ptile,
111 const struct player *pplayer,
112 bool knowledge);
113static struct terrain
114 *mapimg_client_tile_terrain(const struct tile *ptile,
115 const struct player *pplayer, bool knowledge);
116static struct player *mapimg_client_tile_owner(const struct tile *ptile,
117 const struct player *pplayer,
118 bool knowledge);
119static struct player *mapimg_client_tile_city(const struct tile *ptile,
120 const struct player *pplayer,
121 bool knowledge);
122static struct player *mapimg_client_tile_unit(const struct tile *ptile,
123 const struct player *pplayer,
124 bool knowledge);
125static int mapimg_client_plrcolor_count(void);
126static struct rgbcolor *mapimg_client_plrcolor_get(int i);
127
128static void fc_interface_init_client(void);
129
130static void cache_tilesets(void);
131
132char *logfile = NULL;
135char forced_tileset_name[512] = "\0";
136char sound_plugin_name[512] = "\0";
137char sound_set_name[512] = "\0";
138char music_set_name[512] = "\0";
139char server_host[512] = "\0";
140char user_name[512] = "\0";
142char metaserver[512] = "\0";
143int server_port = -1;
144bool auto_connect = FALSE; /* TRUE = skip "Connect to Freeciv Server" dialog */
145bool auto_spawn = FALSE; /* TRUE = skip main menu, start local server */
147
149
151
152/* TRUE if an end turn request is blocked by busy agents */
154
155/*
156 * TRUE between receiving PACKET_END_TURN and PACKET_BEGIN_TURN
157 */
158static bool server_busy = FALSE;
159
160#ifdef FREECIV_DEBUG
161bool hackless = FALSE;
162#endif
163
164static bool client_quitting = FALSE;
165
166/**********************************************************************/
170static char *put_conv(const char *src, size_t *length)
171{
173
174 if (out) {
175 *length = strlen(out);
176 return out;
177 } else {
178 *length = 0;
179 return NULL;
180 }
181}
182
183/**********************************************************************/
188static bool get_conv(char *dst, size_t ndst,
189 const char *src, size_t nsrc)
190{
192 bool ret = TRUE;
193 size_t len;
194
195 if (!out) {
196 dst[0] = '\0';
197 return FALSE;
198 }
199
200 len = strlen(out);
201 if (ndst > 0 && len >= ndst) {
202 ret = FALSE;
203 len = ndst - 1;
204 }
205
206 memcpy(dst, out, len);
207 dst[len] = '\0';
208 free(out);
209
210 return ret;
211}
212
213/**********************************************************************/
221
222/**********************************************************************/
226static void emergency_exit(void)
227{
229}
230
231/**********************************************************************/
234static void at_exit(void)
235{
241}
242
243/**********************************************************************/
265
266/**********************************************************************/
269static void client_game_free(void)
270{
272
274 mapimg_free();
279 control_free();
282 agents_free();
285 game_free();
286 /* update_queue_init() is correct at this point. The queue is reset to
287 a clean state which is also needed if the client is not connected to
288 the server! */
290
293}
294
295/**********************************************************************/
299static void client_game_reset(void)
300{
302
305 control_free();
307 agents_free();
308
309 game_reset();
310 mapimg_reset();
311
313 agents_init();
314 control_init();
316}
317
318/**********************************************************************/
322{
324
325 if (forced_tileset_name[0] != '\0') {
327 log_error(_("Can't load requested tileset %s!"), forced_tileset_name);
329 return EXIT_FAILURE;
330 }
331 } else {
332 if (gui_options.default_tileset_name[0] == '\0') {
333 /* Use topology by default */
335 FALSE, -1, TRUE);
336 } else {
338 }
339 }
340
341 editor_init();
342
343 return EXIT_SUCCESS;
344}
345
346/**********************************************************************/
349int client_main(int argc, char *argv[], bool postpone_tileset)
350{
351 int i;
352 enum log_level loglevel = LOG_NORMAL;
353 int ui_options = 0;
354 bool ui_separator = FALSE;
355 char *option = NULL;
356 int fatal_assertions = -1;
357 int aii;
358 int uret;
359
361
362 /* fc_interface_init_client() includes low level support like
363 * guaranteeing that fc_vsnprintf() will work after it,
364 * so this need to be early. */
366
367 i_am_client(); /* Tell to libfreeciv that we are client */
368
370
371 /* Ensure that all AIs are initialized to unused state
372 * Not using ai_type_iterate as it would stop at
373 * current ai type count, ai_type_get_count(), i.e., 0 */
374 for (aii = 0; aii < FREECIV_AI_MOD_LAST; aii++) {
375 struct ai_type *ai = get_ai_type(aii);
376
377 init_ai(ai);
378 }
379
380#ifdef ENABLE_NLS
381 (void) bindtextdomain("freeciv-nations", get_locale_dir());
382#endif
383
385 audio_init();
387#ifdef ENABLE_NLS
389#endif
390
392
393 i = 1;
394
396
397 while (i < argc) {
398 if (ui_separator) {
399 argv[1 + ui_options] = argv[i];
400 ui_options++;
401 } else if (is_option("--help", argv[i])) {
402 struct cmdhelp *help = cmdhelp_new(argv[0]);
403
404 cmdhelp_add(help, "A",
405 /* TRANS: "Announce" is exactly what user must type, do not translate. */
406 _("Announce PROTO"),
407 _("Announce game in LAN using protocol PROTO "
408 "(IPv4/IPv6/none)"));
409 cmdhelp_add(help, "a", "autoconnect",
410 _("Skip connect dialog"));
411#ifdef FREECIV_DEBUG
412 cmdhelp_add(help, "d",
413 /* TRANS: "debug" is exactly what user must type, do not translate. */
414 _("debug LEVEL"),
415 _("Set debug log level (one of f,e,w,n,v,d, or "
416 "d:file1,min,max:...)"));
417#else /* FREECIV_DEBUG */
418 cmdhelp_add(help, "d",
419 /* TRANS: "debug" is exactly what user must type, do not translate. */
420 _("debug LEVEL"),
421 _("Set debug log level (one of f,e,w,n,v)"));
422#endif /* FREECIV_DEBUG */
423#ifndef FREECIV_NDEBUG
424 cmdhelp_add(help, "F",
425 /* TRANS: "Fatal" is exactly what user must type, do not translate. */
426 _("Fatal [SIGNAL]"),
427 _("Raise a signal on failed assertion"));
428#endif /* FREECIV_NDEBUG */
429 cmdhelp_add(help, "f",
430 /* TRANS: "file" is exactly what user must type, do not translate. */
431 _("file FILE"),
432 _("Load saved game FILE"));
433 cmdhelp_add(help, "h", "help",
434 _("Print a summary of the options"));
435#ifdef FREECIV_DEBUG
436 cmdhelp_add(help, "H", "Hackless",
437 _("Do not request hack access to local server"));
438#endif /* FREECIV_DEBUG */
439 cmdhelp_add(help, "l",
440 /* TRANS: "log" is exactly what user must type, do not translate. */
441 _("log FILE"),
442 _("Use FILE as logfile (spawned server also uses this)"));
443 cmdhelp_add(help, "M",
444 /* TRANS: "Meta" is exactly what user must type, do not translate. */
445 _("Meta HOST"),
446 _("Connect to the metaserver at HOST"));
447 cmdhelp_add(help, "n",
448 /* TRANS: "name" is exactly what user must type, do not translate. */
449 _("name NAME"),
450 _("Use NAME as username on server"));
451 cmdhelp_add(help, "p",
452 /* TRANS: "port" is exactly what user must type, do not translate. */
453 _("port PORT"),
454 _("Connect to server port PORT (usually with -a)"));
455 cmdhelp_add(help, "P",
456 /* TRANS: "Plugin" is exactly what user must type, do not translate. */
457 _("Plugin PLUGIN"),
458 _("Use PLUGIN for sound output %s"),
460 cmdhelp_add(help, "r",
461 /* TRANS: "read" is exactly what user must type, do not translate. */
462 _("read FILE"),
463 _("Read startup script FILE (for spawned server only)"));
464 cmdhelp_add(help, "s",
465 /* TRANS: "server" is exactly what user must type, do not translate. */
466 _("server HOST"),
467 _("Connect to the server at HOST (usually with -a)"));
468 cmdhelp_add(help, "S",
469 /* TRANS: "Sound" is exactly what user must type, do not translate. */
470 _("Sound FILE"),
471 _("Read sound tags from FILE"));
472 cmdhelp_add(help, "m",
473 /* TRANS: "music" is exactly what user must type, do not translate. */
474 _("music FILE"),
475 _("Read music tags from FILE"));
476 cmdhelp_add(help, "t",
477 /* TRANS: "tiles" is exactly what user must type, do not translate. */
478 _("tiles FILE"),
479 _("Use data file FILE.tilespec for tiles"));
480 cmdhelp_add(help, "v", "version",
481 _("Print the version number"));
482 cmdhelp_add(help, "w", "warnings",
483 _("Warn about deprecated modpack constructs"));
484
485 /* The function below prints a header and footer for the options.
486 * Furthermore, the options are sorted. */
487 cmdhelp_display(help, TRUE, TRUE, TRUE);
488 cmdhelp_destroy(help);
489
491 } else if (is_option("--version", argv[i])) {
494#ifdef FREECIV_DEBUG
495 } else if (is_option("--Hackless", argv[i])) {
496 hackless = TRUE;
497#endif /* FREECIV_DEBUG */
498 } else if ((option = get_option_malloc("--log", argv, &i, argc, TRUE))) {
499 logfile = option;
500#ifndef FREECIV_NDEBUG
501 } else if (is_option("--Fatal", argv[i])) {
502 if (i + 1 >= argc || '-' == argv[i + 1][0]) {
504 } else if (str_to_int(argv[i + 1], &fatal_assertions)) {
505 i++;
506 } else {
507 fc_fprintf(stderr, _("Invalid signal number \"%s\".\n"),
508 argv[i + 1]);
509 fc_fprintf(stderr, _("Try using --help.\n"));
511 }
512#endif /* FREECIV_NDEBUG */
513 } else if ((option = get_option_malloc("--read", argv, &i, argc, TRUE))) {
515 } else if ((option = get_option_malloc("--file", argv, &i, argc, TRUE))) {
518 } else if ((option = get_option_malloc("--name", argv, &i, argc, FALSE))) {
520 free(option);
521 } else if ((option = get_option_malloc("--Meta", argv, &i, argc, FALSE))) {
523 free(option);
524 } else if ((option = get_option_malloc("--Sound", argv, &i, argc, FALSE))) {
526 free(option);
527 } else if ((option = get_option_malloc("--music", argv, &i, argc, FALSE))) {
529 free(option);
530 } else if ((option = get_option_malloc("--Plugin", argv, &i, argc, FALSE))) {
532 free(option);
533 } else if ((option = get_option_malloc("--port", argv, &i, argc, FALSE))) {
534 if (!str_to_int(option, &server_port)) {
536 _("Invalid port \"%s\" specified with --port option.\n"),
537 option);
538 fc_fprintf(stderr, _("Try using --help.\n"));
540 }
541 free(option);
542 } else if ((option = get_option_malloc("--server", argv, &i, argc, FALSE))) {
544 free(option);
545 } else if (is_option("--autoconnect", argv[i])) {
547 } else if ((option = get_option_malloc("--debug", argv, &i, argc, FALSE))) {
548 if (!log_parse_level_str(option, &loglevel)) {
550 _("Invalid debug level \"%s\" specified with --debug "
551 "option.\n"), option);
552 fc_fprintf(stderr, _("Try using --help.\n"));
554 }
555 free(option);
556 } else if ((option = get_option_malloc("--tiles", argv, &i, argc, FALSE))) {
558 free(option);
559 } else if ((option = get_option_malloc("--Announce", argv, &i, argc, FALSE))) {
560 if (!fc_strcasecmp(option, "ipv4")) {
562 } else if (!fc_strcasecmp(option, "none")) {
564#ifdef FREECIV_IPV6_SUPPORT
565 } else if (!fc_strcasecmp(option, "ipv6")) {
567#endif /* IPv6 support */
568 } else {
569 fc_fprintf(stderr, _("Invalid announce protocol \"%s\".\n"), option);
571 }
572 free(option);
573 } else if (is_option("--warnings", argv[i])) {
575 } else if (is_option("--", argv[i])) {
577 } else {
578 fc_fprintf(stderr, _("Unrecognized option: \"%s\"\n"), argv[i]);
580 }
581 i++;
582 } /* of while */
583
584 if (auto_spawn && auto_connect) {
585 /* TRANS: don't translate option names */
586 fc_fprintf(stderr, _("-f/--file and -a/--autoconnect options are "
587 "incompatible\n"));
589 }
590
591 /* Remove all options except those intended for the UI. */
592 argv[1 + ui_options] = NULL;
593 argc = 1 + ui_options;
594
595 /* Disallow running as root -- too dangerous */
596 dont_run_as_root(argv[0], "freeciv_client");
597
600
601 /* After log_init: */
602
605 char buf[sizeof(gui_options.default_user_name)];
606
608 if (is_valid_username(buf)) {
610 } else {
613 "player%d", fc_rand(10000));
614 }
615 }
616
617 /* Initialization */
618
621
622 ui_init();
626
628
629 /* Register exit handler */
632
635 init_themes();
636
637 options_init();
638 options_load();
639
641
642 if (sound_set_name[0] == '\0') {
644 }
645 if (music_set_name[0] == '\0') {
647 }
648 if (sound_plugin_name[0] == '\0') {
650 }
651 if (server_host[0] == '\0') {
653 } else if (gui_options.use_prev_server) {
655 }
656 if (user_name[0] == '\0') {
658 }
659 if (metaserver[0] == '\0') {
662 } else {
664 }
665 }
666 if (server_port == -1) {
668 } else if (gui_options.use_prev_server) {
670 }
671
672 /* This seed is not saved anywhere; randoms in the client should
673 have cosmetic effects only (eg city name suggestions). --dwp */
674 fc_srand(time(NULL));
677
680
682 start_menu_music("music_menu", NULL);
683
684 if (!postpone_tileset) {
686
687 if (tsret != EXIT_SUCCESS) {
688 return tsret;
689 }
690 }
691
692 /* Run gui-specific client */
693 uret = ui_main(argc, argv);
694
696
697 /* Termination */
699
700 /* Not reached */
701 return EXIT_SUCCESS;
702}
703
704/**********************************************************************/
707static void log_option_save_msg(enum log_level lvl, const char *msg, ...)
708{
709 va_list args;
710
711 va_start(args, msg);
712 log_va_list(lvl, msg, args);
713 va_end(args);
714}
715
716/**********************************************************************/
721{
722 if (client_state() >= C_S_PREPARING) {
725 }
726
729 }
730
732 if (unscaled_tileset != NULL) {
734 }
735 if (tileset != NULL) {
737 }
738
739 ui_exit();
740
741 /* Play the exit sound while audio system dependencies still up. */
743
745
746 editor_free();
747 options_free();
748 if (client_state() >= C_S_PREPARING) {
750 }
751
752 helpdata_done(); /* client_exit() unlinks help text list */
755
759
761 log_close();
763
765}
766
767/**********************************************************************/
770void client_packet_input(void *packet, int type)
771{
781 && PACKET_SERVER_INFO != type) {
782 log_error("Received packet %s (%d) before establishing connection!",
785 } else if (!client_handle_packet(type, packet)) {
786 log_error("Received unknown packet (type %d) from server!", type);
788 }
789}
790
791/**********************************************************************/
795{
797}
798
799/**********************************************************************/
803{
804 log_debug("send_turn_done() can_end_turn=%d",
805 can_end_turn());
806
807 if (!can_end_turn()) {
808 /*
809 * The turn done button is disabled but the user may have pressed
810 * the return key.
811 */
812
813 if (agents_busy()) {
815 }
816
817 return;
818 }
819
821
823
825
827}
828
829/**********************************************************************/
836
837/**********************************************************************/
841{
843 struct player *pplayer = client_player();
844
845 if (auto_spawn) {
848 if (!client_start_server()) {
849 log_fatal(_("Failed to start local server; aborting."));
851 }
852 }
853
855 if (oldstate == C_S_DISCONNECTED) {
856 log_fatal(_("There was an error while auto connecting; aborting."));
858 } else {
860 auto_connect = FALSE; /* Don't try this again. */
861 }
862 }
863
866 /* Reset the delta-state. */
868 }
869
870 if (oldstate == newstate) {
871 return;
872 }
873
876
877 if (!is_client_quitting()) {
878 /* Back to menu */
879 start_menu_music("music_menu", NULL);
880 }
881 }
882
884
885 switch (newstate) {
886 case C_S_INITIAL:
887 log_error("%d is not a valid client state to set.", C_S_INITIAL);
888 break;
889
890 case C_S_DISCONNECTED:
895
899 editor_clear();
903 if (oldstate > C_S_PREPARING) {
905 }
906 }
907
909 break;
910
911 case C_S_PREPARING:
916
917 if (oldstate < C_S_PREPARING) {
919 } else {
920 /* From an upper state means that we didn't quit the server,
921 * so a lot of information is still in effect. */
924 }
925
927
929 && get_client_page() != PAGE_LOAD) {
931 }
932 break;
933
934 case C_S_RUNNING:
935 if (oldstate == C_S_PREPARING) {
937 stop_menu_music(); /* Stop intro sound loop. */
938 }
939
942 create_event(NULL, E_GAME_START, ftc_client, _("Game started."));
943 if (pplayer) {
945 }
947 boot_help_texts(); /* Reboot with player */
951 can_slide = TRUE;
953 /* Find something sensible to display instead of the intro gfx. */
958
960
961 update_info_label(); /* Get initial population right */
964
967 }
969 audio_play_sound("e_enter_game", NULL, NULL);
970 break;
971
972 case C_S_OVER:
973 if (C_S_RUNNING == oldstate) {
974 /* Extra kludge for end-game handling of the CMA. */
975 if (pplayer && pplayer->cities) {
976 city_list_iterate(pplayer->cities, pcity) {
979 }
981 }
986 } else {
987 /* From C_S_PREPARING. */
990 if (pplayer) {
992 }
994 boot_help_texts(); /* reboot */
999 }
1001
1005
1006 break;
1007 }
1008
1009 menus_init();
1012 if (can_client_change_view()) {
1014 }
1015
1016 /* If turn was going to change, that is now aborted. */
1018}
1019
1020/**********************************************************************/
1024{
1025 return civclient_state;
1026}
1027
1028/**********************************************************************/
1032{
1034 "Trying to remove a non existing connection");
1035
1036 if (NULL != pconn->playing) {
1037 conn_list_remove(pconn->playing->connections, pconn);
1038 }
1042 free(pconn);
1043}
1044
1045/**********************************************************************/
1050{
1052 "Connection list missing");
1053
1054 while (conn_list_size(game.all_connections) > 0) {
1057 }
1058}
1059
1060/**********************************************************************/
1067
1068/**********************************************************************/
1076
1077/**********************************************************************/
1081{
1083}
1084
1085/* Seconds_to_turndone is the number of seconds the server has told us
1086 * are left. The timer tells exactly how much time has passed since the
1087 * server gave us that data. */
1088static double seconds_to_turndone = 0.0;
1089static struct timer *turndone_timer;
1090
1091/* The timer tells how long since server informed us about starting
1092 * turn-change activities. */
1093static struct timer *between_turns = NULL;
1095
1096/* This value shows what value the timeout label is currently showing for
1097 * the seconds-to-turndone. */
1100
1101/**********************************************************************/
1108{
1109 if (current_turn_timeout() > 0) {
1112 turndone_timer != NULL ? NULL : "turndone");
1114
1115 /* Maybe we should do an update_timeout_label here, but it doesn't
1116 * seem to be necessary. */
1118 }
1119}
1120
1121/**********************************************************************/
1125{
1126 return waiting_turn_change;
1127}
1128
1129/**********************************************************************/
1141
1142/**********************************************************************/
1150
1151/**********************************************************************/
1156{
1157 if (current_turn_timeout() > 0) {
1159 } else {
1160 /* This shouldn't happen. */
1161 return FC_INFINITY;
1162 }
1163}
1164
1165/**********************************************************************/
1170{
1172}
1173
1174/**********************************************************************/
1180{
1181 double time_until_next_call = 1.0;
1182
1184
1185 {
1188 }
1189
1190 if (C_S_RUNNING != client_state()) {
1191 return time_until_next_call;
1192 }
1193
1195
1196 {
1198
1200 }
1201
1205 }
1206
1207 if (get_num_units_in_focus() > 0) {
1208 double blink_time = blink_active_unit();
1209
1211 }
1212
1213 /* It is possible to have current_turn_timeout() > 0 but !turndone_timer,
1214 * in the first moments after the timeout is set. */
1215 if (current_turn_timeout() > 0 && turndone_timer != NULL) {
1217 int iseconds = ceil(seconds + 0.1); /* Turn should end right on 0. */
1218
1222 }
1223
1225 seconds - floor(seconds) + 0.001);
1226 }
1227 if (waiting_turn_change) {
1229 int iseconds = ceil(seconds + 0.1); /* Turn should end right on 0. */
1230
1234 }
1235 }
1236
1237 {
1238 static long counter = 0;
1239
1240 counter++;
1241
1242 if (gui_options.heartbeat_enabled && (counter % (20 * 10) == 0)) {
1244 }
1245 }
1246
1247 /* Make sure we wait at least 50 ms, otherwise we may not give any other
1248 * code time to run. */
1249 return MAX(time_until_next_call, 0.05);
1250}
1251
1252/**********************************************************************/
1256{
1257 return (NULL != client.conn.playing
1258 && !client_is_observer());
1259}
1260
1261/**********************************************************************/
1267{
1268 return (can_client_control()
1269 && C_S_RUNNING == client_state());
1270}
1271
1272/**********************************************************************/
1276bool can_meet_with_player(const struct player *pplayer)
1277{
1278 return (can_client_issue_orders()
1279 /* && NULL != client.conn.playing (above) */
1281}
1282
1283/**********************************************************************/
1287bool can_intel_with_player(const struct player *pplayer)
1288{
1289 return (client_is_observer()
1290 || (NULL != client.conn.playing
1291 && could_intel_with_player(client_player(), pplayer)));
1292}
1293
1294/**********************************************************************/
1298const char *title_for_player(const struct player *pplayer,
1299 char *buf, size_t buf_len)
1300{
1301 if (client_player() == pplayer || can_intel_with_player(pplayer)) {
1302 /* Knows the government to construct correct title */
1303 return ruler_title_for_player(pplayer, buf, buf_len);
1304 }
1305
1306 return default_title_for_player(pplayer, buf, buf_len);
1307}
1308
1309/**********************************************************************/
1315{
1316 return ((NULL != client.conn.playing || client_is_observer())
1317 && (C_S_RUNNING == client_state()
1318 || C_S_OVER == client_state()));
1319}
1320
1321/**********************************************************************/
1326{
1327 if (busy != server_busy) {
1328 /* server_busy value will change */
1329 server_busy = busy;
1330
1331 /* This may mean that we have to change from or to wait cursor */
1333 }
1334}
1335
1336/**********************************************************************/
1340{
1341 return server_busy;
1342}
1343
1344/**********************************************************************/
1348{
1349 return client.conn.playing == NULL && client.conn.observer;
1350}
1351
1352/**********************************************************************/
1356{
1357 if (client.conn.playing == NULL) {
1358 return -1;
1359 }
1361}
1362
1363/**********************************************************************/
1367{
1368 return client.conn.playing != NULL;
1369}
1370
1371/**********************************************************************/
1375bool client_map_is_known_and_seen(const struct tile *ptile,
1376 const struct player *pplayer,
1377 enum vision_layer vlayer)
1378{
1379 return dbv_isset(&pplayer->client.tile_vision[vlayer], tile_index(ptile));
1380}
1381
1382/**********************************************************************/
1385static int client_plr_tile_city_id_get(const struct tile *ptile,
1386 const struct player *pplayer)
1387{
1388 struct city *pcity = tile_city(ptile);
1389
1390 /* Can't look up what other players think. */
1391 fc_assert(pplayer == client_player());
1392
1393 return pcity ? pcity->id : IDENTITY_NUMBER_ZERO;
1394}
1395
1396/**********************************************************************/
1400{
1402
1403 if (pset) {
1404 return option_number(pset);
1405 } else {
1406 log_error("No server setting named %s exists.", name);
1407 return SERVER_SETTING_NONE;
1408 }
1409}
1410
1411/**********************************************************************/
1415{
1417
1418 if (pset) {
1419 return option_name(pset);
1420 } else {
1421 log_error("No server setting with the id %d exists.", id);
1422 return NULL;
1423 }
1424}
1425
1426/**********************************************************************/
1430{
1431 enum option_type opt_type;
1433
1434 if (!pset) {
1435 log_error("No server setting with the id %d exists.", id);
1436 return sset_type_invalid();
1437 }
1438
1440
1441 /* The option type isn't client only. */
1443 && opt_type != OT_COLOR
1444 && opt_type != OT_VIDEO_MODE),
1446 "%s is a client option type but not a server "
1447 "setting type",
1449
1450 /* The option type is valid. */
1453
1454 /* Each server setting type value equals the client option type value with
1455 * the same meaning. */
1457 && (enum sset_type)OT_INTEGER == SST_INT
1458 && (enum sset_type)OT_STRING == SST_STRING
1459 && (enum sset_type)OT_ENUM == SST_ENUM
1460 && (enum sset_type)OT_BITWISE == SST_BITWISE
1461 && SST_COUNT == (enum sset_type)5,
1463
1464 /* Exploit the fact that each server setting type value corresponds to the
1465 * client option type value with the same meaning. */
1466 return (enum sset_type)opt_type;
1467}
1468
1469/**********************************************************************/
1473{
1475
1476 if (pset) {
1477 return option_bool_get(pset);
1478 } else {
1479 log_error("No server setting with the id %d exists.", id);
1480 return FALSE;
1481 }
1482}
1483
1484/**********************************************************************/
1488{
1490
1491 if (pset) {
1492 return option_int_get(pset);
1493 } else {
1494 log_error("No server setting with the id %d exists.", id);
1495 return 0;
1496 }
1497}
1498
1499/**********************************************************************/
1503{
1505
1506 if (pset) {
1507 return option_bitwise_get(pset);
1508 } else {
1509 log_error("No server setting with the id %d exists.", id);
1510 return FALSE;
1511 }
1512}
1513
1514/**********************************************************************/
1518{
1520
1521 funcs->server_setting_by_name = client_ss_by_name;
1522 funcs->server_setting_name_get = client_ss_name_get;
1523 funcs->server_setting_type_get = client_ss_type_get;
1524 funcs->server_setting_val_bool_get = client_ss_val_bool_get;
1525 funcs->server_setting_val_int_get = client_ss_val_int_get;
1526 funcs->server_setting_val_bitwise_get = client_ss_val_bitwise_get;
1527 funcs->create_extra = NULL;
1528 funcs->destroy_extra = NULL;
1529 funcs->destroy_city = NULL;
1530 funcs->player_tile_vision_get = client_map_is_known_and_seen;
1531 funcs->player_tile_city_id_get = client_plr_tile_city_id_get;
1532 funcs->gui_color_free = color_free;
1533
1534 /* Keep this function call at the end. It checks if all required functions
1535 are defined. */
1537}
1538
1539/**********************************************************************/
1542static enum known_type mapimg_client_tile_known(const struct tile *ptile,
1543 const struct player *pplayer,
1544 bool knowledge)
1545{
1547 return TILE_KNOWN_SEEN;
1548 }
1549
1550 return tile_get_known(ptile, pplayer);
1551}
1552
1553/**********************************************************************/
1556static struct terrain *
1558 const struct player *pplayer, bool knowledge)
1559{
1560 return tile_terrain(ptile);
1561}
1562
1563/**********************************************************************/
1566static struct player *mapimg_client_tile_owner(const struct tile *ptile,
1567 const struct player *pplayer,
1568 bool knowledge)
1569{
1570 return tile_owner(ptile);
1571}
1572
1573/**********************************************************************/
1576static struct player *mapimg_client_tile_city(const struct tile *ptile,
1577 const struct player *pplayer,
1578 bool knowledge)
1579{
1580 struct city *pcity = tile_city(ptile);
1581
1582 if (!pcity) {
1583 return NULL;
1584 }
1585
1586 return city_owner(tile_city(ptile));
1587}
1588
1589/**********************************************************************/
1592static struct player *mapimg_client_tile_unit(const struct tile *ptile,
1593 const struct player *pplayer,
1594 bool knowledge)
1595{
1596 int unit_count = unit_list_size(ptile->units);
1597
1598 if (unit_count == 0) {
1599 return NULL;
1600 }
1601
1602 return unit_owner(unit_list_get(ptile->units, 0));
1603}
1604
1605/**********************************************************************/
1609{
1610 return player_count();
1611}
1612
1613/**********************************************************************/
1618{
1619 int count = 0;
1620
1621 if (0 > i || i > player_count()) {
1622 return NULL;
1623 }
1624
1625 players_iterate(pplayer) {
1626 if (count == i) {
1627 return pplayer->rgb;
1628 }
1629 count++;
1631
1632 return NULL;
1633}
1634
1635/**********************************************************************/
1639{
1640 return client_quitting;
1641}
1642
1643/**********************************************************************/
1647{
1649}
1650
1651/************************************************************************/
1654static void cache_tilesets(void)
1655{
1657
1659
1661 struct section_file *sf;
1662
1663 sf = secfile_load(pfile->fullname, FALSE);
1664
1665 if (sf != NULL) {
1667 secfile_destroy(sf);
1668 }
1670
1672}
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:659
const char * audio_get_all_plugin_names(void)
Definition audio.c:696
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:530
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)
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:675
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 executable_init(void)
Definition executable.c:34
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:763
#define MAX_LEN_NAME
Definition fc_types.h:67
#define IDENTITY_NUMBER_ZERO
Definition fc_types.h:93
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:494
struct civ_game game
Definition game.c:62
int current_turn_timeout(void)
Definition game.c:856
void game_init(bool keep_ruleset_value)
Definition game.c:446
void game_free(void)
Definition game.c:477
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:428
const char * ruler_title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
Definition government.c:393
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:1892
void editgui_tileset_changed(void)
Definition editgui.c:1864
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:768
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
bool client_handle_packet(enum packet_type type, const void *packet)
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 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:6996
const char * tileset_name_for_topology(int topology_id)
Definition options.c:6910
const struct option_set * server_optset
Definition options.c:4369
void options_free(void)
Definition options.c:6712
int option_number(const struct option *poption)
Definition options.c:669
const char * option_name(const struct option *poption)
Definition options.c:679
int option_int_get(const struct option *poption)
Definition options.c:885
void options_init(void)
Definition options.c:6614
struct option * optset_option_by_number(const struct option_set *poptset, int id)
Definition options.c:471
bool option_bool_get(const struct option *poption)
Definition options.c:848
void server_options_init(void)
Definition options.c:4513
enum option_type option_type(const struct option *poption)
Definition options.c:709
void options_dialogs_update(void)
Definition options.c:6198
void server_options_free(void)
Definition options.c:4582
void options_load(void)
Definition options.c:6259
void options_save(option_save_log_callback log_cb)
Definition options.c:6472
struct client_options gui_options
Definition options.c:71
unsigned option_bitwise_get(const struct option *poption)
Definition options.c:1125
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:482
void options_dialogs_set(void)
Definition options.c:6226
#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
void packhand_free(void)
Definition packhand.c:219
int len
Definition packhand.c:128
bool is_valid_username(const char *name)
Definition player.c:1922
int player_count(void)
Definition player.c:819
int player_number(const struct player *pplayer)
Definition player.c:839
#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:130
void research_update(struct research *presearch)
Definition research.c:504
static int fatal_assertions
Definition ruledit.cpp:53
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:318
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:393
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:115
#define tile_owner(_tile)
Definition tile.h:97
void advance_global_anim_state(void)
Definition tilespec.c:6771
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:406
void role_unit_precalcs(void)
Definition unittype.c:2201
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