Freeciv-3.3
Loading...
Searching...
No Matches
options.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 <stdarg.h>
19#include <string.h>
20#include <sys/stat.h>
21#include <sys/types.h>
22
23/* utility */
24#include "deprecations.h"
25#include "fcintl.h"
26#include "ioz.h"
27#include "log.h"
28#include "mem.h"
29#include "registry.h"
30#include "shared.h"
31#include "string_vector.h"
32#include "support.h"
33
34/* common */
35#include "events.h"
36#include "version.h"
37
38/* client/agents */
39#include "cma_fec.h"
40
41/* client/include */
42#include "chatline_g.h"
43#include "dialogs_g.h"
44#include "gui_main_g.h"
45#include "menu_g.h"
46#include "optiondlg_g.h"
47#include "repodlgs_g.h"
48#include "voteinfo_bar_g.h"
49
50/* client */
51#include "audio.h"
52#include "cityrepdata.h"
53#include "client_main.h"
54#include "climisc.h"
55#include "connectdlg_common.h"
56#include "global_worklist.h"
57#include "mapctrl_common.h"
58#include "mapview_common.h"
59#include "music.h"
60#include "overview_common.h"
61#include <packhand_gen.h> /* <> so looked from the build directory first. */
62#include "plrdlg_common.h"
63#include "repodlgs_common.h"
64#include "servers.h"
65#include "themes_common.h"
66#include "tilespec.h"
67
68#include "options.h"
69
70
74 .default_user_name = "\0",
75 .default_server_host = "localhost",
76 .default_server_port = DEFAULT_SOCK_PORT,
77 .default_metaserver = DEFAULT_METASERVER_OPTION,
78 .default_tileset_square_name = "\0",
79 .default_tileset_hex_name = "\0",
80 .default_tileset_isohex_name = "\0",
81 .default_sound_set_name = "stdsounds",
82 .default_music_set_name = "stdmusic",
83 .default_sound_plugin_name = "\0",
84 .default_chat_logfile = GUI_DEFAULT_CHAT_LOGFILE,
85 .default_topology = TS_TOPO_ISOHEX,
86
87 .followtag_override = DEFAULT_FOLLOWTAG_OPTION,
88
89 .save_options_on_exit = TRUE,
90
91 .use_prev_server = FALSE,
92 .heartbeat_enabled = FALSE,
93 .send_desired_settings = TRUE,
94
96 .first_boot = FALSE,
97 .default_tileset_name = "\0",
98 .default_tileset_overhead_name = "\0",
99 .default_tileset_iso_name = "\0",
100 .gui_gtk3_migrated_from_gtk2 = FALSE,
101 .gui_gtk3_22_migrated_from_gtk3 = FALSE,
102 .gui_gtk5_migrated_from_gtk4 = FALSE,
103 .gui_gtk4_migrated_from_gtk3_22 = FALSE,
104 .gui_sdl2_migrated_from_sdl = FALSE,
105 .gui_sdl3_migrated_from_sdl2 = FALSE,
106 .gui_gtk2_migrated_from_2_5 = FALSE,
107 .gui_gtk3_migrated_from_2_5 = FALSE,
108 .gui_qt_migrated_from_2_5 = FALSE,
109
110 .migrate_fullscreen = FALSE,
111
114 .gui_qt_default_fonts_set = FALSE,
115 .gui_sdl2_default_screen_size_set = FALSE,
116 .gui_sdl3_default_screen_size_set = FALSE,
117
120 .solid_color_behind_units = FALSE,
121 .sound_bell_at_new_turn = FALSE,
122 .smooth_move_unit_msec = 30,
123 .smooth_center_slide_msec = 200,
124 .smooth_combat_step_msec = 10,
125 .ai_manual_turn_done = TRUE,
126 .auto_center_on_unit = TRUE,
127 .auto_center_on_automated = TRUE,
128 .auto_center_on_combat = FALSE,
129 .auto_center_each_turn = TRUE,
130 .wakeup_focus = TRUE,
131 .goto_into_unknown = TRUE,
132 .center_when_popup_city = TRUE,
133 .show_previous_turn_messages = TRUE,
134 .concise_city_production = FALSE,
135 .auto_turn_done = FALSE,
136 .meta_accelerators = TRUE,
137 .ask_city_name = TRUE,
138 .popup_new_cities = TRUE,
139 .popup_actor_arrival = TRUE,
140 .popup_attack_actions = TRUE,
141 .popup_last_move_to_allied = TRUE,
142 .keyboardless_goto = TRUE,
143 .enable_cursor_changes = TRUE,
144 .separate_unit_selection = FALSE,
145 .unit_selection_clears_orders = TRUE,
146 .highlight_our_names = FT_COLOR("#000000", "#FFFF00"),
147
148 .voteinfo_bar_use = TRUE,
149 .voteinfo_bar_always_show = FALSE,
150 .voteinfo_bar_hide_when_not_player = FALSE,
151 .voteinfo_bar_new_at_front = FALSE,
152
153 .autoaccept_tileset_suggestion = FALSE,
154 .autoaccept_soundset_suggestion = FALSE,
155 .autoaccept_musicset_suggestion = FALSE,
156
157 .sound_enable_effects = TRUE,
158 .sound_enable_menu_music = TRUE,
159 .sound_enable_game_music = TRUE,
160 .sound_effects_volume = 100,
161 .silent_when_not_in_focus = FALSE,
162
163 /* This option is currently set by the client - not by the user. */
164 .update_city_text_in_refresh_tile = TRUE,
165
166 .draw_city_outlines = TRUE,
167 .draw_city_output = FALSE,
168 .draw_map_grid = FALSE,
169 .draw_city_names = TRUE,
170 .draw_city_growth = TRUE,
171 .draw_city_productions = TRUE,
172 .draw_city_buycost = FALSE,
173 .draw_city_trade_routes = FALSE,
174 .draw_terrain = TRUE,
175 .draw_coastline = FALSE,
176 .draw_paths = TRUE,
177 .draw_irrigation = TRUE,
178 .draw_mines = TRUE,
179 .draw_fortress_airbase = TRUE,
180 .draw_specials = TRUE,
181 .draw_huts = TRUE,
182 .draw_pollution = TRUE,
183 .draw_cities = TRUE,
184 .draw_units = TRUE,
185 .draw_focus_unit = FALSE,
186 .draw_fog_of_war = TRUE,
187 .draw_borders = TRUE,
188 .draw_native = FALSE,
189 .draw_full_citybar = TRUE,
190 .draw_unit_shields = TRUE,
191 .draw_unit_stack_size = TRUE,
192 .player_dlg_show_dead_players = TRUE,
193 .reqtree_show_icons = TRUE,
194 .reqtree_curved_lines = FALSE,
195
196/* Options for map images */
197/* .mapimg_format, */
198 .mapimg_zoom = 2,
199/* See the definition of MAPIMG_LAYER in mapimg.h. */
200 .mapimg_layer = {
201 FALSE, /* a - MAPIMG_LAYER_AREA */
202 TRUE, /* b - MAPIMG_LAYER_BORDERS */
203 TRUE, /* c - MAPIMG_LAYER_CITIES */
204 TRUE, /* f - MAPIMG_LAYER_FOGOFWAR */
205 TRUE, /* k - MAPIMG_LAYER_KNOWLEDGE */
206 TRUE, /* t - MAPIMG_LAYER_TERRAIN */
207 TRUE /* u - MAPIMG_LAYER_UNITS */
208 },
209/* .mapimg_filename, */
210
211 .zoom_set = FALSE,
212 .zoom_default_level = 1.0,
213
214/* gui-gtk-2.0 client specific options.
215 * These are still kept just so users can migrate them to gtk3-client */
216 .gui_gtk2_map_scrollbars = FALSE,
217 .gui_gtk2_dialogs_on_top = TRUE,
218 .gui_gtk2_show_task_icons = TRUE,
219 .gui_gtk2_enable_tabs = TRUE,
220 .gui_gtk2_better_fog = TRUE,
221 .gui_gtk2_show_chat_message_time = FALSE,
222 .gui_gtk2_new_messages_go_to_top = FALSE,
223 .gui_gtk2_show_message_window_buttons = TRUE,
224 .gui_gtk2_metaserver_tab_first = FALSE,
225 .gui_gtk2_allied_chat_only = FALSE,
226 .gui_gtk2_mouse_over_map_focus = FALSE,
227 .gui_gtk2_chatline_autocompletion = TRUE,
228 .gui_gtk2_citydlg_xsize = GUI_GTK2_CITYDLG_DEFAULT_XSIZE,
229 .gui_gtk2_citydlg_ysize = GUI_GTK2_CITYDLG_DEFAULT_YSIZE,
230 .gui_gtk2_popup_tech_help = GUI_POPUP_TECH_HELP_RULESET,
231 .gui_gtk2_font_city_label = "Monospace 8",
232 .gui_gtk2_font_notify_label = "Monospace Bold 9",
233 .gui_gtk2_font_spaceship_label = "Monospace 8",
234 .gui_gtk2_font_help_label = "Sans Bold 10",
235 .gui_gtk2_font_help_link = "Sans 9",
236 .gui_gtk2_font_help_text = "Monospace 8",
237 .gui_gtk2_font_chatline = "Monospace 8",
238 .gui_gtk2_font_beta_label = "Sans Italic 10",
239 .gui_gtk2_font_small = "Sans 9",
240 .gui_gtk2_font_comment_label = "Sans Italic 9",
241 .gui_gtk2_font_city_names = "Sans Bold 10",
242 .gui_gtk2_font_city_productions = "Serif 10",
243 .gui_gtk2_font_reqtree_text = "Serif 10",
244
245/* gui-gtk-3.0 client specific options. */
246 .gui_gtk3_fullscreen = FALSE,
247 .gui_gtk3_map_scrollbars = FALSE,
248 .gui_gtk3_dialogs_on_top = TRUE,
249 .gui_gtk3_show_task_icons = TRUE,
250 .gui_gtk3_enable_tabs = TRUE,
251 .gui_gtk3_show_chat_message_time = FALSE,
252 .gui_gtk3_new_messages_go_to_top = FALSE,
253 .gui_gtk3_show_message_window_buttons = TRUE,
254 .gui_gtk3_metaserver_tab_first = FALSE,
255 .gui_gtk3_allied_chat_only = FALSE,
256 .gui_gtk3_message_chat_location = GUI_GTK_MSGCHAT_SEPARATE,
257 .gui_gtk3_small_display_layout = FALSE,
258 .gui_gtk3_mouse_over_map_focus = FALSE,
259 .gui_gtk3_chatline_autocompletion = TRUE,
260 .gui_gtk3_citydlg_xsize = GUI_GTK3_CITYDLG_DEFAULT_XSIZE,
261 .gui_gtk3_citydlg_ysize = GUI_GTK3_CITYDLG_DEFAULT_YSIZE,
262 .gui_gtk3_popup_tech_help = GUI_POPUP_TECH_HELP_RULESET,
263 .gui_gtk3_governor_range_min = -20,
264 .gui_gtk3_governor_range_max = 20,
265 .gui_gtk3_font_city_label = "Monospace 8",
266 .gui_gtk3_font_notify_label = "Monospace Bold 9",
267 .gui_gtk3_font_spaceship_label = "Monospace 8",
268 .gui_gtk3_font_help_label = "Sans Bold 10",
269 .gui_gtk3_font_help_link = "Sans 9",
270 .gui_gtk3_font_help_text = "Monospace 8",
271 .gui_gtk3_font_chatline = "Monospace 8",
272 .gui_gtk3_font_beta_label = "Sans Italic 10",
273 .gui_gtk3_font_small = "Sans 9",
274 .gui_gtk3_font_comment_label = "Sans Italic 9",
275 .gui_gtk3_font_city_names = "Sans Bold 10",
276 .gui_gtk3_font_city_productions = "Serif 10",
277 .gui_gtk3_font_reqtree_text = "Serif 10",
278
279/* gui-gtk-3.22 client specific options. */
280 .gui_gtk3_22_default_theme_name = FC_GTK3_22_DEFAULT_THEME_NAME,
281 .gui_gtk3_22_fullscreen = FALSE,
282 .gui_gtk3_22_map_scrollbars = FALSE,
283 .gui_gtk3_22_dialogs_on_top = TRUE,
284 .gui_gtk3_22_show_task_icons = TRUE,
285 .gui_gtk3_22_enable_tabs = TRUE,
286 .gui_gtk3_22_show_chat_message_time = FALSE,
287 .gui_gtk3_22_new_messages_go_to_top = FALSE,
288 .gui_gtk3_22_show_message_window_buttons = TRUE,
289 .gui_gtk3_22_metaserver_tab_first = FALSE,
290 .gui_gtk3_22_allied_chat_only = FALSE,
291 .gui_gtk3_22_message_chat_location = GUI_GTK_MSGCHAT_SEPARATE,
292 .gui_gtk3_22_small_display_layout = FALSE,
293 .gui_gtk3_22_mouse_over_map_focus = FALSE,
294 .gui_gtk3_22_chatline_autocompletion = TRUE,
295 .gui_gtk3_22_citydlg_xsize = GUI_GTK3_22_CITYDLG_DEFAULT_XSIZE,
296 .gui_gtk3_22_citydlg_ysize = GUI_GTK3_22_CITYDLG_DEFAULT_YSIZE,
297 .gui_gtk3_22_helpdlg_xsize = GUI_GTK3_22_HELPDLG_DEFAULT_XSIZE,
298 .gui_gtk3_22_helpdlg_ysize = GUI_GTK3_22_HELPDLG_DEFAULT_YSIZE,
299 .gui_gtk3_22_optionsdlg_xsize = GUI_GTK3_22_OPTIONSDLG_DEFAULT_XSIZE,
300 .gui_gtk3_22_optionsdlg_ysize = GUI_GTK3_22_OPTIONSDLG_DEFAULT_YSIZE,
301 .gui_gtk3_22_popup_tech_help = GUI_POPUP_TECH_HELP_RULESET,
302 .gui_gtk3_22_governor_range_min = -20,
303 .gui_gtk3_22_governor_range_max = 20,
304 .gui_gtk3_22_font_city_label = "Monospace 8",
305 .gui_gtk3_22_font_notify_label = "Monospace Bold 9",
306 .gui_gtk3_22_font_spaceship_label = "Monospace 8",
307 .gui_gtk3_22_font_help_label = "Sans Bold 10",
308 .gui_gtk3_22_font_help_link = "Sans 9",
309 .gui_gtk3_22_font_help_text = "Monospace 8",
310 .gui_gtk3_22_font_chatline = "Monospace 8",
311 .gui_gtk3_22_font_beta_label = "Sans Italic 10",
312 .gui_gtk3_22_font_small = "Sans 9",
313 .gui_gtk3_22_font_comment_label = "Sans Italic 9",
314 .gui_gtk3_22_font_city_names = "Sans Bold 10",
315 .gui_gtk3_22_font_city_productions = "Serif 10",
316 .gui_gtk3_22_font_reqtree_text = "Serif 10",
317
318/* gui-gtk-4.0 client specific options. */
319 .gui_gtk4_default_theme_name = FC_GTK4_DEFAULT_THEME_NAME,
320 .gui_gtk4_fullscreen = FALSE,
321 .gui_gtk4_map_scrollbars = FALSE,
322 .gui_gtk4_dialogs_on_top = TRUE,
323 .gui_gtk4_show_task_icons = TRUE,
324 .gui_gtk4_enable_tabs = TRUE,
325 .gui_gtk4_show_chat_message_time = FALSE,
326 .gui_gtk4_new_messages_go_to_top = FALSE,
327 .gui_gtk4_show_message_window_buttons = TRUE,
328 .gui_gtk4_metaserver_tab_first = FALSE,
329 .gui_gtk4_allied_chat_only = FALSE,
330 .gui_gtk4_message_chat_location = GUI_GTK_MSGCHAT_SEPARATE,
331 .gui_gtk4_small_display_layout = FALSE,
332 .gui_gtk4_mouse_over_map_focus = FALSE,
333 .gui_gtk4_chatline_autocompletion = TRUE,
334 .gui_gtk4_citydlg_xsize = GUI_GTK4_CITYDLG_DEFAULT_XSIZE,
335 .gui_gtk4_citydlg_ysize = GUI_GTK4_CITYDLG_DEFAULT_YSIZE,
336 .gui_gtk4_helpdlg_xsize = GUI_GTK4_HELPDLG_DEFAULT_XSIZE,
337 .gui_gtk4_helpdlg_ysize = GUI_GTK4_HELPDLG_DEFAULT_YSIZE,
338 .gui_gtk4_optionsdlg_ysize = GUI_GTK4_OPTIONSDLG_DEFAULT_YSIZE,
339 .gui_gtk4_optionsdlg_xsize = GUI_GTK4_OPTIONSDLG_DEFAULT_XSIZE,
340 .gui_gtk4_popup_tech_help = GUI_POPUP_TECH_HELP_RULESET,
341 .gui_gtk4_governor_range_min = -20,
342 .gui_gtk4_governor_range_max = 20,
343 .gui_gtk4_font_city_label = "Monospace 8",
344 .gui_gtk4_font_notify_label = "Monospace Bold 9",
345 .gui_gtk4_font_spaceship_label = "Monospace 8",
346 .gui_gtk4_font_help_label = "Sans Bold 10",
347 .gui_gtk4_font_help_link = "Sans 9",
348 .gui_gtk4_font_help_text = "Monospace 8",
349 .gui_gtk4_font_chatline = "Monospace 8",
350 .gui_gtk4_font_beta_label = "Sans Italic 10",
351 .gui_gtk4_font_small = "Sans 9",
352 .gui_gtk4_font_comment_label = "Sans Italic 9",
353 .gui_gtk4_font_city_names = "Sans Bold 10",
354 .gui_gtk4_font_city_productions = "Serif 10",
355 .gui_gtk4_font_reqtree_text = "Serif 10",
356
357/* gui-gtk-5.0 client specific options. */
358 .gui_gtk5_default_theme_name = FC_GTK5_DEFAULT_THEME_NAME,
359 .gui_gtk5_fullscreen = FALSE,
360 .gui_gtk5_map_scrollbars = FALSE,
361 .gui_gtk5_dialogs_on_top = TRUE,
362 .gui_gtk5_show_task_icons = TRUE,
363 .gui_gtk5_enable_tabs = TRUE,
364 .gui_gtk5_show_chat_message_time = FALSE,
365 .gui_gtk5_new_messages_go_to_top = FALSE,
366 .gui_gtk5_show_message_window_buttons = TRUE,
367 .gui_gtk5_metaserver_tab_first = FALSE,
368 .gui_gtk5_allied_chat_only = FALSE,
369 .gui_gtk5_message_chat_location = GUI_GTK_MSGCHAT_SEPARATE,
370 .gui_gtk5_small_display_layout = FALSE,
371 .gui_gtk5_mouse_over_map_focus = FALSE,
372 .gui_gtk5_chatline_autocompletion = TRUE,
373 .gui_gtk5_citydlg_xsize = GUI_GTK5_CITYDLG_DEFAULT_XSIZE,
374 .gui_gtk5_citydlg_ysize = GUI_GTK5_CITYDLG_DEFAULT_YSIZE,
375 .gui_gtk5_helpdlg_xsize = GUI_GTK5_HELPDLG_DEFAULT_XSIZE,
376 .gui_gtk5_helpdlg_ysize = GUI_GTK5_HELPDLG_DEFAULT_YSIZE,
377 .gui_gtk5_optionsdlg_xsize = GUI_GTK5_OPTIONSDLG_DEFAULT_XSIZE,
378 .gui_gtk5_optionsdlg_ysize = GUI_GTK5_OPTIONSDLG_DEFAULT_YSIZE,
379 .gui_gtk5_popup_tech_help = GUI_POPUP_TECH_HELP_RULESET,
380 .gui_gtk5_governor_range_min = -20,
381 .gui_gtk5_governor_range_max = 20,
382 .gui_gtk5_font_city_label = "Monospace 8",
383 .gui_gtk5_font_notify_label = "Monospace Bold 9",
384 .gui_gtk5_font_spaceship_label = "Monospace 8",
385 .gui_gtk5_font_help_label = "Sans Bold 10",
386 .gui_gtk5_font_help_link = "Sans 9",
387 .gui_gtk5_font_help_text = "Monospace 8",
388 .gui_gtk5_font_chatline = "Monospace 8",
389 .gui_gtk5_font_beta_label = "Sans Italic 10",
390 .gui_gtk5_font_small = "Sans 9",
391 .gui_gtk5_font_comment_label = "Sans Italic 9",
392 .gui_gtk5_font_city_names = "Sans Bold 10",
393 .gui_gtk5_font_city_productions = "Serif 10",
394 .gui_gtk5_font_reqtree_text = "Serif 10",
395
396/* gui-sdl client specific options. */
397 .gui_sdl_fullscreen = FALSE,
398 .gui_sdl_screen = VIDEO_MODE(640, 480),
399 .gui_sdl_do_cursor_animation = TRUE,
400 .gui_sdl_use_color_cursors = TRUE,
401
402/* gui-sdl2 client specific options. */
403 .gui_sdl2_default_theme_name = FC_SDL2_DEFAULT_THEME_NAME,
404 .gui_sdl2_fullscreen = FALSE,
405 .gui_sdl2_screen = VIDEO_MODE(640, 480),
406 .gui_sdl2_swrenderer = FALSE,
407 .gui_sdl2_do_cursor_animation = TRUE,
408 .gui_sdl2_use_color_cursors = TRUE,
409 .gui_sdl2_font_city_names = "10",
410 .gui_sdl2_font_city_productions = "10",
411 .gui_sdl2_use_theme_font_size = TRUE,
412 .gui_sdl2_font_size = 10,
413
414/* gui-sdl3 client specific options. */
415 .gui_sdl3_default_theme_name = FC_SDL2_DEFAULT_THEME_NAME,
416 .gui_sdl3_fullscreen = FALSE,
417 .gui_sdl3_screen = VIDEO_MODE(640, 480),
418 .gui_sdl3_do_cursor_animation = TRUE,
419 .gui_sdl3_use_color_cursors = TRUE,
420 .gui_sdl3_font_city_names = "10",
421 .gui_sdl3_font_city_productions = "10",
422 .gui_sdl3_use_theme_font_size = TRUE,
423 .gui_sdl3_font_size = 10,
424
425/* gui-qt client specific options. */
426 .gui_qt_fullscreen = FALSE,
427 .gui_qt_show_preview = TRUE,
428 .gui_qt_sidebar_left = TRUE,
429 .gui_qt_default_theme_name = FC_QT_DEFAULT_THEME_NAME,
430 .gui_qt_font_default = "Sans Serif,10,-1,5,75,0,0,0,0,0",
431 .gui_qt_font_notify_label = "Monospace,8,-1,5,75,0,0,0,0,0",
432 .gui_qt_font_help_label = "Sans Serif,9,-1,5,50,0,0,0,0,0",
433 .gui_qt_font_help_text = "Monospace,8,-1,5,50,0,0,0,0,0",
434 .gui_qt_font_chatline = "Monospace,8,-1,5,50,0,0,0,0,0",
435 .gui_qt_font_city_names = "Sans Serif,10,-1,5,75,0,0,0,0,0",
436 .gui_qt_font_city_productions = "Sans Serif,10,-1,5,50,1,0,0,0,0",
437 .gui_qt_font_reqtree_text = "Sans Serif,10,-1,5,50,1,0,0,0,0",
438 .gui_qt_show_titlebar = TRUE,
439 .gui_qt_wakeup_text = "Wake up %1",
440 .gui_qt_show_relations_panel = TRUE,
441 .gui_qt_show_techs_panel = TRUE,
442 .gui_qt_show_wonders_panel = TRUE,
443 .gui_qt_svgflags = TRUE
444};
445
446/* Set to TRUE after the first call to options_init(), to avoid the usage
447 * of non-initialized datas when calling the changed callback. */
449
450static int sync_serial = 0;
451static int reply_serial = 0;
452static bool queue_save = FALSE;
454
455static const struct strvec *get_mapimg_format_list(const struct option *poption);
456
457/****************************************************************************
458 Option set structure.
459****************************************************************************/
461 struct option * (*option_by_number) (int);
462 struct option * (*option_first) (void);
463
465 const char * (*category_name) (int);
466};
467
468/************************************************************************/
472 int id)
473{
475
476 return poptset->option_by_number(id);
477}
478
479/************************************************************************/
483 const char *name)
484{
486
488 if (0 == strcmp(option_name(poption), name)) {
489 return poption;
490 }
492 return NULL;
493}
494
495/************************************************************************/
499{
501
502 return poptset->option_first();
503}
504
505/************************************************************************/
509{
511
512 return poptset->category_number();
513}
514
515/************************************************************************/
518const char *optset_category_name(const struct option_set *poptset,
519 int category)
520{
522
523 return poptset->category_name(category);
524}
525
526
527/****************************************************************************
528 The base class for options.
529****************************************************************************/
530struct option {
531 /* A link to the option set. */
532 const struct option_set *poptset;
533 /* Type of the option. */
535
536 /* Common accessors. */
537 const struct option_common_vtable {
538 int (*number) (const struct option *);
539 const char * (*name) (const struct option *);
540 const char * (*description) (const struct option *);
541 const char * (*help_text) (const struct option *);
542 int (*category) (const struct option *);
543 bool (*is_changeable) (const struct option *);
544 struct option * (*next) (const struct option *);
546 /* Specific typed accessors. */
547 union {
548 /* Specific boolean accessors (OT_BOOLEAN == type). */
549 const struct option_bool_vtable {
550 bool (*get) (const struct option *);
551 bool (*def) (const struct option *);
552 bool (*set) (struct option *, bool);
554 /* Specific integer accessors (OT_INTEGER == type). */
555 const struct option_int_vtable {
556 int (*get) (const struct option *);
557 int (*def) (const struct option *);
558 int (*minimum) (const struct option *);
559 int (*maximum) (const struct option *);
560 bool (*set) (struct option *, int);
562 /* Specific string accessors (OT_STRING == type). */
563 const struct option_str_vtable {
564 const char * (*get) (const struct option *);
565 const char * (*def) (const struct option *);
566 const struct strvec * (*values) (const struct option *);
567 bool (*set) (struct option *, const char *);
569 /* Specific enum accessors (OT_ENUM == type). */
570 const struct option_enum_vtable {
571 int (*get) (const struct option *);
572 int (*def) (const struct option *);
573 const struct strvec * (*values) (const struct option *);
574 bool (*set) (struct option *, int);
575 int (*cmp) (const char *, const char *);
577 /* Specific bitwise accessors (OT_BITWISE == type). */
578 const struct option_bitwise_vtable {
579 unsigned (*get) (const struct option *);
580 unsigned (*def) (const struct option *);
581 const struct strvec * (*values) (const struct option *);
582 bool (*set) (struct option *, unsigned);
584 /* Specific font accessors (OT_FONT == type). */
585 const struct option_font_vtable {
586 const char * (*get) (const struct option *);
587 const char * (*def) (const struct option *);
588 const char * (*target) (const struct option *);
589 bool (*set) (struct option *, const char *);
591 /* Specific color accessors (OT_COLOR == type). */
592 const struct option_color_vtable {
593 struct ft_color (*get) (const struct option *);
594 struct ft_color (*def) (const struct option *);
595 bool (*set) (struct option *, struct ft_color);
597 /* Specific video mode accessors (OT_VIDEO_MODE == type). */
598 const struct option_video_mode_vtable {
599 struct video_mode (*get) (const struct option *);
600 struct video_mode (*def) (const struct option *);
601 bool (*set) (struct option *, struct video_mode);
603 };
604
605 /* Called after the value changed. */
607
609
610 /* Volatile. */
611 void *gui_data;
612};
613
614#define OPTION(poption) ((struct option *) (poption))
615
616#define OPTION_INIT(optset, spec_type, spec_table_var, common_table, \
617 spec_table, changed_cb, cb_data) { \
618 .poptset = optset, \
619 .type = spec_type, \
620 .common_vtable = &common_table, \
621 INIT_BRACE_BEGIN \
622 .spec_table_var = &spec_table \
623 INIT_BRACE_END, \
624 .changed_callback = changed_cb, \
625 .callback_data = cb_data, \
626 .gui_data = NULL \
627}
628#define OPTION_BOOL_INIT(optset, common_table, bool_table, changed_cb) \
629 OPTION_INIT(optset, OT_BOOLEAN, bool_vtable, common_table, bool_table, \
630 changed_cb, 0)
631#define OPTION_INT_INIT(optset, common_table, int_table, changed_cb) \
632 OPTION_INIT(optset, OT_INTEGER, int_vtable, common_table, int_table, \
633 changed_cb, 0)
634#define OPTION_STR_INIT(optset, common_table, str_table, changed_cb, cb_data) \
635 OPTION_INIT(optset, OT_STRING, str_vtable, common_table, str_table, \
636 changed_cb, cb_data)
637#define OPTION_ENUM_INIT(optset, common_table, enum_table, changed_cb) \
638 OPTION_INIT(optset, OT_ENUM, enum_vtable, common_table, enum_table, \
639 changed_cb, 0)
640#define OPTION_BITWISE_INIT(optset, common_table, bitwise_table, \
641 changed_cb) \
642 OPTION_INIT(optset, OT_BITWISE, bitwise_vtable, common_table, \
643 bitwise_table, changed_cb, 0)
644#define OPTION_FONT_INIT(optset, common_table, font_table, changed_cb) \
645 OPTION_INIT(optset, OT_FONT, font_vtable, common_table, font_table, \
646 changed_cb, 0)
647#define OPTION_COLOR_INIT(optset, common_table, color_table, changed_cb) \
648 OPTION_INIT(optset, OT_COLOR, color_vtable, common_table, color_table, \
649 changed_cb, 0)
650#define OPTION_VIDEO_MODE_INIT(optset, common_table, video_mode_table, \
651 changed_cb) \
652 OPTION_INIT(optset, OT_VIDEO_MODE, video_mode_vtable, common_table, \
653 video_mode_table, changed_cb, 0)
654
655
656/************************************************************************/
659const struct option_set *option_optset(const struct option *poption)
660{
662
663 return poption->poptset;
664}
665
666/************************************************************************/
669int option_number(const struct option *poption)
670{
672
673 return poption->common_vtable->number(poption);
674}
675
676/************************************************************************/
679const char *option_name(const struct option *poption)
680{
682
683 return poption->common_vtable->name(poption);
684}
685
686/************************************************************************/
689const char *option_description(const struct option *poption)
690{
692
693 return poption->common_vtable->description(poption);
694}
695
696/************************************************************************/
699const char *option_help_text(const struct option *poption)
700{
702
703 return poption->common_vtable->help_text(poption);
704}
705
706/************************************************************************/
710{
712
713 return poption->type;
714}
715
716/************************************************************************/
720{
722
723 return poption->common_vtable->category(poption);
724}
725
726/************************************************************************/
729const char *option_category_name(const struct option *poption)
730{
732
733 return optset_category_name(poption->poptset,
734 poption->common_vtable->category(poption));
735}
736
737/************************************************************************/
741{
743
744 return poption->common_vtable->is_changeable(poption);
745}
746
747/************************************************************************/
750struct option *option_next(const struct option *poption)
751{
753
754 return poption->common_vtable->next(poption);
755}
756
757/************************************************************************/
784
785/************************************************************************/
789 void (*callback) (struct option *))
790{
792
793 poption->changed_callback = callback;
794}
795
796/************************************************************************/
800{
802
804 /* Prevent to use non-initialized datas. */
805 return;
806 }
807
808 if (poption->changed_callback) {
809 poption->changed_callback(poption);
810 }
811
813}
814
815/************************************************************************/
818void option_set_gui_data(struct option *poption, void *data)
819{
821
822 poption->gui_data = data;
823}
824
825/************************************************************************/
829{
831
832 return poption->gui_data;
833}
834
835/************************************************************************/
839{
841
842 return poption->callback_data;
843}
844
845/************************************************************************/
848bool option_bool_get(const struct option *poption)
849{
852
853 return poption->bool_vtable->get(poption);
854}
855
856/************************************************************************/
859bool option_bool_def(const struct option *poption)
860{
863
864 return poption->bool_vtable->def(poption);
865}
866
867/************************************************************************/
870bool option_bool_set(struct option *poption, bool val)
871{
874
875 if (poption->bool_vtable->set(poption, val)) {
877 return TRUE;
878 }
879 return FALSE;
880}
881
882/************************************************************************/
885int option_int_get(const struct option *poption)
886{
889
890 return poption->int_vtable->get(poption);
891}
892
893/************************************************************************/
896int option_int_def(const struct option *poption)
897{
900
901 return poption->int_vtable->def(poption);
902}
903
904/************************************************************************/
907int option_int_min(const struct option *poption)
908{
911
912 return poption->int_vtable->minimum(poption);
913}
914
915/************************************************************************/
918int option_int_max(const struct option *poption)
919{
922
923 return poption->int_vtable->maximum(poption);
924}
925
926/************************************************************************/
929bool option_int_set(struct option *poption, int val)
930{
933
934 if (poption->int_vtable->set(poption, val)) {
936 return TRUE;
937 }
938 return FALSE;
939}
940
941/************************************************************************/
944const char *option_str_get(const struct option *poption)
945{
948
949 return poption->str_vtable->get(poption);
950}
951
952/************************************************************************/
955const char *option_str_def(const struct option *poption)
956{
959
960 return poption->str_vtable->def(poption);
961}
962
963/************************************************************************/
966const struct strvec *option_str_values(const struct option *poption)
967{
970
971 return poption->str_vtable->values(poption);
972}
973
974/************************************************************************/
977bool option_str_set(struct option *poption, const char *str)
978{
982
983 if (poption->str_vtable->set(poption, str)) {
985 return TRUE;
986 }
987 return FALSE;
988}
989
990/************************************************************************/
994int option_enum_str_to_int(const struct option *poption, const char *str)
995{
996 const struct strvec *values;
997 int val;
998
1000 fc_assert_ret_val(OT_ENUM == poption->type, -1);
1001 values = poption->enum_vtable->values(poption);
1002 fc_assert_ret_val(NULL != values, -1);
1003
1004 for (val = 0; val < strvec_size(values); val++) {
1005 if (0 == poption->enum_vtable->cmp(strvec_get(values, val), str)) {
1006 return val;
1007 }
1008 }
1009 return -1;
1010}
1011
1012/************************************************************************/
1016const char *option_enum_int_to_str(const struct option *poption, int val)
1017{
1018 const struct strvec *values;
1019
1022 values = poption->enum_vtable->values(poption);
1023 fc_assert_ret_val(NULL != values, NULL);
1024
1025 return strvec_get(values, val);
1026}
1027
1028/************************************************************************/
1032{
1034 fc_assert_ret_val(OT_ENUM == poption->type, -1);
1035
1036 return poption->enum_vtable->get(poption);
1037}
1038
1039/************************************************************************/
1043const char *option_enum_get_str(const struct option *poption)
1044{
1047
1048 return strvec_get(poption->enum_vtable->values(poption),
1049 poption->enum_vtable->get(poption));
1050}
1051
1052/************************************************************************/
1056{
1058 fc_assert_ret_val(OT_ENUM == poption->type, -1);
1059
1060 return poption->enum_vtable->def(poption);
1061}
1062
1063/************************************************************************/
1067const char *option_enum_def_str(const struct option *poption)
1068{
1071
1072 return strvec_get(poption->enum_vtable->values(poption),
1073 poption->enum_vtable->def(poption));
1074}
1075
1076/************************************************************************/
1080const struct strvec *option_enum_values(const struct option *poption)
1081{
1084
1085 return poption->enum_vtable->values(poption);
1086}
1087
1088/************************************************************************/
1091bool option_enum_set_int(struct option *poption, int val)
1092{
1095
1096 if (poption->enum_vtable->set(poption, val)) {
1098 return TRUE;
1099 }
1100 return FALSE;
1101}
1102
1103/************************************************************************/
1108bool option_enum_set_str(struct option *poption, const char *str)
1109{
1113
1114 if (poption->enum_vtable->set(poption,
1117 return TRUE;
1118 }
1119 return FALSE;
1120}
1121
1122/************************************************************************/
1125unsigned option_bitwise_get(const struct option *poption)
1126{
1129
1130 return poption->bitwise_vtable->get(poption);
1131}
1132
1133/************************************************************************/
1136unsigned option_bitwise_def(const struct option *poption)
1137{
1140
1141 return poption->bitwise_vtable->def(poption);
1142}
1143
1144/************************************************************************/
1147unsigned option_bitwise_mask(const struct option *poption)
1148{
1149 const struct strvec *values;
1150
1153
1154 values = poption->bitwise_vtable->values(poption);
1155 fc_assert_ret_val(NULL != values, 0);
1156
1157 return (1 << strvec_size(values)) - 1;
1158}
1159
1160/************************************************************************/
1164const struct strvec *option_bitwise_values(const struct option *poption)
1165{
1168
1169 return poption->bitwise_vtable->values(poption);
1170}
1171
1172/************************************************************************/
1175bool option_bitwise_set(struct option *poption, unsigned val)
1176{
1179
1180 if (0 != (val & ~option_bitwise_mask(poption))
1181 || !poption->bitwise_vtable->set(poption, val)) {
1182 return FALSE;
1183 }
1184
1186 return TRUE;
1187}
1188
1189/************************************************************************/
1192const char *option_font_get(const struct option *poption)
1193{
1196
1197 return poption->font_vtable->get(poption);
1198}
1199
1200/************************************************************************/
1203const char *option_font_def(const struct option *poption)
1204{
1207
1208 return poption->font_vtable->def(poption);
1209}
1210
1211/************************************************************************/
1214const char *option_font_target(const struct option *poption)
1215{
1218
1219 return poption->font_vtable->target(poption);
1220}
1221
1222/************************************************************************/
1225bool option_font_set(struct option *poption, const char *font)
1226{
1229 fc_assert_ret_val(NULL != font, FALSE);
1230
1231 if (poption->font_vtable->set(poption, font)) {
1233 return TRUE;
1234 }
1235 return FALSE;
1236}
1237
1238/************************************************************************/
1248
1249/************************************************************************/
1259
1260/************************************************************************/
1265{
1268
1269 if (poption->color_vtable->set(poption, color)) {
1271 return TRUE;
1272 }
1273 return FALSE;
1274}
1275
1276/************************************************************************/
1280{
1283 video_mode_construct(-1, -1));
1284
1285 return poption->video_mode_vtable->get(poption);
1286}
1287
1288/************************************************************************/
1292{
1295 video_mode_construct(-1, -1));
1296
1297 return poption->video_mode_vtable->def(poption);
1298}
1299
1300/************************************************************************/
1305{
1308
1309 if (poption->video_mode_vtable->set(poption, mode)) {
1311 return TRUE;
1312 }
1313 return FALSE;
1314}
1315
1316
1317/****************************************************************************
1318 Client option set.
1319****************************************************************************/
1320static struct option *client_optset_option_by_number(int id);
1321static struct option *client_optset_option_first(void);
1322static int client_optset_category_number(void);
1323static const char *client_optset_category_name(int category);
1324
1327 .option_first = client_optset_option_first,
1328 .category_number = client_optset_category_number,
1329 .category_name = client_optset_category_name
1330};
1332
1334 const char *support; /* Untranslated long support name, used
1335 * for saving. */
1336 const char *pretty; /* Translated, used to display to the
1337 * users. */
1338};
1339
1340/****************************************************************************
1341 Virtuals tables for the client options.
1342****************************************************************************/
1343static int client_option_number(const struct option *poption);
1344static const char *client_option_name(const struct option *poption);
1345static const char *client_option_description(const struct option *poption);
1346static const char *client_option_help_text(const struct option *poption);
1347static int client_option_category(const struct option *poption);
1348static bool client_option_is_changeable(const struct option *poption);
1349static struct option *client_option_next(const struct option *poption);
1350
1351static const struct option_common_vtable client_option_common_vtable = {
1352 .number = client_option_number,
1353 .name = client_option_name,
1354 .description = client_option_description,
1355 .help_text = client_option_help_text,
1356 .category = client_option_category,
1357 .is_changeable = client_option_is_changeable,
1358 .next = client_option_next
1359};
1360
1361static bool client_option_bool_get(const struct option *poption);
1362static bool client_option_bool_def(const struct option *poption);
1363static bool client_option_bool_set(struct option *poption, bool val);
1364
1365static const struct option_bool_vtable client_option_bool_vtable = {
1369};
1370
1371static int client_option_int_get(const struct option *poption);
1372static int client_option_int_def(const struct option *poption);
1373static int client_option_int_min(const struct option *poption);
1374static int client_option_int_max(const struct option *poption);
1375static bool client_option_int_set(struct option *poption, int val);
1376
1377static const struct option_int_vtable client_option_int_vtable = {
1378 .get = client_option_int_get,
1379 .def = client_option_int_def,
1380 .minimum = client_option_int_min,
1381 .maximum = client_option_int_max,
1383};
1384
1385static const char *client_option_str_get(const struct option *poption);
1386static const char *client_option_str_def(const struct option *poption);
1387static const struct strvec *
1389static bool client_option_str_set(struct option *poption, const char *str);
1390
1391static const struct option_str_vtable client_option_str_vtable = {
1392 .get = client_option_str_get,
1393 .def = client_option_str_def,
1394 .values = client_option_str_values,
1396};
1397
1398static int client_option_enum_get(const struct option *poption);
1399static int client_option_enum_def(const struct option *poption);
1400static const struct strvec *
1402static bool client_option_enum_set(struct option *poption, int val);
1403
1404static const struct option_enum_vtable client_option_enum_vtable = {
1409 .cmp = fc_strcasecmp
1410};
1411
1412#if 0 /* There's no bitwise options currently */
1413static unsigned client_option_bitwise_get(const struct option *poption);
1414static unsigned client_option_bitwise_def(const struct option *poption);
1415static const struct strvec *
1417static bool client_option_bitwise_set(struct option *poption, unsigned val);
1418
1419static const struct option_bitwise_vtable client_option_bitwise_vtable = {
1424};
1425#endif /* 0 */
1426
1427static const char *client_option_font_get(const struct option *poption);
1428static const char *client_option_font_def(const struct option *poption);
1429static const char *client_option_font_target(const struct option *poption);
1430static bool client_option_font_set(struct option *poption, const char *font);
1431
1432static const struct option_font_vtable client_option_font_vtable = {
1435 .target = client_option_font_target,
1437};
1438
1441static bool client_option_color_set(struct option *poption,
1442 struct ft_color color);
1443
1444static const struct option_color_vtable client_option_color_vtable = {
1448};
1449
1450static struct video_mode
1452static struct video_mode
1454static bool client_option_video_mode_set(struct option *poption,
1455 struct video_mode mode);
1456
1457static const struct option_video_mode_vtable client_option_video_mode_vtable = {
1461};
1462
1473
1474/****************************************************************************
1475 Derived class client option, inherinting of base class option.
1476****************************************************************************/
1478 struct option base_option; /* Base structure, must be the first! */
1479
1480 const char *name; /* Short name - used as an identifier */
1481 const char *description; /* One-line description */
1482 const char *help_text; /* Paragraph-length help text */
1484 enum gui_type specific; /* GUI_STUB for common options. */
1485
1486 union {
1487 /* OT_BOOLEAN type option. */
1488 struct {
1489 bool *const pvalue;
1490 const bool def;
1491 } boolean;
1492 /* OT_INTEGER type option. */
1493 struct {
1494 int *const pvalue;
1495 const int def, min, max;
1496 } integer;
1497 /* OT_STRING type option. */
1498 struct {
1499 char *const pvalue;
1500 const size_t size;
1501 const char *const def;
1502 /*
1503 * A function to return a string vector of possible string values,
1504 * or NULL for none.
1505 */
1506 const struct strvec *(*const val_accessor) (const struct option *);
1507 } string;
1508 /* OT_ENUM type option. */
1509 struct {
1510 int *const pvalue;
1511 const int def;
1512 struct strvec *support_names, *pretty_names; /* untranslated */
1513 const struct copt_val_name * (*const name_accessor) (int value);
1514 } enumerator;
1515 /* OT_BITWISE type option. */
1516 struct {
1517 unsigned *const pvalue;
1518 const unsigned def;
1519 struct strvec *support_names, *pretty_names; /* untranslated */
1520 const struct copt_val_name * (*const name_accessor) (int value);
1521 } bitwise;
1522 /* OT_FONT type option. */
1523 struct {
1524 char *const pvalue;
1525 const size_t size;
1526 const char *const def;
1527 const char *const target;
1528 } font;
1529 /* OT_COLOR type option. */
1530 struct {
1531 struct ft_color *const pvalue;
1532 const struct ft_color def;
1534 /* OT_VIDEO_MODE type option. */
1535 struct {
1536 struct video_mode *const pvalue;
1537 const struct video_mode def;
1539 };
1540};
1541
1542#define CLIENT_OPTION(poption) ((struct client_option *) (poption))
1543
1544/*
1545 * Generate a client option of type OT_BOOLEAN.
1546 *
1547 * oname: The option data. Note it is used as name to be loaded or saved.
1548 * So, you shouldn't change the name of this variable in any case.
1549 * odesc: A short description of the client option. Should be used with the
1550 * N_() macro.
1551 * ohelp: The help text for the client option. Should be used with the N_()
1552 * macro.
1553 * ocat: The client_option_class of this client option.
1554 * ospec: A gui_type enumerator which determine for what particular client
1555 * gui this option is for. Sets to GUI_STUB for common options.
1556 * odef: The default value of this client option (FALSE or TRUE).
1557 * ocb: A callback function of type void (*)(struct option *) called when
1558 * the option changed.
1559 */
1560#define GEN_BOOL_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb) \
1561{ \
1562 .base_option = OPTION_BOOL_INIT(&client_optset_static, \
1563 client_option_common_vtable, \
1564 client_option_bool_vtable, ocb), \
1565 .name = #oname, \
1566 .description = odesc, \
1567 .help_text = ohelp, \
1568 .category = ocat, \
1569 .specific = ospec, \
1570 INIT_BRACE_BEGIN \
1571 .boolean = { \
1572 .pvalue = &gui_options.oname, \
1573 .def = odef, \
1574 } \
1575 INIT_BRACE_END \
1576}
1577
1578/*
1579 * Generate a client option of type OT_INTEGER.
1580 *
1581 * oname: The option data. Note it is used as name to be loaded or saved.
1582 * So, you shouldn't change the name of this variable in any case.
1583 * odesc: A short description of the client option. Should be used with the
1584 * N_() macro.
1585 * ohelp: The help text for the client option. Should be used with the N_()
1586 * macro.
1587 * ocat: The client_option_class of this client option.
1588 * ospec: A gui_type enumerator which determine for what particular client
1589 * gui this option is for. Sets to GUI_STUB for common options.
1590 * odef: The default value of this client option.
1591 * omin: The minimal value of this client option.
1592 * omax: The maximal value of this client option.
1593 * ocb: A callback function of type void (*)(struct option *) called when
1594 * the option changed.
1595 */
1596#define GEN_INT_OPTION(oname, odesc, ohelp, ocat, ospec, odef, omin, omax, ocb) \
1597{ \
1598 .base_option = OPTION_INT_INIT(&client_optset_static, \
1599 client_option_common_vtable, \
1600 client_option_int_vtable, ocb), \
1601 .name = #oname, \
1602 .description = odesc, \
1603 .help_text = ohelp, \
1604 .category = ocat, \
1605 .specific = ospec, \
1606 INIT_BRACE_BEGIN \
1607 .integer = { \
1608 .pvalue = &gui_options.oname, \
1609 .def = odef, \
1610 .min = omin, \
1611 .max = omax \
1612 } \
1613 INIT_BRACE_END \
1614}
1615
1616/*
1617 * Generate a client option of type OT_STRING.
1618 *
1619 * oname: The option data. Note it is used as name to be loaded or saved.
1620 * So, you shouldn't change the name of this variable in any case.
1621 * Be sure to pass the array variable and not a pointer to it because
1622 * the size is calculated with sizeof().
1623 * odesc: A short description of the client option. Should be used with the
1624 * N_() macro.
1625 * ohelp: The help text for the client option. Should be used with the N_()
1626 * macro.
1627 * ocat: The client_option_class of this client option.
1628 * ospec: A gui_type enumerator which determines for what particular client
1629 * gui this option is for. Set to GUI_STUB for common options.
1630 * odef: The default string for this client option.
1631 * ocb: A callback function of type void (*)(struct option *) called when
1632 * the option changed.
1633 */
1634#define GEN_STR_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb, cbd) \
1635{ \
1636 .base_option = OPTION_STR_INIT(&client_optset_static, \
1637 client_option_common_vtable, \
1638 client_option_str_vtable, ocb, cbd), \
1639 .name = #oname, \
1640 .description = odesc, \
1641 .help_text = ohelp, \
1642 .category = ocat, \
1643 .specific = ospec, \
1644 INIT_BRACE_BEGIN \
1645 .string = { \
1646 .pvalue = gui_options.oname, \
1647 .size = sizeof(gui_options.oname), \
1648 .def = odef, \
1649 .val_accessor = NULL \
1650 } \
1651 INIT_BRACE_END \
1652}
1653
1654/*
1655 * Generate a client option of type OT_STRING with a string accessor
1656 * function.
1657 *
1658 * oname: The option data. Note it is used as name to be loaded or saved.
1659 * So, you shouldn't change the name of this variable in any case.
1660 * Be sure to pass the array variable and not a pointer to it because
1661 * the size is calculated with sizeof().
1662 * odesc: A short description of the client option. Should be used with the
1663 * N_() macro.
1664 * ohelp: The help text for the client option. Should be used with the N_()
1665 * macro.
1666 * ocat: The client_option_class of this client option.
1667 * ospec: A gui_type enumerator which determine for what particular client
1668 * gui this option is for. Sets to GUI_STUB for common options.
1669 * odef: The default string for this client option.
1670 * oacc: The string accessor where to find the allowed values of type
1671 * 'const struct strvec * (*) (void)'.
1672 * ocb: A callback function of type void (*)(struct option *) called when
1673 * the option changed.
1674 */
1675#define GEN_STR_LIST_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb, cbd) \
1676{ \
1677 .base_option = OPTION_STR_INIT(&client_optset_static, \
1678 client_option_common_vtable, \
1679 client_option_str_vtable, ocb, cbd), \
1680 .name = #oname, \
1681 .description = odesc, \
1682 .help_text = ohelp, \
1683 .category = ocat, \
1684 .specific = ospec, \
1685 INIT_BRACE_BEGIN \
1686 .string = { \
1687 .pvalue = gui_options.oname, \
1688 .size = sizeof(gui_options.oname), \
1689 .def = odef, \
1690 .val_accessor = oacc \
1691 } \
1692 INIT_BRACE_END \
1693}
1694
1695/*
1696 * Generate a client option of type OT_ENUM.
1697 *
1698 * oname: The option data. Note it is used as name to be loaded or saved.
1699 * So, you shouldn't change the name of this variable in any case.
1700 * odesc: A short description of the client option. Should be used with the
1701 * N_() macro.
1702 * ohelp: The help text for the client option. Should be used with the N_()
1703 * macro.
1704 * ocat: The client_option_class of this client option.
1705 * ospec: A gui_type enumerator which determine for what particular client
1706 * gui this option is for. Sets to GUI_STUB for common options.
1707 * odef: The default value for this client option.
1708 * oacc: The name accessor of type 'const struct copt_val_name * (*) (int)'.
1709 * ocb: A callback function of type void (*) (struct option *) called when
1710 * the option changed.
1711 */
1712#define GEN_ENUM_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb) \
1713{ \
1714 .base_option = OPTION_ENUM_INIT(&client_optset_static, \
1715 client_option_common_vtable, \
1716 client_option_enum_vtable, ocb), \
1717 .name = #oname, \
1718 .description = odesc, \
1719 .help_text = ohelp, \
1720 .category = ocat, \
1721 .specific = ospec, \
1722 INIT_BRACE_BEGIN \
1723 .enumerator = { \
1724 .pvalue = (int *) &gui_options.oname, \
1725 .def = odef, \
1726 .support_names = NULL, /* Set in options_init(). */ \
1727 .pretty_names = NULL, \
1728 .name_accessor = oacc \
1729 } \
1730 INIT_BRACE_END \
1731}
1732
1733/*
1734 * Generate a client option of type OT_BITWISE.
1735 *
1736 * oname: The option data. Note it is used as name to be loaded or saved.
1737 * So, you shouldn't change the name of this variable in any case.
1738 * odesc: A short description of the client option. Should be used with the
1739 * N_() macro.
1740 * ohelp: The help text for the client option. Should be used with the N_()
1741 * macro.
1742 * ocat: The client_option_class of this client option.
1743 * ospec: A gui_type enumerator which determine for what particular client
1744 * gui this option is for. Sets to GUI_STUB for common options.
1745 * odef: The default value for this client option.
1746 * oacc: The name accessor of type 'const struct copt_val_name * (*) (int)'.
1747 * ocb: A callback function of type void (*) (struct option *) called when
1748 * the option changed.
1749 */
1750#define GEN_BITWISE_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, \
1751 ocb) \
1752{ \
1753 .base_option = OPTION_BITWISE_INIT(&client_optset_static, \
1754 client_option_common_vtable, \
1755 client_option_bitwise_vtable, ocb), \
1756 .name = #oname, \
1757 .description = odesc, \
1758 .help_text = ohelp, \
1759 .category = ocat, \
1760 .specific = ospec, \
1761 INIT_BRACE_BEGIN \
1762 .bitwise = { \
1763 .pvalue = &gui_options.oname, \
1764 .def = odef, \
1765 .support_names = NULL, /* Set in options_init(). */ \
1766 .pretty_names = NULL, \
1767 .name_accessor = oacc \
1768 } \
1769 INIT_BRACE_END \
1770}
1771
1772/*
1773 * Generate a client option of type OT_FONT.
1774 *
1775 * oname: The option data. Note it is used as name to be loaded or saved.
1776 * So, you shouldn't change the name of this variable in any case.
1777 * Be sure to pass the array variable and not a pointer to it because
1778 * the size is calculated with sizeof().
1779 * otgt: The target widget style.
1780 * odesc: A short description of the client option. Should be used with the
1781 * N_() macro.
1782 * ohelp: The help text for the client option. Should be used with the N_()
1783 * macro.
1784 * ocat: The client_option_class of this client option.
1785 * ospec: A gui_type enumerator which determine for what particular client
1786 * gui this option is for. Sets to GUI_STUB for common options.
1787 * odef: The default string for this client option.
1788 * ocb: A callback function of type void (*)(struct option *) called when
1789 * the option changed.
1790 */
1791#define GEN_FONT_OPTION(oname, otgt, odesc, ohelp, ocat, ospec, odef, ocb) \
1792{ \
1793 .base_option = OPTION_FONT_INIT(&client_optset_static, \
1794 client_option_common_vtable, \
1795 client_option_font_vtable, ocb), \
1796 .name = #oname, \
1797 .description = odesc, \
1798 .help_text = ohelp, \
1799 .category = ocat, \
1800 .specific = ospec, \
1801 INIT_BRACE_BEGIN \
1802 .font = { \
1803 .pvalue = gui_options.oname, \
1804 .size = sizeof(gui_options.oname), \
1805 .def = odef, \
1806 .target = otgt, \
1807 } \
1808 INIT_BRACE_END \
1809}
1810
1811/*
1812 * Generate a client option of type OT_COLOR.
1813 *
1814 * oname: The option data. Note it is used as name to be loaded or saved.
1815 * So, you shouldn't change the name of this variable in any case.
1816 * odesc: A short description of the client option. Should be used with the
1817 * N_() macro.
1818 * ohelp: The help text for the client option. Should be used with the N_()
1819 * macro.
1820 * ocat: The client_option_class of this client option.
1821 * ospec: A gui_type enumerator which determine for what particular client
1822 * gui this option is for. Sets to GUI_STUB for common options.
1823 * odef_fg, odef_bg: The default values for this client option.
1824 * ocb: A callback function of type void (*)(struct option *) called when
1825 * the option changed.
1826 */
1827#define GEN_COLOR_OPTION(oname, odesc, ohelp, ocat, ospec, odef_fg, \
1828 odef_bg, ocb) \
1829{ \
1830 .base_option = OPTION_COLOR_INIT(&client_optset_static, \
1831 client_option_common_vtable, \
1832 client_option_color_vtable, ocb), \
1833 .name = #oname, \
1834 .description = odesc, \
1835 .help_text = ohelp, \
1836 .category = ocat, \
1837 .specific = ospec, \
1838 INIT_BRACE_BEGIN \
1839 .color = { \
1840 .pvalue = &gui_options.oname, \
1841 .def = FT_COLOR(odef_fg, odef_bg) \
1842 } \
1843 INIT_BRACE_END \
1844}
1845
1846/*
1847 * Generate a client option of type OT_VIDEO_MODE.
1848 *
1849 * oname: The option data. Note it is used as name to be loaded or saved.
1850 * So, you shouldn't change the name of this variable in any case.
1851 * odesc: A short description of the client option. Should be used with the
1852 * N_() macro.
1853 * ohelp: The help text for the client option. Should be used with the N_()
1854 * macro.
1855 * ocat: The client_option_class of this client option.
1856 * ospec: A gui_type enumerator which determine for what particular client
1857 * gui this option is for. Sets to GUI_STUB for common options.
1858 * odef_width, odef_height: The default values for this client option.
1859 * ocb: A callback function of type void (*)(struct option *) called when
1860 * the option changed.
1861 */
1862#define GEN_VIDEO_OPTION(oname, odesc, ohelp, ocat, ospec, odef_width, \
1863 odef_height, ocb) \
1864{ \
1865 .base_option = OPTION_VIDEO_MODE_INIT(&client_optset_static, \
1866 client_option_common_vtable, \
1867 client_option_video_mode_vtable, \
1868 ocb), \
1869 .name = #oname, \
1870 .description = odesc, \
1871 .help_text = ohelp, \
1872 .category = ocat, \
1873 .specific = ospec, \
1874 INIT_BRACE_BEGIN \
1875 .video_mode = { \
1876 .pvalue = &gui_options.oname, \
1877 .def = VIDEO_MODE(odef_width, odef_height) \
1878 } \
1879 INIT_BRACE_END \
1880}
1881
1882/****************************************************************************
1883 Enumerator name accessors.
1884****************************************************************************/
1885
1886/************************************************************************/
1889static const struct copt_val_name
1891{
1892 /* Order must match enum GUI_GTK_MSGCHAT_* */
1893 static const struct copt_val_name names[] = {
1894 /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */
1895 { "SPLIT", N_("Split") },
1896 /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */
1897 { "SEPARATE", N_("Separate") },
1898 /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */
1899 { "MERGED", N_("Merged") }
1900 };
1901
1902 return (0 <= value && value < ARRAY_SIZE(names)
1903 ? names + value : NULL);
1904}
1905
1906/************************************************************************/
1909static const struct copt_val_name
1911{
1912 /* Order must match enum GUI_POPUP_TECH_HELP_* */
1913 static const struct copt_val_name names[] = {
1914 /* TRANS: enum value for 'gui_popup_tech_help' */
1915 { "ENABLED", N_("Enabled") },
1916 /* TRANS: enum value for 'gui_popup_tech_help' */
1917 { "DISABLED", N_("Disabled") },
1918 /* TRANS: enum value for 'gui_popup_tech_help' */
1919 { "RULESET", N_("Ruleset") }
1920 };
1921
1922 return (0 <= value && value < ARRAY_SIZE(names)
1923 ? names + value : NULL);
1924}
1925
1926/* Some changed callbacks. */
1927static void reqtree_show_icons_callback(struct option *poption);
1928static void view_option_changed_callback(struct option *poption);
1929static void manual_turn_done_callback(struct option *poption);
1930static void voteinfo_bar_callback(struct option *poption);
1931static void font_changed_callback(struct option *poption);
1932static void mapimg_changed_callback(struct option *poption);
1933static void game_music_enable_callback(struct option *poption);
1934static void menu_music_enable_callback(struct option *poption);
1935static void sound_volume_callback(struct option *poption);
1936
1938 GEN_STR_OPTION(default_user_name,
1939 N_("Login name"),
1940 N_("This is the default login username that will be used "
1941 "in the connection dialogs or with the -a command-line "
1942 "parameter."),
1944 GEN_BOOL_OPTION(use_prev_server, N_("Default to previously used server"),
1945 N_("Automatically update \"Server\" and \"Server port\" "
1946 "options to match your latest connection, so by "
1947 "default you connect to the same server you used "
1948 "on the previous run. You should enable "
1949 "saving options on exit too, so that the automatic "
1950 "updates to the options get saved too."),
1952 GEN_STR_OPTION(default_server_host,
1953 N_("Server"),
1954 N_("This is the default server hostname that will be used "
1955 "in the connection dialogs or with the -a command-line "
1956 "parameter."),
1957 COC_NETWORK, GUI_STUB, "localhost", NULL, 0),
1958 GEN_INT_OPTION(default_server_port,
1959 N_("Server port"),
1960 N_("This is the default server port that will be used "
1961 "in the connection dialogs or with the -a command-line "
1962 "parameter."),
1964 GEN_STR_OPTION(default_metaserver,
1965 N_("Metaserver"),
1966 N_("The metaserver is a host that the client contacts to "
1967 "find out about games on the internet. Don't change "
1968 "this from its default value unless you know what "
1969 "you're doing."),
1971 GEN_BOOL_OPTION(heartbeat_enabled,
1972 N_("Send heartbeat messages to the server"),
1973 N_("Periodically send an empty heartbeat message to the "
1974 "server to probe whether the connection is still up. "
1975 "This can help to make it obvious when the server has "
1976 "cut the connection due to a connectivity outage, if "
1977 "the client would otherwise sit idle for a long period."),
1979 GEN_STR_OPTION(followtag_override,
1980 N_("Followtag override"),
1981 /* TRANS: Leave 'builtin' untranslated */
1982 N_("Followtag determines which kind of new freeciv versions' "
1983 "availability gets checked from the metaserver. Special "
1984 "value 'builtin' means that value builtin to the client "
1985 "gets used."),
1987 GEN_BOOL_OPTION(send_desired_settings,
1988 N_("Send desired settings to the server"),
1989 N_("In single-player mode client usually sends user's "
1990 "desired server settings to the server it has "
1991 "launched internally. By disabling this option one "
1992 "can prevent such override of server settings from "
1993 "other sources, such as settings balanced for a "
1994 "custom ruleset."),
1996 GEN_STR_LIST_OPTION(default_sound_set_name,
1997 N_("Soundset"),
1998 N_("This is the soundset that will be used. Changing "
1999 "this is the same as using the -S command-line "
2000 "parameter. Use modpack installer utility to install "
2001 "additional soundsets."),
2002 COC_SOUND, GUI_STUB, "stdsounds", get_soundset_list, NULL, 0),
2003 GEN_STR_LIST_OPTION(default_music_set_name,
2004 N_("Musicset"),
2005 N_("This is the musicset that will be used. Changing "
2006 "this is the same as using the -m command-line "
2007 "parameter. Use modpack installer utility to install "
2008 "additional musicsets."),
2009 COC_SOUND, GUI_STUB, "stdmusic", get_musicset_list,
2011 GEN_STR_LIST_OPTION(default_sound_plugin_name,
2012 N_("Sound plugin"),
2013 N_("If you have a problem with sound, try changing "
2014 "the sound plugin. The new plugin won't take "
2015 "effect until you restart Freeciv. Changing this "
2016 "is the same as using the -P command-line option."),
2018 GEN_STR_OPTION(default_chat_logfile,
2019 N_("The chat log file"),
2020 N_("The name of the chat log file."),
2022 /* gui_gtk3_22/4/5_default_theme_name and gui_sdl2/3_default_theme_name are
2023 * different settings to avoid client crash after loading the
2024 * style for the other gui. Keeps 6 different options! */
2025 GEN_STR_LIST_OPTION(gui_gtk3_22_default_theme_name, N_("Theme"),
2026 N_("By changing this option you change the "
2027 "active theme."),
2030 GEN_STR_LIST_OPTION(gui_gtk4_default_theme_name, N_("Theme"),
2031 N_("By changing this option you change the "
2032 "active theme."),
2035 GEN_STR_LIST_OPTION(gui_gtk5_default_theme_name, N_("Theme"),
2036 N_("By changing this option you change the "
2037 "active theme."),
2040 GEN_STR_LIST_OPTION(gui_sdl2_default_theme_name, N_("Theme"),
2041 N_("By changing this option you change the "
2042 "active theme."),
2045 GEN_STR_LIST_OPTION(gui_sdl3_default_theme_name, N_("Theme"),
2046 N_("By changing this option you change the "
2047 "active theme."),
2050 GEN_STR_LIST_OPTION(gui_qt_default_theme_name, N_("Theme"),
2051 N_("By changing this option you change the "
2052 "active theme."),
2055
2056 /* It's important to give empty string instead of NULL as as default
2057 * value. For NULL value it would default to assigning first value
2058 * from the tileset list returned by get_tileset_list() as default
2059 * tileset. We don't want default tileset assigned at all here, but
2060 * leave it to tilespec code that can handle tileset priority. */
2061 GEN_STR_LIST_OPTION(default_tileset_square_name, N_("Tileset (Square)"),
2062 N_("Select the tileset used with Square based maps. "
2063 "This may change the currently active tileset, if "
2064 "you are playing on such a map, in which "
2065 "case this is the same as using the -t "
2066 "command-line parameter. "
2067 "Use modpack installer utility to install "
2068 "additional tilesets."),
2071 GEN_STR_LIST_OPTION(default_tileset_hex_name, N_("Tileset (Hex)"),
2072 N_("Select the tileset used with Hex maps. "
2073 "This may change the currently active tileset, if "
2074 "you are playing on such a map, in which "
2075 "case this is the same as using the -t "
2076 "command-line parameter. "
2077 "Use modpack installer utility to install "
2078 "additional tilesets."),
2081 GEN_STR_LIST_OPTION(default_tileset_isohex_name, N_("Tileset (Iso-Hex)"),
2082 N_("Select the tileset used with Iso-Hex maps. "
2083 "This may change the currently active tileset, if "
2084 "you are playing on such a map, in which "
2085 "case this is the same as using the -t "
2086 "command-line parameter."
2087 "Use modpack installer utility to install "
2088 "additional tilesets."),
2091
2092 GEN_BOOL_OPTION(draw_city_outlines, N_("Draw city outlines"),
2093 N_("Setting this option will draw a line at the city "
2094 "workable limit."),
2097 GEN_BOOL_OPTION(draw_city_output, N_("Draw city output"),
2098 N_("Setting this option will draw city output for every "
2099 "citizen."),
2102 GEN_BOOL_OPTION(draw_map_grid, N_("Draw the map grid"),
2103 N_("Setting this option will draw a grid over the map."),
2106 GEN_BOOL_OPTION(draw_full_citybar, N_("Draw the city bar"),
2107 N_("Setting this option will display a 'city bar' "
2108 "containing useful information beneath each city. "
2109 "Disabling this option will display only the city's "
2110 "name and, optionally, production."),
2113 GEN_BOOL_OPTION(draw_city_names, N_("Draw the city names"),
2114 N_("Setting this option will draw the names of the cities "
2115 "on the map."),
2118 GEN_BOOL_OPTION(draw_city_growth, N_("Draw the city growth"),
2119 N_("Setting this option will draw in how many turns the "
2120 "cities will grow or shrink."),
2123 GEN_BOOL_OPTION(draw_city_productions, N_("Draw the city productions"),
2124 N_("Setting this option will draw what the cities are "
2125 "currently building on the map."),
2128 GEN_BOOL_OPTION(draw_city_buycost, N_("Draw the city buy costs"),
2129 N_("Setting this option will draw how much gold is "
2130 "needed to buy the production of the cities."),
2133 GEN_BOOL_OPTION(draw_city_trade_routes, N_("Draw the city trade routes"),
2134 N_("Setting this option will draw trade route lines "
2135 "between cities which have trade routes."),
2138 GEN_BOOL_OPTION(draw_terrain, N_("Draw the terrain"),
2139 N_("Setting this option will draw the terrain."),
2142 GEN_BOOL_OPTION(draw_coastline, N_("Draw the coast line"),
2143 N_("Setting this option will draw a line to separate the "
2144 "land from the ocean."),
2147 GEN_BOOL_OPTION(draw_paths, N_("Draw the paths"),
2148 N_("Setting this option will draw all kind of paths "
2149 "on the map."),
2152 GEN_BOOL_OPTION(draw_irrigation, N_("Draw the irrigation"),
2153 N_("Setting this option will draw the irrigation systems "
2154 "on the map."),
2157 GEN_BOOL_OPTION(draw_mines, N_("Draw the mines"),
2158 N_("Setting this option will draw the mines on the map."),
2161 GEN_BOOL_OPTION(draw_fortress_airbase, N_("Draw the bases"),
2162 N_("Setting this option will draw the bases on the map."),
2165 GEN_BOOL_OPTION(draw_specials, N_("Draw the resources"),
2166 N_("Setting this option will draw the resources on the "
2167 "map."),
2170 GEN_BOOL_OPTION(draw_huts, N_("Draw the huts"),
2171 N_("Setting this option will draw the huts on the "
2172 "map."),
2175 GEN_BOOL_OPTION(draw_pollution, N_("Draw the pollution/nuclear fallout"),
2176 N_("Setting this option will draw pollution and "
2177 "nuclear fallout on the map."),
2180 GEN_BOOL_OPTION(draw_cities, N_("Draw the cities"),
2181 N_("Setting this option will draw the cities on the map."),
2184 GEN_BOOL_OPTION(draw_units, N_("Draw the units"),
2185 N_("Setting this option will draw the units on the map."),
2188 GEN_BOOL_OPTION(solid_color_behind_units,
2189 N_("Solid unit background color"),
2190 N_("Setting this option will cause units on the map "
2191 "view to be drawn with a solid background color "
2192 "instead of the flag backdrop."),
2195 GEN_BOOL_OPTION(draw_unit_shields, N_("Draw shield graphics for units"),
2196 N_("Setting this option will draw a shield icon "
2197 "as the flags on units. If unset, the full flag will "
2198 "be drawn."),
2200 GEN_BOOL_OPTION(draw_unit_stack_size, N_("Draw size of the unit stacks"),
2201 N_("Setting this option will draw a numbers indicating "
2202 "size of the unit stacks. Not all clients support "
2203 "this."),
2205 GEN_BOOL_OPTION(draw_focus_unit, N_("Draw the units in focus"),
2206 N_("Setting this option will cause the currently focused "
2207 "unit(s) to always be drawn, even if units are not "
2208 "otherwise being drawn (for instance if 'Draw the units' "
2209 "is unset)."),
2212 GEN_BOOL_OPTION(draw_fog_of_war, N_("Draw the fog of war"),
2213 N_("Setting this option will draw the fog of war."),
2216 GEN_BOOL_OPTION(draw_borders, N_("Draw the borders"),
2217 N_("Setting this option will draw the national borders."),
2220 GEN_BOOL_OPTION(draw_native, N_("Draw whether tiles are native to "
2221 "selected unit"),
2222 N_("Setting this option will highlight tiles that the "
2223 "currently selected unit cannot enter unaided due to "
2224 "non-native terrain. (If multiple units are selected, "
2225 "only tiles that all of them can enter are indicated.)"),
2228 GEN_BOOL_OPTION(player_dlg_show_dead_players,
2229 N_("Show dead players in Nations report"),
2230 N_("This option controls whether defeated nations are "
2231 "shown on the Nations report page."),
2234 GEN_BOOL_OPTION(sound_bell_at_new_turn, N_("Sound bell at new turn"),
2235 N_("Set this option to have a \"bell\" event be generated "
2236 "at the start of a new turn. You can control the "
2237 "behavior of the \"bell\" event by editing the message "
2238 "options."),
2240 GEN_INT_OPTION(smooth_move_unit_msec,
2241 N_("Unit movement animation time (milliseconds)"),
2242 N_("This option controls how long unit \"animation\" takes "
2243 "when a unit moves on the map view. Set it to 0 to "
2244 "disable animation entirely."),
2245 COC_GRAPHICS, GUI_STUB, 30, 0, 2000, NULL),
2246 GEN_INT_OPTION(smooth_center_slide_msec,
2247 N_("Mapview recentering time (milliseconds)"),
2248 N_("When the map view is recentered, it will slide "
2249 "smoothly over the map to its new position. This "
2250 "option controls how long this slide lasts. Set it to "
2251 "0 to disable mapview sliding entirely."),
2252 COC_GRAPHICS, GUI_STUB, 200, 0, 5000, NULL),
2253 GEN_INT_OPTION(smooth_combat_step_msec,
2254 N_("Combat animation step time (milliseconds)"),
2255 N_("This option controls the speed of combat animation "
2256 "between units on the mapview. Set it to 0 to disable "
2257 "animation entirely."),
2258 COC_GRAPHICS, GUI_STUB, 10, 0, 100, NULL),
2259 GEN_BOOL_OPTION(reqtree_show_icons,
2260 N_("Show icons in the technology tree"),
2261 N_("Setting this option will display icons "
2262 "on the technology tree diagram. Turning "
2263 "this option off makes the technology tree "
2264 "more compact."),
2266 GEN_BOOL_OPTION(reqtree_curved_lines,
2267 N_("Use curved lines in the technology tree"),
2268 N_("Setting this option make the technology tree "
2269 "diagram use curved lines to show technology "
2270 "relations. Turning this option off causes "
2271 "the lines to be drawn straight."),
2274 GEN_COLOR_OPTION(highlight_our_names,
2275 N_("Color to highlight your player/user name"),
2276 N_("If set, your player and user name in the new chat "
2277 "messages will be highlighted using this color as "
2278 "background. If not set, it will just not highlight "
2279 "anything."),
2280 COC_GRAPHICS, GUI_STUB, "#000000", "#FFFF00", NULL),
2281 GEN_BOOL_OPTION(ai_manual_turn_done, N_("Manual Turn Done in AI mode"),
2282 N_("Disable this option if you do not want to "
2283 "press the Turn Done button manually when watching "
2284 "an AI player."),
2286 GEN_BOOL_OPTION(auto_center_on_unit, N_("Auto center on units"),
2287 N_("Set this option to have the active unit centered "
2288 "automatically when the unit focus changes."),
2290 GEN_BOOL_OPTION(auto_center_on_automated, N_("Show automated units"),
2291 N_("Disable this option if you do not want to see "
2292 "automated units autocentered and animated."),
2294 GEN_BOOL_OPTION(auto_center_on_combat, N_("Auto center on combat"),
2295 N_("Set this option to have any combat be centered "
2296 "automatically. Disabling this will speed up the time "
2297 "between turns but may cause you to miss combat "
2298 "entirely."),
2300 GEN_BOOL_OPTION(auto_center_each_turn, N_("Auto center on new turn"),
2301 N_("Set this option to have the client automatically "
2302 "recenter the map on a suitable location at the "
2303 "start of each turn."),
2305 GEN_BOOL_OPTION(wakeup_focus, N_("Focus on awakened units"),
2306 N_("Set this option to have newly awoken units be "
2307 "focused automatically."),
2309 GEN_BOOL_OPTION(keyboardless_goto, N_("Keyboardless goto"),
2310 N_("If this option is set then a goto may be initiated "
2311 "by left-clicking and then holding down the mouse "
2312 "button while dragging the mouse onto a different "
2313 "tile."),
2315 GEN_BOOL_OPTION(goto_into_unknown, N_("Allow goto into the unknown"),
2316 N_("Setting this option will make the game consider "
2317 "moving into unknown tiles. If not, then goto routes "
2318 "will detour around or be blocked by unknown tiles."),
2320 GEN_BOOL_OPTION(center_when_popup_city, N_("Center map when popup city"),
2321 N_("Setting this option makes the mapview center on a "
2322 "city when its city dialog is popped up."),
2324 GEN_BOOL_OPTION(show_previous_turn_messages, N_("Show messages from previous turn"),
2325 N_("Message Window shows messages also from previous turn. "
2326 "This makes sure you don't miss messages received in the end of "
2327 "the turn, just before the window gets cleared."),
2329 GEN_BOOL_OPTION(concise_city_production, N_("Concise city production"),
2330 N_("Set this option to make the city production (as shown "
2331 "in the city dialog) to be more compact."),
2333 GEN_BOOL_OPTION(auto_turn_done, N_("End turn when done moving"),
2334 N_("Setting this option makes your turn end automatically "
2335 "when all your units are done moving."),
2337 GEN_BOOL_OPTION(ask_city_name, N_("Prompt for city names"),
2338 N_("Disabling this option will make the names of newly "
2339 "founded cities be chosen automatically by the server."),
2341 GEN_BOOL_OPTION(popup_new_cities, N_("Pop up city dialog for new cities"),
2342 N_("Setting this option will pop up a newly-founded "
2343 "city's city dialog automatically."),
2345 GEN_BOOL_OPTION(popup_actor_arrival, N_("Pop up caravan and spy actions"),
2346 N_("If this option is enabled, when a unit arrives at "
2347 "a city where it can perform an action like "
2348 "establishing a trade route, helping build a wonder, or "
2349 "establishing an embassy, a window will pop up asking "
2350 "which action should be performed. "
2351 "Disabling this option means you will have to do the "
2352 "action manually by pressing either 'r' (for a trade "
2353 "route), 'b' (for building a wonder) or 'd' (for a "
2354 "spy action) when the unit is in the city."),
2356 GEN_BOOL_OPTION(popup_attack_actions, N_("Pop up attack questions"),
2357 N_("If this option is enabled, when a unit arrives at a "
2358 "target it can attack, a window will pop up asking "
2359 "which action should be performed even if an attack "
2360 "action is legal and no other interesting action are. "
2361 "This allows you to change your mind or to select an "
2362 "uninteresting action."),
2364 GEN_BOOL_OPTION(popup_last_move_to_allied,
2365 /* TODO: Rename option ..._last_... to match _final_ in
2366 * the descriptions.
2367 * Changes options file format, needs migration
2368 * when loading old version. */
2369 N_("Pop up actions when final move to allied tile"),
2370 N_("If this option is enabled the final move in a unit's"
2371 " orders to a tile with allied units or cities it can"
2372 " perform an action to is interpreted as an attempted"
2373 " action. This makes the action selection dialog pop up"
2374 " while the unit is at the adjacent tile."
2375 " This can, in cases where the action requires that"
2376 " the actor unit has moves left, save a turn."
2377 " The down side is that the unit remains adjacent to"
2378 " rather than inside the protection of an allied city"
2379 " or unit stack."),
2381 GEN_BOOL_OPTION(enable_cursor_changes, N_("Enable cursor changing"),
2382 N_("This option controls whether the client should "
2383 "try to change the mouse cursor depending on what "
2384 "is being pointed at, as well as to indicate "
2385 "changes in the client or server state."),
2387 GEN_BOOL_OPTION(separate_unit_selection, N_("Select cities before units"),
2388 N_("If this option is enabled, when both cities and "
2389 "units are present in the selection rectangle, only "
2390 "cities will be selected. See the help on Controls."),
2392 GEN_BOOL_OPTION(unit_selection_clears_orders,
2393 N_("Clear unit orders on selection"),
2394 N_("Enabling this option will cause unit orders to be "
2395 "cleared as soon as one or more units are selected. If "
2396 "this option is disabled, busy units will not stop "
2397 "their current activity when selected. Giving them "
2398 "new orders will clear their current ones; pressing "
2399 "<space> once will clear their orders and leave them "
2400 "selected, and pressing <space> a second time will "
2401 "dismiss them."),
2403 GEN_BOOL_OPTION(voteinfo_bar_use, N_("Enable vote bar"),
2404 N_("If this option is turned on, the vote bar will be "
2405 "displayed to show vote information."),
2407 GEN_BOOL_OPTION(voteinfo_bar_always_show,
2408 N_("Always display the vote bar"),
2409 N_("If this option is turned on, the vote bar will never "
2410 "be hidden, even if there is no running vote."),
2412 GEN_BOOL_OPTION(voteinfo_bar_hide_when_not_player,
2413 N_("Do not show vote bar if not a player"),
2414 N_("If this option is enabled, the client won't show the "
2415 "vote bar if you are not a player."),
2417 GEN_BOOL_OPTION(voteinfo_bar_new_at_front, N_("Set new votes at front"),
2418 N_("If this option is enabled, then new votes will go "
2419 "to the front of the vote list."),
2421 GEN_BOOL_OPTION(autoaccept_tileset_suggestion,
2422 N_("Autoaccept tileset suggestions"),
2423 N_("If this option is enabled, any tileset suggested by "
2424 "the ruleset is automatically used; otherwise you "
2425 "are prompted to change tileset."),
2427
2428 GEN_BOOL_OPTION(sound_enable_effects,
2429 N_("Enable sound effects"),
2430 N_("Play sound effects, assuming there's suitable "
2431 "sound plugin and soundset with the sounds."),
2433 GEN_BOOL_OPTION(sound_enable_game_music,
2434 N_("Enable in-game music"),
2435 N_("Play music during the game, assuming there's suitable "
2436 "sound plugin and musicset with in-game tracks."),
2438 GEN_BOOL_OPTION(sound_enable_menu_music,
2439 N_("Enable menu music"),
2440 N_("Play music while not in actual game, "
2441 "assuming there's suitable "
2442 "sound plugin and musicset with menu music tracks."),
2444 GEN_BOOL_OPTION(silent_when_not_in_focus,
2445 N_("Silent when not in focus"),
2446 N_("Fade all sound out when the client is not in focus. "
2447 "Not all clients support this."),
2449 GEN_INT_OPTION(sound_effects_volume,
2450 N_("Sound volume"),
2451 N_("Volume scale from 0-100"),
2452 COC_SOUND, GUI_STUB, 100,
2453 0, 100,
2455
2456 GEN_BOOL_OPTION(autoaccept_soundset_suggestion,
2457 N_("Autoaccept soundset suggestions"),
2458 N_("If this option is enabled, any soundset suggested by "
2459 "the ruleset is automatically used."),
2461 GEN_BOOL_OPTION(autoaccept_musicset_suggestion,
2462 N_("Autoaccept musicset suggestions"),
2463 N_("If this option is enabled, any musicset suggested by "
2464 "the ruleset is automatically used."),
2466
2468 N_("Background layer"),
2469 N_("The background layer of the overview shows just "
2470 "ocean and land."),
2473 N_("Terrain relief map layer"),
2474 N_("The relief layer shows all terrains on the map."),
2477 N_("Borders layer"),
2478 N_("The borders layer of the overview shows which tiles "
2479 "are owned by each player."),
2482 N_("Borders layer on ocean tiles"),
2483 N_("The borders layer of the overview are drawn on "
2484 "ocean tiles as well (this may look ugly with many "
2485 "islands). This option is only of interest if you "
2486 "have set the option \"Borders layer\" already."),
2489 N_("Units layer"),
2490 N_("Enabling this will draw units on the overview."),
2493 N_("Cities layer"),
2494 N_("Enabling this will draw cities on the overview."),
2497 N_("Overview fog of war"),
2498 N_("Enabling this will show fog of war on the "
2499 "overview."),
2501
2502 /* options for map images */
2503 GEN_STR_LIST_OPTION(mapimg_format,
2504 N_("Image format"),
2505 N_("The image toolkit and file format used for "
2506 "map images."),
2508 NULL, 0),
2509 GEN_INT_OPTION(mapimg_zoom,
2510 N_("Zoom factor for map images"),
2511 N_("The magnification used for map images."),
2513 GEN_BOOL_OPTION(mapimg_layer[MAPIMG_LAYER_AREA],
2514 N_("Show area within borders"),
2515 N_("If set, the territory of each nation is shown "
2516 "on the saved image."),
2519 N_("Show borders"),
2520 N_("If set, the border of each nation is shown on the "
2521 "saved image."),
2524 N_("Show cities"),
2525 N_("If set, cities are shown on the saved image."),
2528 N_("Show fog of war"),
2529 N_("If set, the extent of fog of war is shown on the "
2530 "saved image."),
2533 N_("Show full terrain"),
2534 N_("If set, terrain relief is shown with different colors "
2535 "in the saved image; otherwise, only land and water are "
2536 "distinguished."),
2538 GEN_BOOL_OPTION(mapimg_layer[MAPIMG_LAYER_UNITS],
2539 N_("Show units"),
2540 N_("If set, units are shown in the saved image."),
2542 GEN_STR_OPTION(mapimg_filename,
2543 N_("Map image file name"),
2544 N_("The base part of the filename for saved map images. "
2545 "A string identifying the game turn and map options will "
2546 "be appended."),
2548
2549 /* gui-gtk-2.0 client specific options.
2550 * These are still kept just so users can migrate them to later gtk-clients */
2551 GEN_BOOL_OPTION(gui_gtk2_map_scrollbars, NULL, NULL,
2553 GEN_BOOL_OPTION(gui_gtk2_dialogs_on_top, NULL, NULL,
2555 GEN_BOOL_OPTION(gui_gtk2_show_task_icons, NULL, NULL,
2557 GEN_BOOL_OPTION(gui_gtk2_enable_tabs, NULL, NULL,
2559 GEN_BOOL_OPTION(gui_gtk2_better_fog, NULL, NULL,
2562 GEN_BOOL_OPTION(gui_gtk2_show_chat_message_time, NULL, NULL,
2564 GEN_BOOL_OPTION(gui_gtk2_new_messages_go_to_top, NULL, NULL,
2566 GEN_BOOL_OPTION(gui_gtk2_show_message_window_buttons, NULL, NULL,
2568 GEN_BOOL_OPTION(gui_gtk2_metaserver_tab_first, NULL, NULL,
2570 GEN_BOOL_OPTION(gui_gtk2_allied_chat_only, NULL, NULL,
2572 GEN_BOOL_OPTION(gui_gtk2_mouse_over_map_focus, NULL, NULL,
2574 GEN_BOOL_OPTION(gui_gtk2_chatline_autocompletion, NULL, NULL,
2576 GEN_INT_OPTION(gui_gtk2_citydlg_xsize, NULL, NULL,
2579 NULL),
2580 GEN_INT_OPTION(gui_gtk2_citydlg_ysize, NULL, NULL,
2583 NULL),
2584 GEN_ENUM_OPTION(gui_gtk2_popup_tech_help, NULL, NULL,
2588 GEN_FONT_OPTION(gui_gtk2_font_city_label, "city_label",
2589 NULL, NULL,
2591 "Monospace 8", font_changed_callback),
2592 GEN_FONT_OPTION(gui_gtk2_font_notify_label, "notify_label",
2593 NULL, NULL,
2595 "Monospace Bold 9", font_changed_callback),
2596 GEN_FONT_OPTION(gui_gtk2_font_spaceship_label, "spaceship_label",
2597 NULL, NULL,
2599 "Monospace 8", font_changed_callback),
2600 GEN_FONT_OPTION(gui_gtk2_font_help_label, "help_label",
2601 NULL, NULL,
2603 "Sans Bold 10", font_changed_callback),
2604 GEN_FONT_OPTION(gui_gtk2_font_help_link, "help_link",
2605 NULL, NULL,
2607 "Sans 9", font_changed_callback),
2608 GEN_FONT_OPTION(gui_gtk2_font_help_text, "help_text",
2609 NULL, NULL,
2611 "Monospace 8", font_changed_callback),
2612 GEN_FONT_OPTION(gui_gtk2_font_chatline, "chatline",
2613 NULL, NULL,
2615 "Monospace 8", font_changed_callback),
2616 GEN_FONT_OPTION(gui_gtk2_font_beta_label, "beta_label",
2617 NULL, NULL,
2619 "Sans Italic 10", font_changed_callback),
2620 GEN_FONT_OPTION(gui_gtk2_font_small, "small_font",
2621 NULL, NULL,
2623 "Sans 9", NULL),
2624 GEN_FONT_OPTION(gui_gtk2_font_comment_label, "comment_label",
2625 NULL, NULL,
2627 "Sans Italic 9", font_changed_callback),
2628 GEN_FONT_OPTION(gui_gtk2_font_city_names, "city_names",
2629 NULL, NULL,
2631 "Sans Bold 10", NULL),
2632 GEN_FONT_OPTION(gui_gtk2_font_city_productions, "city_productions",
2633 NULL, NULL,
2635 "Serif 10", NULL),
2636 GEN_FONT_OPTION(gui_gtk2_font_reqtree_text, "reqtree_text",
2637 NULL, NULL,
2639 "Serif 10", NULL),
2640
2641 /* gui-gtk-3.0 client specific options.
2642 * These are still kept just so users can migrate them to later gtk-clients */
2643 GEN_BOOL_OPTION(gui_gtk3_fullscreen, NULL, NULL,
2645 GEN_BOOL_OPTION(gui_gtk3_map_scrollbars, N_("Show map scrollbars"),
2646 N_("Disable this option to hide the scrollbars on the "
2647 "map view."),
2649 GEN_BOOL_OPTION(gui_gtk3_dialogs_on_top, NULL, NULL,
2651 GEN_BOOL_OPTION(gui_gtk3_show_task_icons, NULL, NULL,
2653 GEN_BOOL_OPTION(gui_gtk3_enable_tabs, NULL, NULL,
2655 GEN_BOOL_OPTION(gui_gtk3_show_chat_message_time, NULL, NULL,
2657 GEN_BOOL_OPTION(gui_gtk3_new_messages_go_to_top, NULL, NULL,
2659 GEN_BOOL_OPTION(gui_gtk3_show_message_window_buttons, NULL, NULL,
2661 GEN_BOOL_OPTION(gui_gtk3_metaserver_tab_first, NULL, NULL,
2663 GEN_BOOL_OPTION(gui_gtk3_allied_chat_only, NULL, NULL,
2665 GEN_ENUM_OPTION(gui_gtk3_message_chat_location, NULL, NULL,
2669 GEN_BOOL_OPTION(gui_gtk3_small_display_layout, NULL, NULL,
2671 GEN_BOOL_OPTION(gui_gtk3_mouse_over_map_focus, NULL, NULL,
2673 GEN_BOOL_OPTION(gui_gtk3_chatline_autocompletion, NULL, NULL,
2675 GEN_INT_OPTION(gui_gtk3_citydlg_xsize, NULL, NULL,
2678 NULL),
2679 GEN_INT_OPTION(gui_gtk3_citydlg_ysize, NULL, NULL,
2682 NULL),
2683 GEN_ENUM_OPTION(gui_gtk3_popup_tech_help, NULL, NULL,
2687 GEN_INT_OPTION(gui_gtk3_governor_range_min, NULL, NULL,
2690 NULL),
2691 GEN_INT_OPTION(gui_gtk3_governor_range_max, NULL, NULL,
2694 NULL),
2695 GEN_FONT_OPTION(gui_gtk3_font_city_label, "city_label",
2696 NULL, NULL,
2698 "Monospace 8", font_changed_callback),
2699 GEN_FONT_OPTION(gui_gtk3_font_notify_label, "notify_label",
2700 NULL, NULL,
2702 "Monospace Bold 9", font_changed_callback),
2703 GEN_FONT_OPTION(gui_gtk3_font_spaceship_label, "spaceship_label",
2704 NULL, NULL,
2706 "Monospace 8", font_changed_callback),
2707 GEN_FONT_OPTION(gui_gtk3_font_help_label, "help_label",
2708 NULL, NULL,
2710 "Sans Bold 10", font_changed_callback),
2711 GEN_FONT_OPTION(gui_gtk3_font_help_link, "help_link",
2712 NULL, NULL,
2714 "Sans 9", font_changed_callback),
2715 GEN_FONT_OPTION(gui_gtk3_font_help_text, "help_text",
2716 NULL, NULL,
2718 "Monospace 8", font_changed_callback),
2719 GEN_FONT_OPTION(gui_gtk3_font_chatline, "chatline",
2720 NULL, NULL,
2722 "Monospace 8", font_changed_callback),
2723 GEN_FONT_OPTION(gui_gtk3_font_beta_label, "beta_label",
2724 NULL, NULL,
2726 "Sans Italic 10", font_changed_callback),
2727 GEN_FONT_OPTION(gui_gtk3_font_small, "small_font",
2728 NULL, NULL,
2730 "Sans 9", NULL),
2731 GEN_FONT_OPTION(gui_gtk3_font_comment_label, "comment_label",
2732 NULL, NULL,
2734 "Sans Italic 9", font_changed_callback),
2735 GEN_FONT_OPTION(gui_gtk3_font_city_names, "city_names",
2736 NULL, NULL,
2738 "Sans Bold 10", NULL),
2739 GEN_FONT_OPTION(gui_gtk3_font_city_productions, "city_productions",
2740 NULL, NULL,
2742 "Serif 10", NULL),
2743 GEN_FONT_OPTION(gui_gtk3_font_reqtree_text, "reqtree_text",
2744 NULL, NULL,
2746 "Serif 10", NULL),
2747
2748 /* gui-gtk-3.22 client specific options. */
2749 GEN_BOOL_OPTION(gui_gtk3_22_fullscreen, N_("Fullscreen"),
2750 N_("If this option is set the client will use the "
2751 "whole screen area for drawing."),
2753 GEN_BOOL_OPTION(gui_gtk3_22_map_scrollbars, N_("Show map scrollbars"),
2754 N_("Disable this option to hide the scrollbars on the "
2755 "map view."),
2757 GEN_BOOL_OPTION(gui_gtk3_22_dialogs_on_top, N_("Keep dialogs on top"),
2758 N_("If this option is set then dialog windows will always "
2759 "remain in front of the main Freeciv window. "
2760 "Disabling this has no effect in fullscreen mode."),
2762 GEN_BOOL_OPTION(gui_gtk3_22_show_task_icons, N_("Show worklist task icons"),
2763 N_("Disabling this will turn off the unit and building "
2764 "icons in the worklist dialog and the production "
2765 "tab of the city dialog."),
2767 GEN_BOOL_OPTION(gui_gtk3_22_enable_tabs, N_("Enable status report tabs"),
2768 N_("If this option is enabled then report dialogs will "
2769 "be shown as separate tabs rather than in popup "
2770 "dialogs."),
2772 GEN_BOOL_OPTION(gui_gtk3_22_show_chat_message_time,
2773 N_("Show time for each chat message"),
2774 N_("If this option is enabled then all chat messages "
2775 "will be prefixed by a time string of the form "
2776 "[hour:minute:second]."),
2778 GEN_BOOL_OPTION(gui_gtk3_22_new_messages_go_to_top,
2779 N_("New message events go to top of list"),
2780 N_("If this option is enabled, new events in the "
2781 "message window will appear at the top of the list, "
2782 "rather than being appended at the bottom."),
2784 GEN_BOOL_OPTION(gui_gtk3_22_show_message_window_buttons,
2785 N_("Show extra message window buttons"),
2786 N_("If this option is enabled, there will be two "
2787 "buttons displayed in the message window for "
2788 "inspecting a city and going to a location. If this "
2789 "option is disabled, these buttons will not appear "
2790 "(you can still double-click with the left mouse "
2791 "button or right-click on a row to inspect or goto "
2792 "respectively). This option will only take effect "
2793 "once the message window is closed and reopened."),
2795 GEN_BOOL_OPTION(gui_gtk3_22_metaserver_tab_first,
2796 N_("Metaserver tab first in network page"),
2797 N_("If this option is enabled, the metaserver tab will "
2798 "be the first notebook tab in the network page. This "
2799 "option requires a restart in order to take effect."),
2801 GEN_BOOL_OPTION(gui_gtk3_22_allied_chat_only,
2802 N_("Plain chat messages are sent to allies only"),
2803 N_("If this option is enabled, then plain messages "
2804 "typed into the chat entry while the game is "
2805 "running will only be sent to your allies. "
2806 "Otherwise plain messages will be sent as "
2807 "public chat messages. To send a public chat "
2808 "message with this option enabled, prefix the "
2809 "message with a single colon ':'. This option "
2810 "can also be set using a toggle button beside "
2811 "the chat entry (only visible in multiplayer "
2812 "games)."),
2814 GEN_ENUM_OPTION(gui_gtk3_22_message_chat_location,
2815 N_("Messages and Chat reports location"),
2816 /* TRANS: The strings used in the UI for 'Split' etc are
2817 * tagged 'gui_gtk3_22/gtk4/gtk4_message_chat_location' */
2818 N_("Controls where the Messages and Chat reports "
2819 "appear relative to the main view containing the map.\n"
2820 "'Split' allows all three to be seen simultaneously, "
2821 "which is best for multiplayer, but requires a large "
2822 "window to be usable.\n"
2823 "'Separate' puts Messages and Chat in a notebook "
2824 "separate from the main view, so that one of them "
2825 "can always be seen alongside the main view.\n"
2826 "'Merged' makes the Messages and Chat reports into "
2827 "tabs alongside the map and other reports; this "
2828 "allows a larger map view on small screens.\n"
2829 "This option requires a restart in order to take "
2830 "effect."), COC_INTERFACE, GUI_GTK3_22,
2833 GEN_BOOL_OPTION(gui_gtk3_22_small_display_layout,
2834 N_("Arrange widgets for small displays"),
2835 N_("If this option is enabled, widgets in the main "
2836 "window will be arranged so that they take up the "
2837 "least amount of total screen space. Specifically, "
2838 "the left panel containing the overview, player "
2839 "status, and the unit information box will be "
2840 "extended over the entire left side of the window. "
2841 "This option requires a restart in order to take "
2842 "effect."), COC_INTERFACE, GUI_GTK3_22, FALSE, NULL),
2843 GEN_BOOL_OPTION(gui_gtk3_22_mouse_over_map_focus,
2844 N_("Mouse over the map widget selects it automatically"),
2845 N_("If this option is enabled, then the map will be "
2846 "focused when the mouse hovers over it."),
2848 GEN_BOOL_OPTION(gui_gtk3_22_chatline_autocompletion,
2849 N_("Player or user name autocompletion"),
2850 N_("If this option is turned on, the tabulation key "
2851 "will be used in the chatline to complete the word you "
2852 "are typing with the name of a player or a user."),
2854 GEN_INT_OPTION(gui_gtk3_22_citydlg_xsize,
2855 N_("Width of the city dialog"),
2856 N_("This value is only used if the width of the city "
2857 "dialog is saved."),
2860 NULL),
2861 GEN_INT_OPTION(gui_gtk3_22_citydlg_ysize,
2862 N_("Height of the city dialog"),
2863 N_("This value is only used if the height of the city "
2864 "dialog is saved."),
2867 NULL),
2868 GEN_INT_OPTION(gui_gtk3_22_helpdlg_xsize,
2869 N_("Width of the help dialog"),
2870 NULL,
2873 NULL),
2874 GEN_INT_OPTION(gui_gtk3_22_helpdlg_ysize,
2875 N_("Height of the help dialog"),
2876 NULL,
2879 NULL),
2880 GEN_INT_OPTION(gui_gtk3_22_optionsdlg_xsize,
2881 N_("Width of the options dialog"),
2882 NULL,
2885 NULL),
2886 GEN_INT_OPTION(gui_gtk3_22_optionsdlg_ysize,
2887 N_("Height of the options dialog"),
2888 NULL,
2891 NULL),
2892 GEN_ENUM_OPTION(gui_gtk3_22_popup_tech_help,
2893 N_("Popup tech help when gained"),
2894 N_("Controls if tech help should be opened when "
2895 "new tech has been gained.\n"
2896 "'Ruleset' means that behavior suggested by "
2897 "current ruleset is used."), COC_INTERFACE, GUI_GTK3_22,
2900 GEN_INT_OPTION(gui_gtk3_22_governor_range_min,
2901 N_("Minimum surplus for a governor"),
2902 N_("The lower limit of the range for requesting surpluses "
2903 "from the governor."),
2906 NULL),
2907 GEN_INT_OPTION(gui_gtk3_22_governor_range_max,
2908 N_("Maximum surplus for a governor"),
2909 N_("The higher limit of the range for requesting surpluses "
2910 "from the governor."),
2913 NULL),
2914 GEN_FONT_OPTION(gui_gtk3_22_font_city_label, "city_label",
2915 N_("City Label"),
2916 N_("This font is used to display the city labels on city "
2917 "dialogs."),
2919 "Monospace 8", font_changed_callback),
2920 GEN_FONT_OPTION(gui_gtk3_22_font_notify_label, "notify_label",
2921 N_("Notify Label"),
2922 N_("This font is used to display server reports such "
2923 "as the demographic report or historian publications."),
2925 "Monospace Bold 9", font_changed_callback),
2926 GEN_FONT_OPTION(gui_gtk3_22_font_spaceship_label, "spaceship_label",
2927 N_("Spaceship Label"),
2928 N_("This font is used to display the spaceship widgets."),
2930 "Monospace 8", font_changed_callback),
2931 GEN_FONT_OPTION(gui_gtk3_22_font_help_label, "help_label",
2932 N_("Help Label"),
2933 N_("This font is used to display the help headers in the "
2934 "help window."),
2936 "Sans Bold 10", font_changed_callback),
2937 GEN_FONT_OPTION(gui_gtk3_22_font_help_link, "help_link",
2938 N_("Help Link"),
2939 N_("This font is used to display the help links in the "
2940 "help window."),
2942 "Sans 9", font_changed_callback),
2943 GEN_FONT_OPTION(gui_gtk3_22_font_help_text, "help_text",
2944 N_("Help Text"),
2945 N_("This font is used to display the help body text in "
2946 "the help window."),
2948 "Monospace 8", font_changed_callback),
2949 GEN_FONT_OPTION(gui_gtk3_22_font_chatline, "chatline",
2950 N_("Chatline Area"),
2951 N_("This font is used to display the text in the "
2952 "chatline area."),
2954 "Monospace 8", font_changed_callback),
2955 GEN_FONT_OPTION(gui_gtk3_22_font_beta_label, "beta_label",
2956 N_("Beta Label"),
2957 N_("This font is used to display the beta label."),
2959 "Sans Italic 10", font_changed_callback),
2960 GEN_FONT_OPTION(gui_gtk3_22_font_small, "small_font",
2961 N_("Small Font"),
2962 N_("This font is used for any small font request. For "
2963 "example, it is used for display the building lists "
2964 "in the city dialog, the Economy report or the Units "
2965 "report."),
2967 "Sans 9", font_changed_callback),
2968 GEN_FONT_OPTION(gui_gtk3_22_font_comment_label, "comment_label",
2969 N_("Comment Label"),
2970 N_("This font is used to display comment labels, such as "
2971 "in the governor page of the city dialogs."),
2973 "Sans Italic 9", font_changed_callback),
2974 GEN_FONT_OPTION(gui_gtk3_22_font_city_names, "city_names",
2975 N_("City Names"),
2976 N_("This font is used to the display the city names "
2977 "on the map."),
2979 "Sans Bold 10", NULL),
2980 GEN_FONT_OPTION(gui_gtk3_22_font_city_productions, "city_productions",
2981 N_("City Productions"),
2982 N_("This font is used to display the city production "
2983 "on the map."),
2985 "Serif 10", NULL),
2986 GEN_FONT_OPTION(gui_gtk3_22_font_reqtree_text, "reqtree_text",
2987 N_("Requirement Tree"),
2988 N_("This font is used to the display the requirement tree "
2989 "in the Research report."),
2991 "Serif 10", NULL),
2992
2993 /* gui-gtk-4.0 client specific options. */
2994 GEN_BOOL_OPTION(gui_gtk4_fullscreen, N_("Fullscreen"),
2995 N_("If this option is set the client will use the "
2996 "whole screen area for drawing."),
2998 GEN_BOOL_OPTION(gui_gtk4_map_scrollbars, N_("Show map scrollbars"),
2999 N_("Disable this option to hide the scrollbars on the "
3000 "map view."),
3002 GEN_BOOL_OPTION(gui_gtk4_dialogs_on_top, N_("Keep dialogs on top"),
3003 N_("If this option is set then dialog windows will always "
3004 "remain in front of the main Freeciv window. "
3005 "Disabling this has no effect in fullscreen mode."),
3007 GEN_BOOL_OPTION(gui_gtk4_show_task_icons, N_("Show worklist task icons"),
3008 N_("Disabling this will turn off the unit and building "
3009 "icons in the worklist dialog and the production "
3010 "tab of the city dialog."),
3012 GEN_BOOL_OPTION(gui_gtk4_enable_tabs, N_("Enable status report tabs"),
3013 N_("If this option is enabled then report dialogs will "
3014 "be shown as separate tabs rather than in popup "
3015 "dialogs."),
3017 GEN_BOOL_OPTION(gui_gtk4_show_chat_message_time,
3018 N_("Show time for each chat message"),
3019 N_("If this option is enabled then all chat messages "
3020 "will be prefixed by a time string of the form "
3021 "[hour:minute:second]."),
3023 GEN_BOOL_OPTION(gui_gtk4_new_messages_go_to_top,
3024 N_("New message events go to top of list"),
3025 N_("If this option is enabled, new events in the "
3026 "message window will appear at the top of the list, "
3027 "rather than being appended at the bottom."),
3029 GEN_BOOL_OPTION(gui_gtk4_show_message_window_buttons,
3030 N_("Show extra message window buttons"),
3031 N_("If this option is enabled, there will be two "
3032 "buttons displayed in the message window for "
3033 "inspecting a city and going to a location. If this "
3034 "option is disabled, these buttons will not appear "
3035 "(you can still double-click with the left mouse "
3036 "button or right-click on a row to inspect or goto "
3037 "respectively). This option will only take effect "
3038 "once the message window is closed and reopened."),
3040 GEN_BOOL_OPTION(gui_gtk4_metaserver_tab_first,
3041 N_("Metaserver tab first in network page"),
3042 N_("If this option is enabled, the metaserver tab will "
3043 "be the first notebook tab in the network page. This "
3044 "option requires a restart in order to take effect."),
3046 GEN_BOOL_OPTION(gui_gtk4_allied_chat_only,
3047 N_("Plain chat messages are sent to allies only"),
3048 N_("If this option is enabled, then plain messages "
3049 "typed into the chat entry while the game is "
3050 "running will only be sent to your allies. "
3051 "Otherwise plain messages will be sent as "
3052 "public chat messages. To send a public chat "
3053 "message with this option enabled, prefix the "
3054 "message with a single colon ':'. This option "
3055 "can also be set using a toggle button beside "
3056 "the chat entry (only visible in multiplayer "
3057 "games)."),
3059 GEN_ENUM_OPTION(gui_gtk4_message_chat_location,
3060 N_("Messages and Chat reports location"),
3061 /* TRANS: The strings used in the UI for 'Split' etc are
3062 * tagged 'gui_gtk3_22/gtk4/gtk5_message_chat_location' */
3063 N_("Controls where the Messages and Chat reports "
3064 "appear relative to the main view containing the map.\n"
3065 "'Split' allows all three to be seen simultaneously, "
3066 "which is best for multiplayer, but requires a large "
3067 "window to be usable.\n"
3068 "'Separate' puts Messages and Chat in a notebook "
3069 "separate from the main view, so that one of them "
3070 "can always be seen alongside the main view.\n"
3071 "'Merged' makes the Messages and Chat reports into "
3072 "tabs alongside the map and other reports; this "
3073 "allows a larger map view on small screens.\n"
3074 "This option requires a restart in order to take "
3075 "effect."), COC_INTERFACE, GUI_GTK4,
3078 GEN_BOOL_OPTION(gui_gtk4_small_display_layout,
3079 N_("Arrange widgets for small displays"),
3080 N_("If this option is enabled, widgets in the main "
3081 "window will be arranged so that they take up the "
3082 "least amount of total screen space. Specifically, "
3083 "the left panel containing the overview, player "
3084 "status, and the unit information box will be "
3085 "extended over the entire left side of the window. "
3086 "This option requires a restart in order to take "
3087 "effect."), COC_INTERFACE, GUI_GTK4, FALSE, NULL),
3088 GEN_BOOL_OPTION(gui_gtk4_mouse_over_map_focus,
3089 N_("Mouse over the map widget selects it automatically"),
3090 N_("If this option is enabled, then the map will be "
3091 "focused when the mouse hovers over it."),
3093 GEN_BOOL_OPTION(gui_gtk4_chatline_autocompletion,
3094 N_("Player or user name autocompletion"),
3095 N_("If this option is turned on, the tabulation key "
3096 "will be used in the chatline to complete the word you "
3097 "are typing with the name of a player or a user."),
3099 GEN_INT_OPTION(gui_gtk4_citydlg_xsize,
3100 N_("Width of the city dialog"),
3101 N_("This value is only used if the width of the city "
3102 "dialog is saved."),
3105 NULL),
3106 GEN_INT_OPTION(gui_gtk4_citydlg_ysize,
3107 N_("Height of the city dialog"),
3108 N_("This value is only used if the height of the city "
3109 "dialog is saved."),
3112 NULL),
3113 GEN_INT_OPTION(gui_gtk4_helpdlg_xsize,
3114 N_("Width of the help dialog"),
3115 N_("This value is only used if the width of the help "
3116 "dialog is saved."),
3119 NULL),
3120 GEN_INT_OPTION(gui_gtk4_helpdlg_ysize,
3121 N_("Height of the help dialog"),
3122 N_("This value is only used if the height of the help "
3123 "dialog is saved."),
3126 NULL),
3127 GEN_INT_OPTION(gui_gtk4_optionsdlg_xsize,
3128 N_("Width of the options dialog"),
3129 NULL,
3132 NULL),
3133 GEN_INT_OPTION(gui_gtk4_optionsdlg_ysize,
3134 N_("Height of the options dialog"),
3135 NULL,
3138 NULL),
3139 GEN_ENUM_OPTION(gui_gtk4_popup_tech_help,
3140 N_("Popup tech help when gained"),
3141 N_("Controls if tech help should be opened when "
3142 "new tech has been gained.\n"
3143 "'Ruleset' means that behavior suggested by "
3144 "current ruleset is used."), COC_INTERFACE, GUI_GTK4,
3147 GEN_INT_OPTION(gui_gtk4_governor_range_min,
3148 N_("Minimum surplus for a governor"),
3149 N_("The lower limit of the range for requesting surpluses "
3150 "from the governor."),
3153 NULL),
3154 GEN_INT_OPTION(gui_gtk4_governor_range_max,
3155 N_("Maximum surplus for a governor"),
3156 N_("The higher limit of the range for requesting surpluses "
3157 "from the governor."),
3160 NULL),
3161 GEN_FONT_OPTION(gui_gtk4_font_city_label, "city_label",
3162 N_("City Label"),
3163 N_("This font is used to display the city labels on city "
3164 "dialogs."),
3166 "Monospace 8", font_changed_callback),
3167 GEN_FONT_OPTION(gui_gtk4_font_notify_label, "notify_label",
3168 N_("Notify Label"),
3169 N_("This font is used to display server reports such "
3170 "as the demographic report or historian publications."),
3172 "Monospace Bold 9", font_changed_callback),
3173 GEN_FONT_OPTION(gui_gtk4_font_spaceship_label, "spaceship_label",
3174 N_("Spaceship Label"),
3175 N_("This font is used to display the spaceship widgets."),
3177 "Monospace 8", font_changed_callback),
3178 GEN_FONT_OPTION(gui_gtk4_font_help_label, "help_label",
3179 N_("Help Label"),
3180 N_("This font is used to display the help headers in the "
3181 "help window."),
3183 "Sans Bold 10", font_changed_callback),
3184 GEN_FONT_OPTION(gui_gtk4_font_help_link, "help_link",
3185 N_("Help Link"),
3186 N_("This font is used to display the help links in the "
3187 "help window."),
3189 "Sans 9", font_changed_callback),
3190 GEN_FONT_OPTION(gui_gtk4_font_help_text, "help_text",
3191 N_("Help Text"),
3192 N_("This font is used to display the help body text in "
3193 "the help window."),
3195 "Monospace 8", font_changed_callback),
3196 GEN_FONT_OPTION(gui_gtk4_font_chatline, "chatline",
3197 N_("Chatline Area"),
3198 N_("This font is used to display the text in the "
3199 "chatline area."),
3201 "Monospace 8", font_changed_callback),
3202 GEN_FONT_OPTION(gui_gtk4_font_beta_label, "beta_label",
3203 N_("Beta Label"),
3204 N_("This font is used to display the beta label."),
3206 "Sans Italic 10", font_changed_callback),
3207 GEN_FONT_OPTION(gui_gtk4_font_small, "small_font",
3208 N_("Small Font"),
3209 N_("This font is used for any small font request. For "
3210 "example, it is used for display the building lists "
3211 "in the city dialog, the Economy report or the Units "
3212 "report."),
3214 "Sans 9", font_changed_callback),
3215 GEN_FONT_OPTION(gui_gtk4_font_comment_label, "comment_label",
3216 N_("Comment Label"),
3217 N_("This font is used to display comment labels, such as "
3218 "in the governor page of the city dialogs."),
3220 "Sans Italic 9", font_changed_callback),
3221 GEN_FONT_OPTION(gui_gtk4_font_city_names, "city_names",
3222 N_("City Names"),
3223 N_("This font is used to the display the city names "
3224 "on the map."),
3226 "Sans Bold 10", NULL),
3227 GEN_FONT_OPTION(gui_gtk4_font_city_productions, "city_productions",
3228 N_("City Productions"),
3229 N_("This font is used to display the city production "
3230 "on the map."),
3232 "Serif 10", NULL),
3233 GEN_FONT_OPTION(gui_gtk4_font_reqtree_text, "reqtree_text",
3234 N_("Requirement Tree"),
3235 N_("This font is used to the display the requirement tree "
3236 "in the Research report."),
3238 "Serif 10", NULL),
3239
3240 /* gui-gtk-5.0 client specific options. */
3241 GEN_BOOL_OPTION(gui_gtk5_fullscreen, N_("Fullscreen"),
3242 N_("If this option is set the client will use the "
3243 "whole screen area for drawing."),
3245 GEN_BOOL_OPTION(gui_gtk5_map_scrollbars, N_("Show map scrollbars"),
3246 N_("Disable this option to hide the scrollbars on the "
3247 "map view."),
3249 GEN_BOOL_OPTION(gui_gtk5_dialogs_on_top, N_("Keep dialogs on top"),
3250 N_("If this option is set then dialog windows will always "
3251 "remain in front of the main Freeciv window. "
3252 "Disabling this has no effect in fullscreen mode."),
3254 GEN_BOOL_OPTION(gui_gtk5_show_task_icons, N_("Show worklist task icons"),
3255 N_("Disabling this will turn off the unit and building "
3256 "icons in the worklist dialog and the production "
3257 "tab of the city dialog."),
3259 GEN_BOOL_OPTION(gui_gtk5_enable_tabs, N_("Enable status report tabs"),
3260 N_("If this option is enabled then report dialogs will "
3261 "be shown as separate tabs rather than in popup "
3262 "dialogs."),
3264 GEN_BOOL_OPTION(gui_gtk5_show_chat_message_time,
3265 N_("Show time for each chat message"),
3266 N_("If this option is enabled then all chat messages "
3267 "will be prefixed by a time string of the form "
3268 "[hour:minute:second]."),
3270 GEN_BOOL_OPTION(gui_gtk5_new_messages_go_to_top,
3271 N_("New message events go to top of list"),
3272 N_("If this option is enabled, new events in the "
3273 "message window will appear at the top of the list, "
3274 "rather than being appended at the bottom."),
3276 GEN_BOOL_OPTION(gui_gtk5_show_message_window_buttons,
3277 N_("Show extra message window buttons"),
3278 N_("If this option is enabled, there will be two "
3279 "buttons displayed in the message window for "
3280 "inspecting a city and going to a location. If this "
3281 "option is disabled, these buttons will not appear "
3282 "(you can still double-click with the left mouse "
3283 "button or right-click on a row to inspect or goto "
3284 "respectively). This option will only take effect "
3285 "once the message window is closed and reopened."),
3287 GEN_BOOL_OPTION(gui_gtk5_metaserver_tab_first,
3288 N_("Metaserver tab first in network page"),
3289 N_("If this option is enabled, the metaserver tab will "
3290 "be the first notebook tab in the network page. This "
3291 "option requires a restart in order to take effect."),
3293 GEN_BOOL_OPTION(gui_gtk5_allied_chat_only,
3294 N_("Plain chat messages are sent to allies only"),
3295 N_("If this option is enabled, then plain messages "
3296 "typed into the chat entry while the game is "
3297 "running will only be sent to your allies. "
3298 "Otherwise plain messages will be sent as "
3299 "public chat messages. To send a public chat "
3300 "message with this option enabled, prefix the "
3301 "message with a single colon ':'. This option "
3302 "can also be set using a toggle button beside "
3303 "the chat entry (only visible in multiplayer "
3304 "games)."),
3306 GEN_ENUM_OPTION(gui_gtk5_message_chat_location,
3307 N_("Messages and Chat reports location"),
3308 /* TRANS: The strings used in the UI for 'Split' etc are
3309 * tagged 'gui_gtk3_22/gtk4/gtk5_message_chat_location' */
3310 N_("Controls where the Messages and Chat reports "
3311 "appear relative to the main view containing the map.\n"
3312 "'Split' allows all three to be seen simultaneously, "
3313 "which is best for multiplayer, but requires a large "
3314 "window to be usable.\n"
3315 "'Separate' puts Messages and Chat in a notebook "
3316 "separate from the main view, so that one of them "
3317 "can always be seen alongside the main view.\n"
3318 "'Merged' makes the Messages and Chat reports into "
3319 "tabs alongside the map and other reports; this "
3320 "allows a larger map view on small screens.\n"
3321 "This option requires a restart in order to take "
3322 "effect."), COC_INTERFACE, GUI_GTK5,
3325 GEN_BOOL_OPTION(gui_gtk5_small_display_layout,
3326 N_("Arrange widgets for small displays"),
3327 N_("If this option is enabled, widgets in the main "
3328 "window will be arranged so that they take up the "
3329 "least amount of total screen space. Specifically, "
3330 "the left panel containing the overview, player "
3331 "status, and the unit information box will be "
3332 "extended over the entire left side of the window. "
3333 "This option requires a restart in order to take "
3334 "effect."), COC_INTERFACE, GUI_GTK5, FALSE, NULL),
3335 GEN_BOOL_OPTION(gui_gtk5_mouse_over_map_focus,
3336 N_("Mouse over the map widget selects it automatically"),
3337 N_("If this option is enabled, then the map will be "
3338 "focused when the mouse hovers over it."),
3340 GEN_BOOL_OPTION(gui_gtk5_chatline_autocompletion,
3341 N_("Player or user name autocompletion"),
3342 N_("If this option is turned on, the tabulation key "
3343 "will be used in the chatline to complete the word you "
3344 "are typing with the name of a player or a user."),
3346 GEN_INT_OPTION(gui_gtk5_citydlg_xsize,
3347 N_("Width of the city dialog"),
3348 N_("This value is only used if the width of the city "
3349 "dialog is saved."),
3352 NULL),
3353 GEN_INT_OPTION(gui_gtk5_citydlg_ysize,
3354 N_("Height of the city dialog"),
3355 N_("This value is only used if the height of the city "
3356 "dialog is saved."),
3359 NULL),
3360 GEN_INT_OPTION(gui_gtk5_helpdlg_xsize,
3361 N_("Width of the help dialog"),
3362 N_("This value is only used if the width of the help "
3363 "dialog is saved."),
3366 NULL),
3367 GEN_INT_OPTION(gui_gtk5_helpdlg_ysize,
3368 N_("Height of the city dialog"),
3369 N_("This value is only used if the height of the city "
3370 "dialog is saved."),
3373 NULL),
3374 GEN_INT_OPTION(gui_gtk5_optionsdlg_xsize,
3375 N_("Width of the options dialog"),
3376 NULL,
3379 NULL),
3380 GEN_INT_OPTION(gui_gtk5_optionsdlg_ysize,
3381 N_("Height of the options dialog"),
3382 NULL,
3385 NULL),
3386 GEN_ENUM_OPTION(gui_gtk5_popup_tech_help,
3387 N_("Popup tech help when gained"),
3388 N_("Controls if tech help should be opened when "
3389 "new tech has been gained.\n"
3390 "'Ruleset' means that behavior suggested by "
3391 "current ruleset is used."), COC_INTERFACE, GUI_GTK5,
3394 GEN_INT_OPTION(gui_gtk5_governor_range_min,
3395 N_("Minimum surplus for a governor"),
3396 N_("The lower limit of the range for requesting surpluses "
3397 "from the governor."),
3400 NULL),
3401 GEN_INT_OPTION(gui_gtk5_governor_range_max,
3402 N_("Maximum surplus for a governor"),
3403 N_("The higher limit of the range for requesting surpluses "
3404 "from the governor."),
3407 NULL),
3408 GEN_FONT_OPTION(gui_gtk5_font_city_label, "city_label",
3409 N_("City Label"),
3410 N_("This font is used to display the city labels on city "
3411 "dialogs."),
3413 "Monospace 8", font_changed_callback),
3414 GEN_FONT_OPTION(gui_gtk5_font_notify_label, "notify_label",
3415 N_("Notify Label"),
3416 N_("This font is used to display server reports such "
3417 "as the demographic report or historian publications."),
3419 "Monospace Bold 9", font_changed_callback),
3420 GEN_FONT_OPTION(gui_gtk5_font_spaceship_label, "spaceship_label",
3421 N_("Spaceship Label"),
3422 N_("This font is used to display the spaceship widgets."),
3424 "Monospace 8", font_changed_callback),
3425 GEN_FONT_OPTION(gui_gtk5_font_help_label, "help_label",
3426 N_("Help Label"),
3427 N_("This font is used to display the help headers in the "
3428 "help window."),
3430 "Sans Bold 10", font_changed_callback),
3431 GEN_FONT_OPTION(gui_gtk5_font_help_link, "help_link",
3432 N_("Help Link"),
3433 N_("This font is used to display the help links in the "
3434 "help window."),
3436 "Sans 9", font_changed_callback),
3437 GEN_FONT_OPTION(gui_gtk5_font_help_text, "help_text",
3438 N_("Help Text"),
3439 N_("This font is used to display the help body text in "
3440 "the help window."),
3442 "Monospace 8", font_changed_callback),
3443 GEN_FONT_OPTION(gui_gtk5_font_chatline, "chatline",
3444 N_("Chatline Area"),
3445 N_("This font is used to display the text in the "
3446 "chatline area."),
3448 "Monospace 8", font_changed_callback),
3449 GEN_FONT_OPTION(gui_gtk5_font_beta_label, "beta_label",
3450 N_("Beta Label"),
3451 N_("This font is used to display the beta label."),
3453 "Sans Italic 10", font_changed_callback),
3454 GEN_FONT_OPTION(gui_gtk5_font_small, "small_font",
3455 N_("Small Font"),
3456 N_("This font is used for any small font request. For "
3457 "example, it is used for display the building lists "
3458 "in the city dialog, the Economy report or the Units "
3459 "report."),
3461 "Sans 9", font_changed_callback),
3462 GEN_FONT_OPTION(gui_gtk5_font_comment_label, "comment_label",
3463 N_("Comment Label"),
3464 N_("This font is used to display comment labels, such as "
3465 "in the governor page of the city dialogs."),
3467 "Sans Italic 9", font_changed_callback),
3468 GEN_FONT_OPTION(gui_gtk5_font_city_names, "city_names",
3469 N_("City Names"),
3470 N_("This font is used to the display the city names "
3471 "on the map."),
3473 "Sans Bold 10", NULL),
3474 GEN_FONT_OPTION(gui_gtk5_font_city_productions, "city_productions",
3475 N_("City Productions"),
3476 N_("This font is used to display the city production "
3477 "on the map."),
3479 "Serif 10", NULL),
3480 GEN_FONT_OPTION(gui_gtk5_font_reqtree_text, "reqtree_text",
3481 N_("Requirement Tree"),
3482 N_("This font is used to the display the requirement tree "
3483 "in the Research report."),
3485 "Serif 10", NULL),
3486
3487 /* gui-sdl client specific options.
3488 * These are still kept just so users can migrate them to sdl2-client */
3489 GEN_BOOL_OPTION(gui_sdl_fullscreen, NULL, NULL,
3491 GEN_VIDEO_OPTION(gui_sdl_screen, NULL, NULL,
3492 COC_INTERFACE, GUI_SDL, 640, 480, NULL),
3493 GEN_BOOL_OPTION(gui_sdl_do_cursor_animation, NULL, NULL,
3495 GEN_BOOL_OPTION(gui_sdl_use_color_cursors, NULL, NULL,
3497
3498 /* gui-sdl2 client specific options. */
3499 GEN_BOOL_OPTION(gui_sdl2_fullscreen, N_("Fullscreen"),
3500 N_("If this option is set the client will use the "
3501 "whole screen area for drawing."),
3503 GEN_VIDEO_OPTION(gui_sdl2_screen, N_("Screen resolution"),
3504 N_("This option controls the resolution of the "
3505 "selected screen."),
3506 COC_INTERFACE, GUI_SDL2, 640, 480, NULL),
3507 GEN_BOOL_OPTION(gui_sdl2_swrenderer, N_("Use software rendering"),
3508 N_("Usually hardware rendering is used when possible. "
3509 "With this option set, software rendering is always used."),
3511 GEN_BOOL_OPTION(gui_sdl2_do_cursor_animation, N_("Do cursor animation"),
3512 N_("If this option is disabled, the cursor will "
3513 "always be displayed as static."),
3515 GEN_BOOL_OPTION(gui_sdl2_use_color_cursors, N_("Use color cursors"),
3516 N_("If this option is disabled, the cursor will "
3517 "always be displayed in black and white."),
3519 GEN_FONT_OPTION(gui_sdl2_font_city_names, "FONT_CITY_NAME",
3520 N_("City Names"),
3521 N_("The size of font used to the display the city names "
3522 "on the map."),
3524 "10", font_changed_callback),
3525 GEN_FONT_OPTION(gui_sdl2_font_city_productions, "FONT_CITY_PROD",
3526 N_("City Productions"),
3527 N_("The size of font used to the display the city "
3528 "production names on the map."),
3530 "10", font_changed_callback),
3531 GEN_BOOL_OPTION(gui_sdl2_use_theme_font_size, N_("Use theme defined font size"),
3532 N_("Disable this to override base font size set by theme "
3533 "by the setting below."),
3535 GEN_INT_OPTION(gui_sdl2_font_size, N_("Base Font Size"),
3536 N_("Base Font Size. All the fonts' sizes are defined relative "
3537 "to this. This option has effect only if theme font sizes "
3538 "option is disabled."),
3539 COC_FONT, GUI_SDL2, 10, 6, 50, NULL),
3540
3541 /* gui-sdl3 client specific options. */
3542 GEN_BOOL_OPTION(gui_sdl3_fullscreen, N_("Fullscreen"),
3543 N_("If this option is set the client will use the "
3544 "whole screen area for drawing."),
3546 GEN_VIDEO_OPTION(gui_sdl3_screen, N_("Screen resolution"),
3547 N_("This option controls the resolution of the "
3548 "selected screen."),
3549 COC_INTERFACE, GUI_SDL3, 640, 480, NULL),
3550 GEN_BOOL_OPTION(gui_sdl3_do_cursor_animation, N_("Do cursor animation"),
3551 N_("If this option is disabled, the cursor will "
3552 "always be displayed as static."),
3554 GEN_BOOL_OPTION(gui_sdl3_use_color_cursors, N_("Use color cursors"),
3555 N_("If this option is disabled, the cursor will "
3556 "always be displayed in black and white."),
3558 GEN_FONT_OPTION(gui_sdl3_font_city_names, "FONT_CITY_NAME",
3559 N_("City Names"),
3560 N_("The size of font used to the display the city names "
3561 "on the map."),
3563 "10", font_changed_callback),
3564 GEN_FONT_OPTION(gui_sdl3_font_city_productions, "FONT_CITY_PROD",
3565 N_("City Productions"),
3566 N_("The size of font used to the display the city "
3567 "production names on the map."),
3569 "10", font_changed_callback),
3570 GEN_BOOL_OPTION(gui_sdl3_use_theme_font_size, N_("Use theme defined font size"),
3571 N_("Disable this to override base font size set by theme "
3572 "by the setting below."),
3574 GEN_INT_OPTION(gui_sdl3_font_size, N_("Base Font Size"),
3575 N_("Base Font Size. All the fonts' sizes are defined relative "
3576 "to this. This option has effect only if theme font sizes "
3577 "option is disabled."),
3578 COC_FONT, GUI_SDL3, 10, 6, 50, NULL),
3579
3580 /* gui-qt client specific options. */
3581 GEN_BOOL_OPTION(gui_qt_fullscreen, N_("Fullscreen"),
3582 N_("If this option is set the client will use the "
3583 "whole screen area for drawing."),
3585 GEN_BOOL_OPTION(gui_qt_show_titlebar, N_("Show titlebar"),
3586 N_("If this option is set the client will show a titlebar. "
3587 "If disabled, then no titlebar will be shown, and "
3588 "minimize/maximize/etc buttons will be placed on the "
3589 "menu bar."),
3591 GEN_FONT_OPTION(gui_qt_font_default, "default_font",
3592 N_("Default font"),
3593 N_("This is default font"),
3595 "Sans Serif,10,-1,5,75,0,0,0,0,0", font_changed_callback),
3596 GEN_FONT_OPTION(gui_qt_font_notify_label, "notify_label",
3597 N_("Notify Label"),
3598 N_("This font is used to display server reports such "
3599 "as the demographic report or historian publications."),
3601 "Monospace,9,-1,5,75,0,0,0,0,0", font_changed_callback),
3602 GEN_FONT_OPTION(gui_qt_font_help_label, "help_label",
3603 N_("Help Label"),
3604 N_("This font is used to display the help labels in the "
3605 "help window."),
3607 "Sans Serif,9,-1,5,50,0,0,0,0,0", font_changed_callback),
3608 GEN_FONT_OPTION(gui_qt_font_help_text, "help_text",
3609 N_("Help Text"),
3610 N_("This font is used to display the help body text in "
3611 "the help window."),
3613 "Monospace,8,-1,5,50,0,0,0,0,0", font_changed_callback),
3614 GEN_FONT_OPTION(gui_qt_font_chatline, "chatline",
3615 N_("Chatline Area"),
3616 N_("This font is used to display the text in the "
3617 "chatline area."),
3619 "Monospace,8,-1,5,50,0,0,0,0,0", font_changed_callback),
3620 GEN_FONT_OPTION(gui_qt_font_city_names, "city_names",
3621 N_("City Names"),
3622 N_("This font is used to the display the city names "
3623 "on the map."),
3625 "Sans Serif,10,-1,5,75,0,0,0,0,0", font_changed_callback),
3626 GEN_FONT_OPTION(gui_qt_font_city_productions, "city_productions",
3627 N_("City Productions"),
3628 N_("This font is used to display the city production "
3629 "on the map."),
3631 "Sans Serif,10,-1,5,50,1,0,0,0,0", font_changed_callback),
3632 GEN_FONT_OPTION(gui_qt_font_reqtree_text, "reqtree_text",
3633 N_("Requirement Tree"),
3634 N_("This font is used to the display the requirement tree "
3635 "in the Research report."),
3637 "Sans Serif,10,-1,5,50,1,0,0,0,0", font_changed_callback),
3638 GEN_BOOL_OPTION(gui_qt_show_preview, N_("Show savegame information"),
3639 N_("If this option is set the client will show "
3640 "information and map preview of current savegame."),
3642 GEN_BOOL_OPTION(gui_qt_sidebar_left, N_("Sidebar position"),
3643 N_("If this option is set, the sidebar will be to the left "
3644 "of the map, otherwise to the right."),
3646 GEN_STR_OPTION(gui_qt_wakeup_text,
3647 N_("Wake up sequence"),
3648 N_("String which will trigger sound in pregame page; "
3649 "%1 stands for username."),
3650 COC_INTERFACE, GUI_QT, "Wake up %1", NULL, 0),
3651 GEN_BOOL_OPTION(gui_qt_svgflags, N_("SVG flags features"),
3653 N_("Enable svgflags features, such as bigger flags "
3654 "on the diplomacy dialog. Change to this comes "
3655 "to an effect on next client start."),
3656#else /* FREECIV_SVG_FLAGS */
3657 N_("Enable svgflags features, such as bigger flags "
3658 "on the diplomacy dialog. This has no effect on "
3659 "this freeciv build, as the svg support has not "
3660 "been built in."),
3661#endif /* FREECIV_SVG_FLAGS */
3663};
3665
3666/* Iteration loop, including invalid options for the current gui type. */
3667#define client_options_iterate_all(poption) \
3668{ \
3669 const struct client_option *const poption##_max = \
3670 client_options + client_options_num; \
3671 struct client_option *client_##poption = client_options; \
3672 struct option *poption; \
3673 for (; client_##poption < poption##_max; client_##poption++) { \
3674 poption = OPTION(client_##poption);
3675
3676#define client_options_iterate_all_end \
3677 } \
3678}
3679
3680
3681/************************************************************************/
3684static struct client_option *
3686{
3687 const struct client_option *const max =
3689 const enum gui_type our_type = get_gui_type();
3690
3691 while (poption < max
3692 && poption->specific != GUI_STUB
3693 && poption->specific != our_type) {
3694 poption++;
3695 }
3696
3697 return (poption < max ? poption : NULL);
3698}
3699
3700/************************************************************************/
3704{
3705 if (0 > id || id > client_options_num) {
3706 return NULL;
3707 }
3708 return OPTION(client_options + id);
3709}
3710
3711/************************************************************************/
3718
3719/************************************************************************/
3723{
3724 return COC_MAX;
3725}
3726
3727/************************************************************************/
3730static const char *client_optset_category_name(int category)
3731{
3732 switch (category) {
3733 case COC_GRAPHICS:
3734 return _("Graphics");
3735 case COC_OVERVIEW:
3736 /* TRANS: Options section for overview map (mini-map) */
3737 return Q_("?map:Overview");
3738 case COC_SOUND:
3739 return _("Sound");
3740 case COC_INTERFACE:
3741 return _("Interface");
3742 case COC_MAPIMG:
3743 return _("Map Image");
3744 case COC_NETWORK:
3745 return _("Network");
3746 case COC_FONT:
3747 return _("Font");
3748 case COC_MAX:
3749 break;
3750 }
3751
3752 log_error("%s: invalid option category number %d.",
3753 __FUNCTION__, category);
3754 return NULL;
3755}
3756
3757/************************************************************************/
3760static int client_option_number(const struct option *poption)
3761{
3763}
3764
3765/************************************************************************/
3768static const char *client_option_name(const struct option *poption)
3769{
3770 return CLIENT_OPTION(poption)->name;
3771}
3772
3773/************************************************************************/
3776static const char *client_option_description(const struct option *poption)
3777{
3778 return _(CLIENT_OPTION(poption)->description);
3779}
3780
3781/************************************************************************/
3784static const char *client_option_help_text(const struct option *poption)
3785{
3786 return _(CLIENT_OPTION(poption)->help_text);
3787}
3788
3789/************************************************************************/
3792static int client_option_category(const struct option *poption)
3793{
3794 return CLIENT_OPTION(poption)->category;
3795}
3796
3797/************************************************************************/
3801{
3802 return TRUE;
3803}
3804
3805/************************************************************************/
3808static struct option *client_option_next(const struct option *poption)
3809{
3811}
3812
3813/************************************************************************/
3816static bool client_option_bool_get(const struct option *poption)
3817{
3818 return *(CLIENT_OPTION(poption)->boolean.pvalue);
3819}
3820
3821/************************************************************************/
3824static bool client_option_bool_def(const struct option *poption)
3825{
3826 return CLIENT_OPTION(poption)->boolean.def;
3827}
3828
3829/************************************************************************/
3833static bool client_option_bool_set(struct option *poption, bool val)
3834{
3836
3837 if (*pcoption->boolean.pvalue == val) {
3838 return FALSE;
3839 }
3840
3841 *pcoption->boolean.pvalue = val;
3842 return TRUE;
3843}
3844
3845/************************************************************************/
3848static int client_option_int_get(const struct option *poption)
3849{
3850 return *(CLIENT_OPTION(poption)->integer.pvalue);
3851}
3852
3853/************************************************************************/
3856static int client_option_int_def(const struct option *poption)
3857{
3858 return CLIENT_OPTION(poption)->integer.def;
3859}
3860
3861/************************************************************************/
3864static int client_option_int_min(const struct option *poption)
3865{
3866 return CLIENT_OPTION(poption)->integer.min;
3867}
3868
3869/************************************************************************/
3872static int client_option_int_max(const struct option *poption)
3873{
3874 return CLIENT_OPTION(poption)->integer.max;
3875}
3876
3877/************************************************************************/
3881static bool client_option_int_set(struct option *poption, int val)
3882{
3884
3886 || val > pcoption->integer.max
3887 || *pcoption->integer.pvalue == val) {
3888 return FALSE;
3889 }
3890
3891 *pcoption->integer.pvalue = val;
3892 return TRUE;
3893}
3894
3895/************************************************************************/
3898static const char *client_option_str_get(const struct option *poption)
3899{
3900 return CLIENT_OPTION(poption)->string.pvalue;
3901}
3902
3903/************************************************************************/
3906static const char *client_option_str_def(const struct option *poption)
3907{
3908 return CLIENT_OPTION(poption)->string.def;
3909}
3910
3911/************************************************************************/
3915static const struct strvec *
3917{
3918 return (CLIENT_OPTION(poption)->string.val_accessor
3919 ? CLIENT_OPTION(poption)->string.val_accessor(poption) : NULL);
3920}
3921
3922/************************************************************************/
3926static bool client_option_str_set(struct option *poption, const char *str)
3927{
3929
3930 if (strlen(str) >= pcoption->string.size
3931 || 0 == strcmp(pcoption->string.pvalue, str)) {
3932 return FALSE;
3933 }
3934
3935 fc_strlcpy(pcoption->string.pvalue, str, pcoption->string.size);
3936 return TRUE;
3937}
3938
3939/************************************************************************/
3942static int client_option_enum_get(const struct option *poption)
3943{
3944 return *(CLIENT_OPTION(poption)->enumerator.pvalue);
3945}
3946
3947/************************************************************************/
3950static int client_option_enum_def(const struct option *poption)
3951{
3952 return CLIENT_OPTION(poption)->enumerator.def;
3953}
3954
3955/************************************************************************/
3959static const struct strvec *
3961{
3962 return CLIENT_OPTION(poption)->enumerator.pretty_names;
3963}
3964
3965/************************************************************************/
3969static bool client_option_enum_set(struct option *poption, int val)
3970{
3972
3973 if (*pcoption->enumerator.pvalue == val
3974 || 0 > val
3975 || val >= strvec_size(pcoption->enumerator.support_names)) {
3976 return FALSE;
3977 }
3978
3979 *pcoption->enumerator.pvalue = val;
3980 return TRUE;
3981}
3982
3983/************************************************************************/
3989 int val)
3990{
3991 const struct strvec *names = CLIENT_OPTION(data)->enumerator.support_names;
3992
3993 return (0 <= val && val < strvec_size(names)
3994 ? strvec_get(names, val) : NULL);
3995}
3996
3997#if 0 /* There's no bitwise options currently */
3998/************************************************************************/
4001static unsigned client_option_bitwise_get(const struct option *poption)
4002{
4003 return *(CLIENT_OPTION(poption)->bitwise.pvalue);
4004}
4005
4006/************************************************************************/
4009static unsigned client_option_bitwise_def(const struct option *poption)
4010{
4011 return CLIENT_OPTION(poption)->bitwise.def;
4012}
4013
4014/************************************************************************/
4018static const struct strvec *
4020{
4021 return CLIENT_OPTION(poption)->bitwise.pretty_names;
4022}
4023
4024/************************************************************************/
4028static bool client_option_bitwise_set(struct option *poption, unsigned val)
4029{
4031
4032 if (*pcoption->bitwise.pvalue == val) {
4033 return FALSE;
4034 }
4035
4036 *pcoption->bitwise.pvalue = val;
4037 return TRUE;
4038}
4039#endif /* 0 */
4040
4041/************************************************************************/
4047 int val)
4048{
4049 const struct strvec *names = CLIENT_OPTION(data)->bitwise.support_names;
4050
4051 return (0 <= val && val < strvec_size(names)
4052 ? strvec_get(names, val) : NULL);
4053}
4054
4055/************************************************************************/
4058static const char *client_option_font_get(const struct option *poption)
4059{
4060 return CLIENT_OPTION(poption)->font.pvalue;
4061}
4062
4063/************************************************************************/
4066static const char *client_option_font_def(const struct option *poption)
4067{
4068 return CLIENT_OPTION(poption)->font.def;
4069}
4070
4071/************************************************************************/
4074static const char *client_option_font_target(const struct option *poption)
4075{
4076 return CLIENT_OPTION(poption)->font.target;
4077}
4078
4079/************************************************************************/
4083static bool client_option_font_set(struct option *poption, const char *font)
4084{
4086
4087 if (strlen(font) >= pcoption->font.size
4088 || 0 == strcmp(pcoption->font.pvalue, font)) {
4089 return FALSE;
4090 }
4091
4092 fc_strlcpy(pcoption->font.pvalue, font, pcoption->font.size);
4093 return TRUE;
4094}
4095
4096/************************************************************************/
4100{
4101 return *CLIENT_OPTION(poption)->color.pvalue;
4102}
4103
4104/************************************************************************/
4108{
4109 return CLIENT_OPTION(poption)->color.def;
4110}
4111
4112/************************************************************************/
4117 struct ft_color color)
4118{
4119 struct ft_color *pcolor = CLIENT_OPTION(poption)->color.pvalue;
4120 bool changed = FALSE;
4121
4122#define color_set(color_tgt, color) \
4123 if (NULL == color_tgt) { \
4124 if (NULL != color) { \
4125 color_tgt = fc_strdup(color); \
4126 changed = TRUE; \
4127 } \
4128 } else { \
4129 if (NULL == color) { \
4130 free((void *) color_tgt); \
4131 color_tgt = NULL; \
4132 changed = TRUE; \
4133 } else if (0 != strcmp(color_tgt, color)) { \
4134 free((void *) color_tgt); \
4135 color_tgt = fc_strdup(color); \
4136 changed = TRUE; \
4137 } \
4138 }
4139
4140 color_set(pcolor->foreground, color.foreground);
4141 color_set(pcolor->background, color.background);
4142
4143#undef color_set
4144
4145 return changed;
4146}
4147
4148/************************************************************************/
4151static struct video_mode
4153{
4154 return *CLIENT_OPTION(poption)->video_mode.pvalue;
4155}
4156
4157/************************************************************************/
4160static struct video_mode
4165
4166/************************************************************************/
4171 struct video_mode mode)
4172{
4174
4175 if (0 == memcmp(&mode, pcoption->video_mode.pvalue,
4176 sizeof(struct video_mode))) {
4177 return FALSE;
4178 }
4179
4180 *pcoption->video_mode.pvalue = mode;
4181 return TRUE;
4182}
4183
4184/************************************************************************/
4188 struct section_file *sf)
4189{
4192
4193 switch (option_type(poption)) {
4194 case OT_BOOLEAN:
4195 {
4196 bool value;
4197 const char *pname = option_name(poption);
4198 const char *old_paths = "draw_roads_rails";
4199
4200 if (!strcmp("draw_paths", pname)) {
4201 /* Renamed in freeciv-3.2 */
4202 if (secfile_lookup_bool(sf, &value, "client.draw_paths")
4203 && option_bool_set(poption, value)) {
4204 return TRUE;
4205 }
4206
4207 /* Try by old name. */
4208 pname = old_paths;
4209 }
4210
4211 return (secfile_lookup_bool(sf, &value, "client.%s",
4212 pname)
4213 && option_bool_set(poption, value));
4214 }
4215 case OT_INTEGER:
4216 {
4217 int value;
4218
4219 return (secfile_lookup_int(sf, &value, "client.%s",
4221 && option_int_set(poption, value));
4222 }
4223 case OT_STRING:
4224 {
4225 const char *string;
4226
4227 return ((string = secfile_lookup_str(sf, "client.%s",
4229 && option_str_set(poption, string));
4230 }
4231 case OT_ENUM:
4232 {
4233 int value;
4234
4235 return (secfile_lookup_enum_data(sf, &value, FALSE,
4237 poption, "client.%s",
4239 && option_enum_set_int(poption, value));
4240 }
4241 case OT_BITWISE:
4242 {
4243 int value;
4244
4245 return (secfile_lookup_enum_data(sf, &value, TRUE,
4247 poption, "client.%s",
4249 && option_bitwise_set(poption, value));
4250 }
4251 case OT_FONT:
4252 {
4253 const char *string;
4254
4255 return ((string = secfile_lookup_str(sf, "client.%s",
4257 && option_font_set(poption, string));
4258 }
4259 case OT_COLOR:
4260 {
4261 struct ft_color color;
4262
4263 return ((color.foreground =
4264 secfile_lookup_str(sf, "client.%s.foreground",
4266 && (color.background =
4267 secfile_lookup_str(sf, "client.%s.background",
4270 }
4271 case OT_VIDEO_MODE:
4272 {
4273 struct video_mode mode;
4274
4275 return (secfile_lookup_int(sf, &mode.width, "client.%s.width",
4277 && secfile_lookup_int(sf, &mode.height, "client.%s.height",
4279 && option_video_mode_set(poption, mode));
4280 }
4281 }
4282 return FALSE;
4283}
4284
4285/************************************************************************/
4289 struct section_file *sf)
4290{
4292 fc_assert_ret(NULL != sf);
4293
4294 switch (option_type(poption)) {
4295 case OT_BOOLEAN:
4297 "client.%s", option_name(poption));
4298 break;
4299 case OT_INTEGER:
4301 "client.%s", option_name(poption));
4302 break;
4303 case OT_STRING:
4305 "client.%s", option_name(poption));
4306 break;
4307 case OT_ENUM:
4310 "client.%s", option_name(poption));
4311 break;
4312 case OT_BITWISE:
4315 "client.%s", option_name(poption));
4316 break;
4317 case OT_FONT:
4319 "client.%s", option_name(poption));
4320 break;
4321 case OT_COLOR:
4322 {
4324
4325 secfile_insert_str(sf, color.foreground, "client.%s.foreground",
4327 secfile_insert_str(sf, color.background, "client.%s.background",
4329 }
4330 break;
4331 case OT_VIDEO_MODE:
4332 {
4334
4335 secfile_insert_int(sf, mode.width, "client.%s.width",
4337 secfile_insert_int(sf, mode.height, "client.%s.height",
4339 }
4340 break;
4341 }
4342}
4343
4344
4345/****************************************************************************
4346 Server options variables.
4347****************************************************************************/
4350
4352static int server_options_num = 0;
4353
4354
4355/****************************************************************************
4356 Server option set.
4357****************************************************************************/
4358static struct option *server_optset_option_by_number(int id);
4359static struct option *server_optset_option_first(void);
4360static int server_optset_category_number(void);
4361static const char *server_optset_category_name(int category);
4362
4365 .option_first = server_optset_option_first,
4366 .category_number = server_optset_category_number,
4367 .category_name = server_optset_category_name
4368};
4370
4371
4372/****************************************************************************
4373 Virtuals tables for the client options.
4374****************************************************************************/
4375static int server_option_number(const struct option *poption);
4376static const char *server_option_name(const struct option *poption);
4377static const char *server_option_description(const struct option *poption);
4378static const char *server_option_help_text(const struct option *poption);
4379static int server_option_category(const struct option *poption);
4380static bool server_option_is_changeable(const struct option *poption);
4381static struct option *server_option_next(const struct option *poption);
4382
4383static const struct option_common_vtable server_option_common_vtable = {
4384 .number = server_option_number,
4385 .name = server_option_name,
4386 .description = server_option_description,
4387 .help_text = server_option_help_text,
4388 .category = server_option_category,
4389 .is_changeable = server_option_is_changeable,
4390 .next = server_option_next
4391};
4392
4393static bool server_option_bool_get(const struct option *poption);
4394static bool server_option_bool_def(const struct option *poption);
4395static bool server_option_bool_set(struct option *poption, bool val);
4396
4397static const struct option_bool_vtable server_option_bool_vtable = {
4401};
4402
4403static int server_option_int_get(const struct option *poption);
4404static int server_option_int_def(const struct option *poption);
4405static int server_option_int_min(const struct option *poption);
4406static int server_option_int_max(const struct option *poption);
4407static bool server_option_int_set(struct option *poption, int val);
4408
4409static const struct option_int_vtable server_option_int_vtable = {
4410 .get = server_option_int_get,
4411 .def = server_option_int_def,
4412 .minimum = server_option_int_min,
4413 .maximum = server_option_int_max,
4415};
4416
4417static const char *server_option_str_get(const struct option *poption);
4418static const char *server_option_str_def(const struct option *poption);
4419static const struct strvec *
4421static bool server_option_str_set(struct option *poption, const char *str);
4422
4423static const struct option_str_vtable server_option_str_vtable = {
4424 .get = server_option_str_get,
4425 .def = server_option_str_def,
4426 .values = server_option_str_values,
4428};
4429
4430static int server_option_enum_get(const struct option *poption);
4431static int server_option_enum_def(const struct option *poption);
4432static const struct strvec *
4434static bool server_option_enum_set(struct option *poption, int val);
4435
4436static const struct option_enum_vtable server_option_enum_vtable = {
4439 .values = server_option_enum_pretty,
4441 .cmp = strcmp
4442};
4443
4444static unsigned server_option_bitwise_get(const struct option *poption);
4445static unsigned server_option_bitwise_def(const struct option *poption);
4446static const struct strvec *
4448static bool server_option_bitwise_set(struct option *poption, unsigned val);
4449
4450static const struct option_bitwise_vtable server_option_bitwise_vtable = {
4455};
4456
4457/****************************************************************************
4458 Derived class server option, inheriting from base class option.
4459****************************************************************************/
4461 struct option base_option; /* Base structure, must be the first! */
4462
4463 char *name; /* Short name - used as an identifier */
4464 char *description; /* One-line description */
4465 char *help_text; /* Paragraph-length help text */
4466 unsigned char category;
4471
4472 union {
4473 /* OT_BOOLEAN type option. */
4474 struct {
4475 bool value;
4476 bool def;
4477 } boolean;
4478 /* OT_INTEGER type option. */
4479 struct {
4481 int def, min, max;
4482 } integer;
4483 /* OT_STRING type option. */
4484 struct {
4485 char *value;
4486 char *def;
4487 } string;
4488 /* OT_ENUM type option. */
4489 struct {
4490 int value;
4491 int def;
4493 struct strvec *pretty_names; /* untranslated */
4494 } enumerator;
4495 /* OT_BITWISE type option. */
4496 struct {
4497 unsigned value;
4498 unsigned def;
4499 struct strvec *support_names;
4500 struct strvec *pretty_names; /* untranslated */
4501 } bitwise;
4502 };
4503};
4504
4505#define SERVER_OPTION(poption) ((struct server_option *) (poption))
4506
4507static void desired_settable_option_send(struct option *poption);
4508
4509
4510/************************************************************************/
4520
4521/************************************************************************/
4525{
4526 option_gui_remove(&(poption->base_option));
4527
4528 switch (poption->base_option.type) {
4529 case OT_STRING:
4530 if (NULL != poption->string.value) {
4531 FC_FREE(poption->string.value);
4532 }
4533 if (NULL != poption->string.def) {
4534 FC_FREE(poption->string.def);
4535 }
4536 break;
4537
4538 case OT_ENUM:
4539 if (NULL != poption->enumerator.support_names) {
4540 strvec_destroy(poption->enumerator.support_names);
4541 poption->enumerator.support_names = NULL;
4542 }
4543 if (NULL != poption->enumerator.pretty_names) {
4544 strvec_destroy(poption->enumerator.pretty_names);
4545 poption->enumerator.pretty_names = NULL;
4546 }
4547 break;
4548
4549 case OT_BITWISE:
4550 if (NULL != poption->bitwise.support_names) {
4551 strvec_destroy(poption->bitwise.support_names);
4552 poption->bitwise.support_names = NULL;
4553 }
4554 if (NULL != poption->bitwise.pretty_names) {
4555 strvec_destroy(poption->bitwise.pretty_names);
4556 poption->bitwise.pretty_names = NULL;
4557 }
4558 break;
4559
4560 case OT_BOOLEAN:
4561 case OT_INTEGER:
4562 case OT_FONT:
4563 case OT_COLOR:
4564 case OT_VIDEO_MODE:
4565 break;
4566 }
4567
4568 if (NULL != poption->name) {
4569 FC_FREE(poption->name);
4570 }
4571 if (NULL != poption->description) {
4572 FC_FREE(poption->description);
4573 }
4574 if (NULL != poption->help_text) {
4575 FC_FREE(poption->help_text);
4576 }
4577}
4578
4579/************************************************************************/
4583{
4584 int i;
4585
4586 /* Don't keep this dialog open. */
4588
4589 /* Free the options themselves. */
4590 if (NULL != server_options) {
4591 for (i = 0; i < server_options_num; i++) {
4593 }
4596 }
4597
4598 /* Free the categories. */
4600 for (i = 0; i < server_options_categories_num; i++) {
4603 }
4604 }
4607 }
4608}
4609
4610/************************************************************************/
4614 (const struct packet_server_setting_control *packet)
4615{
4616 int i;
4617
4618 /* This packet should be received only once. */
4623
4624 /* Allocate server option categories. */
4625 if (0 < packet->categories_num) {
4629 sizeof(*server_options_categories));
4630
4631 for (i = 0; i < server_options_categories_num; i++) {
4632 /* NB: Translate now. */
4634 }
4635 }
4636
4637 /* Allocate server options. */
4638 if (0 < packet->settings_num) {
4641 }
4642}
4643
4644/************************************************************************/
4648 (const struct packet_server_setting_const *packet)
4649{
4652
4654
4655 fc_assert(NULL == psoption->name);
4656 psoption->name = fc_strdup(packet->name);
4657 fc_assert(NULL == psoption->description);
4658 /* NB: Translate now. */
4659 psoption->description = fc_strdup(_(packet->short_help));
4660 fc_assert(NULL == psoption->help_text);
4661 /* NB: Translate now. */
4662 psoption->help_text = fc_strdup(_(packet->extra_help));
4663 psoption->category = packet->category;
4664}
4665
4666/****************************************************************************
4667 Common part of handle_server_setting_*() functions. See below.
4668****************************************************************************/
4669#define handle_server_setting_common(psoption, packet) \
4670 psoption->is_changeable = packet->is_changeable; \
4671 psoption->setdef = packet->setdef; \
4672 if (psoption->is_visible != packet->is_visible) { \
4673 if (psoption->is_visible) { \
4674 need_gui_remove = TRUE; \
4675 } else if (packet->is_visible) { \
4676 need_gui_add = TRUE; \
4677 } \
4678 psoption->is_visible = packet->is_visible; \
4679 } \
4680 \
4681 /* Keep this list of conditions in sync with one in \
4682 resend_desired_settable_options() */ \
4683 if (!psoption->desired_sent \
4684 && psoption->is_visible \
4685 && psoption->is_changeable \
4686 && gui_options.send_desired_settings \
4687 && is_server_running() \
4688 && packet->initial_setting) { \
4689 /* Only send our private settings if we are running \
4690 * on a forked local server, i.e. started by the \
4691 * client with the "Start New Game" button. \
4692 * Do now override settings that are already saved to savegame \
4693 * and now loaded. */ \
4694 desired_settable_option_send(OPTION(poption)); \
4695 dsend_packet_sync_serial(&client.conn, ++sync_serial); \
4696 psoption->desired_sent = TRUE; \
4697 } \
4698 \
4699 /* Update the GUI. */ \
4700 if (need_gui_remove) { \
4701 option_gui_remove(poption); \
4702 } else if (need_gui_add) { \
4703 option_gui_add(poption); \
4704 } else { \
4705 option_gui_update(poption); \
4707
4708/************************************************************************/
4712 (const struct packet_server_setting_bool *packet)
4713{
4716 bool need_gui_remove = FALSE;
4717 bool need_gui_add = FALSE;
4718
4720
4721 if (NULL == poption->common_vtable) {
4722 /* Not initialized yet. */
4723 poption->poptset = server_optset;
4724 poption->common_vtable = &server_option_common_vtable;
4725 poption->type = OT_BOOLEAN;
4726 poption->bool_vtable = &server_option_bool_vtable;
4727 }
4729 "Server setting \"%s\" (nb %d) has type %s (%d), "
4730 "expected %s (%d)",
4732 option_type_name(poption->type), poption->type,
4734
4735 if (packet->is_visible) {
4736 psoption->boolean.value = packet->val;
4737 psoption->boolean.def = packet->default_val;
4738 }
4739
4742
4743/************************************************************************/
4747 (const struct packet_server_setting_int *packet)
4748{
4751 bool need_gui_remove = FALSE;
4752 bool need_gui_add = FALSE;
4753
4755
4756 if (NULL == poption->common_vtable) {
4757 /* Not initialized yet. */
4758 poption->poptset = server_optset;
4759 poption->common_vtable = &server_option_common_vtable;
4760 poption->type = OT_INTEGER;
4761 poption->int_vtable = &server_option_int_vtable;
4762 }
4764 "Server setting \"%s\" (nb %d) has type %s (%d), "
4765 "expected %s (%d)",
4767 option_type_name(poption->type), poption->type,
4769
4770 if (packet->is_visible) {
4771 psoption->integer.value = packet->val;
4772 psoption->integer.def = packet->default_val;
4773 psoption->integer.min = packet->min_val;
4774 psoption->integer.max = packet->max_val;
4775 }
4776
4779
4780/************************************************************************/
4784 (const struct packet_server_setting_str *packet)
4785{
4788 bool need_gui_remove = FALSE;
4789 bool need_gui_add = FALSE;
4790
4792
4793 if (NULL == poption->common_vtable) {
4794 /* Not initialized yet. */
4795 poption->poptset = server_optset;
4796 poption->common_vtable = &server_option_common_vtable;
4797 poption->type = OT_STRING;
4798 poption->str_vtable = &server_option_str_vtable;
4799 }
4801 "Server setting \"%s\" (nb %d) has type %s (%d), "
4802 "expected %s (%d)",
4804 option_type_name(poption->type), poption->type,
4806
4807 if (packet->is_visible) {
4808 if (NULL == psoption->string.value) {
4809 psoption->string.value = fc_strdup(packet->val);
4810 } else if (0 != strcmp(packet->val, psoption->string.value)) {
4811 free(psoption->string.value);
4812 psoption->string.value = fc_strdup(packet->val);
4813 }
4814 if (NULL == psoption->string.def) {
4815 psoption->string.def = fc_strdup(packet->default_val);
4816 } else if (0 != strcmp(packet->default_val, psoption->string.def)) {
4817 free(psoption->string.def);
4818 psoption->string.def = fc_strdup(packet->default_val);
4819 }
4820 }
4821
4824
4825/************************************************************************/
4829 (const struct packet_server_setting_enum *packet)
4830{
4833 bool need_gui_remove = FALSE;
4834 bool need_gui_add = FALSE;
4835
4837
4838 if (NULL == poption->common_vtable) {
4839 /* Not initialized yet. */
4840 poption->poptset = server_optset;
4841 poption->common_vtable = &server_option_common_vtable;
4842 poption->type = OT_ENUM;
4843 poption->enum_vtable = &server_option_enum_vtable;
4844 }
4846 "Server setting \"%s\" (nb %d) has type %s (%d), "
4847 "expected %s (%d)",
4849 option_type_name(poption->type), poption->type,
4851
4852 if (packet->is_visible) {
4853 int i;
4854
4855 psoption->enumerator.value = packet->val;
4856 psoption->enumerator.def = packet->default_val;
4857
4858 if (NULL == psoption->enumerator.support_names) {
4859 /* First time we get this packet. */
4860 fc_assert(NULL == psoption->enumerator.pretty_names);
4861 psoption->enumerator.support_names = strvec_new();
4862 strvec_reserve(psoption->enumerator.support_names, packet->values_num);
4863 psoption->enumerator.pretty_names = strvec_new();
4864 strvec_reserve(psoption->enumerator.pretty_names, packet->values_num);
4865 for (i = 0; i < packet->values_num; i++) {
4866 strvec_set(psoption->enumerator.support_names, i,
4867 packet->support_names[i]);
4868 /* Store untranslated string from server. */
4869 strvec_set(psoption->enumerator.pretty_names, i,
4870 packet->pretty_names[i]);
4871 }
4872 } else if (strvec_size(psoption->enumerator.support_names)
4873 != packet->values_num) {
4874 fc_assert(strvec_size(psoption->enumerator.support_names)
4875 == strvec_size(psoption->enumerator.pretty_names));
4876 /* The number of values have changed, we need to reset the list
4877 * of possible values. */
4878 strvec_reserve(psoption->enumerator.support_names, packet->values_num);
4879 strvec_reserve(psoption->enumerator.pretty_names, packet->values_num);
4880 for (i = 0; i < packet->values_num; i++) {
4881 strvec_set(psoption->enumerator.support_names, i,
4882 packet->support_names[i]);
4883 /* Store untranslated string from server. */
4884 strvec_set(psoption->enumerator.pretty_names, i,
4885 packet->pretty_names[i]);
4886 }
4889 } else {
4890 /* Check if a value changed, then we need to reset the list
4891 * of possible values. */
4892 const char *str;
4893
4894 for (i = 0; i < packet->values_num; i++) {
4895 str = strvec_get(psoption->enumerator.pretty_names, i);
4896 if (NULL == str || 0 != strcmp(str, packet->pretty_names[i])) {
4897 /* Store untranslated string from server. */
4898 strvec_set(psoption->enumerator.pretty_names, i,
4899 packet->pretty_names[i]);
4902 }
4903 /* Support names are not visible, we don't need to check if it
4904 * has changed. */
4905 strvec_set(psoption->enumerator.support_names, i,
4906 packet->support_names[i]);
4907 }
4908 }
4909 }
4910
4913
4914/************************************************************************/
4918 (const struct packet_server_setting_bitwise *packet)
4919{
4922 bool need_gui_remove = FALSE;
4923 bool need_gui_add = FALSE;
4924
4926
4927 if (NULL == poption->common_vtable) {
4928 /* Not initialized yet. */
4929 poption->poptset = server_optset;
4930 poption->common_vtable = &server_option_common_vtable;
4931 poption->type = OT_BITWISE;
4932 poption->bitwise_vtable = &server_option_bitwise_vtable;
4933 }
4935 "Server setting \"%s\" (nb %d) has type %s (%d), "
4936 "expected %s (%d)",
4938 option_type_name(poption->type), poption->type,
4940
4941 if (packet->is_visible) {
4942 int i;
4943
4944 psoption->bitwise.value = packet->val;
4945 psoption->bitwise.def = packet->default_val;
4946
4947 if (NULL == psoption->bitwise.support_names) {
4948 /* First time we get this packet. */
4949 fc_assert(NULL == psoption->bitwise.pretty_names);
4950 psoption->bitwise.support_names = strvec_new();
4951 strvec_reserve(psoption->bitwise.support_names, packet->bits_num);
4952 psoption->bitwise.pretty_names = strvec_new();
4953 strvec_reserve(psoption->bitwise.pretty_names, packet->bits_num);
4954 for (i = 0; i < packet->bits_num; i++) {
4955 strvec_set(psoption->bitwise.support_names, i,
4956 packet->support_names[i]);
4957 /* Store untranslated string from server. */
4958 strvec_set(psoption->bitwise.pretty_names, i,
4959 packet->pretty_names[i]);
4960 }
4961 } else if (strvec_size(psoption->bitwise.support_names)
4962 != packet->bits_num) {
4963 fc_assert(strvec_size(psoption->bitwise.support_names)
4964 == strvec_size(psoption->bitwise.pretty_names));
4965 /* The number of values have changed, we need to reset the list
4966 * of possible values. */
4967 strvec_reserve(psoption->bitwise.support_names, packet->bits_num);
4968 strvec_reserve(psoption->bitwise.pretty_names, packet->bits_num);
4969 for (i = 0; i < packet->bits_num; i++) {
4970 strvec_set(psoption->bitwise.support_names, i,
4971 packet->support_names[i]);
4972 /* Store untranslated string from server. */
4973 strvec_set(psoption->bitwise.pretty_names, i,
4974 packet->pretty_names[i]);
4975 }
4978 } else {
4979 /* Check if a value changed, then we need to reset the list
4980 * of possible values. */
4981 const char *str;
4982
4983 for (i = 0; i < packet->bits_num; i++) {
4984 str = strvec_get(psoption->bitwise.pretty_names, i);
4985 if (NULL == str || 0 != strcmp(str, packet->pretty_names[i])) {
4986 /* Store untranslated string from server. */
4987 strvec_set(psoption->bitwise.pretty_names, i,
4988 packet->pretty_names[i]);
4991 }
4992 /* Support names are not visible, we don't need to check if it
4993 * has changed. */
4994 strvec_set(psoption->bitwise.support_names, i,
4995 packet->support_names[i]);
4996 }
4997 }
4998 }
4999
5001}
5003/************************************************************************/
5006static struct server_option *
5008{
5009 if (server_options != NULL) {
5010 const struct server_option *const max =
5012
5014 poption++;
5015 }
5016
5017 return (poption < max ? poption : NULL);
5018 }
5019
5020 return NULL;
5022
5023/************************************************************************/
5027{
5028 if (0 > id || id > server_options_num) {
5029 return NULL;
5030 }
5031 return OPTION(server_options + id);
5033
5034/************************************************************************/
5038{
5041
5042/************************************************************************/
5046{
5049
5050/************************************************************************/
5053const char *server_optset_category_name(int category)
5054{
5055 if (0 > category || category >= server_options_categories_num) {
5056 return NULL;
5057 }
5058
5059 return server_options_categories[category];
5061
5062/************************************************************************/
5065static int server_option_number(const struct option *poption)
5066{
5069
5070/************************************************************************/
5073static const char *server_option_name(const struct option *poption)
5074{
5075 return SERVER_OPTION(poption)->name;
5077
5078/************************************************************************/
5081static const char *server_option_description(const struct option *poption)
5082{
5083 return SERVER_OPTION(poption)->description;
5085
5086/************************************************************************/
5089static const char *server_option_help_text(const struct option *poption)
5090{
5091 return SERVER_OPTION(poption)->help_text;
5093
5094/************************************************************************/
5097static int server_option_category(const struct option *poption)
5098{
5099 return SERVER_OPTION(poption)->category;
5101
5102/************************************************************************/
5105static bool server_option_is_changeable(const struct option *poption)
5106{
5107 return SERVER_OPTION(poption)->is_changeable;
5109
5110/************************************************************************/
5113static struct option *server_option_next(const struct option *poption)
5114{
5117
5118/************************************************************************/
5121static bool server_option_bool_get(const struct option *poption)
5122{
5123 return SERVER_OPTION(poption)->boolean.value;
5125
5126/************************************************************************/
5129static bool server_option_bool_def(const struct option *poption)
5130{
5131 return SERVER_OPTION(poption)->boolean.def;
5132}
5134/************************************************************************/
5138static bool server_option_bool_set(struct option *poption, bool val)
5139{
5141
5142 if (psoption->boolean.value == val) {
5143 return FALSE;
5144 }
5145
5146 send_chat_printf("/set %s %s", psoption->name,
5147 val ? "enabled" : "disabled");
5149
5150 return TRUE;
5152
5153/************************************************************************/
5156static int server_option_int_get(const struct option *poption)
5157{
5158 return SERVER_OPTION(poption)->integer.value;
5160
5161/************************************************************************/
5164static int server_option_int_def(const struct option *poption)
5165{
5166 return SERVER_OPTION(poption)->integer.def;
5168
5169/************************************************************************/
5172static int server_option_int_min(const struct option *poption)
5173{
5174 return SERVER_OPTION(poption)->integer.min;
5176
5177/************************************************************************/
5180static int server_option_int_max(const struct option *poption)
5181{
5182 return SERVER_OPTION(poption)->integer.max;
5183}
5185/************************************************************************/
5189static bool server_option_int_set(struct option *poption, int val)
5190{
5192
5194 || val > psoption->integer.max
5195 || psoption->integer.value == val) {
5196 return FALSE;
5197 }
5198
5199 send_chat_printf("/set %s %d", psoption->name, val);
5201
5202 return TRUE;
5204
5205/************************************************************************/
5208static const char *server_option_str_get(const struct option *poption)
5209{
5210 return SERVER_OPTION(poption)->string.value;
5212
5213/************************************************************************/
5216static const char *server_option_str_def(const struct option *poption)
5217{
5218 return SERVER_OPTION(poption)->string.def;
5219}
5220
5221/************************************************************************/
5225static const struct strvec *
5227{
5228 return NULL;
5229}
5231/************************************************************************/
5235static bool server_option_str_set(struct option *poption, const char *str)
5236{
5238
5239 if (0 == strcmp(psoption->string.value, str)) {
5240 return FALSE;
5241 }
5242
5243 send_chat_printf("/set %s \"%s\"", psoption->name, str);
5245
5246 return TRUE;
5248
5249/************************************************************************/
5252static int server_option_enum_get(const struct option *poption)
5253{
5254 return SERVER_OPTION(poption)->enumerator.value;
5256
5257/************************************************************************/
5260static int server_option_enum_def(const struct option *poption)
5261{
5262 return SERVER_OPTION(poption)->enumerator.def;
5263}
5264
5265/************************************************************************/
5269static const struct strvec *
5271{
5272 return SERVER_OPTION(poption)->enumerator.pretty_names;
5273}
5275/************************************************************************/
5279static bool server_option_enum_set(struct option *poption, int val)
5280{
5282 const char *name;
5283
5284 if (val == psoption->enumerator.value
5285 || !(name = strvec_get(psoption->enumerator.support_names, val))) {
5286 return FALSE;
5287 }
5288
5289 send_chat_printf("/set %s \"%s\"", psoption->name, name);
5291
5292 return TRUE;
5293}
5295/************************************************************************/
5299static void server_option_enum_support_name(const struct option *poption,
5300 const char **pvalue,
5301 const char **pdefault)
5302{
5304 const struct strvec *values = psoption->enumerator.support_names;
5305
5306 if (NULL != pvalue) {
5307 *pvalue = strvec_get(values, psoption->enumerator.value);
5308 }
5309 if (NULL != pdefault) {
5310 *pdefault = strvec_get(values, psoption->enumerator.def);
5311 }
5313
5314/************************************************************************/
5317static unsigned server_option_bitwise_get(const struct option *poption)
5318{
5319 return SERVER_OPTION(poption)->bitwise.value;
5321
5322/************************************************************************/
5325static unsigned server_option_bitwise_def(const struct option *poption)
5326{
5327 return SERVER_OPTION(poption)->bitwise.def;
5328}
5329
5330/************************************************************************/
5334static const struct strvec *
5336{
5337 return SERVER_OPTION(poption)->bitwise.pretty_names;
5339
5340/************************************************************************/
5343static void server_option_bitwise_support_base(const struct strvec *values,
5344 unsigned val,
5345 char *buf, size_t buf_len)
5346{
5347 int bit;
5348
5349 buf[0] = '\0';
5350 for (bit = 0; bit < strvec_size(values); bit++) {
5351 if ((1 << bit) & val) {
5352 if ('\0' != buf[0]) {
5353 fc_strlcat(buf, "|", buf_len);
5354 }
5355 fc_strlcat(buf, strvec_get(values, bit), buf_len);
5356 }
5357 }
5358}
5360/************************************************************************/
5364static bool server_option_bitwise_set(struct option *poption, unsigned val)
5365{
5367 char name[MAX_LEN_MSG];
5368
5369 if (val == psoption->bitwise.value) {
5370 return FALSE;
5371 }
5372
5373 server_option_bitwise_support_base(psoption->bitwise.support_names, val,
5374 name, sizeof(name));
5375 send_chat_printf("/set %s \"%s\"", psoption->name, name);
5377
5378 return TRUE;
5379}
5381/************************************************************************/
5385static void server_option_bitwise_support_name(const struct option *poption,
5386 char *val_buf, size_t val_len,
5387 char *def_buf, size_t def_len)
5388{
5390 const struct strvec *values = psoption->bitwise.support_names;
5391
5392 if (NULL != val_buf && 0 < val_len) {
5393 server_option_bitwise_support_base(values, psoption->bitwise.value,
5394 val_buf, val_len);
5395 }
5396 if (NULL != def_buf && 0 < def_len) {
5397 server_option_bitwise_support_base(values, psoption->bitwise.def,
5398 def_buf, def_len);
5399 }
5401
5402
5406
5408/************************************************************************/
5412static void message_options_init(void)
5413{
5414 int none[] = {
5420 };
5421 int out_only[] = {
5424 };
5425 int all[] = {
5427 };
5428 int i;
5429
5430 for (i = 0; i <= event_type_max(); i++) {
5431 /* Include possible undefined values. */
5433 }
5434 for (i = 0; i < ARRAY_SIZE(none); i++) {
5435 messages_where[none[i]] = 0;
5436 }
5437 for (i = 0; i < ARRAY_SIZE(out_only); i++) {
5439 }
5440 for (i = 0; i < ARRAY_SIZE(all); i++) {
5442 }
5443
5444 events_init();
5446
5447/************************************************************************/
5450static void message_options_free(void)
5451{
5452 events_free();
5453}
5455/************************************************************************/
5459static void message_options_load(struct section_file *file,
5460 const char *prefix)
5461{
5462 enum event_type event;
5463 int i, num_events;
5464 const char *p;
5465
5466 if (!secfile_lookup_int(file, &num_events, "messages.count")) {
5467 /* version < 2.2 */
5468 /* Order of the events in 2.1. */
5469 const enum event_type old_events[] = {
5498 };
5499 const size_t old_events_num = ARRAY_SIZE(old_events);
5500
5501 for (i = 0; i < old_events_num; i++) {
5504 "%s.message_where_%02d", prefix, i);
5505 }
5506 return;
5507 }
5508
5509 for (i = 0; i < num_events; i++) {
5510 p = secfile_lookup_str(file, "messages.event%d.name", i);
5511 if (NULL == p) {
5512 log_error("Corruption in file %s: %s",
5513 secfile_name(file), secfile_error());
5514 continue;
5515 }
5516 /* Compatibility: Before 3.0 E_UNIT_WIN_DEF was called E_UNIT_WIN. */
5517 if (!fc_strcasecmp("E_UNIT_WIN", p)) {
5518 log_deprecation(_("Deprecated event type E_UNIT_WIN in client options."));
5519 p = "E_UNIT_WIN_DEF";
5520 }
5521 event = event_type_by_name(p, strcmp);
5522 if (!event_type_is_valid(event)) {
5523 log_error("Event not supported: %s", p);
5524 continue;
5525 }
5526
5528 "messages.event%d.where", i)) {
5529 log_error("Corruption in file %s: %s",
5530 secfile_name(file), secfile_error());
5531 }
5532 }
5533}
5535/************************************************************************/
5539static void message_options_save(struct section_file *file,
5540 const char *prefix)
5541{
5542 enum event_type event;
5543 int i = 0;
5544
5545 for (event = event_type_begin(); event != event_type_end();
5546 event = event_type_next(event)) {
5548 "messages.event%d.name", i);
5550 "messages.event%d.where", i);
5551 i++;
5552 }
5553
5554 secfile_insert_int(file, i, "messages.count");
5556
5557/************************************************************************/
5560static void load_cma_preset(struct section_file *file, int i)
5561{
5562 struct cm_parameter parameter;
5563 const char *name =
5564 secfile_lookup_str_default(file, "preset",
5565 "cma.preset%d.name", i);
5566
5567 /* Init correct default values even for the fields that are not
5568 * loaded below. */
5569 cm_init_parameter(&parameter);
5570
5572 parameter.minimal_surplus[o] =
5573 secfile_lookup_int_default(file, 0, "cma.preset%d.minsurp%d", i, o);
5574 parameter.factor[o] =
5575 secfile_lookup_int_default(file, 0, "cma.preset%d.factor%d", i, o);
5577 parameter.require_happy =
5578 secfile_lookup_bool_default(file, FALSE, "cma.preset%d.reqhappy", i);
5579 parameter.happy_factor =
5580 secfile_lookup_int_default(file, 0, "cma.preset%d.happyfactor", i);
5581 parameter.allow_disorder = FALSE;
5582 parameter.allow_specialists = TRUE;
5583
5584 cmafec_preset_add(name, &parameter);
5586
5587/************************************************************************/
5590static void save_cma_preset(struct section_file *file, int i)
5591{
5592 const struct cm_parameter *const pparam = cmafec_preset_get_parameter(i);
5594
5595 secfile_insert_str(file, name, "cma.preset%d.name", i);
5596
5598 secfile_insert_int(file, pparam->minimal_surplus[o],
5599 "cma.preset%d.minsurp%d", i, o);
5600 secfile_insert_int(file, pparam->factor[o],
5601 "cma.preset%d.factor%d", i, o);
5603 secfile_insert_bool(file, pparam->require_happy,
5604 "cma.preset%d.reqhappy", i);
5605 secfile_insert_int(file, pparam->happy_factor,
5606 "cma.preset%d.happyfactor", i);
5608
5609/************************************************************************/
5612static void save_cma_presets(struct section_file *file)
5613{
5614 int i;
5615
5617 _("If you add a preset by hand,"
5618 " also update \"number_of_presets\""),
5619 "cma.number_of_presets");
5620 for (i = 0; i < cmafec_preset_num(); i++) {
5623}
5624
5625/* RC file name. */
5626#define MID_OPTION_FILE_NAME ".freeciv-client-rc-%d.%d"
5627#define NEW_OPTION_FILE_NAME "freeciv-client-rc-%d.%d"
5629/* The first version the new option name appeared (2.6). */
5630#define FIRST_MAJOR_NEW_OPTION_FILE_NAME 2
5631#define FIRST_MINOR_NEW_OPTION_FILE_NAME 6
5632/* The first version the mid option name appeared (2.2). */
5633#define FIRST_MAJOR_MID_OPTION_FILE_NAME 2
5634#define FIRST_MINOR_MID_OPTION_FILE_NAME 2
5635/* The first version the new boolean values appeared (2.3). */
5636#define FIRST_MAJOR_NEW_BOOLEAN 2
5637#define FIRST_MINOR_NEW_BOOLEAN 3
5638
5639/************************************************************************/
5646static const char *get_current_option_file_name(void)
5647{
5648 static char name_buffer[256];
5649 const char *name;
5650
5651 name = getenv("FREECIV_OPT");
5652
5653 if (name) {
5655 } else {
5656#ifdef OPTION_FILE_NAME
5658#else
5660 if (!name) {
5661 log_error(_("Cannot find freeciv storage directory"));
5662 return NULL;
5663 }
5667#endif /* OPTION_FILE_NAME */
5668 }
5669 log_verbose("settings file is %s", name_buffer);
5670 return name_buffer;
5671}
5672
5673/************************************************************************/
5681static const char *get_last_option_file_name(bool *allow_digital_boolean)
5682{
5683 static char name_buffer[256];
5684 const char *name;
5685 static int last_minors[] = {
5686 0, /* There was no 0.x releases */
5687 14, /* 1.14 */
5688 6 /* 2.6 */
5689 };
5690
5691#if MINOR_VERSION >= 90
5693#else
5695#endif
5696
5697 *allow_digital_boolean = FALSE;
5698 name = getenv("FREECIV_OPT");
5699 if (name) {
5701 } else {
5702#ifdef OPTION_FILE_NAME
5704#else
5705 int major, minor;
5706 struct stat buf;
5707
5709 if (name == NULL) {
5710 log_error(_("Cannot find freeciv storage directory"));
5711
5712 return NULL;
5713 }
5714
5720 : minor >= 0); minor--) {
5723 if (0 == fc_stat(name_buffer, &buf)) {
5726 log_normal(_("Didn't find '%s' option file, "
5727 "loading from '%s' instead."),
5729 name_buffer + strlen(name) + 1);
5730 }
5731
5732 return name_buffer;
5733 }
5734 }
5735 minor = last_minors[major - 1];
5736 }
5737
5738 /* Older versions had options file in user home directory */
5739 name = user_home_dir();
5740 if (name == NULL) {
5741 log_error(_("Cannot find your home directory"));
5742
5743 return NULL;
5744 }
5745
5746 /* Minor having max value of FIRST_MINOR_NEW_OPTION_FILE_NAME
5747 * works since MID versioning scheme was used within major version 2
5748 * only (2.2 - 2.6) so the last minor is bigger than any earlier minor. */
5752 minor--) {
5755 if (0 == fc_stat(name_buffer, &buf)) {
5756 log_normal(_("Didn't find '%s' option file, "
5757 "loading from '%s' instead."),
5759 name_buffer + strlen(name) + 1);
5760
5762 *allow_digital_boolean = TRUE;
5763 }
5764 return name_buffer;
5765 }
5766 }
5767
5768 return NULL;
5769#endif /* OPTION_FILE_NAME */
5770 }
5771 log_verbose("settings file is %s", name_buffer);
5772
5773 return name_buffer;
5774}
5775#undef MID_OPTION_FILE_NAME
5776#undef NEW_OPTION_FILE_NAME
5777#undef FIRST_MAJOR_NEW_OPTION_FILE_NAME
5778#undef FIRST_MINOR_NEW_OPTION_FILE_NAME
5779#undef FIRST_MAJOR_MID_OPTION_FILE_NAME
5780#undef FIRST_MINOR_MID_OPTION_FILE_NAME
5781#undef FIRST_MINOR_NEW_BOOLEAN
5784/****************************************************************************
5785 Desired settable options.
5786****************************************************************************/
5787#define SPECHASH_TAG settable_options
5788#define SPECHASH_ASTR_KEY_TYPE
5789#define SPECHASH_ASTR_DATA_TYPE
5790#include "spechash.h"
5791#define settable_options_hash_iterate(hash, name, value) \
5792 TYPED_HASH_ITERATE(const char *, const char *, hash, name, value)
5793#define settable_options_hash_iterate_end HASH_ITERATE_END
5794
5796
5797/************************************************************************/
5800static void settable_options_load(struct section_file *sf)
5801{
5802 char buf[64];
5803 const struct section *psection;
5804 const struct entry_list *entries;
5805 const char *string;
5806 bool bval;
5807 int ival;
5808
5810
5812
5813 psection = secfile_section_by_name(sf, "server");
5814 if (NULL == psection) {
5815 /* Does not exist! */
5816 return;
5817 }
5818
5819 entries = section_entries(psection);
5821 string = NULL;
5822 switch (entry_type_get(pentry)) {
5823 case ENTRY_BOOL:
5824 if (entry_bool_get(pentry, &bval)) {
5825 fc_strlcpy(buf, bval ? "enabled" : "disabled", sizeof(buf));
5826 string = buf;
5827 }
5828 break;
5829
5830 case ENTRY_INT:
5831 if (entry_int_get(pentry, &ival)) {
5832 fc_snprintf(buf, sizeof(buf), "%d", ival);
5833 string = buf;
5834 }
5835 break;
5836
5837 case ENTRY_STR:
5838 (void) entry_str_get(pentry, &string);
5839 break;
5840
5841 case ENTRY_FLOAT:
5843 /* Not supported yet */
5844 break;
5845 case ENTRY_LONG_COMMENT:
5847 break;
5848 case ENTRY_ILLEGAL:
5850 break;
5851 }
5852
5853 if (NULL == string) {
5854 log_error("Entry type variant of \"%s.%s\" is not supported.",
5855 section_name(psection), entry_name(pentry));
5856 continue;
5857 }
5858
5860 string);
5863
5864/************************************************************************/
5867static void settable_options_save(struct section_file *sf)
5868{
5870
5872 if (!fc_strcasecmp(name, "gameseed") || !fc_strcasecmp(name, "mapseed")) {
5873 /* Do not save mapseed or gameseed. */
5874 continue;
5875 }
5876 if (!fc_strcasecmp(name, "topology")) {
5877 /* client_start_server() sets topology based on tileset. Don't store
5878 * its choice. The tileset is already stored. Storing topology leads
5879 * to all sort of breakage:
5880 * - it breaks ruleset default topology.
5881 * - it interacts badly with tileset ruleset change, ruleset tileset
5882 * change and topology tileset change.
5883 * - its value is probably based on what tileset was loaded when
5884 * client_start_server() decided to set topology, not on player
5885 * choice.
5886 */
5887 continue;
5888 }
5889 secfile_insert_str(sf, value, "server.%s", name);
5891}
5893/************************************************************************/
5898{
5899 char val_buf[1024], def_buf[1024];
5900 const char *value, *def_val;
5901
5903
5906
5907 if (srv->setdef != SETDEF_CHANGED) {
5908 /* Some level default - do not store */
5911 } else {
5912 value = NULL;
5913 def_val = NULL;
5914 switch (option_type(poption)) {
5915 case OT_BOOLEAN:
5916 fc_strlcpy(val_buf, option_bool_get(poption) ? "enabled" : "disabled",
5917 sizeof(val_buf));
5918 value = val_buf;
5919 fc_strlcpy(def_buf, option_bool_def(poption) ? "enabled" : "disabled",
5920 sizeof(def_buf));
5921 def_val = def_buf;
5922 break;
5923 case OT_INTEGER:
5925 value = val_buf;
5927 def_val = def_buf;
5928 break;
5929 case OT_STRING:
5932 break;
5933 case OT_ENUM:
5935 break;
5936 case OT_BITWISE:
5938 def_buf, sizeof(def_buf));
5939 value = val_buf;
5940 def_val = def_buf;
5941 break;
5942 case OT_FONT:
5943 case OT_COLOR:
5944 case OT_VIDEO_MODE:
5945 break;
5946 }
5947
5948 if (NULL == value || NULL == def_val) {
5949 log_error("Option type %s (%d) not supported for '%s'.",
5952 continue;
5953 }
5954
5957 }
5959}
5961/************************************************************************/
5966 const char *op_value,
5967 bool allow_replace)
5968{
5970
5971 if (allow_replace) {
5973 } else {
5975 }
5976}
5978/************************************************************************/
5982static bool settable_option_upgrade_value(const struct option *poption,
5983 int old_value,
5984 char *buf, size_t buf_len)
5985{
5986 const char *name = option_name(poption);
5987
5988#define SETTING_CASE(ARG_name, ...) \
5989 if (0 == strcmp(ARG_name, name)) { \
5990 static const char *values[] = { __VA_ARGS__ }; \
5991 if (0 <= old_value && old_value < ARRAY_SIZE(values) \
5992 && NULL != values[old_value]) { \
5993 fc_strlcpy(buf, values[old_value], buf_len); \
5994 return TRUE; \
5995 } else { \
5996 return FALSE; \
5997 } \
5998 }
5999
6000 SETTING_CASE("topology", "", "WRAPX", "WRAPY", "WRAPX|WRAPY", "ISO",
6001 "WRAPX|ISO", "WRAPY|ISO", "WRAPX|WRAPY|ISO", "HEX",
6002 "WRAPX|HEX", "WRAPY|HEX", "WRAPX|WRAPY|HEX", "ISO|HEX",
6003 "WRAPX|ISO|HEX", "WRAPY|ISO|HEX", "WRAPX|WRAPY|ISO|HEX");
6004 SETTING_CASE("generator", NULL, "RANDOM", "FRACTAL", "ISLAND");
6005 SETTING_CASE("startpos", "DEFAULT", "SINGLE", "2or3", "ALL", "VARIABLE");
6006 SETTING_CASE("borders", "DISABLED", "ENABLED", "SEE_INSIDE", "EXPAND");
6007 SETTING_CASE("diplomacy", "ALL", "HUMAN", "AI", "TEAM", "DISABLED");
6008 SETTING_CASE("citynames", "NO_RESTRICTIONS", "PLAYER_UNIQUE",
6009 "GLOBAL_UNIQUE", "NO_STEALING");
6010 SETTING_CASE("barbarians", "DISABLED", "HUTS_ONLY", "NORMAL", "FREQUENT",
6011 "HORDES");
6012 SETTING_CASE("phasemode", "ALL", "PLAYER", "TEAM");
6013 SETTING_CASE("compresstype", "PLAIN", "LIBZ", "BZIP2");
6014
6015#undef SETTING_CASE
6016 return FALSE;
6018
6019/************************************************************************/
6022static void desired_settable_option_send(struct option *poption)
6023{
6024 char *desired;
6025 int value;
6026
6028
6031 /* No change explicitly desired. */
6032 return;
6033 }
6034
6035 switch (option_type(poption)) {
6036 case OT_BOOLEAN:
6037 if ((0 == fc_strcasecmp("enabled", desired)
6038 || (str_to_int(desired, &value) && 1 == value))
6039 && !option_bool_get(poption)) {
6040 send_chat_printf("/set %s enabled", option_name(poption));
6041 } else if ((0 == fc_strcasecmp("disabled", desired)
6042 || (str_to_int(desired, &value) && 0 == value))
6044 send_chat_printf("/set %s disabled", option_name(poption));
6045 }
6046 return;
6047 case OT_INTEGER:
6049 send_chat_printf("/set %s %d", option_name(poption), value);
6050 }
6051 return;
6052 case OT_STRING:
6053 if (0 != strcmp(desired, option_str_get(poption))) {
6054 send_chat_printf("/set %s \"%s\"", option_name(poption), desired);
6055 }
6056 return;
6057 case OT_ENUM:
6058 {
6059 char desired_buf[256];
6060 const char *value_str;
6061
6062 /* Handle old values. */
6063 if (str_to_int(desired, &value)
6065 sizeof(desired_buf))) {
6067 }
6068
6070 if (0 != strcmp(desired, value_str)) {
6071 send_chat_printf("/set %s \"%s\"", option_name(poption), desired);
6072 }
6073 }
6074 return;
6075 case OT_BITWISE:
6076 {
6077 char desired_buf[256], value_buf[256];
6078
6079 /* Handle old values. */
6080 if (str_to_int(desired, &value)
6082 sizeof(desired_buf))) {
6084 }
6085
6087 sizeof(value_buf), NULL, 0);
6088 if (0 != strcmp(desired, value_buf)) {
6089 send_chat_printf("/set %s \"%s\"", option_name(poption), desired);
6090 }
6091 }
6092 return;
6093 case OT_FONT:
6094 case OT_COLOR:
6095 case OT_VIDEO_MODE:
6096 break;
6097 }
6098
6099 log_error("Option type %s (%d) not supported for '%s'.",
6102}
6104/************************************************************************/
6109{
6112 (void) value; /* Silence compiler warning about unused variable */
6114
6115 if (poption != NULL) {
6117
6118 /* We only sent the option if it has been sent already in the past.
6119 * Otherwise we leave it for that "initial" sending functionality
6120 * to send it. That has the benefit that the initial send (can) check
6121 * that server is not currently using value from the savegame that
6122 * we should not override */
6123 if (psoption->desired_sent) {
6124 /* Keep this list of conditions in sync with one in
6125 * handle_server_setting_common()
6126 * For lacking initial_setting check here, see comment above about
6127 * checking psoption->desired_sent. */
6128 if (psoption->is_visible
6129 && psoption->is_changeable) {
6132 }
6133 }
6134 }
6136 }
6137}
6138
6139
6140/****************************************************************************
6141 City and player report dialog options.
6142****************************************************************************/
6143#define SPECHASH_TAG dialog_options
6144#define SPECHASH_ASTR_KEY_TYPE
6145#define SPECHASH_IDATA_TYPE bool
6146#define SPECHASH_UDATA_TO_IDATA FC_INT_TO_PTR
6147#define SPECHASH_IDATA_TO_UDATA FC_PTR_TO_INT
6148#define SPECHASH_VPTR_TO_IDATA FC_PTR_TO_INT
6149#include "spechash.h"
6150#define dialog_options_hash_iterate(hash, column, visible) \
6151 TYPED_HASH_ITERATE(const char *, intptr_t, hash, column, visible)
6152#define dialog_options_hash_iterate_end HASH_ITERATE_END
6153
6155
6156/************************************************************************/
6159static void options_dialogs_load(struct section_file *sf)
6160{
6161 const struct entry_list *entries;
6162 const char *prefixes[] = { "player_dlg_", "city_report_", NULL };
6163 const char **prefix;
6164 bool visible;
6165
6167
6169
6170 if (NULL != entries) {
6172 for (prefix = prefixes; NULL != *prefix; prefix++) {
6173 if (!fc_strncmp(*prefix, entry_name(pentry), strlen(*prefix))
6174 && secfile_lookup_bool(sf, &visible, "client.%s",
6175 entry_name(pentry))) {
6178 break;
6179 }
6180 }
6182 }
6184
6185/************************************************************************/
6188static void options_dialogs_save(struct section_file *sf)
6189{
6191
6194 secfile_insert_bool(sf, visible, "client.%s", column);
6196}
6197
6198/************************************************************************/
6203void options_dialogs_update(void)
6204{
6205 char buf[64];
6206 int i;
6207
6209
6210 /* Player report dialog options. */
6211 for (i = 1; i < num_player_dlg_columns; i++) {
6212 fc_snprintf(buf, sizeof(buf), "player_dlg_%s",
6213 player_dlg_columns[i].tagname);
6216 }
6217
6218 /* City report dialog options. */
6219 for (i = 0; i < num_city_report_spec(); i++) {
6220 fc_snprintf(buf, sizeof(buf), "city_report_%s",
6224 }
6225}
6227/************************************************************************/
6231void options_dialogs_set(void)
6232{
6233 char buf[64];
6234 bool visible;
6235 int i;
6236
6238
6239 /* Player report dialog options. */
6240 for (i = 1; i < num_player_dlg_columns; i++) {
6241 fc_snprintf(buf, sizeof(buf), "player_dlg_%s",
6242 player_dlg_columns[i].tagname);
6245 }
6246 }
6247
6248 /* City report dialog options. */
6249 for (i = 0; i < num_city_report_spec(); i++) {
6250 fc_snprintf(buf, sizeof(buf), "city_report_%s",
6254 }
6255 }
6256}
6257
6258/************************************************************************/
6264void options_load(void)
6265{
6266 struct section_file *sf;
6268 int i, num;
6269 const char *name;
6270 const char *const prefix = "client";
6271 const char *str;
6272
6274 if (!name) {
6275 log_normal(_("Didn't find the option file. Creating a new one."));
6279 return;
6280 }
6281 if (!(sf = secfile_load(name, TRUE))) {
6282 log_debug("Error loading option file '%s':\n%s", name, secfile_error());
6283 /* Try to create the rc file */
6284 sf = secfile_new(TRUE);
6285 secfile_insert_str(sf, VERSION_STRING, "client.version");
6286
6289 save_cma_presets(sf);
6290
6291 /* FIXME: need better messages */
6292 if (!secfile_save(sf, name, 0, FZ_PLAIN)) {
6293 log_error(_("Save failed, cannot write to file %s"), name);
6294 } else {
6295 log_normal(_("Saved settings to file %s"), name);
6296 }
6297 secfile_destroy(sf);
6299 return;
6300 }
6302
6303 /* A "secret" option for the lazy. TODO: make this saveable */
6305 secfile_lookup_str_default(sf, "", "%s.password", prefix));
6306
6309 "%s.save_options_on_exit", prefix);
6312 "%s.fullscreen_mode", prefix);
6313
6314 /* Settings migrations */
6317 "%s.migration_gtk3_from_gtk2", prefix);
6320 "%s.migration_gtk3_22_from_gtk3", prefix);
6323 "%s.migration_gtk4_from_gtk3_22", prefix);
6326 "%s.migration_gtk5_from_gtk4", prefix);
6329 "%s.migration_sdl2_from_sdl", prefix);
6332 "%s.migration_sdl3_from_sdl2", prefix);
6335 "%s.migration_gtk2_from_2_5", prefix);
6338 "%s.migration_gtk3_from_2_5", prefix);
6341 "%s.migration_qt_from_2_5", prefix);
6342
6343 /* Flag values */
6346 "%s.flag_qt_default_fonts_set", prefix);
6349 "%s.flag_sdl2_default_screen_size_set", prefix);
6352 "%s.flag_sdl3_default_screen_size_set", prefix);
6353
6354 /* These are not gui-enabled yet */
6356 = secfile_lookup_bool_default(sf, FALSE, "%s.zoom_set", prefix);
6359 "%s.zoom_default_level", prefix);
6360
6363 "%s.gui_qt_show_relations_panel", prefix);
6366 "%s.gui_qt_show_techs_panel", prefix);
6369 "%s.gui_qt_show_wonders_panel", prefix);
6370
6371 /* default_tileset_name present until freeciv-3.2 */
6372 str = secfile_lookup_str_default(sf, NULL, "client.default_tileset_name");
6373 if (str == NULL) {
6375 "client.default_topology");
6376 } else {
6378 }
6379 str = secfile_lookup_str_default(sf, NULL, "client.default_tileset_overhead_name");
6380 if (str != NULL) {
6382 }
6383 str = secfile_lookup_str_default(sf, NULL, "client.default_tileset_iso_name");
6384 if (str != NULL) {
6386 }
6387
6388 /* Backwards compatibility for removed options replaced by entirely "new"
6389 * options. The equivalent "new" option will override these, if set. */
6390
6391 /* Renamed in 2.6 */
6393 "%s.popup_caravan_arrival", prefix);
6394
6395 /* Load all the regular options */
6399
6400 /* More backwards compatibility, for removed options that had been
6401 * folded into then-existing options. Here, the backwards-compatibility
6402 * behavior overrides the "destination" option. */
6403
6404 /* Removed in 2.4 */
6406 "%s.do_combat_animation", prefix)) {
6408 }
6409
6410 message_options_load(sf, prefix);
6412
6413 /* Load cma presets. If cma.number_of_presets doesn't exist, don't load
6414 * any, the order here should be reversed to keep the order the same */
6415 if (secfile_lookup_int(sf, &num, "cma.number_of_presets")) {
6416 for (i = num - 1; i >= 0; i--) {
6417 load_cma_preset(sf, i);
6418 }
6419 } else {
6421 }
6422
6425
6426 secfile_destroy(sf);
6429
6430/************************************************************************/
6434 const char *msg, ...)
6435{
6436 va_list args;
6437
6438 va_start(args, msg);
6440 va_end(args);
6442
6443/************************************************************************/
6447{
6448 if (reply_serial >= sync_serial) {
6449 /* We've already got reply to the latest options sync request */
6450 log_debug("Options save immediate (%d vs %d)", sync_serial, reply_serial);
6452 options_save(log_cb);
6453 } else {
6454 log_debug("Options save queued (%d vs %d)", sync_serial, reply_serial);
6455 queue_save = TRUE;
6456 queued_cb = log_cb;
6457 }
6459
6460/************************************************************************/
6463void options_sync_reply(int serial)
6464{
6465 reply_serial = serial;
6466
6468 log_debug("Pop queued options saving.");
6471 }
6473
6474/************************************************************************/
6478{
6479 struct section_file *sf;
6480 const char *name = get_current_option_file_name();
6481 char dir_name[2048];
6482 int i;
6483
6484 queue_save = FALSE;
6485
6486 if (log_cb == NULL) {
6487 /* Default callback */
6489 }
6490
6491 if (!name) {
6492 log_cb(LOG_ERROR, _("Save failed, cannot find a filename."));
6493 return;
6494 }
6495
6496 sf = secfile_new(TRUE);
6497 secfile_insert_str(sf, VERSION_STRING, "client.version");
6498
6500 "client.save_options_on_exit");
6502 "deprecated", "client.fullscreen_mode");
6503
6504 /* Migrations */
6506 "client.migration_gtk3_from_gtk2");
6508 "client.migration_gtk3_22_from_gtk3");
6510 "client.migration_gtk4_from_gtk3_22");
6512 "client.migration_gtk5_from_gtk4");
6514 "client.migration_sdl2_from_sdl");
6516 "client.migration_sdl3_from_sdl2");
6518 "client.migration_gtk2_from_2_5");
6520 "client.migration_gtk3_from_2_5");
6522 "client.migration_qt_from_2_5");
6523
6524 /* Flag */
6526 "client.flag_qt_default_fonts_set");
6528 "client.flag_sdl2_default_screen_size_set");
6530 "client.flag_sdl3_default_screen_size_set");
6531
6532 /* gui-enabled options */
6537 /* Once options have been migrated from a client that no longer exist to a newer client,
6538 * there's no use for those settings of dropped client any more, so no point in saving them. */
6540 }
6542
6543 /* These are not gui-enabled yet. */
6544 secfile_insert_bool(sf, gui_options.zoom_set, "client.zoom_set");
6546 "client.zoom_default_level");
6547
6549 "client.gui_qt_show_relations_panel");
6551 "client.gui_qt_show_techs_panel");
6553 "client.gui_qt_show_wonders_panel");
6554
6555 if (tileset != NULL) {
6557 "client.default_topology");
6558 } else {
6560 "client.default_topology");
6561 }
6562
6563 message_options_save(sf, "client");
6565
6566 /* Server settings */
6567 save_cma_presets(sf);
6569
6570 /* Insert global worklists */
6572
6573 /* Directory name */
6575 for (i = strlen(dir_name) - 1 ; dir_name[i] != DIR_SEPARATOR_CHAR && i >= 0; i--) {
6576 /* Nothing */
6577 }
6578
6579 if (i > 0) {
6580 dir_name[i] = '\0';
6582 log_cb(LOG_ERROR, _("Saving options failed, cannot create directory %s"),
6583 dir_name);
6584 secfile_destroy(sf);
6585 return;
6586 }
6587 }
6588
6589 /* Save to disk */
6590 if (!secfile_save(sf, name, 0, FZ_PLAIN)) {
6591 log_cb(LOG_ERROR, _("Saving options failed, cannot write to file %s"), name);
6592 } else {
6593 log_cb(LOG_VERBOSE, _("Saved options to file %s"), name);
6594 }
6595 secfile_destroy(sf);
6597
6598/************************************************************************/
6601static void options_init_names(const struct copt_val_name *(*acc)(int),
6602 struct strvec **support, struct strvec **pretty)
6603{
6604 int val;
6605 const struct copt_val_name *name;
6606
6608 *support = strvec_new();
6609 *pretty = strvec_new();
6610 for (val = 0; (name = acc(val)); val++) {
6611 strvec_append(*support, name->support);
6612 strvec_append(*pretty, name->pretty);
6613 }
6615
6616/************************************************************************/
6619void options_init(void)
6620{
6624
6627
6630
6631 switch (option_type(poption)) {
6632 case OT_INTEGER:
6639
6640 log_error("option %s has default value of %d, which is "
6641 "out of its range [%d; %d], changing to %d.",
6644 new_default);
6645 *((int *) &(pcoption->integer.def)) = new_default;
6646 }
6647 break;
6648
6649 case OT_STRING:
6651 /* Hack to get a default value. */
6652 *((const char **) &(pcoption->string.def)) =
6654 }
6655
6656 if (NULL == option_str_def(poption)) {
6657 const struct strvec *values = option_str_values(poption);
6658
6659 if (NULL == values || strvec_size(values) == 0) {
6660 log_error("Invalid NULL default string for option %s.",
6662 } else {
6663 *((const char **) &(pcoption->string.def)) =
6664 strvec_get(values, 0);
6665 }
6666 }
6667 break;
6668
6669 case OT_ENUM:
6670 fc_assert(NULL == pcoption->enumerator.support_names);
6671 fc_assert(NULL == pcoption->enumerator.pretty_names);
6672 options_init_names(pcoption->enumerator.name_accessor,
6673 &pcoption->enumerator.support_names,
6674 &pcoption->enumerator.pretty_names);
6675 fc_assert(NULL != pcoption->enumerator.support_names);
6676 fc_assert(NULL != pcoption->enumerator.pretty_names);
6677 break;
6678
6679 case OT_BITWISE:
6680 fc_assert(NULL == pcoption->bitwise.support_names);
6681 fc_assert(NULL == pcoption->bitwise.pretty_names);
6682 options_init_names(pcoption->bitwise.name_accessor,
6683 &pcoption->bitwise.support_names,
6684 &pcoption->bitwise.pretty_names);
6685 fc_assert(NULL != pcoption->bitwise.support_names);
6686 fc_assert(NULL != pcoption->bitwise.pretty_names);
6687 break;
6688
6689 case OT_COLOR:
6690 {
6691 /* Duplicate the string pointers. */
6692 struct ft_color *pcolor = pcoption->color.pvalue;
6693
6694 if (NULL != pcolor->foreground) {
6695 pcolor->foreground = fc_strdup(pcolor->foreground);
6696 }
6697 if (NULL != pcolor->background) {
6698 pcolor->background = fc_strdup(pcolor->background);
6699 }
6700 }
6701 break;
6702
6703 case OT_BOOLEAN:
6704 case OT_FONT:
6705 case OT_VIDEO_MODE:
6706 break;
6707 }
6708
6709 /* Set to default. */
6713
6714/************************************************************************/
6717void options_free(void)
6718{
6721
6723
6724 switch (option_type(poption)) {
6725 case OT_ENUM:
6726 fc_assert_action(NULL != pcoption->enumerator.support_names, break);
6727 strvec_destroy(pcoption->enumerator.support_names);
6728 pcoption->enumerator.support_names = NULL;
6729 fc_assert_action(NULL != pcoption->enumerator.pretty_names, break);
6730 strvec_destroy(pcoption->enumerator.pretty_names);
6731 pcoption->enumerator.pretty_names = NULL;
6732 break;
6733
6734 case OT_BITWISE:
6735 fc_assert_action(NULL != pcoption->bitwise.support_names, break);
6736 strvec_destroy(pcoption->bitwise.support_names);
6737 pcoption->bitwise.support_names = NULL;
6738 fc_assert_action(NULL != pcoption->bitwise.pretty_names, break);
6739 strvec_destroy(pcoption->bitwise.pretty_names);
6740 pcoption->bitwise.pretty_names = NULL;
6741 break;
6742
6743 case OT_BOOLEAN:
6744 case OT_INTEGER:
6745 case OT_STRING:
6746 case OT_FONT:
6747 case OT_COLOR:
6748 case OT_VIDEO_MODE:
6749 break;
6750 }
6752
6753 if (NULL != settable_options_hash) {
6756 }
6757
6758 if (NULL != dialog_options_hash) {
6761 }
6762
6765}
6767/************************************************************************/
6771static void reqtree_show_icons_callback(struct option *poption)
6772{
6775
6776/************************************************************************/
6779static void view_option_changed_callback(struct option *poption)
6780{
6781 menus_init();
6784
6785/************************************************************************/
6788static void manual_turn_done_callback(struct option *poption)
6789{
6791
6793 struct player *pplayer = client_player();
6794
6795 if (pplayer != NULL && is_ai(pplayer)
6796 && can_end_turn()) {
6798 }
6799 }
6801
6802/****************************************************************************
6803 Callback for changing music volume
6804****************************************************************************/
6805static void sound_volume_callback(struct option *poption)
6806{
6809
6810/************************************************************************/
6813static void voteinfo_bar_callback(struct option *poption)
6814{
6817
6818/************************************************************************/
6821static void font_changed_callback(struct option *poption)
6822{
6826
6827/************************************************************************/
6830static void mapimg_changed_callback(struct option *poption)
6831{
6833#ifndef FREECIV_NDEBUG
6834 bool success;
6835#endif
6836
6837 log_normal("Error setting the value for %s (%s). Restoring the default "
6838 "value.", option_name(poption), mapimg_error());
6839
6840 /* Reset the value to the default value. */
6841#ifndef FREECIV_NDEBUG
6842 success =
6843#endif
6845
6847 "Failed to reset the option \"%s\".",
6849#ifndef FREECIV_NDEBUG
6850 success =
6851#endif
6853
6855 "Failed to restore mapimg definition for option \"%s\".",
6857 }
6859
6860/************************************************************************/
6863static void game_music_enable_callback(struct option *poption)
6864{
6865 if (client_state() == C_S_RUNNING) {
6868 } else {
6870 }
6871 }
6873
6874/************************************************************************/
6877static void menu_music_enable_callback(struct option *poption)
6878{
6879 if (client_state() != C_S_RUNNING) {
6881 start_menu_music("music_menu", NULL);
6882 } else {
6884 }
6885 }
6887
6888/************************************************************************/
6891bool video_mode_to_string(char *buf, size_t buf_len, struct video_mode *mode)
6892{
6893 return (2 < fc_snprintf(buf, buf_len, "%dx%d", mode->width, mode->height));
6895
6896/************************************************************************/
6899bool string_to_video_mode(const char *buf, struct video_mode *mode)
6900{
6901 return (2 == sscanf(buf, "%dx%d", &mode->width, &mode->height));
6903
6904/************************************************************************/
6907static const struct strvec *get_mapimg_format_list(const struct option *poption)
6908{
6909 return mapimg_get_format_list();
6911
6912/************************************************************************/
6915const char *tileset_name_for_topology(int topology_id)
6916{
6917 const char *tsn = NULL;
6918
6919 switch (topology_id & (TF_ISO | TF_HEX)) {
6920 case 0:
6921 case TF_ISO:
6923 break;
6924 case TF_HEX:
6926 break;
6927 case TF_ISO | TF_HEX:
6929 break;
6930 }
6931
6932 if (tsn == NULL) {
6934 }
6935
6936 return tsn;
6938
6939/************************************************************************/
6942void option_set_default_ts(struct tileset *t)
6943{
6944 const char *optname = "<not set>";
6945 struct option *opt;
6946
6947 switch (tileset_topo_index(t)) {
6948 case TS_TOPO_SQUARE:
6949 /* Overhead */
6950 optname = "default_tileset_square_name";
6951 break;
6952 case TS_TOPO_HEX:
6953 /* Hex */
6954 optname = "default_tileset_hex_name";
6955 break;
6956 case TS_TOPO_ISOHEX:
6957 /* Isohex */
6958 optname = "default_tileset_isohex_name";
6959 break;
6960 }
6961
6963
6964 if (opt == NULL) {
6965 log_error("Unknown option name \"%s\" in option_set_default_ts()", optname);
6966 return;
6967 }
6968
6969 /* Do not call option_str_set() since we don't want option changed callback
6970 * to reload this tileset. */
6971 opt->str_vtable->set(opt, tileset_basename(t));
6974
6975/************************************************************************/
6978static bool is_ts_option_unset(const char *optname)
6979{
6980 struct option *opt;
6981 const char *val;
6982
6984
6985 if (opt == NULL) {
6986 return TRUE;
6987 }
6988
6989 val = opt->str_vtable->get(opt);
6990
6991 if (val == NULL || val[0] == '\0') {
6992 return TRUE;
6993 }
6994
6995 return FALSE;
6997
6998/************************************************************************/
7001void fill_topo_ts_default(void)
7002{
7003 if (is_ts_option_unset("default_tileset_square_name")) {
7004 if (gui_options.default_tileset_iso_name[0] != '\0') {
7008 } else if (gui_options.default_tileset_overhead_name[0] != '\0') {
7012 } else {
7013 log_debug("Setting tileset for square topologies.");
7015 }
7016 }
7017 if (is_ts_option_unset("default_tileset_hex_name")) {
7018 log_debug("Setting tileset for hex topology.");
7020 }
7021 if (is_ts_option_unset("default_tileset_isohex_name")) {
7022 log_debug("Setting tileset for isohex topology.");
7024 }
7025}
struct @130::my_agent entries[MAX_AGENTS]
#define str
Definition astring.c:76
void audio_set_volume(double volume)
Definition audio.c:647
const struct strvec * get_musicset_list(const struct option *poption)
Definition audio.c:126
const struct strvec * get_soundset_list(const struct option *poption)
Definition audio.c:116
const struct strvec * get_soundplugin_list(const struct option *poption)
Definition audio.c:80
struct canvas int int int int struct sprite *sprite struct canvas struct color * pcolor
Definition canvas_g.h:56
int send_chat_printf(const char *format,...)
void output_window_vprintf(const struct ft_color color, const char *format, va_list args)
static int cmp(int v1, int v2)
Definition city.c:325
#define output_type_iterate(output)
Definition city.h:842
#define output_type_iterate_end
Definition city.h:848
int num_city_report_spec(void)
const char * city_report_spec_tagname(int i)
bool * city_report_spec_show_ptr(int i)
void user_ended_turn(void)
struct civclient client
enum client_states client_state(void)
char fc_password[MAX_LEN_PASSWORD]
#define client_player()
@ C_S_RUNNING
Definition client_main.h:47
bool mapimg_client_define(void)
Definition climisc.c:1409
void cm_init_parameter(struct cm_parameter *dest)
Definition cm.c:2183
char * cmafec_preset_get_descr(int idx)
Definition cma_fec.c:169
const struct cm_parameter * cmafec_preset_get_parameter(int idx)
Definition cma_fec.c:182
void cmafec_preset_add(const char *descr_name, struct cm_parameter *pparam)
Definition cma_fec.c:136
int cmafec_preset_num(void)
Definition cma_fec.c:213
void create_default_cma_presets(void)
Definition cma_fec.c:384
char * incite_cost
Definition comments.c:76
#define MAX_LEN_MSG
Definition conn_types.h:37
bool is_server_running(void)
#define log_deprecation(message,...)
enum event_type event
Definition events.c:81
void events_init(void)
Definition events.c:331
void events_free(void)
Definition events.c:377
#define Q_(String)
Definition fcintl.h:70
#define _(String)
Definition fcintl.h:67
#define N_(String)
Definition fcintl.h:69
const struct ft_color ftc_client
#define FT_COLOR(fg, bg)
static struct ft_color ft_color_construct(const char *foreground, const char *background)
static bool static void void global_worklists_init(void)
void global_worklists_load(struct section_file *file)
void global_worklists_free(void)
void global_worklists_save(struct section_file *file)
enum gui_type get_gui_type(void)
Definition gui_main.c:2078
void options_extra_init(void)
Definition gui_main.c:2480
static GtkTextBuffer * help_text
Definition helpdlg.c:70
void option_gui_remove(struct option *poption)
Definition optiondlg.c:1053
void option_dialog_popdown(const struct option_set *poptset)
Definition optiondlg.c:998
void option_gui_update(struct option *poption)
Definition optiondlg.c:1025
void science_report_dialog_redraw(void)
Definition repodlgs.c:761
void voteinfo_gui_update(void)
#define show(id)
Definition widget.h:235
gui_update_font
Definition gui_main_g.h:43
const char * name
Definition inputfile.c:127
@ FZ_PLAIN
Definition ioz.h:38
#define fc_assert_msg(condition, message,...)
Definition log.h:182
#define fc_assert_ret(condition)
Definition log.h:192
#define log_verbose(message,...)
Definition log.h:110
#define fc_assert(condition)
Definition log.h:177
#define fc_assert_ret_msg(condition, message,...)
Definition log.h:206
#define fc_assert_ret_val(condition, val)
Definition log.h:195
#define fc_assert_action(condition, action)
Definition log.h:188
#define log_debug(message,...)
Definition log.h:116
#define log_normal(message,...)
Definition log.h:108
log_level
Definition log.h:29
@ LOG_ERROR
Definition log.h:31
@ LOG_VERBOSE
Definition log.h:34
#define log_error(message,...)
Definition log.h:104
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:238
void update_turn_done_button_state(void)
bool can_end_turn(void)
bool mapimg_initialised(void)
Definition mapimg.c:1558
const struct strvec * mapimg_get_format_list(void)
Definition mapimg.c:1156
const char * mapimg_error(void)
Definition mapimg.c:759
void update_map_canvas_visible(void)
#define fc_calloc(n, esz)
Definition mem.h:38
#define FC_FREE(ptr)
Definition mem.h:41
#define fc_strdup(str)
Definition mem.h:43
void menus_init(void)
void musicspec_reread_callback(struct option *poption)
Definition music.c:129
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
str prefix(str prefix, str text)
static struct option * client_optset_option_first(void)
Definition options.c:3714
void handle_server_setting_const(const struct packet_server_setting_const *packet)
Definition options.c:4648
void handle_server_setting_int(const struct packet_server_setting_int *packet)
Definition options.c:4742
static int server_option_int_max(const struct option *poption)
Definition options.c:5175
static bool client_option_font_set(struct option *poption, const char *font)
Definition options.c:4083
unsigned option_bitwise_mask(const struct option *poption)
Definition options.c:1147
void fill_topo_ts_default(void)
Definition options.c:6996
#define FIRST_MAJOR_MID_OPTION_FILE_NAME
Definition options.c:5628
#define client_options_iterate_all_end
Definition options.c:3676
static const struct strvec * server_option_str_values(const struct option *poption)
Definition options.c:5221
static int client_option_enum_get(const struct option *poption)
Definition options.c:3942
void resend_desired_settable_options(void)
Definition options.c:6103
const struct strvec * option_str_values(const struct option *poption)
Definition options.c:966
static void desired_settable_option_send(struct option *poption)
Definition options.c:6017
static const char * client_option_name(const struct option *poption)
Definition options.c:3768
static int sync_serial
Definition options.c:450
static unsigned server_option_bitwise_def(const struct option *poption)
Definition options.c:5320
#define FIRST_MAJOR_NEW_OPTION_FILE_NAME
Definition options.c:5625
static const struct option_video_mode_vtable client_option_video_mode_vtable
Definition options.c:1457
#define GEN_STR_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb, cbd)
Definition options.c:1634
static struct dialog_options_hash * dialog_options_hash
Definition options.c:6149
static bool queue_save
Definition options.c:452
void option_changed(struct option *poption)
Definition options.c:799
static void menu_music_enable_callback(struct option *poption)
Definition options.c:6872
static bool options_fully_initialized
Definition options.c:448
static const struct option_str_vtable client_option_str_vtable
Definition options.c:1391
static int reply_serial
Definition options.c:451
unsigned option_bitwise_def(const struct option *poption)
Definition options.c:1136
int option_enum_str_to_int(const struct option *poption, const char *str)
Definition options.c:994
static const char * client_option_description(const struct option *poption)
Definition options.c:3776
int option_int_min(const struct option *poption)
Definition options.c:907
static void option_save_output_window_callback(enum log_level lvl, const char *msg,...)
Definition options.c:6428
static void message_options_save(struct section_file *file, const char *prefix)
Definition options.c:5534
bool option_bool_def(const struct option *poption)
Definition options.c:859
static struct option * client_option_next(const struct option *poption)
Definition options.c:3808
static const char * server_option_name(const struct option *poption)
Definition options.c:5068
const char * option_font_def(const struct option *poption)
Definition options.c:1203
const char * tileset_name_for_topology(int topology_id)
Definition options.c:6910
static const struct copt_val_name * gui_gtk_message_chat_location_name(int value)
Definition options.c:1890
static bool server_option_str_set(struct option *poption, const char *str)
Definition options.c:5230
static const struct copt_val_name * gui_popup_tech_help_name(int value)
Definition options.c:1910
struct option * optset_option_first(const struct option_set *poptset)
Definition options.c:498
static const char * server_optset_category_name(int category)
Definition options.c:5048
const struct option_set * server_optset
Definition options.c:4369
static void view_option_changed_callback(struct option *poption)
Definition options.c:6774
static const char * client_option_font_target(const struct option *poption)
Definition options.c:4074
static void server_option_enum_support_name(const struct option *poption, const char **pvalue, const char **pdefault)
Definition options.c:5294
#define GEN_INT_OPTION(oname, odesc, ohelp, ocat, ospec, odef, omin, omax, ocb)
Definition options.c:1596
static const char * server_option_description(const struct option *poption)
Definition options.c:5076
static unsigned server_option_bitwise_get(const struct option *poption)
Definition options.c:5312
static bool client_option_is_changeable(const struct option *poption)
Definition options.c:3800
static int server_option_int_min(const struct option *poption)
Definition options.c:5167
static const char * client_optset_category_name(int category)
Definition options.c:3730
static struct option * server_option_next(const struct option *poption)
Definition options.c:5108
static struct client_option client_options[]
Definition options.c:1937
#define SERVER_OPTION(poption)
Definition options.c:4505
static void settable_options_save(struct section_file *sf)
Definition options.c:5862
static bool server_option_bool_get(const struct option *poption)
Definition options.c:5116
bool option_reset(struct option *poption)
Definition options.c:760
void options_free(void)
Definition options.c:6712
const char * option_description(const struct option *poption)
Definition options.c:689
const char * option_help_text(const struct option *poption)
Definition options.c:699
#define settable_options_hash_iterate_end
Definition options.c:5788
static const char * client_option_font_get(const struct option *poption)
Definition options.c:4058
static int server_option_enum_def(const struct option *poption)
Definition options.c:5255
static int server_option_int_def(const struct option *poption)
Definition options.c:5159
#define client_options_iterate_all(poption)
Definition options.c:3667
static int client_option_int_min(const struct option *poption)
Definition options.c:3864
static int server_options_categories_num
Definition options.c:4351
const char * option_enum_get_str(const struct option *poption)
Definition options.c:1043
static struct ft_color client_option_color_def(const struct option *poption)
Definition options.c:4107
static const struct strvec * client_option_enum_pretty_names(const struct option *poption)
Definition options.c:3960
static bool server_option_enum_set(struct option *poption, int val)
Definition options.c:5274
static void save_cma_presets(struct section_file *file)
Definition options.c:5607
struct ft_color option_color_get(const struct option *poption)
Definition options.c:1241
static struct video_mode client_option_video_mode_def(const struct option *poption)
Definition options.c:4161
static int client_option_int_get(const struct option *poption)
Definition options.c:3848
static char ** server_options_categories
Definition options.c:4348
int option_enum_get_int(const struct option *poption)
Definition options.c:1031
static void settable_options_load(struct section_file *sf)
Definition options.c:5795
int option_number(const struct option *poption)
Definition options.c:669
static struct option * server_optset_option_first(void)
Definition options.c:5032
static struct settable_options_hash * settable_options_hash
Definition options.c:5790
int option_category(const struct option *poption)
Definition options.c:719
static struct server_option * server_options
Definition options.c:4349
static const struct option_int_vtable server_option_int_vtable
Definition options.c:4409
static void options_dialogs_save(struct section_file *sf)
Definition options.c:6183
static struct option_set client_optset_static
Definition options.c:1325
void options_sync_reply(int serial)
Definition options.c:6458
static bool client_option_color_set(struct option *poption, struct ft_color color)
Definition options.c:4116
#define dialog_options_hash_iterate_end
Definition options.c:6147
static void save_cma_preset(struct section_file *file, int i)
Definition options.c:5585
static int client_optset_category_number(void)
Definition options.c:3722
static const char * client_option_str_def(const struct option *poption)
Definition options.c:3906
static bool client_option_video_mode_set(struct option *poption, struct video_mode mode)
Definition options.c:4170
void handle_server_setting_bitwise(const struct packet_server_setting_bitwise *packet)
Definition options.c:4913
static const struct option_font_vtable client_option_font_vtable
Definition options.c:1432
static bool client_option_enum_set(struct option *poption, int val)
Definition options.c:3969
void desired_settable_option_update(const char *op_name, const char *op_value, bool allow_replace)
Definition options.c:5960
void option_set_default_ts(struct tileset *t)
Definition options.c:6937
bool option_str_set(struct option *poption, const char *str)
Definition options.c:977
void handle_server_setting_bool(const struct packet_server_setting_bool *packet)
Definition options.c:4707
static const struct strvec * client_option_str_values(const struct option *poption)
Definition options.c:3916
const struct option_set * client_optset
Definition options.c:1331
static const struct option_bool_vtable server_option_bool_vtable
Definition options.c:4397
static const struct option_bitwise_vtable server_option_bitwise_vtable
Definition options.c:4450
const char * option_name(const struct option *poption)
Definition options.c:679
static const char * client_option_help_text(const struct option *poption)
Definition options.c:3784
static void message_options_init(void)
Definition options.c:5407
static int client_option_number(const struct option *poption)
Definition options.c:3760
void handle_server_setting_str(const struct packet_server_setting_str *packet)
Definition options.c:4779
int option_int_get(const struct option *poption)
Definition options.c:885
static void client_option_save(struct option *poption, struct section_file *sf)
Definition options.c:4288
void options_init(void)
Definition options.c:6614
static int client_option_int_def(const struct option *poption)
Definition options.c:3856
static int server_option_category(const struct option *poption)
Definition options.c:5092
#define FIRST_MINOR_MID_OPTION_FILE_NAME
Definition options.c:5629
static const struct option_enum_vtable client_option_enum_vtable
Definition options.c:1404
static const struct option_str_vtable server_option_str_vtable
Definition options.c:4423
static int server_options_num
Definition options.c:4352
#define handle_server_setting_common(psoption, packet)
Definition options.c:4669
static const struct option_color_vtable client_option_color_vtable
Definition options.c:1444
bool option_enum_set_str(struct option *poption, const char *str)
Definition options.c:1108
static const struct strvec * server_option_enum_pretty(const struct option *poption)
Definition options.c:5265
static void server_option_bitwise_support_name(const struct option *poption, char *val_buf, size_t val_len, char *def_buf, size_t def_len)
Definition options.c:5380
bool option_color_set(struct option *poption, struct ft_color color)
Definition options.c:1264
#define SETTING_CASE(ARG_name,...)
static struct video_mode client_option_video_mode_get(const struct option *poption)
Definition options.c:4152
static bool is_ts_option_unset(const char *optname)
Definition options.c:6973
void option_set_changed_callback(struct option *poption, void(*callback)(struct option *))
Definition options.c:788
#define OPTION(poption)
Definition options.c:614
#define NEW_OPTION_FILE_NAME
Definition options.c:5622
static bool server_option_bool_set(struct option *poption, bool val)
Definition options.c:5133
bool option_bool_set(struct option *poption, bool val)
Definition options.c:870
bool option_is_changeable(const struct option *poption)
Definition options.c:740
#define GEN_ENUM_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb)
Definition options.c:1712
bool option_video_mode_set(struct option *poption, struct video_mode mode)
Definition options.c:1304
#define MID_OPTION_FILE_NAME
Definition options.c:5621
static int server_option_number(const struct option *poption)
Definition options.c:5060
#define dialog_options_hash_iterate(hash, column, visible)
Definition options.c:6145
#define FIRST_MINOR_NEW_BOOLEAN
Definition options.c:5632
static const char * server_option_str_get(const struct option *poption)
Definition options.c:5203
#define settable_options_hash_iterate(hash, name, value)
Definition options.c:5786
void option_set_gui_data(struct option *poption, void *data)
Definition options.c:818
#define FIRST_MINOR_NEW_OPTION_FILE_NAME
Definition options.c:5626
#define GEN_BOOL_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb)
Definition options.c:1560
const char * option_str_get(const struct option *poption)
Definition options.c:944
struct option * optset_option_by_number(const struct option_set *poptset, int id)
Definition options.c:471
static bool client_option_bool_get(const struct option *poption)
Definition options.c:3816
void * option_get_gui_data(const struct option *poption)
Definition options.c:828
static const char * server_option_str_def(const struct option *poption)
Definition options.c:5211
static const struct option_common_vtable client_option_common_vtable
Definition options.c:1351
static bool settable_option_upgrade_value(const struct option *poption, int old_value, char *buf, size_t buf_len)
Definition options.c:5977
const struct strvec * option_enum_values(const struct option *poption)
Definition options.c:1080
static const struct strvec * get_mapimg_format_list(const struct option *poption)
Definition options.c:6902
static void sound_volume_callback(struct option *poption)
Definition options.c:6800
bool option_enum_set_int(struct option *poption, int val)
Definition options.c:1091
bool option_bool_get(const struct option *poption)
Definition options.c:848
int optset_category_number(const struct option_set *poptset)
Definition options.c:508
#define color_set(color_tgt, color)
static bool client_option_bool_def(const struct option *poption)
Definition options.c:3824
static const struct strvec * server_option_bitwise_pretty(const struct option *poption)
Definition options.c:5330
void server_options_init(void)
Definition options.c:4513
enum option_type option_type(const struct option *poption)
Definition options.c:709
static int client_option_enum_def(const struct option *poption)
Definition options.c:3950
const char * option_enum_int_to_str(const struct option *poption, int val)
Definition options.c:1016
void options_dialogs_update(void)
Definition options.c:6198
int option_get_cb_data(const struct option *poption)
Definition options.c:838
bool video_mode_to_string(char *buf, size_t buf_len, struct video_mode *mode)
Definition options.c:6886
static void options_dialogs_load(struct section_file *sf)
Definition options.c:6154
const struct option_set * option_optset(const struct option *poption)
Definition options.c:659
void server_options_free(void)
Definition options.c:4582
struct video_mode option_video_mode_get(const struct option *poption)
Definition options.c:1279
static int server_option_enum_get(const struct option *poption)
Definition options.c:5247
struct option * option_next(const struct option *poption)
Definition options.c:750
static struct option * client_optset_option_by_number(int id)
Definition options.c:3703
static void font_changed_callback(struct option *poption)
Definition options.c:6816
const char * option_str_def(const struct option *poption)
Definition options.c:955
const char * optset_category_name(const struct option_set *poptset, int category)
Definition options.c:518
int option_int_max(const struct option *poption)
Definition options.c:918
#define GEN_COLOR_OPTION(oname, odesc, ohelp, ocat, ospec, odef_fg, odef_bg, ocb)
Definition options.c:1827
const char * option_enum_def_str(const struct option *poption)
Definition options.c:1067
void options_load(void)
Definition options.c:6259
static const char * client_option_str_get(const struct option *poption)
Definition options.c:3898
static option_save_log_callback queued_cb
Definition options.c:453
static const struct option_common_vtable server_option_common_vtable
Definition options.c:4383
static int server_optset_category_number(void)
Definition options.c:5040
static bool client_option_bool_set(struct option *poption, bool val)
Definition options.c:3833
static const char * server_option_help_text(const struct option *poption)
Definition options.c:5084
static const struct option_bool_vtable client_option_bool_vtable
Definition options.c:1365
static bool client_option_load(struct option *poption, struct section_file *sf)
Definition options.c:4187
bool option_font_set(struct option *poption, const char *font)
Definition options.c:1225
static bool server_option_bitwise_set(struct option *poption, unsigned val)
Definition options.c:5359
const char * option_font_target(const struct option *poption)
Definition options.c:1214
static const char * client_option_enum_secfile_str(secfile_data_t data, int val)
Definition options.c:3988
static struct server_option * server_option_next_valid(struct server_option *poption)
Definition options.c:5002
static void server_option_bitwise_support_base(const struct strvec *values, unsigned val, char *buf, size_t buf_len)
Definition options.c:5338
void queue_options_save(option_save_log_callback log_cb)
Definition options.c:6441
static void voteinfo_bar_callback(struct option *poption)
Definition options.c:6808
static struct option * server_optset_option_by_number(int id)
Definition options.c:5021
void options_save(option_save_log_callback log_cb)
Definition options.c:6472
static void message_options_free(void)
Definition options.c:5445
static const struct option_enum_vtable server_option_enum_vtable
Definition options.c:4436
bool string_to_video_mode(const char *buf, struct video_mode *mode)
Definition options.c:6894
const struct strvec * option_bitwise_values(const struct option *poption)
Definition options.c:1164
static bool server_option_int_set(struct option *poption, int val)
Definition options.c:5184
int messages_where[E_COUNT]
Definition options.c:5400
static void message_options_load(struct section_file *file, const char *prefix)
Definition options.c:5454
struct client_options gui_options
Definition options.c:71
static void server_option_free(struct server_option *poption)
Definition options.c:4524
#define CLIENT_OPTION(poption)
Definition options.c:1542
#define GEN_FONT_OPTION(oname, otgt, odesc, ohelp, ocat, ospec, odef, ocb)
Definition options.c:1791
static struct option_set server_optset_static
Definition options.c:4363
void handle_server_setting_control(const struct packet_server_setting_control *packet)
Definition options.c:4614
static void mapimg_changed_callback(struct option *poption)
Definition options.c:6825
bool option_bitwise_set(struct option *poption, unsigned val)
Definition options.c:1175
static int server_option_int_get(const struct option *poption)
Definition options.c:5151
static void manual_turn_done_callback(struct option *poption)
Definition options.c:6783
static void reqtree_show_icons_callback(struct option *poption)
Definition options.c:6766
const char * option_font_get(const struct option *poption)
Definition options.c:1192
void desired_settable_options_update(void)
Definition options.c:5892
static void load_cma_preset(struct section_file *file, int i)
Definition options.c:5555
static bool client_option_str_set(struct option *poption, const char *str)
Definition options.c:3926
void handle_server_setting_enum(const struct packet_server_setting_enum *packet)
Definition options.c:4824
struct ft_color option_color_def(const struct option *poption)
Definition options.c:1252
static int client_option_int_max(const struct option *poption)
Definition options.c:3872
#define GEN_STR_LIST_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb, cbd)
Definition options.c:1675
client_option_category
Definition options.c:1463
@ COC_MAX
Definition options.c:1471
@ COC_SOUND
Definition options.c:1466
@ COC_NETWORK
Definition options.c:1469
@ COC_INTERFACE
Definition options.c:1467
@ COC_GRAPHICS
Definition options.c:1464
@ COC_OVERVIEW
Definition options.c:1465
@ COC_FONT
Definition options.c:1470
@ COC_MAPIMG
Definition options.c:1468
unsigned option_bitwise_get(const struct option *poption)
Definition options.c:1125
static bool server_option_is_changeable(const struct option *poption)
Definition options.c:5100
static struct ft_color client_option_color_get(const struct option *poption)
Definition options.c:4099
int option_enum_def_int(const struct option *poption)
Definition options.c:1055
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:482
static const int client_options_num
Definition options.c:3664
static bool client_option_int_set(struct option *poption, int val)
Definition options.c:3881
void options_dialogs_set(void)
Definition options.c:6226
bool option_int_set(struct option *poption, int val)
Definition options.c:929
static struct client_option * client_option_next_valid(struct client_option *poption)
Definition options.c:3685
static const char * client_option_bitwise_secfile_str(secfile_data_t data, int val)
Definition options.c:4046
#define GEN_VIDEO_OPTION(oname, odesc, ohelp, ocat, ospec, odef_width, odef_height, ocb)
Definition options.c:1862
static const struct option_int_vtable client_option_int_vtable
Definition options.c:1377
static const char * client_option_font_def(const struct option *poption)
Definition options.c:4066
static const char * get_last_option_file_name(bool *allow_digital_boolean)
Definition options.c:5676
const char * option_category_name(const struct option *poption)
Definition options.c:729
static void game_music_enable_callback(struct option *poption)
Definition options.c:6858
static const char * get_current_option_file_name(void)
Definition options.c:5641
int option_int_def(const struct option *poption)
Definition options.c:896
static void options_init_names(const struct copt_val_name *(*acc)(int), struct strvec **support, struct strvec **pretty)
Definition options.c:6596
struct video_mode option_video_mode_def(const struct option *poption)
Definition options.c:1291
static bool server_option_bool_def(const struct option *poption)
Definition options.c:5124
#define GUI_GTK5_OPTIONSDLG_MIN_YSIZE
Definition options.h:763
#define GUI_GTK3_CITYDLG_DEFAULT_XSIZE
Definition options.h:653
#define GUI_GTK3_22_GOV_RANGE_MIN_DEFAULT
Definition options.h:696
#define GUI_GTK5_CITYDLG_DEFAULT_XSIZE
Definition options.h:740
#define MW_POPUP
Definition options.h:631
#define GUI_GTK3_CITYDLG_MAX_YSIZE
Definition options.h:659
#define GUI_GTK3_22_OPTIONSDLG_MAX_XSIZE
Definition options.h:690
#define GUI_GTK3_22_OPTIONSDLG_DEFAULT_YSIZE
Definition options.h:692
#define GUI_GTK3_22_GOV_RANGE_MIN_MIN
Definition options.h:697
@ GUI_POPUP_TECH_HELP_RULESET
Definition options.h:77
#define GUI_GTK3_GOV_RANGE_MIN_DEFAULT
Definition options.h:661
#define GUI_GTK3_22_HELPDLG_MIN_YSIZE
Definition options.h:684
#define GUI_GTK4_GOV_RANGE_MIN_MAX
Definition options.h:733
#define GUI_GTK3_22_CITYDLG_MIN_YSIZE
Definition options.h:675
#define GUI_GTK4_CITYDLG_MAX_XSIZE
Definition options.h:707
#define GUI_GTK4_GOV_RANGE_MIN_DEFAULT
Definition options.h:731
#define GUI_GTK5_CITYDLG_MAX_XSIZE
Definition options.h:742
#define GUI_GTK3_GOV_RANGE_MAX_DEFAULT
Definition options.h:665
void(* option_save_log_callback)(enum log_level lvl, const char *msg,...)
Definition options.h:494
#define GUI_GTK4_OPTIONSDLG_MIN_XSIZE
Definition options.h:724
#define GUI_GTK4_CITYDLG_DEFAULT_XSIZE
Definition options.h:705
#define FC_SDL3_DEFAULT_THEME_NAME
Definition options.h:441
#define GUI_GTK2_CITYDLG_DEFAULT_YSIZE
Definition options.h:645
#define GUI_GTK5_GOV_RANGE_MAX_MAX
Definition options.h:772
#define GUI_GTK4_HELPDLG_MAX_YSIZE
Definition options.h:720
#define FC_GTK3_22_DEFAULT_THEME_NAME
Definition options.h:301
#define GUI_GTK3_22_CITYDLG_DEFAULT_XSIZE
Definition options.h:670
#define FC_QT_DEFAULT_THEME_NAME
Definition options.h:453
#define GUI_GTK3_22_HELPDLG_MIN_XSIZE
Definition options.h:680
#define GUI_GTK4_OPTIONSDLG_DEFAULT_YSIZE
Definition options.h:727
#define GUI_GTK3_CITYDLG_MIN_YSIZE
Definition options.h:658
#define GUI_GTK3_CITYDLG_MIN_XSIZE
Definition options.h:654
#define GUI_GTK3_22_CITYDLG_DEFAULT_YSIZE
Definition options.h:674
#define GUI_GTK5_OPTIONSDLG_DEFAULT_XSIZE
Definition options.h:758
#define GUI_GTK4_OPTIONSDLG_MIN_YSIZE
Definition options.h:728
#define GUI_GTK5_OPTIONSDLG_MAX_XSIZE
Definition options.h:760
#define GUI_GTK4_CITYDLG_MIN_YSIZE
Definition options.h:710
#define DEFAULT_FOLLOWTAG_OPTION
Definition options.h:30
#define GUI_GTK5_CITYDLG_DEFAULT_YSIZE
Definition options.h:744
#define GUI_GTK2_CITYDLG_MIN_YSIZE
Definition options.h:646
#define GUI_GTK5_OPTIONSDLG_MIN_XSIZE
Definition options.h:759
#define options_iterate(poptset, poption)
Definition options.h:602
#define GUI_GTK3_22_OPTIONSDLG_MAX_YSIZE
Definition options.h:694
#define GUI_GTK2_CITYDLG_MAX_XSIZE
Definition options.h:643
#define GUI_DEFAULT_CHAT_LOGFILE
Definition options.h:638
#define GUI_GTK5_CITYDLG_MAX_YSIZE
Definition options.h:746
#define GUI_GTK3_22_HELPDLG_DEFAULT_YSIZE
Definition options.h:683
#define GUI_GTK4_HELPDLG_MIN_XSIZE
Definition options.h:715
#define GUI_GTK3_GOV_RANGE_MAX_MAX
Definition options.h:667
#define GUI_GTK4_CITYDLG_MIN_XSIZE
Definition options.h:706
#define GUI_GTK4_HELPDLG_MIN_YSIZE
Definition options.h:719
#define GUI_GTK3_22_GOV_RANGE_MAX_DEFAULT
Definition options.h:700
#define DEFAULT_METASERVER_OPTION
Definition options.h:29
#define GUI_GTK3_CITYDLG_DEFAULT_YSIZE
Definition options.h:657
static struct video_mode video_mode_construct(int width, int height)
Definition options.h:57
#define GUI_GTK3_22_CITYDLG_MAX_XSIZE
Definition options.h:672
#define GUI_GTK4_OPTIONSDLG_MAX_XSIZE
Definition options.h:725
#define GUI_GTK3_22_GOV_RANGE_MAX_MIN
Definition options.h:701
#define GUI_GTK5_GOV_RANGE_MAX_MIN
Definition options.h:771
#define GUI_GTK3_GOV_RANGE_MIN_MIN
Definition options.h:662
#define GUI_GTK3_GOV_RANGE_MIN_MAX
Definition options.h:663
#define GUI_GTK3_22_CITYDLG_MIN_XSIZE
Definition options.h:671
#define GUI_GTK5_HELPDLG_MIN_XSIZE
Definition options.h:750
@ GUI_GTK_MSGCHAT_SEPARATE
Definition options.h:68
#define FC_GTK5_DEFAULT_THEME_NAME
Definition options.h:381
#define GUI_GTK5_HELPDLG_DEFAULT_XSIZE
Definition options.h:749
#define GUI_GTK4_GOV_RANGE_MAX_DEFAULT
Definition options.h:735
#define MAJOR_NEW_OPTION_FILE_NAME
Definition options.h:38
#define GUI_GTK4_HELPDLG_DEFAULT_YSIZE
Definition options.h:718
#define GUI_GTK3_22_HELPDLG_DEFAULT_XSIZE
Definition options.h:679
#define GUI_GTK3_22_OPTIONSDLG_MIN_YSIZE
Definition options.h:693
#define GUI_GTK3_GOV_RANGE_MAX_MIN
Definition options.h:666
#define GUI_GTK2_CITYDLG_MAX_YSIZE
Definition options.h:647
#define GUI_DEFAULT_MAPIMG_FILENAME
Definition options.h:774
#define GUI_GTK5_CITYDLG_MIN_XSIZE
Definition options.h:741
#define GUI_GTK3_22_HELPDLG_MAX_YSIZE
Definition options.h:685
#define GUI_GTK3_22_CITYDLG_MAX_YSIZE
Definition options.h:676
#define GUI_GTK4_HELPDLG_MAX_XSIZE
Definition options.h:716
#define GUI_GTK4_GOV_RANGE_MIN_MIN
Definition options.h:732
#define GUI_GTK5_GOV_RANGE_MIN_DEFAULT
Definition options.h:766
#define GUI_GTK4_CITYDLG_MAX_YSIZE
Definition options.h:711
#define MW_OUTPUT
Definition options.h:629
#define GUI_GTK5_GOV_RANGE_MAX_DEFAULT
Definition options.h:770
#define GUI_GTK5_HELPDLG_MAX_XSIZE
Definition options.h:751
#define GUI_GTK4_CITYDLG_DEFAULT_YSIZE
Definition options.h:709
#define options_iterate_end
Definition options.h:607
#define GUI_GTK5_GOV_RANGE_MIN_MAX
Definition options.h:768
#define GUI_GTK3_22_OPTIONSDLG_MIN_XSIZE
Definition options.h:689
#define GUI_GTK5_HELPDLG_MIN_YSIZE
Definition options.h:754
#define GUI_GTK4_GOV_RANGE_MAX_MAX
Definition options.h:737
#define MW_MESSAGES
Definition options.h:630
#define FC_GTK4_DEFAULT_THEME_NAME
Definition options.h:341
#define GUI_GTK3_22_GOV_RANGE_MIN_MAX
Definition options.h:698
#define GUI_GTK4_HELPDLG_DEFAULT_XSIZE
Definition options.h:714
#define MINOR_NEW_OPTION_FILE_NAME
Definition options.h:42
#define GUI_GTK5_OPTIONSDLG_DEFAULT_YSIZE
Definition options.h:762
#define GUI_GTK2_CITYDLG_DEFAULT_XSIZE
Definition options.h:641
#define FC_SDL2_DEFAULT_THEME_NAME
Definition options.h:428
#define GUI_GTK3_22_GOV_RANGE_MAX_MAX
Definition options.h:702
#define GUI_GTK5_HELPDLG_MAX_YSIZE
Definition options.h:755
#define GUI_GTK3_22_OPTIONSDLG_DEFAULT_XSIZE
Definition options.h:688
#define GUI_GTK5_OPTIONSDLG_MAX_YSIZE
Definition options.h:764
#define VIDEO_MODE(ARG_width, ARG_height)
Definition options.h:51
#define GUI_GTK5_GOV_RANGE_MIN_MIN
Definition options.h:767
@ OLAYER_BORDERS
Definition options.h:83
@ OLAYER_BACKGROUND
Definition options.h:81
@ OLAYER_CITIES
Definition options.h:86
@ OLAYER_BORDERS_ON_OCEAN
Definition options.h:84
@ OLAYER_UNITS
Definition options.h:85
@ OLAYER_RELIEF
Definition options.h:82
#define GUI_GTK5_HELPDLG_DEFAULT_YSIZE
Definition options.h:753
#define GUI_GTK4_OPTIONSDLG_MAX_YSIZE
Definition options.h:729
#define GUI_GTK3_CITYDLG_MAX_XSIZE
Definition options.h:655
#define GUI_GTK3_22_HELPDLG_MAX_XSIZE
Definition options.h:681
#define GUI_GTK4_GOV_RANGE_MAX_MIN
Definition options.h:736
#define GUI_GTK4_OPTIONSDLG_DEFAULT_XSIZE
Definition options.h:723
#define GUI_GTK5_CITYDLG_MIN_YSIZE
Definition options.h:745
#define GUI_GTK2_CITYDLG_MIN_XSIZE
Definition options.h:642
void overview_redraw_callback(struct option *option)
int dsend_packet_sync_serial(struct connection *pc, int serial)
#define is_ai(plr)
Definition player.h:232
struct player_dlg_column player_dlg_columns[]
const int num_player_dlg_columns
struct section_file * secfile_load(const char *filename, bool allow_duplicates)
Definition registry.c:51
void secfile_allow_digital_boolean(struct section_file *secfile, bool allow_digital_boolean) fc__attribute((nonnull(1)))
struct section_file * secfile_new(bool allow_duplicates)
const char * secfile_error(void)
const char * section_name(const struct section *psection)
void secfile_destroy(struct section_file *secfile)
bool entry_bool_get(const struct entry *pentry, bool *value)
bool secfile_lookup_int(const struct section_file *secfile, int *ival, const char *path,...)
bool secfile_lookup_enum_data(const struct section_file *secfile, int *pvalue, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...)
const struct entry_list * section_entries(const struct section *psection)
const char * entry_name(const struct entry *pentry)
bool entry_str_get(const struct entry *pentry, const char **value)
const char * secfile_lookup_str(const struct section_file *secfile, const char *path,...)
float secfile_lookup_float_default(const struct section_file *secfile, float def, const char *path,...)
bool secfile_save(const struct section_file *secfile, const char *filename, int compression_level, enum fz_method compression_method)
bool secfile_lookup_bool_default(const struct section_file *secfile, bool def, const char *path,...)
int secfile_lookup_int_default(const struct section_file *secfile, int def, const char *path,...)
bool entry_int_get(const struct entry *pentry, int *value)
const char * secfile_name(const struct section_file *secfile)
struct section * secfile_section_by_name(const struct section_file *secfile, const char *name)
const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...)
bool secfile_lookup_bool(const struct section_file *secfile, bool *bval, const char *path,...)
enum entry_type entry_type_get(const struct entry *pentry)
#define secfile_insert_int(secfile, value, path,...)
#define secfile_insert_bool_comment(secfile, value, comment, path,...)
@ ENTRY_FILEREFERENCE
@ ENTRY_LONG_COMMENT
@ ENTRY_INT
@ ENTRY_FLOAT
@ ENTRY_STR
@ ENTRY_ILLEGAL
@ ENTRY_BOOL
#define entry_list_iterate_end
#define secfile_insert_str(secfile, string, path,...)
#define secfile_insert_bool(secfile, value, path,...)
#define entry_list_iterate(entlist, pentry)
#define secfile_insert_enum_data(secfile, value, bitwise, name_fn, data, path,...)
#define secfile_insert_int_comment(secfile, value, comment, path,...)
#define secfile_insert_float(secfile, value, path,...)
const void * secfile_data_t
char * user_home_dir(void)
Definition shared.c:627
bool str_to_int(const char *str, int *pint)
Definition shared.c:515
bool make_dir(const char *pathname, int mode)
Definition shared.c:1779
char * freeciv_storage_dir(void)
Definition shared.c:671
#define DIR_SEPARATOR
Definition shared.h:127
#define DIR_SEPARATOR_CHAR
Definition shared.h:128
#define ARRAY_SIZE(x)
Definition shared.h:85
#define MIN(x, y)
Definition shared.h:55
#define DIRMODE_DEFAULT
Definition shared.h:258
#define MAX(x, y)
Definition shared.h:54
size_t size
Definition specvec.h:72
void strvec_destroy(struct strvec *psv)
bool strvec_set(struct strvec *psv, size_t svindex, const char *string)
void strvec_append(struct strvec *psv, const char *string)
void strvec_reserve(struct strvec *psv, size_t reserve)
const char * strvec_get(const struct strvec *psv, size_t svindex)
struct strvec * strvec_new(void)
size_t strvec_size(const struct strvec *psv)
struct connection conn
Definition client_main.h:96
const int def
Definition options.c:1495
const unsigned def
Definition options.c:1518
struct client_option::@239::@246 font
enum gui_type specific
Definition options.c:1484
struct client_option::@239::@242 integer
struct client_option::@239::@243 string
const char * description
Definition options.c:1481
const char *const def
Definition options.c:1501
struct ft_color *const pvalue
Definition options.c:1531
struct video_mode *const pvalue
Definition options.c:1536
const size_t size
Definition options.c:1500
char *const pvalue
Definition options.c:1499
const int max
Definition options.c:1495
const bool def
Definition options.c:1490
const char *const target
Definition options.c:1527
bool *const pvalue
Definition options.c:1489
struct option base_option
Definition options.c:1478
const char * help_text
Definition options.c:1482
unsigned *const pvalue
Definition options.c:1517
enum client_option_category category
Definition options.c:1483
int *const pvalue
Definition options.c:1494
const char * name
Definition options.c:1480
bool gui_gtk3_22_migrated_from_gtk3
Definition options.h:134
bool gui_gtk2_migrated_from_2_5
Definition options.h:139
bool gui_sdl2_migrated_from_sdl
Definition options.h:137
bool sound_enable_menu_music
Definition options.h:189
char default_tileset_hex_name[512]
Definition options.h:117
bool gui_qt_show_relations_panel
Definition options.h:469
char default_tileset_iso_name[512]
Definition options.h:132
bool gui_qt_show_techs_panel
Definition options.h:470
char default_tileset_name[512]
Definition options.h:130
bool gui_gtk5_migrated_from_gtk4
Definition options.h:135
bool send_desired_settings
Definition options.h:113
char default_tileset_overhead_name[512]
Definition options.h:131
bool gui_gtk3_migrated_from_2_5
Definition options.h:140
int default_topology
Definition options.h:123
char default_tileset_square_name[512]
Definition options.h:116
bool save_options_on_exit
Definition options.h:125
int sound_effects_volume
Definition options.h:191
bool ai_manual_turn_done
Definition options.h:155
bool gui_sdl2_default_screen_size_set
Definition options.h:143
bool gui_sdl3_default_screen_size_set
Definition options.h:144
int smooth_combat_step_msec
Definition options.h:154
bool first_boot
Definition options.h:128
float zoom_default_level
Definition options.h:232
char default_tileset_isohex_name[512]
Definition options.h:118
bool gui_qt_migrated_from_2_5
Definition options.h:141
bool popup_actor_arrival
Definition options.h:169
bool gui_sdl3_migrated_from_sdl2
Definition options.h:138
bool gui_qt_show_wonders_panel
Definition options.h:471
bool sound_enable_game_music
Definition options.h:190
bool migrate_fullscreen
Definition options.h:146
bool gui_qt_default_fonts_set
Definition options.h:142
bool gui_gtk3_migrated_from_gtk2
Definition options.h:133
char default_user_name[512]
Definition options.h:108
bool gui_gtk4_migrated_from_gtk3_22
Definition options.h:136
bool allow_disorder
Definition cm.h:44
int factor[O_LAST]
Definition cm.h:47
bool allow_specialists
Definition cm.h:45
bool require_happy
Definition cm.h:43
int minimal_surplus[O_LAST]
Definition cm.h:41
int happy_factor
Definition cm.h:48
Definition colors.h:21
const char * support
Definition options.c:1334
const char * pretty
Definition options.c:1336
int(* number)(const struct option *)
Definition options.c:538
int(* category)(const struct option *)
Definition options.c:542
bool(* is_changeable)(const struct option *)
Definition options.c:543
struct option *(* option_by_number)(int)
Definition options.c:461
struct option *(* option_first)(void)
Definition options.c:462
const char *(* category_name)(int)
Definition options.c:465
int(* category_number)(void)
Definition options.c:464
const struct option::@237::option_color_vtable * color_vtable
const struct option::option_common_vtable * common_vtable
const struct option::@237::option_int_vtable * int_vtable
const struct option::@237::option_bitwise_vtable * bitwise_vtable
const struct option::@237::option_font_vtable * font_vtable
enum option_type type
Definition options.c:534
const struct option_set * poptset
Definition options.c:532
const struct option::@237::option_bool_vtable * bool_vtable
const struct option::@237::option_enum_vtable * enum_vtable
int callback_data
Definition options.c:608
const struct option::@237::option_video_mode_vtable * video_mode_vtable
void(* changed_callback)(struct option *option)
Definition options.c:606
void * gui_data
Definition options.c:611
const struct option::@237::option_str_vtable * str_vtable
bool fog
Definition options.h:102
bool layers[OLAYER_COUNT]
Definition options.h:103
char support_names[64][MAX_LEN_NAME]
char pretty_names[64][MAX_LEN_ENUM]
char name[MAX_LEN_NAME]
char short_help[MAX_LEN_PACKET]
char extra_help[MAX_LEN_PACKET]
char category_names[256][MAX_LEN_NAME]
char pretty_names[64][MAX_LEN_ENUM]
char support_names[64][MAX_LEN_NAME]
char default_val[MAX_LEN_PACKET]
char val[MAX_LEN_PACKET]
bool allow_digital_boolean
struct strvec * support_names
Definition options.c:4492
unsigned value
Definition options.c:4497
char * help_text
Definition options.c:4465
char * name
Definition options.c:4463
bool is_visible
Definition options.c:4469
char * description
Definition options.c:4464
unsigned char category
Definition options.c:4466
struct strvec * pretty_names
Definition options.c:4493
enum setting_default_level setdef
Definition options.c:4470
struct server_option::@249::@252 integer
unsigned def
Definition options.c:4498
bool is_changeable
Definition options.c:4468
char * value
Definition options.c:4485
struct option base_option
Definition options.c:4461
bool desired_sent
Definition options.c:4467
int height
Definition options.h:48
int width
Definition options.h:47
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
size_t fc_strlcpy(char *dest, const char *src, size_t n)
Definition support.c:777
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:186
size_t fc_strlcat(char *dest, const char *src, size_t n)
Definition support.c:822
int fc_stat(const char *filename, struct stat *buf)
Definition support.c:574
#define sz_strlcpy(dest, src)
Definition support.h:195
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
#define bool
Definition support.h:71
#define fc_strncmp(_s1_, _s2_, _len_)
Definition support.h:160
void theme_reread_callback(struct option *poption)
const struct strvec * get_themes_list(const struct option *poption)
bool tilespec_try_read(const char *tileset_name, bool verbose, int topo_id, bool global_default)
Definition tilespec.c:1360
const struct strvec * get_tileset_list(const struct option *poption)
Definition tilespec.c:1150
const char * tileset_basename(const struct tileset *t)
Definition tilespec.c:730
void tilespec_reread_callback(struct option *poption)
Definition tilespec.c:1555
int tileset_topo_index(struct tileset *t)
Definition tilespec.c:7812
#define TS_TOPO_ISOHEX
Definition tilespec.h:455
#define TS_TOPO_HEX
Definition tilespec.h:454
#define TS_TOPO_SQUARE
Definition tilespec.h:453