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_popup_tech_help = GUI_POPUP_TECH_HELP_RULESET,
298 .gui_gtk3_22_governor_range_min = -20,
299 .gui_gtk3_22_governor_range_max = 20,
300 .gui_gtk3_22_font_city_label = "Monospace 8",
301 .gui_gtk3_22_font_notify_label = "Monospace Bold 9",
302 .gui_gtk3_22_font_spaceship_label = "Monospace 8",
303 .gui_gtk3_22_font_help_label = "Sans Bold 10",
304 .gui_gtk3_22_font_help_link = "Sans 9",
305 .gui_gtk3_22_font_help_text = "Monospace 8",
306 .gui_gtk3_22_font_chatline = "Monospace 8",
307 .gui_gtk3_22_font_beta_label = "Sans Italic 10",
308 .gui_gtk3_22_font_small = "Sans 9",
309 .gui_gtk3_22_font_comment_label = "Sans Italic 9",
310 .gui_gtk3_22_font_city_names = "Sans Bold 10",
311 .gui_gtk3_22_font_city_productions = "Serif 10",
312 .gui_gtk3_22_font_reqtree_text = "Serif 10",
313
314/* gui-gtk-4.0 client specific options. */
315 .gui_gtk4_default_theme_name = FC_GTK4_DEFAULT_THEME_NAME,
316 .gui_gtk4_fullscreen = FALSE,
317 .gui_gtk4_map_scrollbars = FALSE,
318 .gui_gtk4_dialogs_on_top = TRUE,
319 .gui_gtk4_show_task_icons = TRUE,
320 .gui_gtk4_enable_tabs = TRUE,
321 .gui_gtk4_show_chat_message_time = FALSE,
322 .gui_gtk4_new_messages_go_to_top = FALSE,
323 .gui_gtk4_show_message_window_buttons = TRUE,
324 .gui_gtk4_metaserver_tab_first = FALSE,
325 .gui_gtk4_allied_chat_only = FALSE,
326 .gui_gtk4_message_chat_location = GUI_GTK_MSGCHAT_SEPARATE,
327 .gui_gtk4_small_display_layout = FALSE,
328 .gui_gtk4_mouse_over_map_focus = FALSE,
329 .gui_gtk4_chatline_autocompletion = TRUE,
330 .gui_gtk4_citydlg_xsize = GUI_GTK4_CITYDLG_DEFAULT_XSIZE,
331 .gui_gtk4_citydlg_ysize = GUI_GTK4_CITYDLG_DEFAULT_YSIZE,
332 .gui_gtk4_popup_tech_help = GUI_POPUP_TECH_HELP_RULESET,
333 .gui_gtk4_governor_range_min = -20,
334 .gui_gtk4_governor_range_max = 20,
335 .gui_gtk4_font_city_label = "Monospace 8",
336 .gui_gtk4_font_notify_label = "Monospace Bold 9",
337 .gui_gtk4_font_spaceship_label = "Monospace 8",
338 .gui_gtk4_font_help_label = "Sans Bold 10",
339 .gui_gtk4_font_help_link = "Sans 9",
340 .gui_gtk4_font_help_text = "Monospace 8",
341 .gui_gtk4_font_chatline = "Monospace 8",
342 .gui_gtk4_font_beta_label = "Sans Italic 10",
343 .gui_gtk4_font_small = "Sans 9",
344 .gui_gtk4_font_comment_label = "Sans Italic 9",
345 .gui_gtk4_font_city_names = "Sans Bold 10",
346 .gui_gtk4_font_city_productions = "Serif 10",
347 .gui_gtk4_font_reqtree_text = "Serif 10",
348
349/* gui-gtk-5.0 client specific options. */
350 .gui_gtk5_default_theme_name = FC_GTK5_DEFAULT_THEME_NAME,
351 .gui_gtk5_fullscreen = FALSE,
352 .gui_gtk5_map_scrollbars = FALSE,
353 .gui_gtk5_dialogs_on_top = TRUE,
354 .gui_gtk5_show_task_icons = TRUE,
355 .gui_gtk5_enable_tabs = TRUE,
356 .gui_gtk5_show_chat_message_time = FALSE,
357 .gui_gtk5_new_messages_go_to_top = FALSE,
358 .gui_gtk5_show_message_window_buttons = TRUE,
359 .gui_gtk5_metaserver_tab_first = FALSE,
360 .gui_gtk5_allied_chat_only = FALSE,
361 .gui_gtk5_message_chat_location = GUI_GTK_MSGCHAT_SEPARATE,
362 .gui_gtk5_small_display_layout = FALSE,
363 .gui_gtk5_mouse_over_map_focus = FALSE,
364 .gui_gtk5_chatline_autocompletion = TRUE,
365 .gui_gtk5_citydlg_xsize = GUI_GTK5_CITYDLG_DEFAULT_XSIZE,
366 .gui_gtk5_citydlg_ysize = GUI_GTK5_CITYDLG_DEFAULT_YSIZE,
367 .gui_gtk5_popup_tech_help = GUI_POPUP_TECH_HELP_RULESET,
368 .gui_gtk5_governor_range_min = -20,
369 .gui_gtk5_governor_range_max = 20,
370 .gui_gtk5_font_city_label = "Monospace 8",
371 .gui_gtk5_font_notify_label = "Monospace Bold 9",
372 .gui_gtk5_font_spaceship_label = "Monospace 8",
373 .gui_gtk5_font_help_label = "Sans Bold 10",
374 .gui_gtk5_font_help_link = "Sans 9",
375 .gui_gtk5_font_help_text = "Monospace 8",
376 .gui_gtk5_font_chatline = "Monospace 8",
377 .gui_gtk5_font_beta_label = "Sans Italic 10",
378 .gui_gtk5_font_small = "Sans 9",
379 .gui_gtk5_font_comment_label = "Sans Italic 9",
380 .gui_gtk5_font_city_names = "Sans Bold 10",
381 .gui_gtk5_font_city_productions = "Serif 10",
382 .gui_gtk5_font_reqtree_text = "Serif 10",
383
384/* gui-sdl client specific options. */
385 .gui_sdl_fullscreen = FALSE,
386 .gui_sdl_screen = VIDEO_MODE(640, 480),
387 .gui_sdl_do_cursor_animation = TRUE,
388 .gui_sdl_use_color_cursors = TRUE,
389
390/* gui-sdl2 client specific options. */
391 .gui_sdl2_default_theme_name = FC_SDL2_DEFAULT_THEME_NAME,
392 .gui_sdl2_fullscreen = FALSE,
393 .gui_sdl2_screen = VIDEO_MODE(640, 480),
394 .gui_sdl2_swrenderer = FALSE,
395 .gui_sdl2_do_cursor_animation = TRUE,
396 .gui_sdl2_use_color_cursors = TRUE,
397 .gui_sdl2_font_city_names = "10",
398 .gui_sdl2_font_city_productions = "10",
399 .gui_sdl2_use_theme_font_size = TRUE,
400 .gui_sdl2_font_size = 10,
401
402/* gui-sdl3 client specific options. */
403 .gui_sdl3_default_theme_name = FC_SDL2_DEFAULT_THEME_NAME,
404 .gui_sdl3_fullscreen = FALSE,
405 .gui_sdl3_screen = VIDEO_MODE(640, 480),
406 .gui_sdl3_do_cursor_animation = TRUE,
407 .gui_sdl3_use_color_cursors = TRUE,
408 .gui_sdl3_font_city_names = "10",
409 .gui_sdl3_font_city_productions = "10",
410 .gui_sdl3_use_theme_font_size = TRUE,
411 .gui_sdl3_font_size = 10,
412
413/* gui-qt client specific options. */
414 .gui_qt_fullscreen = FALSE,
415 .gui_qt_show_preview = TRUE,
416 .gui_qt_sidebar_left = TRUE,
417 .gui_qt_default_theme_name = FC_QT_DEFAULT_THEME_NAME,
418 .gui_qt_font_default = "Sans Serif,10,-1,5,75,0,0,0,0,0",
419 .gui_qt_font_notify_label = "Monospace,8,-1,5,75,0,0,0,0,0",
420 .gui_qt_font_help_label = "Sans Serif,9,-1,5,50,0,0,0,0,0",
421 .gui_qt_font_help_text = "Monospace,8,-1,5,50,0,0,0,0,0",
422 .gui_qt_font_chatline = "Monospace,8,-1,5,50,0,0,0,0,0",
423 .gui_qt_font_city_names = "Sans Serif,10,-1,5,75,0,0,0,0,0",
424 .gui_qt_font_city_productions = "Sans Serif,10,-1,5,50,1,0,0,0,0",
425 .gui_qt_font_reqtree_text = "Sans Serif,10,-1,5,50,1,0,0,0,0",
426 .gui_qt_show_titlebar = TRUE,
427 .gui_qt_wakeup_text = "Wake up %1",
428 .gui_qt_show_relations_panel = TRUE,
429 .gui_qt_show_techs_panel = TRUE,
430 .gui_qt_show_wonders_panel = TRUE,
431 .gui_qt_svgflags = TRUE
432};
433
434/* Set to TRUE after the first call to options_init(), to avoid the usage
435 * of non-initialized datas when calling the changed callback. */
437
438static int sync_serial = 0;
439
440static const struct strvec *get_mapimg_format_list(const struct option *poption);
441
442/****************************************************************************
443 Option set structure.
444****************************************************************************/
446 struct option * (*option_by_number) (int);
447 struct option * (*option_first) (void);
448
450 const char * (*category_name) (int);
451};
452
453/************************************************************************/
457 int id)
458{
460
461 return poptset->option_by_number(id);
462}
463
464/************************************************************************/
468 const char *name)
469{
471
473 if (0 == strcmp(option_name(poption), name)) {
474 return poption;
475 }
477 return NULL;
478}
479
480/************************************************************************/
484{
486
487 return poptset->option_first();
488}
489
490/************************************************************************/
494{
496
497 return poptset->category_number();
498}
499
500/************************************************************************/
503const char *optset_category_name(const struct option_set *poptset,
504 int category)
505{
507
508 return poptset->category_name(category);
509}
510
511
512/****************************************************************************
513 The base class for options.
514****************************************************************************/
515struct option {
516 /* A link to the option set. */
517 const struct option_set *poptset;
518 /* Type of the option. */
520
521 /* Common accessors. */
522 const struct option_common_vtable {
523 int (*number) (const struct option *);
524 const char * (*name) (const struct option *);
525 const char * (*description) (const struct option *);
526 const char * (*help_text) (const struct option *);
527 int (*category) (const struct option *);
528 bool (*is_changeable) (const struct option *);
529 struct option * (*next) (const struct option *);
531 /* Specific typed accessors. */
532 union {
533 /* Specific boolean accessors (OT_BOOLEAN == type). */
534 const struct option_bool_vtable {
535 bool (*get) (const struct option *);
536 bool (*def) (const struct option *);
537 bool (*set) (struct option *, bool);
539 /* Specific integer accessors (OT_INTEGER == type). */
540 const struct option_int_vtable {
541 int (*get) (const struct option *);
542 int (*def) (const struct option *);
543 int (*minimum) (const struct option *);
544 int (*maximum) (const struct option *);
545 bool (*set) (struct option *, int);
547 /* Specific string accessors (OT_STRING == type). */
548 const struct option_str_vtable {
549 const char * (*get) (const struct option *);
550 const char * (*def) (const struct option *);
551 const struct strvec * (*values) (const struct option *);
552 bool (*set) (struct option *, const char *);
554 /* Specific enum accessors (OT_ENUM == type). */
555 const struct option_enum_vtable {
556 int (*get) (const struct option *);
557 int (*def) (const struct option *);
558 const struct strvec * (*values) (const struct option *);
559 bool (*set) (struct option *, int);
560 int (*cmp) (const char *, const char *);
562 /* Specific bitwise accessors (OT_BITWISE == type). */
563 const struct option_bitwise_vtable {
564 unsigned (*get) (const struct option *);
565 unsigned (*def) (const struct option *);
566 const struct strvec * (*values) (const struct option *);
567 bool (*set) (struct option *, unsigned);
569 /* Specific font accessors (OT_FONT == type). */
570 const struct option_font_vtable {
571 const char * (*get) (const struct option *);
572 const char * (*def) (const struct option *);
573 const char * (*target) (const struct option *);
574 bool (*set) (struct option *, const char *);
576 /* Specific color accessors (OT_COLOR == type). */
577 const struct option_color_vtable {
578 struct ft_color (*get) (const struct option *);
579 struct ft_color (*def) (const struct option *);
580 bool (*set) (struct option *, struct ft_color);
582 /* Specific video mode accessors (OT_VIDEO_MODE == type). */
583 const struct option_video_mode_vtable {
584 struct video_mode (*get) (const struct option *);
585 struct video_mode (*def) (const struct option *);
586 bool (*set) (struct option *, struct video_mode);
588 };
589
590 /* Called after the value changed. */
592
594
595 /* Volatile. */
596 void *gui_data;
597};
598
599#define OPTION(poption) ((struct option *) (poption))
600
601#define OPTION_INIT(optset, spec_type, spec_table_var, common_table, \
602 spec_table, changed_cb, cb_data) { \
603 .poptset = optset, \
604 .type = spec_type, \
605 .common_vtable = &common_table, \
606 INIT_BRACE_BEGIN \
607 .spec_table_var = &spec_table \
608 INIT_BRACE_END, \
609 .changed_callback = changed_cb, \
610 .callback_data = cb_data, \
611 .gui_data = NULL \
612}
613#define OPTION_BOOL_INIT(optset, common_table, bool_table, changed_cb) \
614 OPTION_INIT(optset, OT_BOOLEAN, bool_vtable, common_table, bool_table, \
615 changed_cb, 0)
616#define OPTION_INT_INIT(optset, common_table, int_table, changed_cb) \
617 OPTION_INIT(optset, OT_INTEGER, int_vtable, common_table, int_table, \
618 changed_cb, 0)
619#define OPTION_STR_INIT(optset, common_table, str_table, changed_cb, cb_data) \
620 OPTION_INIT(optset, OT_STRING, str_vtable, common_table, str_table, \
621 changed_cb, cb_data)
622#define OPTION_ENUM_INIT(optset, common_table, enum_table, changed_cb) \
623 OPTION_INIT(optset, OT_ENUM, enum_vtable, common_table, enum_table, \
624 changed_cb, 0)
625#define OPTION_BITWISE_INIT(optset, common_table, bitwise_table, \
626 changed_cb) \
627 OPTION_INIT(optset, OT_BITWISE, bitwise_vtable, common_table, \
628 bitwise_table, changed_cb, 0)
629#define OPTION_FONT_INIT(optset, common_table, font_table, changed_cb) \
630 OPTION_INIT(optset, OT_FONT, font_vtable, common_table, font_table, \
631 changed_cb, 0)
632#define OPTION_COLOR_INIT(optset, common_table, color_table, changed_cb) \
633 OPTION_INIT(optset, OT_COLOR, color_vtable, common_table, color_table, \
634 changed_cb, 0)
635#define OPTION_VIDEO_MODE_INIT(optset, common_table, video_mode_table, \
636 changed_cb) \
637 OPTION_INIT(optset, OT_VIDEO_MODE, video_mode_vtable, common_table, \
638 video_mode_table, changed_cb, 0)
639
640
641/************************************************************************/
644const struct option_set *option_optset(const struct option *poption)
645{
647
648 return poption->poptset;
649}
650
651/************************************************************************/
654int option_number(const struct option *poption)
655{
657
658 return poption->common_vtable->number(poption);
659}
660
661/************************************************************************/
664const char *option_name(const struct option *poption)
665{
667
668 return poption->common_vtable->name(poption);
669}
670
671/************************************************************************/
674const char *option_description(const struct option *poption)
675{
677
678 return poption->common_vtable->description(poption);
679}
680
681/************************************************************************/
684const char *option_help_text(const struct option *poption)
685{
687
688 return poption->common_vtable->help_text(poption);
689}
690
691/************************************************************************/
695{
697
698 return poption->type;
699}
700
701/************************************************************************/
705{
707
708 return poption->common_vtable->category(poption);
709}
710
711/************************************************************************/
714const char *option_category_name(const struct option *poption)
715{
717
718 return optset_category_name(poption->poptset,
719 poption->common_vtable->category(poption));
720}
721
722/************************************************************************/
726{
728
729 return poption->common_vtable->is_changeable(poption);
730}
731
732/************************************************************************/
735struct option *option_next(const struct option *poption)
736{
738
739 return poption->common_vtable->next(poption);
740}
741
742/************************************************************************/
769
770/************************************************************************/
774 void (*callback) (struct option *))
775{
777
778 poption->changed_callback = callback;
779}
780
781/************************************************************************/
785{
787
789 /* Prevent to use non-initialized datas. */
790 return;
791 }
792
793 if (poption->changed_callback) {
794 poption->changed_callback(poption);
795 }
796
798}
799
800/************************************************************************/
803void option_set_gui_data(struct option *poption, void *data)
804{
806
807 poption->gui_data = data;
808}
809
810/************************************************************************/
814{
816
817 return poption->gui_data;
818}
819
820/************************************************************************/
824{
826
827 return poption->callback_data;
828}
829
830/************************************************************************/
833bool option_bool_get(const struct option *poption)
834{
837
838 return poption->bool_vtable->get(poption);
839}
840
841/************************************************************************/
844bool option_bool_def(const struct option *poption)
845{
848
849 return poption->bool_vtable->def(poption);
850}
851
852/************************************************************************/
855bool option_bool_set(struct option *poption, bool val)
856{
859
860 if (poption->bool_vtable->set(poption, val)) {
862 return TRUE;
863 }
864 return FALSE;
865}
866
867/************************************************************************/
870int option_int_get(const struct option *poption)
871{
874
875 return poption->int_vtable->get(poption);
876}
877
878/************************************************************************/
881int option_int_def(const struct option *poption)
882{
885
886 return poption->int_vtable->def(poption);
887}
888
889/************************************************************************/
892int option_int_min(const struct option *poption)
893{
896
897 return poption->int_vtable->minimum(poption);
898}
899
900/************************************************************************/
903int option_int_max(const struct option *poption)
904{
907
908 return poption->int_vtable->maximum(poption);
909}
910
911/************************************************************************/
914bool option_int_set(struct option *poption, int val)
915{
918
919 if (poption->int_vtable->set(poption, val)) {
921 return TRUE;
922 }
923 return FALSE;
924}
925
926/************************************************************************/
929const char *option_str_get(const struct option *poption)
930{
933
934 return poption->str_vtable->get(poption);
935}
936
937/************************************************************************/
940const char *option_str_def(const struct option *poption)
941{
944
945 return poption->str_vtable->def(poption);
946}
947
948/************************************************************************/
951const struct strvec *option_str_values(const struct option *poption)
952{
955
956 return poption->str_vtable->values(poption);
957}
958
959/************************************************************************/
962bool option_str_set(struct option *poption, const char *str)
963{
967
968 if (poption->str_vtable->set(poption, str)) {
970 return TRUE;
971 }
972 return FALSE;
973}
974
975/************************************************************************/
979int option_enum_str_to_int(const struct option *poption, const char *str)
980{
981 const struct strvec *values;
982 int val;
983
985 fc_assert_ret_val(OT_ENUM == poption->type, -1);
986 values = poption->enum_vtable->values(poption);
987 fc_assert_ret_val(NULL != values, -1);
988
989 for (val = 0; val < strvec_size(values); val++) {
990 if (0 == poption->enum_vtable->cmp(strvec_get(values, val), str)) {
991 return val;
992 }
993 }
994 return -1;
995}
996
997/************************************************************************/
1001const char *option_enum_int_to_str(const struct option *poption, int val)
1002{
1003 const struct strvec *values;
1004
1007 values = poption->enum_vtable->values(poption);
1008 fc_assert_ret_val(NULL != values, NULL);
1009
1010 return strvec_get(values, val);
1011}
1012
1013/************************************************************************/
1017{
1019 fc_assert_ret_val(OT_ENUM == poption->type, -1);
1020
1021 return poption->enum_vtable->get(poption);
1022}
1023
1024/************************************************************************/
1028const char *option_enum_get_str(const struct option *poption)
1029{
1032
1033 return strvec_get(poption->enum_vtable->values(poption),
1034 poption->enum_vtable->get(poption));
1035}
1036
1037/************************************************************************/
1041{
1043 fc_assert_ret_val(OT_ENUM == poption->type, -1);
1044
1045 return poption->enum_vtable->def(poption);
1046}
1047
1048/************************************************************************/
1052const char *option_enum_def_str(const struct option *poption)
1053{
1056
1057 return strvec_get(poption->enum_vtable->values(poption),
1058 poption->enum_vtable->def(poption));
1059}
1060
1061/************************************************************************/
1065const struct strvec *option_enum_values(const struct option *poption)
1066{
1069
1070 return poption->enum_vtable->values(poption);
1071}
1072
1073/************************************************************************/
1076bool option_enum_set_int(struct option *poption, int val)
1077{
1080
1081 if (poption->enum_vtable->set(poption, val)) {
1083 return TRUE;
1084 }
1085 return FALSE;
1086}
1087
1088/************************************************************************/
1093bool option_enum_set_str(struct option *poption, const char *str)
1094{
1098
1099 if (poption->enum_vtable->set(poption,
1102 return TRUE;
1103 }
1104 return FALSE;
1105}
1106
1107/************************************************************************/
1110unsigned option_bitwise_get(const struct option *poption)
1111{
1114
1115 return poption->bitwise_vtable->get(poption);
1116}
1117
1118/************************************************************************/
1121unsigned option_bitwise_def(const struct option *poption)
1122{
1125
1126 return poption->bitwise_vtable->def(poption);
1127}
1128
1129/************************************************************************/
1132unsigned option_bitwise_mask(const struct option *poption)
1133{
1134 const struct strvec *values;
1135
1138
1139 values = poption->bitwise_vtable->values(poption);
1140 fc_assert_ret_val(NULL != values, 0);
1141
1142 return (1 << strvec_size(values)) - 1;
1143}
1144
1145/************************************************************************/
1149const struct strvec *option_bitwise_values(const struct option *poption)
1150{
1153
1154 return poption->bitwise_vtable->values(poption);
1155}
1156
1157/************************************************************************/
1160bool option_bitwise_set(struct option *poption, unsigned val)
1161{
1164
1165 if (0 != (val & ~option_bitwise_mask(poption))
1166 || !poption->bitwise_vtable->set(poption, val)) {
1167 return FALSE;
1168 }
1169
1171 return TRUE;
1172}
1173
1174/************************************************************************/
1177const char *option_font_get(const struct option *poption)
1178{
1181
1182 return poption->font_vtable->get(poption);
1183}
1184
1185/************************************************************************/
1188const char *option_font_def(const struct option *poption)
1189{
1192
1193 return poption->font_vtable->def(poption);
1194}
1195
1196/************************************************************************/
1199const char *option_font_target(const struct option *poption)
1200{
1203
1204 return poption->font_vtable->target(poption);
1205}
1206
1207/************************************************************************/
1210bool option_font_set(struct option *poption, const char *font)
1211{
1214 fc_assert_ret_val(NULL != font, FALSE);
1215
1216 if (poption->font_vtable->set(poption, font)) {
1218 return TRUE;
1219 }
1220 return FALSE;
1221}
1222
1223/************************************************************************/
1233
1234/************************************************************************/
1244
1245/************************************************************************/
1250{
1253
1254 if (poption->color_vtable->set(poption, color)) {
1256 return TRUE;
1257 }
1258 return FALSE;
1259}
1260
1261/************************************************************************/
1265{
1268 video_mode_construct(-1, -1));
1269
1270 return poption->video_mode_vtable->get(poption);
1271}
1272
1273/************************************************************************/
1277{
1280 video_mode_construct(-1, -1));
1281
1282 return poption->video_mode_vtable->def(poption);
1283}
1284
1285/************************************************************************/
1290{
1293
1294 if (poption->video_mode_vtable->set(poption, mode)) {
1296 return TRUE;
1297 }
1298 return FALSE;
1299}
1300
1301
1302/****************************************************************************
1303 Client option set.
1304****************************************************************************/
1305static struct option *client_optset_option_by_number(int id);
1306static struct option *client_optset_option_first(void);
1307static int client_optset_category_number(void);
1308static const char *client_optset_category_name(int category);
1309
1312 .option_first = client_optset_option_first,
1313 .category_number = client_optset_category_number,
1314 .category_name = client_optset_category_name
1315};
1317
1319 const char *support; /* Untranslated long support name, used
1320 * for saving. */
1321 const char *pretty; /* Translated, used to display to the
1322 * users. */
1323};
1324
1325/****************************************************************************
1326 Virtuals tables for the client options.
1327****************************************************************************/
1328static int client_option_number(const struct option *poption);
1329static const char *client_option_name(const struct option *poption);
1330static const char *client_option_description(const struct option *poption);
1331static const char *client_option_help_text(const struct option *poption);
1332static int client_option_category(const struct option *poption);
1333static bool client_option_is_changeable(const struct option *poption);
1334static struct option *client_option_next(const struct option *poption);
1335
1336static const struct option_common_vtable client_option_common_vtable = {
1337 .number = client_option_number,
1338 .name = client_option_name,
1339 .description = client_option_description,
1340 .help_text = client_option_help_text,
1341 .category = client_option_category,
1342 .is_changeable = client_option_is_changeable,
1343 .next = client_option_next
1344};
1345
1346static bool client_option_bool_get(const struct option *poption);
1347static bool client_option_bool_def(const struct option *poption);
1348static bool client_option_bool_set(struct option *poption, bool val);
1349
1350static const struct option_bool_vtable client_option_bool_vtable = {
1354};
1355
1356static int client_option_int_get(const struct option *poption);
1357static int client_option_int_def(const struct option *poption);
1358static int client_option_int_min(const struct option *poption);
1359static int client_option_int_max(const struct option *poption);
1360static bool client_option_int_set(struct option *poption, int val);
1361
1362static const struct option_int_vtable client_option_int_vtable = {
1363 .get = client_option_int_get,
1364 .def = client_option_int_def,
1365 .minimum = client_option_int_min,
1366 .maximum = client_option_int_max,
1368};
1369
1370static const char *client_option_str_get(const struct option *poption);
1371static const char *client_option_str_def(const struct option *poption);
1372static const struct strvec *
1374static bool client_option_str_set(struct option *poption, const char *str);
1375
1376static const struct option_str_vtable client_option_str_vtable = {
1377 .get = client_option_str_get,
1378 .def = client_option_str_def,
1379 .values = client_option_str_values,
1381};
1382
1383static int client_option_enum_get(const struct option *poption);
1384static int client_option_enum_def(const struct option *poption);
1385static const struct strvec *
1387static bool client_option_enum_set(struct option *poption, int val);
1388
1389static const struct option_enum_vtable client_option_enum_vtable = {
1394 .cmp = fc_strcasecmp
1395};
1396
1397#if 0 /* There's no bitwise options currently */
1398static unsigned client_option_bitwise_get(const struct option *poption);
1399static unsigned client_option_bitwise_def(const struct option *poption);
1400static const struct strvec *
1402static bool client_option_bitwise_set(struct option *poption, unsigned val);
1403
1404static const struct option_bitwise_vtable client_option_bitwise_vtable = {
1409};
1410#endif /* 0 */
1411
1412static const char *client_option_font_get(const struct option *poption);
1413static const char *client_option_font_def(const struct option *poption);
1414static const char *client_option_font_target(const struct option *poption);
1415static bool client_option_font_set(struct option *poption, const char *font);
1416
1417static const struct option_font_vtable client_option_font_vtable = {
1420 .target = client_option_font_target,
1422};
1423
1426static bool client_option_color_set(struct option *poption,
1427 struct ft_color color);
1428
1429static const struct option_color_vtable client_option_color_vtable = {
1433};
1434
1435static struct video_mode
1437static struct video_mode
1439static bool client_option_video_mode_set(struct option *poption,
1440 struct video_mode mode);
1441
1442static const struct option_video_mode_vtable client_option_video_mode_vtable = {
1446};
1447
1458
1459/****************************************************************************
1460 Derived class client option, inherinting of base class option.
1461****************************************************************************/
1463 struct option base_option; /* Base structure, must be the first! */
1464
1465 const char *name; /* Short name - used as an identifier */
1466 const char *description; /* One-line description */
1467 const char *help_text; /* Paragraph-length help text */
1469 enum gui_type specific; /* GUI_STUB for common options. */
1470
1471 union {
1472 /* OT_BOOLEAN type option. */
1473 struct {
1474 bool *const pvalue;
1475 const bool def;
1476 } boolean;
1477 /* OT_INTEGER type option. */
1478 struct {
1479 int *const pvalue;
1480 const int def, min, max;
1481 } integer;
1482 /* OT_STRING type option. */
1483 struct {
1484 char *const pvalue;
1485 const size_t size;
1486 const char *const def;
1487 /*
1488 * A function to return a string vector of possible string values,
1489 * or NULL for none.
1490 */
1491 const struct strvec *(*const val_accessor) (const struct option *);
1492 } string;
1493 /* OT_ENUM type option. */
1494 struct {
1495 int *const pvalue;
1496 const int def;
1497 struct strvec *support_names, *pretty_names; /* untranslated */
1498 const struct copt_val_name * (*const name_accessor) (int value);
1499 } enumerator;
1500 /* OT_BITWISE type option. */
1501 struct {
1502 unsigned *const pvalue;
1503 const unsigned def;
1504 struct strvec *support_names, *pretty_names; /* untranslated */
1505 const struct copt_val_name * (*const name_accessor) (int value);
1506 } bitwise;
1507 /* OT_FONT type option. */
1508 struct {
1509 char *const pvalue;
1510 const size_t size;
1511 const char *const def;
1512 const char *const target;
1513 } font;
1514 /* OT_COLOR type option. */
1515 struct {
1516 struct ft_color *const pvalue;
1517 const struct ft_color def;
1519 /* OT_VIDEO_MODE type option. */
1520 struct {
1521 struct video_mode *const pvalue;
1522 const struct video_mode def;
1524 };
1525};
1526
1527#define CLIENT_OPTION(poption) ((struct client_option *) (poption))
1528
1529/*
1530 * Generate a client option of type OT_BOOLEAN.
1531 *
1532 * oname: The option data. Note it is used as name to be loaded or saved.
1533 * So, you shouldn't change the name of this variable in any case.
1534 * odesc: A short description of the client option. Should be used with the
1535 * N_() macro.
1536 * ohelp: The help text for the client option. Should be used with the N_()
1537 * macro.
1538 * ocat: The client_option_class of this client option.
1539 * ospec: A gui_type enumerator which determine for what particular client
1540 * gui this option is for. Sets to GUI_STUB for common options.
1541 * odef: The default value of this client option (FALSE or TRUE).
1542 * ocb: A callback function of type void (*)(struct option *) called when
1543 * the option changed.
1544 */
1545#define GEN_BOOL_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb) \
1546{ \
1547 .base_option = OPTION_BOOL_INIT(&client_optset_static, \
1548 client_option_common_vtable, \
1549 client_option_bool_vtable, ocb), \
1550 .name = #oname, \
1551 .description = odesc, \
1552 .help_text = ohelp, \
1553 .category = ocat, \
1554 .specific = ospec, \
1555 INIT_BRACE_BEGIN \
1556 .boolean = { \
1557 .pvalue = &gui_options.oname, \
1558 .def = odef, \
1559 } \
1560 INIT_BRACE_END \
1561}
1562
1563/*
1564 * Generate a client option of type OT_INTEGER.
1565 *
1566 * oname: The option data. Note it is used as name to be loaded or saved.
1567 * So, you shouldn't change the name of this variable in any case.
1568 * odesc: A short description of the client option. Should be used with the
1569 * N_() macro.
1570 * ohelp: The help text for the client option. Should be used with the N_()
1571 * macro.
1572 * ocat: The client_option_class of this client option.
1573 * ospec: A gui_type enumerator which determine for what particular client
1574 * gui this option is for. Sets to GUI_STUB for common options.
1575 * odef: The default value of this client option.
1576 * omin: The minimal value of this client option.
1577 * omax: The maximal value of this client option.
1578 * ocb: A callback function of type void (*)(struct option *) called when
1579 * the option changed.
1580 */
1581#define GEN_INT_OPTION(oname, odesc, ohelp, ocat, ospec, odef, omin, omax, ocb) \
1582{ \
1583 .base_option = OPTION_INT_INIT(&client_optset_static, \
1584 client_option_common_vtable, \
1585 client_option_int_vtable, ocb), \
1586 .name = #oname, \
1587 .description = odesc, \
1588 .help_text = ohelp, \
1589 .category = ocat, \
1590 .specific = ospec, \
1591 INIT_BRACE_BEGIN \
1592 .integer = { \
1593 .pvalue = &gui_options.oname, \
1594 .def = odef, \
1595 .min = omin, \
1596 .max = omax \
1597 } \
1598 INIT_BRACE_END \
1599}
1600
1601/*
1602 * Generate a client option of type OT_STRING.
1603 *
1604 * oname: The option data. Note it is used as name to be loaded or saved.
1605 * So, you shouldn't change the name of this variable in any case.
1606 * Be sure to pass the array variable and not a pointer to it because
1607 * the size is calculated with sizeof().
1608 * odesc: A short description of the client option. Should be used with the
1609 * N_() macro.
1610 * ohelp: The help text for the client option. Should be used with the N_()
1611 * macro.
1612 * ocat: The client_option_class of this client option.
1613 * ospec: A gui_type enumerator which determines for what particular client
1614 * gui this option is for. Set to GUI_STUB for common options.
1615 * odef: The default string for this client option.
1616 * ocb: A callback function of type void (*)(struct option *) called when
1617 * the option changed.
1618 */
1619#define GEN_STR_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb, cbd) \
1620{ \
1621 .base_option = OPTION_STR_INIT(&client_optset_static, \
1622 client_option_common_vtable, \
1623 client_option_str_vtable, ocb, cbd), \
1624 .name = #oname, \
1625 .description = odesc, \
1626 .help_text = ohelp, \
1627 .category = ocat, \
1628 .specific = ospec, \
1629 INIT_BRACE_BEGIN \
1630 .string = { \
1631 .pvalue = gui_options.oname, \
1632 .size = sizeof(gui_options.oname), \
1633 .def = odef, \
1634 .val_accessor = NULL \
1635 } \
1636 INIT_BRACE_END \
1637}
1638
1639/*
1640 * Generate a client option of type OT_STRING with a string accessor
1641 * function.
1642 *
1643 * oname: The option data. Note it is used as name to be loaded or saved.
1644 * So, you shouldn't change the name of this variable in any case.
1645 * Be sure to pass the array variable and not a pointer to it because
1646 * the size is calculated with sizeof().
1647 * odesc: A short description of the client option. Should be used with the
1648 * N_() macro.
1649 * ohelp: The help text for the client option. Should be used with the N_()
1650 * macro.
1651 * ocat: The client_option_class of this client option.
1652 * ospec: A gui_type enumerator which determine for what particular client
1653 * gui this option is for. Sets to GUI_STUB for common options.
1654 * odef: The default string for this client option.
1655 * oacc: The string accessor where to find the allowed values of type
1656 * 'const struct strvec * (*) (void)'.
1657 * ocb: A callback function of type void (*)(struct option *) called when
1658 * the option changed.
1659 */
1660#define GEN_STR_LIST_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb, cbd) \
1661{ \
1662 .base_option = OPTION_STR_INIT(&client_optset_static, \
1663 client_option_common_vtable, \
1664 client_option_str_vtable, ocb, cbd), \
1665 .name = #oname, \
1666 .description = odesc, \
1667 .help_text = ohelp, \
1668 .category = ocat, \
1669 .specific = ospec, \
1670 INIT_BRACE_BEGIN \
1671 .string = { \
1672 .pvalue = gui_options.oname, \
1673 .size = sizeof(gui_options.oname), \
1674 .def = odef, \
1675 .val_accessor = oacc \
1676 } \
1677 INIT_BRACE_END \
1678}
1679
1680/*
1681 * Generate a client option of type OT_ENUM.
1682 *
1683 * oname: The option data. Note it is used as name to be loaded or saved.
1684 * So, you shouldn't change the name of this variable in any case.
1685 * odesc: A short description of the client option. Should be used with the
1686 * N_() macro.
1687 * ohelp: The help text for the client option. Should be used with the N_()
1688 * macro.
1689 * ocat: The client_option_class of this client option.
1690 * ospec: A gui_type enumerator which determine for what particular client
1691 * gui this option is for. Sets to GUI_STUB for common options.
1692 * odef: The default value for this client option.
1693 * oacc: The name accessor of type 'const struct copt_val_name * (*) (int)'.
1694 * ocb: A callback function of type void (*) (struct option *) called when
1695 * the option changed.
1696 */
1697#define GEN_ENUM_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb) \
1698{ \
1699 .base_option = OPTION_ENUM_INIT(&client_optset_static, \
1700 client_option_common_vtable, \
1701 client_option_enum_vtable, ocb), \
1702 .name = #oname, \
1703 .description = odesc, \
1704 .help_text = ohelp, \
1705 .category = ocat, \
1706 .specific = ospec, \
1707 INIT_BRACE_BEGIN \
1708 .enumerator = { \
1709 .pvalue = (int *) &gui_options.oname, \
1710 .def = odef, \
1711 .support_names = NULL, /* Set in options_init(). */ \
1712 .pretty_names = NULL, \
1713 .name_accessor = oacc \
1714 } \
1715 INIT_BRACE_END \
1716}
1717
1718/*
1719 * Generate a client option of type OT_BITWISE.
1720 *
1721 * oname: The option data. Note it is used as name to be loaded or saved.
1722 * So, you shouldn't change the name of this variable in any case.
1723 * odesc: A short description of the client option. Should be used with the
1724 * N_() macro.
1725 * ohelp: The help text for the client option. Should be used with the N_()
1726 * macro.
1727 * ocat: The client_option_class of this client option.
1728 * ospec: A gui_type enumerator which determine for what particular client
1729 * gui this option is for. Sets to GUI_STUB for common options.
1730 * odef: The default value for this client option.
1731 * oacc: The name accessor of type 'const struct copt_val_name * (*) (int)'.
1732 * ocb: A callback function of type void (*) (struct option *) called when
1733 * the option changed.
1734 */
1735#define GEN_BITWISE_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, \
1736 ocb) \
1737{ \
1738 .base_option = OPTION_BITWISE_INIT(&client_optset_static, \
1739 client_option_common_vtable, \
1740 client_option_bitwise_vtable, ocb), \
1741 .name = #oname, \
1742 .description = odesc, \
1743 .help_text = ohelp, \
1744 .category = ocat, \
1745 .specific = ospec, \
1746 INIT_BRACE_BEGIN \
1747 .bitwise = { \
1748 .pvalue = &gui_options.oname, \
1749 .def = odef, \
1750 .support_names = NULL, /* Set in options_init(). */ \
1751 .pretty_names = NULL, \
1752 .name_accessor = oacc \
1753 } \
1754 INIT_BRACE_END \
1755}
1756
1757/*
1758 * Generate a client option of type OT_FONT.
1759 *
1760 * oname: The option data. Note it is used as name to be loaded or saved.
1761 * So, you shouldn't change the name of this variable in any case.
1762 * Be sure to pass the array variable and not a pointer to it because
1763 * the size is calculated with sizeof().
1764 * otgt: The target widget style.
1765 * odesc: A short description of the client option. Should be used with the
1766 * N_() macro.
1767 * ohelp: The help text for the client option. Should be used with the N_()
1768 * macro.
1769 * ocat: The client_option_class of this client option.
1770 * ospec: A gui_type enumerator which determine for what particular client
1771 * gui this option is for. Sets to GUI_STUB for common options.
1772 * odef: The default string for this client option.
1773 * ocb: A callback function of type void (*)(struct option *) called when
1774 * the option changed.
1775 */
1776#define GEN_FONT_OPTION(oname, otgt, odesc, ohelp, ocat, ospec, odef, ocb) \
1777{ \
1778 .base_option = OPTION_FONT_INIT(&client_optset_static, \
1779 client_option_common_vtable, \
1780 client_option_font_vtable, ocb), \
1781 .name = #oname, \
1782 .description = odesc, \
1783 .help_text = ohelp, \
1784 .category = ocat, \
1785 .specific = ospec, \
1786 INIT_BRACE_BEGIN \
1787 .font = { \
1788 .pvalue = gui_options.oname, \
1789 .size = sizeof(gui_options.oname), \
1790 .def = odef, \
1791 .target = otgt, \
1792 } \
1793 INIT_BRACE_END \
1794}
1795
1796/*
1797 * Generate a client option of type OT_COLOR.
1798 *
1799 * oname: The option data. Note it is used as name to be loaded or saved.
1800 * So, you shouldn't change the name of this variable in any case.
1801 * odesc: A short description of the client option. Should be used with the
1802 * N_() macro.
1803 * ohelp: The help text for the client option. Should be used with the N_()
1804 * macro.
1805 * ocat: The client_option_class of this client option.
1806 * ospec: A gui_type enumerator which determine for what particular client
1807 * gui this option is for. Sets to GUI_STUB for common options.
1808 * odef_fg, odef_bg: The default values for this client option.
1809 * ocb: A callback function of type void (*)(struct option *) called when
1810 * the option changed.
1811 */
1812#define GEN_COLOR_OPTION(oname, odesc, ohelp, ocat, ospec, odef_fg, \
1813 odef_bg, ocb) \
1814{ \
1815 .base_option = OPTION_COLOR_INIT(&client_optset_static, \
1816 client_option_common_vtable, \
1817 client_option_color_vtable, ocb), \
1818 .name = #oname, \
1819 .description = odesc, \
1820 .help_text = ohelp, \
1821 .category = ocat, \
1822 .specific = ospec, \
1823 INIT_BRACE_BEGIN \
1824 .color = { \
1825 .pvalue = &gui_options.oname, \
1826 .def = FT_COLOR(odef_fg, odef_bg) \
1827 } \
1828 INIT_BRACE_END \
1829}
1830
1831/*
1832 * Generate a client option of type OT_VIDEO_MODE.
1833 *
1834 * oname: The option data. Note it is used as name to be loaded or saved.
1835 * So, you shouldn't change the name of this variable in any case.
1836 * odesc: A short description of the client option. Should be used with the
1837 * N_() macro.
1838 * ohelp: The help text for the client option. Should be used with the N_()
1839 * macro.
1840 * ocat: The client_option_class of this client option.
1841 * ospec: A gui_type enumerator which determine for what particular client
1842 * gui this option is for. Sets to GUI_STUB for common options.
1843 * odef_width, odef_height: The default values for this client option.
1844 * ocb: A callback function of type void (*)(struct option *) called when
1845 * the option changed.
1846 */
1847#define GEN_VIDEO_OPTION(oname, odesc, ohelp, ocat, ospec, odef_width, \
1848 odef_height, ocb) \
1849{ \
1850 .base_option = OPTION_VIDEO_MODE_INIT(&client_optset_static, \
1851 client_option_common_vtable, \
1852 client_option_video_mode_vtable, \
1853 ocb), \
1854 .name = #oname, \
1855 .description = odesc, \
1856 .help_text = ohelp, \
1857 .category = ocat, \
1858 .specific = ospec, \
1859 INIT_BRACE_BEGIN \
1860 .video_mode = { \
1861 .pvalue = &gui_options.oname, \
1862 .def = VIDEO_MODE(odef_width, odef_height) \
1863 } \
1864 INIT_BRACE_END \
1865}
1866
1867/****************************************************************************
1868 Enumerator name accessors.
1869****************************************************************************/
1870
1871/************************************************************************/
1874static const struct copt_val_name
1876{
1877 /* Order must match enum GUI_GTK_MSGCHAT_* */
1878 static const struct copt_val_name names[] = {
1879 /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */
1880 { "SPLIT", N_("Split") },
1881 /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */
1882 { "SEPARATE", N_("Separate") },
1883 /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */
1884 { "MERGED", N_("Merged") }
1885 };
1886
1887 return (0 <= value && value < ARRAY_SIZE(names)
1888 ? names + value : NULL);
1889}
1890
1891/************************************************************************/
1894static const struct copt_val_name
1896{
1897 /* Order must match enum GUI_POPUP_TECH_HELP_* */
1898 static const struct copt_val_name names[] = {
1899 /* TRANS: enum value for 'gui_popup_tech_help' */
1900 { "ENABLED", N_("Enabled") },
1901 /* TRANS: enum value for 'gui_popup_tech_help' */
1902 { "DISABLED", N_("Disabled") },
1903 /* TRANS: enum value for 'gui_popup_tech_help' */
1904 { "RULESET", N_("Ruleset") }
1905 };
1906
1907 return (0 <= value && value < ARRAY_SIZE(names)
1908 ? names + value : NULL);
1909}
1910
1911/* Some changed callbacks. */
1912static void reqtree_show_icons_callback(struct option *poption);
1913static void view_option_changed_callback(struct option *poption);
1914static void manual_turn_done_callback(struct option *poption);
1915static void voteinfo_bar_callback(struct option *poption);
1916static void font_changed_callback(struct option *poption);
1917static void mapimg_changed_callback(struct option *poption);
1918static void game_music_enable_callback(struct option *poption);
1919static void menu_music_enable_callback(struct option *poption);
1920static void sound_volume_callback(struct option *poption);
1921
1923 GEN_STR_OPTION(default_user_name,
1924 N_("Login name"),
1925 N_("This is the default login username that will be used "
1926 "in the connection dialogs or with the -a command-line "
1927 "parameter."),
1929 GEN_BOOL_OPTION(use_prev_server, N_("Default to previously used server"),
1930 N_("Automatically update \"Server\" and \"Server port\" "
1931 "options to match your latest connection, so by "
1932 "default you connect to the same server you used "
1933 "on the previous run. You should enable "
1934 "saving options on exit too, so that the automatic "
1935 "updates to the options get saved too."),
1937 GEN_STR_OPTION(default_server_host,
1938 N_("Server"),
1939 N_("This is the default server hostname that will be used "
1940 "in the connection dialogs or with the -a command-line "
1941 "parameter."),
1942 COC_NETWORK, GUI_STUB, "localhost", NULL, 0),
1943 GEN_INT_OPTION(default_server_port,
1944 N_("Server port"),
1945 N_("This is the default server port that will be used "
1946 "in the connection dialogs or with the -a command-line "
1947 "parameter."),
1949 GEN_STR_OPTION(default_metaserver,
1950 N_("Metaserver"),
1951 N_("The metaserver is a host that the client contacts to "
1952 "find out about games on the internet. Don't change "
1953 "this from its default value unless you know what "
1954 "you're doing."),
1956 GEN_BOOL_OPTION(heartbeat_enabled,
1957 N_("Send heartbeat messages to the server"),
1958 N_("Periodically send an empty heartbeat message to the "
1959 "server to probe whether the connection is still up. "
1960 "This can help to make it obvious when the server has "
1961 "cut the connection due to a connectivity outage, if "
1962 "the client would otherwise sit idle for a long period."),
1964 GEN_STR_OPTION(followtag_override,
1965 N_("Followtag override"),
1966 /* TRANS: Leave 'builtin' untranslated */
1967 N_("Followtag determines which kind of new freeciv versions' "
1968 "availability gets checked from the metaserver. Special "
1969 "value 'builtin' means that value builtin to the client "
1970 "gets used."),
1972 GEN_BOOL_OPTION(send_desired_settings,
1973 N_("Send desired settings to the server"),
1974 N_("In single-player mode client usually sends user's "
1975 "desired server settings to the server it has "
1976 "launched internally. By disabling this option one "
1977 "can prevent such override of server settings from "
1978 "other sources, such as settings balanced for a "
1979 "custom ruleset."),
1981 GEN_STR_LIST_OPTION(default_sound_set_name,
1982 N_("Soundset"),
1983 N_("This is the soundset that will be used. Changing "
1984 "this is the same as using the -S command-line "
1985 "parameter. Use modpack installer utility to install "
1986 "additional soundsets."),
1987 COC_SOUND, GUI_STUB, "stdsounds", get_soundset_list, NULL, 0),
1988 GEN_STR_LIST_OPTION(default_music_set_name,
1989 N_("Musicset"),
1990 N_("This is the musicset that will be used. Changing "
1991 "this is the same as using the -m command-line "
1992 "parameter. Use modpack installer utility to install "
1993 "additional musicsets."),
1994 COC_SOUND, GUI_STUB, "stdmusic", get_musicset_list,
1996 GEN_STR_LIST_OPTION(default_sound_plugin_name,
1997 N_("Sound plugin"),
1998 N_("If you have a problem with sound, try changing "
1999 "the sound plugin. The new plugin won't take "
2000 "effect until you restart Freeciv. Changing this "
2001 "is the same as using the -P command-line option."),
2003 GEN_STR_OPTION(default_chat_logfile,
2004 N_("The chat log file"),
2005 N_("The name of the chat log file."),
2007 /* gui_gtk3_22/4/5_default_theme_name and gui_sdl2/3_default_theme_name are
2008 * different settings to avoid client crash after loading the
2009 * style for the other gui. Keeps 6 different options! */
2010 GEN_STR_LIST_OPTION(gui_gtk3_22_default_theme_name, N_("Theme"),
2011 N_("By changing this option you change the "
2012 "active theme."),
2015 GEN_STR_LIST_OPTION(gui_gtk4_default_theme_name, N_("Theme"),
2016 N_("By changing this option you change the "
2017 "active theme."),
2020 GEN_STR_LIST_OPTION(gui_gtk5_default_theme_name, N_("Theme"),
2021 N_("By changing this option you change the "
2022 "active theme."),
2025 GEN_STR_LIST_OPTION(gui_sdl2_default_theme_name, N_("Theme"),
2026 N_("By changing this option you change the "
2027 "active theme."),
2030 GEN_STR_LIST_OPTION(gui_sdl3_default_theme_name, N_("Theme"),
2031 N_("By changing this option you change the "
2032 "active theme."),
2035 GEN_STR_LIST_OPTION(gui_qt_default_theme_name, N_("Theme"),
2036 N_("By changing this option you change the "
2037 "active theme."),
2040
2041 /* It's important to give empty string instead of NULL as as default
2042 * value. For NULL value it would default to assigning first value
2043 * from the tileset list returned by get_tileset_list() as default
2044 * tileset. We don't want default tileset assigned at all here, but
2045 * leave it to tilespec code that can handle tileset priority. */
2046 GEN_STR_LIST_OPTION(default_tileset_square_name, N_("Tileset (Square)"),
2047 N_("Select the tileset used with Square based maps. "
2048 "This may change the currently active tileset, if "
2049 "you are playing on such a map, in which "
2050 "case this is the same as using the -t "
2051 "command-line parameter. "
2052 "Use modpack installer utility to install "
2053 "additional tilesets."),
2056 GEN_STR_LIST_OPTION(default_tileset_hex_name, N_("Tileset (Hex)"),
2057 N_("Select the tileset used with Hex maps. "
2058 "This may change the currently active tileset, if "
2059 "you are playing on such a map, in which "
2060 "case this is the same as using the -t "
2061 "command-line parameter. "
2062 "Use modpack installer utility to install "
2063 "additional tilesets."),
2066 GEN_STR_LIST_OPTION(default_tileset_isohex_name, N_("Tileset (Iso-Hex)"),
2067 N_("Select the tileset used with Iso-Hex maps. "
2068 "This may change the currently active tileset, if "
2069 "you are playing on such a map, in which "
2070 "case this is the same as using the -t "
2071 "command-line parameter."
2072 "Use modpack installer utility to install "
2073 "additional tilesets."),
2076
2077 GEN_BOOL_OPTION(draw_city_outlines, N_("Draw city outlines"),
2078 N_("Setting this option will draw a line at the city "
2079 "workable limit."),
2082 GEN_BOOL_OPTION(draw_city_output, N_("Draw city output"),
2083 N_("Setting this option will draw city output for every "
2084 "citizen."),
2087 GEN_BOOL_OPTION(draw_map_grid, N_("Draw the map grid"),
2088 N_("Setting this option will draw a grid over the map."),
2091 GEN_BOOL_OPTION(draw_full_citybar, N_("Draw the city bar"),
2092 N_("Setting this option will display a 'city bar' "
2093 "containing useful information beneath each city. "
2094 "Disabling this option will display only the city's "
2095 "name and, optionally, production."),
2098 GEN_BOOL_OPTION(draw_city_names, N_("Draw the city names"),
2099 N_("Setting this option will draw the names of the cities "
2100 "on the map."),
2103 GEN_BOOL_OPTION(draw_city_growth, N_("Draw the city growth"),
2104 N_("Setting this option will draw in how many turns the "
2105 "cities will grow or shrink."),
2108 GEN_BOOL_OPTION(draw_city_productions, N_("Draw the city productions"),
2109 N_("Setting this option will draw what the cities are "
2110 "currently building on the map."),
2113 GEN_BOOL_OPTION(draw_city_buycost, N_("Draw the city buy costs"),
2114 N_("Setting this option will draw how much gold is "
2115 "needed to buy the production of the cities."),
2118 GEN_BOOL_OPTION(draw_city_trade_routes, N_("Draw the city trade routes"),
2119 N_("Setting this option will draw trade route lines "
2120 "between cities which have trade routes."),
2123 GEN_BOOL_OPTION(draw_terrain, N_("Draw the terrain"),
2124 N_("Setting this option will draw the terrain."),
2127 GEN_BOOL_OPTION(draw_coastline, N_("Draw the coast line"),
2128 N_("Setting this option will draw a line to separate the "
2129 "land from the ocean."),
2132 GEN_BOOL_OPTION(draw_paths, N_("Draw the paths"),
2133 N_("Setting this option will draw all kind of paths "
2134 "on the map."),
2137 GEN_BOOL_OPTION(draw_irrigation, N_("Draw the irrigation"),
2138 N_("Setting this option will draw the irrigation systems "
2139 "on the map."),
2142 GEN_BOOL_OPTION(draw_mines, N_("Draw the mines"),
2143 N_("Setting this option will draw the mines on the map."),
2146 GEN_BOOL_OPTION(draw_fortress_airbase, N_("Draw the bases"),
2147 N_("Setting this option will draw the bases on the map."),
2150 GEN_BOOL_OPTION(draw_specials, N_("Draw the resources"),
2151 N_("Setting this option will draw the resources on the "
2152 "map."),
2155 GEN_BOOL_OPTION(draw_huts, N_("Draw the huts"),
2156 N_("Setting this option will draw the huts on the "
2157 "map."),
2160 GEN_BOOL_OPTION(draw_pollution, N_("Draw the pollution/nuclear fallout"),
2161 N_("Setting this option will draw pollution and "
2162 "nuclear fallout on the map."),
2165 GEN_BOOL_OPTION(draw_cities, N_("Draw the cities"),
2166 N_("Setting this option will draw the cities on the map."),
2169 GEN_BOOL_OPTION(draw_units, N_("Draw the units"),
2170 N_("Setting this option will draw the units on the map."),
2173 GEN_BOOL_OPTION(solid_color_behind_units,
2174 N_("Solid unit background color"),
2175 N_("Setting this option will cause units on the map "
2176 "view to be drawn with a solid background color "
2177 "instead of the flag backdrop."),
2180 GEN_BOOL_OPTION(draw_unit_shields, N_("Draw shield graphics for units"),
2181 N_("Setting this option will draw a shield icon "
2182 "as the flags on units. If unset, the full flag will "
2183 "be drawn."),
2185 GEN_BOOL_OPTION(draw_unit_stack_size, N_("Draw size of the unit stacks"),
2186 N_("Setting this option will draw a numbers indicating "
2187 "size of the unit stacks. Not all clients support "
2188 "this."),
2190 GEN_BOOL_OPTION(draw_focus_unit, N_("Draw the units in focus"),
2191 N_("Setting this option will cause the currently focused "
2192 "unit(s) to always be drawn, even if units are not "
2193 "otherwise being drawn (for instance if 'Draw the units' "
2194 "is unset)."),
2197 GEN_BOOL_OPTION(draw_fog_of_war, N_("Draw the fog of war"),
2198 N_("Setting this option will draw the fog of war."),
2201 GEN_BOOL_OPTION(draw_borders, N_("Draw the borders"),
2202 N_("Setting this option will draw the national borders."),
2205 GEN_BOOL_OPTION(draw_native, N_("Draw whether tiles are native to "
2206 "selected unit"),
2207 N_("Setting this option will highlight tiles that the "
2208 "currently selected unit cannot enter unaided due to "
2209 "non-native terrain. (If multiple units are selected, "
2210 "only tiles that all of them can enter are indicated.)"),
2213 GEN_BOOL_OPTION(player_dlg_show_dead_players,
2214 N_("Show dead players in Nations report"),
2215 N_("This option controls whether defeated nations are "
2216 "shown on the Nations report page."),
2219 GEN_BOOL_OPTION(sound_bell_at_new_turn, N_("Sound bell at new turn"),
2220 N_("Set this option to have a \"bell\" event be generated "
2221 "at the start of a new turn. You can control the "
2222 "behavior of the \"bell\" event by editing the message "
2223 "options."),
2225 GEN_INT_OPTION(smooth_move_unit_msec,
2226 N_("Unit movement animation time (milliseconds)"),
2227 N_("This option controls how long unit \"animation\" takes "
2228 "when a unit moves on the map view. Set it to 0 to "
2229 "disable animation entirely."),
2230 COC_GRAPHICS, GUI_STUB, 30, 0, 2000, NULL),
2231 GEN_INT_OPTION(smooth_center_slide_msec,
2232 N_("Mapview recentering time (milliseconds)"),
2233 N_("When the map view is recentered, it will slide "
2234 "smoothly over the map to its new position. This "
2235 "option controls how long this slide lasts. Set it to "
2236 "0 to disable mapview sliding entirely."),
2237 COC_GRAPHICS, GUI_STUB, 200, 0, 5000, NULL),
2238 GEN_INT_OPTION(smooth_combat_step_msec,
2239 N_("Combat animation step time (milliseconds)"),
2240 N_("This option controls the speed of combat animation "
2241 "between units on the mapview. Set it to 0 to disable "
2242 "animation entirely."),
2243 COC_GRAPHICS, GUI_STUB, 10, 0, 100, NULL),
2244 GEN_BOOL_OPTION(reqtree_show_icons,
2245 N_("Show icons in the technology tree"),
2246 N_("Setting this option will display icons "
2247 "on the technology tree diagram. Turning "
2248 "this option off makes the technology tree "
2249 "more compact."),
2251 GEN_BOOL_OPTION(reqtree_curved_lines,
2252 N_("Use curved lines in the technology tree"),
2253 N_("Setting this option make the technology tree "
2254 "diagram use curved lines to show technology "
2255 "relations. Turning this option off causes "
2256 "the lines to be drawn straight."),
2259 GEN_COLOR_OPTION(highlight_our_names,
2260 N_("Color to highlight your player/user name"),
2261 N_("If set, your player and user name in the new chat "
2262 "messages will be highlighted using this color as "
2263 "background. If not set, it will just not highlight "
2264 "anything."),
2265 COC_GRAPHICS, GUI_STUB, "#000000", "#FFFF00", NULL),
2266 GEN_BOOL_OPTION(ai_manual_turn_done, N_("Manual Turn Done in AI mode"),
2267 N_("Disable this option if you do not want to "
2268 "press the Turn Done button manually when watching "
2269 "an AI player."),
2271 GEN_BOOL_OPTION(auto_center_on_unit, N_("Auto center on units"),
2272 N_("Set this option to have the active unit centered "
2273 "automatically when the unit focus changes."),
2275 GEN_BOOL_OPTION(auto_center_on_automated, N_("Show automated units"),
2276 N_("Disable this option if you do not want to see "
2277 "automated units autocentered and animated."),
2279 GEN_BOOL_OPTION(auto_center_on_combat, N_("Auto center on combat"),
2280 N_("Set this option to have any combat be centered "
2281 "automatically. Disabling this will speed up the time "
2282 "between turns but may cause you to miss combat "
2283 "entirely."),
2285 GEN_BOOL_OPTION(auto_center_each_turn, N_("Auto center on new turn"),
2286 N_("Set this option to have the client automatically "
2287 "recenter the map on a suitable location at the "
2288 "start of each turn."),
2290 GEN_BOOL_OPTION(wakeup_focus, N_("Focus on awakened units"),
2291 N_("Set this option to have newly awoken units be "
2292 "focused automatically."),
2294 GEN_BOOL_OPTION(keyboardless_goto, N_("Keyboardless goto"),
2295 N_("If this option is set then a goto may be initiated "
2296 "by left-clicking and then holding down the mouse "
2297 "button while dragging the mouse onto a different "
2298 "tile."),
2300 GEN_BOOL_OPTION(goto_into_unknown, N_("Allow goto into the unknown"),
2301 N_("Setting this option will make the game consider "
2302 "moving into unknown tiles. If not, then goto routes "
2303 "will detour around or be blocked by unknown tiles."),
2305 GEN_BOOL_OPTION(center_when_popup_city, N_("Center map when popup city"),
2306 N_("Setting this option makes the mapview center on a "
2307 "city when its city dialog is popped up."),
2309 GEN_BOOL_OPTION(show_previous_turn_messages, N_("Show messages from previous turn"),
2310 N_("Message Window shows messages also from previous turn. "
2311 "This makes sure you don't miss messages received in the end of "
2312 "the turn, just before the window gets cleared."),
2314 GEN_BOOL_OPTION(concise_city_production, N_("Concise city production"),
2315 N_("Set this option to make the city production (as shown "
2316 "in the city dialog) to be more compact."),
2318 GEN_BOOL_OPTION(auto_turn_done, N_("End turn when done moving"),
2319 N_("Setting this option makes your turn end automatically "
2320 "when all your units are done moving."),
2322 GEN_BOOL_OPTION(ask_city_name, N_("Prompt for city names"),
2323 N_("Disabling this option will make the names of newly "
2324 "founded cities be chosen automatically by the server."),
2326 GEN_BOOL_OPTION(popup_new_cities, N_("Pop up city dialog for new cities"),
2327 N_("Setting this option will pop up a newly-founded "
2328 "city's city dialog automatically."),
2330 GEN_BOOL_OPTION(popup_actor_arrival, N_("Pop up caravan and spy actions"),
2331 N_("If this option is enabled, when a unit arrives at "
2332 "a city where it can perform an action like "
2333 "establishing a trade route, helping build a wonder, or "
2334 "establishing an embassy, a window will pop up asking "
2335 "which action should be performed. "
2336 "Disabling this option means you will have to do the "
2337 "action manually by pressing either 'r' (for a trade "
2338 "route), 'b' (for building a wonder) or 'd' (for a "
2339 "spy action) when the unit is in the city."),
2341 GEN_BOOL_OPTION(popup_attack_actions, N_("Pop up attack questions"),
2342 N_("If this option is enabled, when a unit arrives at a "
2343 "target it can attack, a window will pop up asking "
2344 "which action should be performed even if an attack "
2345 "action is legal and no other interesting action are. "
2346 "This allows you to change your mind or to select an "
2347 "uninteresting action."),
2349 GEN_BOOL_OPTION(popup_last_move_to_allied,
2350 /* TODO: Rename option ..._last_... to match _final_ in
2351 * the descriptions.
2352 * Changes options file format, needs migration
2353 * when loading old version. */
2354 N_("Pop up actions when final move to allied tile"),
2355 N_("If this option is enabled the final move in a unit's"
2356 " orders to a tile with allied units or cities it can"
2357 " perform an action to is interpreted as an attempted"
2358 " action. This makes the action selection dialog pop up"
2359 " while the unit is at the adjacent tile."
2360 " This can, in cases where the action requires that"
2361 " the actor unit has moves left, save a turn."
2362 " The down side is that the unit remains adjacent to"
2363 " rather than inside the protection of an allied city"
2364 " or unit stack."),
2366 GEN_BOOL_OPTION(enable_cursor_changes, N_("Enable cursor changing"),
2367 N_("This option controls whether the client should "
2368 "try to change the mouse cursor depending on what "
2369 "is being pointed at, as well as to indicate "
2370 "changes in the client or server state."),
2372 GEN_BOOL_OPTION(separate_unit_selection, N_("Select cities before units"),
2373 N_("If this option is enabled, when both cities and "
2374 "units are present in the selection rectangle, only "
2375 "cities will be selected. See the help on Controls."),
2377 GEN_BOOL_OPTION(unit_selection_clears_orders,
2378 N_("Clear unit orders on selection"),
2379 N_("Enabling this option will cause unit orders to be "
2380 "cleared as soon as one or more units are selected. If "
2381 "this option is disabled, busy units will not stop "
2382 "their current activity when selected. Giving them "
2383 "new orders will clear their current ones; pressing "
2384 "<space> once will clear their orders and leave them "
2385 "selected, and pressing <space> a second time will "
2386 "dismiss them."),
2388 GEN_BOOL_OPTION(voteinfo_bar_use, N_("Enable vote bar"),
2389 N_("If this option is turned on, the vote bar will be "
2390 "displayed to show vote information."),
2392 GEN_BOOL_OPTION(voteinfo_bar_always_show,
2393 N_("Always display the vote bar"),
2394 N_("If this option is turned on, the vote bar will never "
2395 "be hidden, even if there is no running vote."),
2397 GEN_BOOL_OPTION(voteinfo_bar_hide_when_not_player,
2398 N_("Do not show vote bar if not a player"),
2399 N_("If this option is enabled, the client won't show the "
2400 "vote bar if you are not a player."),
2402 GEN_BOOL_OPTION(voteinfo_bar_new_at_front, N_("Set new votes at front"),
2403 N_("If this option is enabled, then new votes will go "
2404 "to the front of the vote list."),
2406 GEN_BOOL_OPTION(autoaccept_tileset_suggestion,
2407 N_("Autoaccept tileset suggestions"),
2408 N_("If this option is enabled, any tileset suggested by "
2409 "the ruleset is automatically used; otherwise you "
2410 "are prompted to change tileset."),
2412
2413 GEN_BOOL_OPTION(sound_enable_effects,
2414 N_("Enable sound effects"),
2415 N_("Play sound effects, assuming there's suitable "
2416 "sound plugin and soundset with the sounds."),
2418 GEN_BOOL_OPTION(sound_enable_game_music,
2419 N_("Enable in-game music"),
2420 N_("Play music during the game, assuming there's suitable "
2421 "sound plugin and musicset with in-game tracks."),
2423 GEN_BOOL_OPTION(sound_enable_menu_music,
2424 N_("Enable menu music"),
2425 N_("Play music while not in actual game, "
2426 "assuming there's suitable "
2427 "sound plugin and musicset with menu music tracks."),
2429 GEN_BOOL_OPTION(silent_when_not_in_focus,
2430 N_("Silent when not in focus"),
2431 N_("Fade all sound out when the client is not in focus. "
2432 "Not all clients support this."),
2434 GEN_INT_OPTION(sound_effects_volume,
2435 N_("Sound volume"),
2436 N_("Volume scale from 0-100"),
2437 COC_SOUND, GUI_STUB, 100,
2438 0, 100,
2440
2441 GEN_BOOL_OPTION(autoaccept_soundset_suggestion,
2442 N_("Autoaccept soundset suggestions"),
2443 N_("If this option is enabled, any soundset suggested by "
2444 "the ruleset is automatically used."),
2446 GEN_BOOL_OPTION(autoaccept_musicset_suggestion,
2447 N_("Autoaccept musicset suggestions"),
2448 N_("If this option is enabled, any musicset suggested by "
2449 "the ruleset is automatically used."),
2451
2453 N_("Background layer"),
2454 N_("The background layer of the overview shows just "
2455 "ocean and land."),
2458 N_("Terrain relief map layer"),
2459 N_("The relief layer shows all terrains on the map."),
2462 N_("Borders layer"),
2463 N_("The borders layer of the overview shows which tiles "
2464 "are owned by each player."),
2467 N_("Borders layer on ocean tiles"),
2468 N_("The borders layer of the overview are drawn on "
2469 "ocean tiles as well (this may look ugly with many "
2470 "islands). This option is only of interest if you "
2471 "have set the option \"Borders layer\" already."),
2474 N_("Units layer"),
2475 N_("Enabling this will draw units on the overview."),
2478 N_("Cities layer"),
2479 N_("Enabling this will draw cities on the overview."),
2482 N_("Overview fog of war"),
2483 N_("Enabling this will show fog of war on the "
2484 "overview."),
2486
2487 /* options for map images */
2488 GEN_STR_LIST_OPTION(mapimg_format,
2489 N_("Image format"),
2490 N_("The image toolkit and file format used for "
2491 "map images."),
2493 NULL, 0),
2494 GEN_INT_OPTION(mapimg_zoom,
2495 N_("Zoom factor for map images"),
2496 N_("The magnification used for map images."),
2498 GEN_BOOL_OPTION(mapimg_layer[MAPIMG_LAYER_AREA],
2499 N_("Show area within borders"),
2500 N_("If set, the territory of each nation is shown "
2501 "on the saved image."),
2504 N_("Show borders"),
2505 N_("If set, the border of each nation is shown on the "
2506 "saved image."),
2509 N_("Show cities"),
2510 N_("If set, cities are shown on the saved image."),
2513 N_("Show fog of war"),
2514 N_("If set, the extent of fog of war is shown on the "
2515 "saved image."),
2518 N_("Show full terrain"),
2519 N_("If set, terrain relief is shown with different colors "
2520 "in the saved image; otherwise, only land and water are "
2521 "distinguished."),
2523 GEN_BOOL_OPTION(mapimg_layer[MAPIMG_LAYER_UNITS],
2524 N_("Show units"),
2525 N_("If set, units are shown in the saved image."),
2527 GEN_STR_OPTION(mapimg_filename,
2528 N_("Map image file name"),
2529 N_("The base part of the filename for saved map images. "
2530 "A string identifying the game turn and map options will "
2531 "be appended."),
2533
2534 /* gui-gtk-2.0 client specific options.
2535 * These are still kept just so users can migrate them to later gtk-clients */
2536 GEN_BOOL_OPTION(gui_gtk2_map_scrollbars, NULL, NULL,
2538 GEN_BOOL_OPTION(gui_gtk2_dialogs_on_top, NULL, NULL,
2540 GEN_BOOL_OPTION(gui_gtk2_show_task_icons, NULL, NULL,
2542 GEN_BOOL_OPTION(gui_gtk2_enable_tabs, NULL, NULL,
2544 GEN_BOOL_OPTION(gui_gtk2_better_fog, NULL, NULL,
2547 GEN_BOOL_OPTION(gui_gtk2_show_chat_message_time, NULL, NULL,
2549 GEN_BOOL_OPTION(gui_gtk2_new_messages_go_to_top, NULL, NULL,
2551 GEN_BOOL_OPTION(gui_gtk2_show_message_window_buttons, NULL, NULL,
2553 GEN_BOOL_OPTION(gui_gtk2_metaserver_tab_first, NULL, NULL,
2555 GEN_BOOL_OPTION(gui_gtk2_allied_chat_only, NULL, NULL,
2557 GEN_BOOL_OPTION(gui_gtk2_mouse_over_map_focus, NULL, NULL,
2559 GEN_BOOL_OPTION(gui_gtk2_chatline_autocompletion, NULL, NULL,
2561 GEN_INT_OPTION(gui_gtk2_citydlg_xsize, NULL, NULL,
2564 NULL),
2565 GEN_INT_OPTION(gui_gtk2_citydlg_ysize, NULL, NULL,
2568 NULL),
2569 GEN_ENUM_OPTION(gui_gtk2_popup_tech_help, NULL, NULL,
2573 GEN_FONT_OPTION(gui_gtk2_font_city_label, "city_label",
2574 NULL, NULL,
2576 "Monospace 8", font_changed_callback),
2577 GEN_FONT_OPTION(gui_gtk2_font_notify_label, "notify_label",
2578 NULL, NULL,
2580 "Monospace Bold 9", font_changed_callback),
2581 GEN_FONT_OPTION(gui_gtk2_font_spaceship_label, "spaceship_label",
2582 NULL, NULL,
2584 "Monospace 8", font_changed_callback),
2585 GEN_FONT_OPTION(gui_gtk2_font_help_label, "help_label",
2586 NULL, NULL,
2588 "Sans Bold 10", font_changed_callback),
2589 GEN_FONT_OPTION(gui_gtk2_font_help_link, "help_link",
2590 NULL, NULL,
2592 "Sans 9", font_changed_callback),
2593 GEN_FONT_OPTION(gui_gtk2_font_help_text, "help_text",
2594 NULL, NULL,
2596 "Monospace 8", font_changed_callback),
2597 GEN_FONT_OPTION(gui_gtk2_font_chatline, "chatline",
2598 NULL, NULL,
2600 "Monospace 8", font_changed_callback),
2601 GEN_FONT_OPTION(gui_gtk2_font_beta_label, "beta_label",
2602 NULL, NULL,
2604 "Sans Italic 10", font_changed_callback),
2605 GEN_FONT_OPTION(gui_gtk2_font_small, "small_font",
2606 NULL, NULL,
2608 "Sans 9", NULL),
2609 GEN_FONT_OPTION(gui_gtk2_font_comment_label, "comment_label",
2610 NULL, NULL,
2612 "Sans Italic 9", font_changed_callback),
2613 GEN_FONT_OPTION(gui_gtk2_font_city_names, "city_names",
2614 NULL, NULL,
2616 "Sans Bold 10", NULL),
2617 GEN_FONT_OPTION(gui_gtk2_font_city_productions, "city_productions",
2618 NULL, NULL,
2620 "Serif 10", NULL),
2621 GEN_FONT_OPTION(gui_gtk2_font_reqtree_text, "reqtree_text",
2622 NULL, NULL,
2624 "Serif 10", NULL),
2625
2626 /* gui-gtk-3.0 client specific options.
2627 * These are still kept just so users can migrate them to later gtk-clients */
2628 GEN_BOOL_OPTION(gui_gtk3_fullscreen, NULL, NULL,
2630 GEN_BOOL_OPTION(gui_gtk3_map_scrollbars, N_("Show map scrollbars"),
2631 N_("Disable this option to hide the scrollbars on the "
2632 "map view."),
2634 GEN_BOOL_OPTION(gui_gtk3_dialogs_on_top, NULL, NULL,
2636 GEN_BOOL_OPTION(gui_gtk3_show_task_icons, NULL, NULL,
2638 GEN_BOOL_OPTION(gui_gtk3_enable_tabs, NULL, NULL,
2640 GEN_BOOL_OPTION(gui_gtk3_show_chat_message_time, NULL, NULL,
2642 GEN_BOOL_OPTION(gui_gtk3_new_messages_go_to_top, NULL, NULL,
2644 GEN_BOOL_OPTION(gui_gtk3_show_message_window_buttons, NULL, NULL,
2646 GEN_BOOL_OPTION(gui_gtk3_metaserver_tab_first, NULL, NULL,
2648 GEN_BOOL_OPTION(gui_gtk3_allied_chat_only, NULL, NULL,
2650 GEN_ENUM_OPTION(gui_gtk3_message_chat_location, NULL, NULL,
2654 GEN_BOOL_OPTION(gui_gtk3_small_display_layout, NULL, NULL,
2656 GEN_BOOL_OPTION(gui_gtk3_mouse_over_map_focus, NULL, NULL,
2658 GEN_BOOL_OPTION(gui_gtk3_chatline_autocompletion, NULL, NULL,
2660 GEN_INT_OPTION(gui_gtk3_citydlg_xsize, NULL, NULL,
2663 NULL),
2664 GEN_INT_OPTION(gui_gtk3_citydlg_ysize, NULL, NULL,
2667 NULL),
2668 GEN_ENUM_OPTION(gui_gtk3_popup_tech_help, NULL, NULL,
2672 GEN_INT_OPTION(gui_gtk3_governor_range_min, NULL, NULL,
2675 NULL),
2676 GEN_INT_OPTION(gui_gtk3_governor_range_max, NULL, NULL,
2679 NULL),
2680 GEN_FONT_OPTION(gui_gtk3_font_city_label, "city_label",
2681 NULL, NULL,
2683 "Monospace 8", font_changed_callback),
2684 GEN_FONT_OPTION(gui_gtk3_font_notify_label, "notify_label",
2685 NULL, NULL,
2687 "Monospace Bold 9", font_changed_callback),
2688 GEN_FONT_OPTION(gui_gtk3_font_spaceship_label, "spaceship_label",
2689 NULL, NULL,
2691 "Monospace 8", font_changed_callback),
2692 GEN_FONT_OPTION(gui_gtk3_font_help_label, "help_label",
2693 NULL, NULL,
2695 "Sans Bold 10", font_changed_callback),
2696 GEN_FONT_OPTION(gui_gtk3_font_help_link, "help_link",
2697 NULL, NULL,
2699 "Sans 9", font_changed_callback),
2700 GEN_FONT_OPTION(gui_gtk3_font_help_text, "help_text",
2701 NULL, NULL,
2703 "Monospace 8", font_changed_callback),
2704 GEN_FONT_OPTION(gui_gtk3_font_chatline, "chatline",
2705 NULL, NULL,
2707 "Monospace 8", font_changed_callback),
2708 GEN_FONT_OPTION(gui_gtk3_font_beta_label, "beta_label",
2709 NULL, NULL,
2711 "Sans Italic 10", font_changed_callback),
2712 GEN_FONT_OPTION(gui_gtk3_font_small, "small_font",
2713 NULL, NULL,
2715 "Sans 9", NULL),
2716 GEN_FONT_OPTION(gui_gtk3_font_comment_label, "comment_label",
2717 NULL, NULL,
2719 "Sans Italic 9", font_changed_callback),
2720 GEN_FONT_OPTION(gui_gtk3_font_city_names, "city_names",
2721 NULL, NULL,
2723 "Sans Bold 10", NULL),
2724 GEN_FONT_OPTION(gui_gtk3_font_city_productions, "city_productions",
2725 NULL, NULL,
2727 "Serif 10", NULL),
2728 GEN_FONT_OPTION(gui_gtk3_font_reqtree_text, "reqtree_text",
2729 NULL, NULL,
2731 "Serif 10", NULL),
2732
2733 /* gui-gtk-3.22 client specific options. */
2734 GEN_BOOL_OPTION(gui_gtk3_22_fullscreen, N_("Fullscreen"),
2735 N_("If this option is set the client will use the "
2736 "whole screen area for drawing."),
2738 GEN_BOOL_OPTION(gui_gtk3_22_map_scrollbars, N_("Show map scrollbars"),
2739 N_("Disable this option to hide the scrollbars on the "
2740 "map view."),
2742 GEN_BOOL_OPTION(gui_gtk3_22_dialogs_on_top, N_("Keep dialogs on top"),
2743 N_("If this option is set then dialog windows will always "
2744 "remain in front of the main Freeciv window. "
2745 "Disabling this has no effect in fullscreen mode."),
2747 GEN_BOOL_OPTION(gui_gtk3_22_show_task_icons, N_("Show worklist task icons"),
2748 N_("Disabling this will turn off the unit and building "
2749 "icons in the worklist dialog and the production "
2750 "tab of the city dialog."),
2752 GEN_BOOL_OPTION(gui_gtk3_22_enable_tabs, N_("Enable status report tabs"),
2753 N_("If this option is enabled then report dialogs will "
2754 "be shown as separate tabs rather than in popup "
2755 "dialogs."),
2757 GEN_BOOL_OPTION(gui_gtk3_22_show_chat_message_time,
2758 N_("Show time for each chat message"),
2759 N_("If this option is enabled then all chat messages "
2760 "will be prefixed by a time string of the form "
2761 "[hour:minute:second]."),
2763 GEN_BOOL_OPTION(gui_gtk3_22_new_messages_go_to_top,
2764 N_("New message events go to top of list"),
2765 N_("If this option is enabled, new events in the "
2766 "message window will appear at the top of the list, "
2767 "rather than being appended at the bottom."),
2769 GEN_BOOL_OPTION(gui_gtk3_22_show_message_window_buttons,
2770 N_("Show extra message window buttons"),
2771 N_("If this option is enabled, there will be two "
2772 "buttons displayed in the message window for "
2773 "inspecting a city and going to a location. If this "
2774 "option is disabled, these buttons will not appear "
2775 "(you can still double-click with the left mouse "
2776 "button or right-click on a row to inspect or goto "
2777 "respectively). This option will only take effect "
2778 "once the message window is closed and reopened."),
2780 GEN_BOOL_OPTION(gui_gtk3_22_metaserver_tab_first,
2781 N_("Metaserver tab first in network page"),
2782 N_("If this option is enabled, the metaserver tab will "
2783 "be the first notebook tab in the network page. This "
2784 "option requires a restart in order to take effect."),
2786 GEN_BOOL_OPTION(gui_gtk3_22_allied_chat_only,
2787 N_("Plain chat messages are sent to allies only"),
2788 N_("If this option is enabled, then plain messages "
2789 "typed into the chat entry while the game is "
2790 "running will only be sent to your allies. "
2791 "Otherwise plain messages will be sent as "
2792 "public chat messages. To send a public chat "
2793 "message with this option enabled, prefix the "
2794 "message with a single colon ':'. This option "
2795 "can also be set using a toggle button beside "
2796 "the chat entry (only visible in multiplayer "
2797 "games)."),
2799 GEN_ENUM_OPTION(gui_gtk3_22_message_chat_location,
2800 N_("Messages and Chat reports location"),
2801 /* TRANS: The strings used in the UI for 'Split' etc are
2802 * tagged 'gui_gtk3_22/gtk4/gtk4_message_chat_location' */
2803 N_("Controls where the Messages and Chat reports "
2804 "appear relative to the main view containing the map.\n"
2805 "'Split' allows all three to be seen simultaneously, "
2806 "which is best for multiplayer, but requires a large "
2807 "window to be usable.\n"
2808 "'Separate' puts Messages and Chat in a notebook "
2809 "separate from the main view, so that one of them "
2810 "can always be seen alongside the main view.\n"
2811 "'Merged' makes the Messages and Chat reports into "
2812 "tabs alongside the map and other reports; this "
2813 "allows a larger map view on small screens.\n"
2814 "This option requires a restart in order to take "
2815 "effect."), COC_INTERFACE, GUI_GTK3_22,
2818 GEN_BOOL_OPTION(gui_gtk3_22_small_display_layout,
2819 N_("Arrange widgets for small displays"),
2820 N_("If this option is enabled, widgets in the main "
2821 "window will be arranged so that they take up the "
2822 "least amount of total screen space. Specifically, "
2823 "the left panel containing the overview, player "
2824 "status, and the unit information box will be "
2825 "extended over the entire left side of the window. "
2826 "This option requires a restart in order to take "
2827 "effect."), COC_INTERFACE, GUI_GTK3_22, FALSE, NULL),
2828 GEN_BOOL_OPTION(gui_gtk3_22_mouse_over_map_focus,
2829 N_("Mouse over the map widget selects it automatically"),
2830 N_("If this option is enabled, then the map will be "
2831 "focused when the mouse hovers over it."),
2833 GEN_BOOL_OPTION(gui_gtk3_22_chatline_autocompletion,
2834 N_("Player or user name autocompletion"),
2835 N_("If this option is turned on, the tabulation key "
2836 "will be used in the chatline to complete the word you "
2837 "are typing with the name of a player or a user."),
2839 GEN_INT_OPTION(gui_gtk3_22_citydlg_xsize,
2840 N_("Width of the city dialog"),
2841 N_("This value is only used if the width of the city "
2842 "dialog is saved."),
2845 NULL),
2846 GEN_INT_OPTION(gui_gtk3_22_citydlg_ysize,
2847 N_("Height of the city dialog"),
2848 N_("This value is only used if the height of the city "
2849 "dialog is saved."),
2852 NULL),
2853 GEN_ENUM_OPTION(gui_gtk3_22_popup_tech_help,
2854 N_("Popup tech help when gained"),
2855 N_("Controls if tech help should be opened when "
2856 "new tech has been gained.\n"
2857 "'Ruleset' means that behavior suggested by "
2858 "current ruleset is used."), COC_INTERFACE, GUI_GTK3_22,
2861 GEN_INT_OPTION(gui_gtk3_22_governor_range_min,
2862 N_("Minimum surplus for a governor"),
2863 N_("The lower limit of the range for requesting surpluses "
2864 "from the governor."),
2867 NULL),
2868 GEN_INT_OPTION(gui_gtk3_22_governor_range_max,
2869 N_("Maximum surplus for a governor"),
2870 N_("The higher limit of the range for requesting surpluses "
2871 "from the governor."),
2874 NULL),
2875 GEN_FONT_OPTION(gui_gtk3_22_font_city_label, "city_label",
2876 N_("City Label"),
2877 N_("This font is used to display the city labels on city "
2878 "dialogs."),
2880 "Monospace 8", font_changed_callback),
2881 GEN_FONT_OPTION(gui_gtk3_22_font_notify_label, "notify_label",
2882 N_("Notify Label"),
2883 N_("This font is used to display server reports such "
2884 "as the demographic report or historian publications."),
2886 "Monospace Bold 9", font_changed_callback),
2887 GEN_FONT_OPTION(gui_gtk3_22_font_spaceship_label, "spaceship_label",
2888 N_("Spaceship Label"),
2889 N_("This font is used to display the spaceship widgets."),
2891 "Monospace 8", font_changed_callback),
2892 GEN_FONT_OPTION(gui_gtk3_22_font_help_label, "help_label",
2893 N_("Help Label"),
2894 N_("This font is used to display the help headers in the "
2895 "help window."),
2897 "Sans Bold 10", font_changed_callback),
2898 GEN_FONT_OPTION(gui_gtk3_22_font_help_link, "help_link",
2899 N_("Help Link"),
2900 N_("This font is used to display the help links in the "
2901 "help window."),
2903 "Sans 9", font_changed_callback),
2904 GEN_FONT_OPTION(gui_gtk3_22_font_help_text, "help_text",
2905 N_("Help Text"),
2906 N_("This font is used to display the help body text in "
2907 "the help window."),
2909 "Monospace 8", font_changed_callback),
2910 GEN_FONT_OPTION(gui_gtk3_22_font_chatline, "chatline",
2911 N_("Chatline Area"),
2912 N_("This font is used to display the text in the "
2913 "chatline area."),
2915 "Monospace 8", font_changed_callback),
2916 GEN_FONT_OPTION(gui_gtk3_22_font_beta_label, "beta_label",
2917 N_("Beta Label"),
2918 N_("This font is used to display the beta label."),
2920 "Sans Italic 10", font_changed_callback),
2921 GEN_FONT_OPTION(gui_gtk3_22_font_small, "small_font",
2922 N_("Small Font"),
2923 N_("This font is used for any small font request. For "
2924 "example, it is used for display the building lists "
2925 "in the city dialog, the Economy report or the Units "
2926 "report."),
2928 "Sans 9", font_changed_callback),
2929 GEN_FONT_OPTION(gui_gtk3_22_font_comment_label, "comment_label",
2930 N_("Comment Label"),
2931 N_("This font is used to display comment labels, such as "
2932 "in the governor page of the city dialogs."),
2934 "Sans Italic 9", font_changed_callback),
2935 GEN_FONT_OPTION(gui_gtk3_22_font_city_names, "city_names",
2936 N_("City Names"),
2937 N_("This font is used to the display the city names "
2938 "on the map."),
2940 "Sans Bold 10", NULL),
2941 GEN_FONT_OPTION(gui_gtk3_22_font_city_productions, "city_productions",
2942 N_("City Productions"),
2943 N_("This font is used to display the city production "
2944 "on the map."),
2946 "Serif 10", NULL),
2947 GEN_FONT_OPTION(gui_gtk3_22_font_reqtree_text, "reqtree_text",
2948 N_("Requirement Tree"),
2949 N_("This font is used to the display the requirement tree "
2950 "in the Research report."),
2952 "Serif 10", NULL),
2953
2954 /* gui-gtk-4.0 client specific options. */
2955 GEN_BOOL_OPTION(gui_gtk4_fullscreen, N_("Fullscreen"),
2956 N_("If this option is set the client will use the "
2957 "whole screen area for drawing."),
2959 GEN_BOOL_OPTION(gui_gtk4_map_scrollbars, N_("Show map scrollbars"),
2960 N_("Disable this option to hide the scrollbars on the "
2961 "map view."),
2963 GEN_BOOL_OPTION(gui_gtk4_dialogs_on_top, N_("Keep dialogs on top"),
2964 N_("If this option is set then dialog windows will always "
2965 "remain in front of the main Freeciv window. "
2966 "Disabling this has no effect in fullscreen mode."),
2968 GEN_BOOL_OPTION(gui_gtk4_show_task_icons, N_("Show worklist task icons"),
2969 N_("Disabling this will turn off the unit and building "
2970 "icons in the worklist dialog and the production "
2971 "tab of the city dialog."),
2973 GEN_BOOL_OPTION(gui_gtk4_enable_tabs, N_("Enable status report tabs"),
2974 N_("If this option is enabled then report dialogs will "
2975 "be shown as separate tabs rather than in popup "
2976 "dialogs."),
2978 GEN_BOOL_OPTION(gui_gtk4_show_chat_message_time,
2979 N_("Show time for each chat message"),
2980 N_("If this option is enabled then all chat messages "
2981 "will be prefixed by a time string of the form "
2982 "[hour:minute:second]."),
2984 GEN_BOOL_OPTION(gui_gtk4_new_messages_go_to_top,
2985 N_("New message events go to top of list"),
2986 N_("If this option is enabled, new events in the "
2987 "message window will appear at the top of the list, "
2988 "rather than being appended at the bottom."),
2990 GEN_BOOL_OPTION(gui_gtk4_show_message_window_buttons,
2991 N_("Show extra message window buttons"),
2992 N_("If this option is enabled, there will be two "
2993 "buttons displayed in the message window for "
2994 "inspecting a city and going to a location. If this "
2995 "option is disabled, these buttons will not appear "
2996 "(you can still double-click with the left mouse "
2997 "button or right-click on a row to inspect or goto "
2998 "respectively). This option will only take effect "
2999 "once the message window is closed and reopened."),
3001 GEN_BOOL_OPTION(gui_gtk4_metaserver_tab_first,
3002 N_("Metaserver tab first in network page"),
3003 N_("If this option is enabled, the metaserver tab will "
3004 "be the first notebook tab in the network page. This "
3005 "option requires a restart in order to take effect."),
3007 GEN_BOOL_OPTION(gui_gtk4_allied_chat_only,
3008 N_("Plain chat messages are sent to allies only"),
3009 N_("If this option is enabled, then plain messages "
3010 "typed into the chat entry while the game is "
3011 "running will only be sent to your allies. "
3012 "Otherwise plain messages will be sent as "
3013 "public chat messages. To send a public chat "
3014 "message with this option enabled, prefix the "
3015 "message with a single colon ':'. This option "
3016 "can also be set using a toggle button beside "
3017 "the chat entry (only visible in multiplayer "
3018 "games)."),
3020 GEN_ENUM_OPTION(gui_gtk4_message_chat_location,
3021 N_("Messages and Chat reports location"),
3022 /* TRANS: The strings used in the UI for 'Split' etc are
3023 * tagged 'gui_gtk3_22/gtk4/gtk5_message_chat_location' */
3024 N_("Controls where the Messages and Chat reports "
3025 "appear relative to the main view containing the map.\n"
3026 "'Split' allows all three to be seen simultaneously, "
3027 "which is best for multiplayer, but requires a large "
3028 "window to be usable.\n"
3029 "'Separate' puts Messages and Chat in a notebook "
3030 "separate from the main view, so that one of them "
3031 "can always be seen alongside the main view.\n"
3032 "'Merged' makes the Messages and Chat reports into "
3033 "tabs alongside the map and other reports; this "
3034 "allows a larger map view on small screens.\n"
3035 "This option requires a restart in order to take "
3036 "effect."), COC_INTERFACE, GUI_GTK4,
3039 GEN_BOOL_OPTION(gui_gtk4_small_display_layout,
3040 N_("Arrange widgets for small displays"),
3041 N_("If this option is enabled, widgets in the main "
3042 "window will be arranged so that they take up the "
3043 "least amount of total screen space. Specifically, "
3044 "the left panel containing the overview, player "
3045 "status, and the unit information box will be "
3046 "extended over the entire left side of the window. "
3047 "This option requires a restart in order to take "
3048 "effect."), COC_INTERFACE, GUI_GTK4, FALSE, NULL),
3049 GEN_BOOL_OPTION(gui_gtk4_mouse_over_map_focus,
3050 N_("Mouse over the map widget selects it automatically"),
3051 N_("If this option is enabled, then the map will be "
3052 "focused when the mouse hovers over it."),
3054 GEN_BOOL_OPTION(gui_gtk4_chatline_autocompletion,
3055 N_("Player or user name autocompletion"),
3056 N_("If this option is turned on, the tabulation key "
3057 "will be used in the chatline to complete the word you "
3058 "are typing with the name of a player or a user."),
3060 GEN_INT_OPTION(gui_gtk4_citydlg_xsize,
3061 N_("Width of the city dialog"),
3062 N_("This value is only used if the width of the city "
3063 "dialog is saved."),
3066 NULL),
3067 GEN_INT_OPTION(gui_gtk4_citydlg_ysize,
3068 N_("Height of the city dialog"),
3069 N_("This value is only used if the height of the city "
3070 "dialog is saved."),
3073 NULL),
3074 GEN_ENUM_OPTION(gui_gtk4_popup_tech_help,
3075 N_("Popup tech help when gained"),
3076 N_("Controls if tech help should be opened when "
3077 "new tech has been gained.\n"
3078 "'Ruleset' means that behavior suggested by "
3079 "current ruleset is used."), COC_INTERFACE, GUI_GTK4,
3082 GEN_INT_OPTION(gui_gtk4_governor_range_min,
3083 N_("Minimum surplus for a governor"),
3084 N_("The lower limit of the range for requesting surpluses "
3085 "from the governor."),
3088 NULL),
3089 GEN_INT_OPTION(gui_gtk4_governor_range_max,
3090 N_("Maximum surplus for a governor"),
3091 N_("The higher limit of the range for requesting surpluses "
3092 "from the governor."),
3095 NULL),
3096 GEN_FONT_OPTION(gui_gtk4_font_city_label, "city_label",
3097 N_("City Label"),
3098 N_("This font is used to display the city labels on city "
3099 "dialogs."),
3101 "Monospace 8", font_changed_callback),
3102 GEN_FONT_OPTION(gui_gtk4_font_notify_label, "notify_label",
3103 N_("Notify Label"),
3104 N_("This font is used to display server reports such "
3105 "as the demographic report or historian publications."),
3107 "Monospace Bold 9", font_changed_callback),
3108 GEN_FONT_OPTION(gui_gtk4_font_spaceship_label, "spaceship_label",
3109 N_("Spaceship Label"),
3110 N_("This font is used to display the spaceship widgets."),
3112 "Monospace 8", font_changed_callback),
3113 GEN_FONT_OPTION(gui_gtk4_font_help_label, "help_label",
3114 N_("Help Label"),
3115 N_("This font is used to display the help headers in the "
3116 "help window."),
3118 "Sans Bold 10", font_changed_callback),
3119 GEN_FONT_OPTION(gui_gtk4_font_help_link, "help_link",
3120 N_("Help Link"),
3121 N_("This font is used to display the help links in the "
3122 "help window."),
3124 "Sans 9", font_changed_callback),
3125 GEN_FONT_OPTION(gui_gtk4_font_help_text, "help_text",
3126 N_("Help Text"),
3127 N_("This font is used to display the help body text in "
3128 "the help window."),
3130 "Monospace 8", font_changed_callback),
3131 GEN_FONT_OPTION(gui_gtk4_font_chatline, "chatline",
3132 N_("Chatline Area"),
3133 N_("This font is used to display the text in the "
3134 "chatline area."),
3136 "Monospace 8", font_changed_callback),
3137 GEN_FONT_OPTION(gui_gtk4_font_beta_label, "beta_label",
3138 N_("Beta Label"),
3139 N_("This font is used to display the beta label."),
3141 "Sans Italic 10", font_changed_callback),
3142 GEN_FONT_OPTION(gui_gtk4_font_small, "small_font",
3143 N_("Small Font"),
3144 N_("This font is used for any small font request. For "
3145 "example, it is used for display the building lists "
3146 "in the city dialog, the Economy report or the Units "
3147 "report."),
3149 "Sans 9", font_changed_callback),
3150 GEN_FONT_OPTION(gui_gtk4_font_comment_label, "comment_label",
3151 N_("Comment Label"),
3152 N_("This font is used to display comment labels, such as "
3153 "in the governor page of the city dialogs."),
3155 "Sans Italic 9", font_changed_callback),
3156 GEN_FONT_OPTION(gui_gtk4_font_city_names, "city_names",
3157 N_("City Names"),
3158 N_("This font is used to the display the city names "
3159 "on the map."),
3161 "Sans Bold 10", NULL),
3162 GEN_FONT_OPTION(gui_gtk4_font_city_productions, "city_productions",
3163 N_("City Productions"),
3164 N_("This font is used to display the city production "
3165 "on the map."),
3167 "Serif 10", NULL),
3168 GEN_FONT_OPTION(gui_gtk4_font_reqtree_text, "reqtree_text",
3169 N_("Requirement Tree"),
3170 N_("This font is used to the display the requirement tree "
3171 "in the Research report."),
3173 "Serif 10", NULL),
3174
3175 /* gui-gtk-5.0 client specific options. */
3176 GEN_BOOL_OPTION(gui_gtk5_fullscreen, N_("Fullscreen"),
3177 N_("If this option is set the client will use the "
3178 "whole screen area for drawing."),
3180 GEN_BOOL_OPTION(gui_gtk5_map_scrollbars, N_("Show map scrollbars"),
3181 N_("Disable this option to hide the scrollbars on the "
3182 "map view."),
3184 GEN_BOOL_OPTION(gui_gtk5_dialogs_on_top, N_("Keep dialogs on top"),
3185 N_("If this option is set then dialog windows will always "
3186 "remain in front of the main Freeciv window. "
3187 "Disabling this has no effect in fullscreen mode."),
3189 GEN_BOOL_OPTION(gui_gtk5_show_task_icons, N_("Show worklist task icons"),
3190 N_("Disabling this will turn off the unit and building "
3191 "icons in the worklist dialog and the production "
3192 "tab of the city dialog."),
3194 GEN_BOOL_OPTION(gui_gtk5_enable_tabs, N_("Enable status report tabs"),
3195 N_("If this option is enabled then report dialogs will "
3196 "be shown as separate tabs rather than in popup "
3197 "dialogs."),
3199 GEN_BOOL_OPTION(gui_gtk5_show_chat_message_time,
3200 N_("Show time for each chat message"),
3201 N_("If this option is enabled then all chat messages "
3202 "will be prefixed by a time string of the form "
3203 "[hour:minute:second]."),
3205 GEN_BOOL_OPTION(gui_gtk5_new_messages_go_to_top,
3206 N_("New message events go to top of list"),
3207 N_("If this option is enabled, new events in the "
3208 "message window will appear at the top of the list, "
3209 "rather than being appended at the bottom."),
3211 GEN_BOOL_OPTION(gui_gtk5_show_message_window_buttons,
3212 N_("Show extra message window buttons"),
3213 N_("If this option is enabled, there will be two "
3214 "buttons displayed in the message window for "
3215 "inspecting a city and going to a location. If this "
3216 "option is disabled, these buttons will not appear "
3217 "(you can still double-click with the left mouse "
3218 "button or right-click on a row to inspect or goto "
3219 "respectively). This option will only take effect "
3220 "once the message window is closed and reopened."),
3222 GEN_BOOL_OPTION(gui_gtk5_metaserver_tab_first,
3223 N_("Metaserver tab first in network page"),
3224 N_("If this option is enabled, the metaserver tab will "
3225 "be the first notebook tab in the network page. This "
3226 "option requires a restart in order to take effect."),
3228 GEN_BOOL_OPTION(gui_gtk5_allied_chat_only,
3229 N_("Plain chat messages are sent to allies only"),
3230 N_("If this option is enabled, then plain messages "
3231 "typed into the chat entry while the game is "
3232 "running will only be sent to your allies. "
3233 "Otherwise plain messages will be sent as "
3234 "public chat messages. To send a public chat "
3235 "message with this option enabled, prefix the "
3236 "message with a single colon ':'. This option "
3237 "can also be set using a toggle button beside "
3238 "the chat entry (only visible in multiplayer "
3239 "games)."),
3241 GEN_ENUM_OPTION(gui_gtk5_message_chat_location,
3242 N_("Messages and Chat reports location"),
3243 /* TRANS: The strings used in the UI for 'Split' etc are
3244 * tagged 'gui_gtk3_22/gtk4/gtk5_message_chat_location' */
3245 N_("Controls where the Messages and Chat reports "
3246 "appear relative to the main view containing the map.\n"
3247 "'Split' allows all three to be seen simultaneously, "
3248 "which is best for multiplayer, but requires a large "
3249 "window to be usable.\n"
3250 "'Separate' puts Messages and Chat in a notebook "
3251 "separate from the main view, so that one of them "
3252 "can always be seen alongside the main view.\n"
3253 "'Merged' makes the Messages and Chat reports into "
3254 "tabs alongside the map and other reports; this "
3255 "allows a larger map view on small screens.\n"
3256 "This option requires a restart in order to take "
3257 "effect."), COC_INTERFACE, GUI_GTK5,
3260 GEN_BOOL_OPTION(gui_gtk5_small_display_layout,
3261 N_("Arrange widgets for small displays"),
3262 N_("If this option is enabled, widgets in the main "
3263 "window will be arranged so that they take up the "
3264 "least amount of total screen space. Specifically, "
3265 "the left panel containing the overview, player "
3266 "status, and the unit information box will be "
3267 "extended over the entire left side of the window. "
3268 "This option requires a restart in order to take "
3269 "effect."), COC_INTERFACE, GUI_GTK5, FALSE, NULL),
3270 GEN_BOOL_OPTION(gui_gtk5_mouse_over_map_focus,
3271 N_("Mouse over the map widget selects it automatically"),
3272 N_("If this option is enabled, then the map will be "
3273 "focused when the mouse hovers over it."),
3275 GEN_BOOL_OPTION(gui_gtk5_chatline_autocompletion,
3276 N_("Player or user name autocompletion"),
3277 N_("If this option is turned on, the tabulation key "
3278 "will be used in the chatline to complete the word you "
3279 "are typing with the name of a player or a user."),
3281 GEN_INT_OPTION(gui_gtk5_citydlg_xsize,
3282 N_("Width of the city dialog"),
3283 N_("This value is only used if the width of the city "
3284 "dialog is saved."),
3287 NULL),
3288 GEN_INT_OPTION(gui_gtk5_citydlg_ysize,
3289 N_("Height of the city dialog"),
3290 N_("This value is only used if the height of the city "
3291 "dialog is saved."),
3294 NULL),
3295 GEN_ENUM_OPTION(gui_gtk5_popup_tech_help,
3296 N_("Popup tech help when gained"),
3297 N_("Controls if tech help should be opened when "
3298 "new tech has been gained.\n"
3299 "'Ruleset' means that behavior suggested by "
3300 "current ruleset is used."), COC_INTERFACE, GUI_GTK5,
3303 GEN_INT_OPTION(gui_gtk5_governor_range_min,
3304 N_("Minimum surplus for a governor"),
3305 N_("The lower limit of the range for requesting surpluses "
3306 "from the governor."),
3309 NULL),
3310 GEN_INT_OPTION(gui_gtk5_governor_range_max,
3311 N_("Maximum surplus for a governor"),
3312 N_("The higher limit of the range for requesting surpluses "
3313 "from the governor."),
3316 NULL),
3317 GEN_FONT_OPTION(gui_gtk5_font_city_label, "city_label",
3318 N_("City Label"),
3319 N_("This font is used to display the city labels on city "
3320 "dialogs."),
3322 "Monospace 8", font_changed_callback),
3323 GEN_FONT_OPTION(gui_gtk5_font_notify_label, "notify_label",
3324 N_("Notify Label"),
3325 N_("This font is used to display server reports such "
3326 "as the demographic report or historian publications."),
3328 "Monospace Bold 9", font_changed_callback),
3329 GEN_FONT_OPTION(gui_gtk5_font_spaceship_label, "spaceship_label",
3330 N_("Spaceship Label"),
3331 N_("This font is used to display the spaceship widgets."),
3333 "Monospace 8", font_changed_callback),
3334 GEN_FONT_OPTION(gui_gtk5_font_help_label, "help_label",
3335 N_("Help Label"),
3336 N_("This font is used to display the help headers in the "
3337 "help window."),
3339 "Sans Bold 10", font_changed_callback),
3340 GEN_FONT_OPTION(gui_gtk5_font_help_link, "help_link",
3341 N_("Help Link"),
3342 N_("This font is used to display the help links in the "
3343 "help window."),
3345 "Sans 9", font_changed_callback),
3346 GEN_FONT_OPTION(gui_gtk5_font_help_text, "help_text",
3347 N_("Help Text"),
3348 N_("This font is used to display the help body text in "
3349 "the help window."),
3351 "Monospace 8", font_changed_callback),
3352 GEN_FONT_OPTION(gui_gtk5_font_chatline, "chatline",
3353 N_("Chatline Area"),
3354 N_("This font is used to display the text in the "
3355 "chatline area."),
3357 "Monospace 8", font_changed_callback),
3358 GEN_FONT_OPTION(gui_gtk5_font_beta_label, "beta_label",
3359 N_("Beta Label"),
3360 N_("This font is used to display the beta label."),
3362 "Sans Italic 10", font_changed_callback),
3363 GEN_FONT_OPTION(gui_gtk5_font_small, "small_font",
3364 N_("Small Font"),
3365 N_("This font is used for any small font request. For "
3366 "example, it is used for display the building lists "
3367 "in the city dialog, the Economy report or the Units "
3368 "report."),
3370 "Sans 9", font_changed_callback),
3371 GEN_FONT_OPTION(gui_gtk5_font_comment_label, "comment_label",
3372 N_("Comment Label"),
3373 N_("This font is used to display comment labels, such as "
3374 "in the governor page of the city dialogs."),
3376 "Sans Italic 9", font_changed_callback),
3377 GEN_FONT_OPTION(gui_gtk5_font_city_names, "city_names",
3378 N_("City Names"),
3379 N_("This font is used to the display the city names "
3380 "on the map."),
3382 "Sans Bold 10", NULL),
3383 GEN_FONT_OPTION(gui_gtk5_font_city_productions, "city_productions",
3384 N_("City Productions"),
3385 N_("This font is used to display the city production "
3386 "on the map."),
3388 "Serif 10", NULL),
3389 GEN_FONT_OPTION(gui_gtk5_font_reqtree_text, "reqtree_text",
3390 N_("Requirement Tree"),
3391 N_("This font is used to the display the requirement tree "
3392 "in the Research report."),
3394 "Serif 10", NULL),
3395
3396 /* gui-sdl client specific options.
3397 * These are still kept just so users can migrate them to sdl2-client */
3398 GEN_BOOL_OPTION(gui_sdl_fullscreen, NULL, NULL,
3400 GEN_VIDEO_OPTION(gui_sdl_screen, NULL, NULL,
3401 COC_INTERFACE, GUI_SDL, 640, 480, NULL),
3402 GEN_BOOL_OPTION(gui_sdl_do_cursor_animation, NULL, NULL,
3404 GEN_BOOL_OPTION(gui_sdl_use_color_cursors, NULL, NULL,
3406
3407 /* gui-sdl2 client specific options. */
3408 GEN_BOOL_OPTION(gui_sdl2_fullscreen, N_("Fullscreen"),
3409 N_("If this option is set the client will use the "
3410 "whole screen area for drawing."),
3412 GEN_VIDEO_OPTION(gui_sdl2_screen, N_("Screen resolution"),
3413 N_("This option controls the resolution of the "
3414 "selected screen."),
3415 COC_INTERFACE, GUI_SDL2, 640, 480, NULL),
3416 GEN_BOOL_OPTION(gui_sdl2_swrenderer, N_("Use software rendering"),
3417 N_("Usually hardware rendering is used when possible. "
3418 "With this option set, software rendering is always used."),
3420 GEN_BOOL_OPTION(gui_sdl2_do_cursor_animation, N_("Do cursor animation"),
3421 N_("If this option is disabled, the cursor will "
3422 "always be displayed as static."),
3424 GEN_BOOL_OPTION(gui_sdl2_use_color_cursors, N_("Use color cursors"),
3425 N_("If this option is disabled, the cursor will "
3426 "always be displayed in black and white."),
3428 GEN_FONT_OPTION(gui_sdl2_font_city_names, "FONT_CITY_NAME",
3429 N_("City Names"),
3430 N_("The size of font used to the display the city names "
3431 "on the map."),
3433 "10", font_changed_callback),
3434 GEN_FONT_OPTION(gui_sdl2_font_city_productions, "FONT_CITY_PROD",
3435 N_("City Productions"),
3436 N_("The size of font used to the display the city "
3437 "production names on the map."),
3439 "10", font_changed_callback),
3440 GEN_BOOL_OPTION(gui_sdl2_use_theme_font_size, N_("Use theme defined font size"),
3441 N_("Disable this to override base font size set by theme "
3442 "by the setting below."),
3444 GEN_INT_OPTION(gui_sdl2_font_size, N_("Base Font Size"),
3445 N_("Base Font Size. All the fonts' sizes are defined relative "
3446 "to this. This option has effect only if theme font sizes "
3447 "option is disabled."),
3448 COC_FONT, GUI_SDL2, 10, 6, 50, NULL),
3449
3450 /* gui-sdl3 client specific options. */
3451 GEN_BOOL_OPTION(gui_sdl3_fullscreen, N_("Fullscreen"),
3452 N_("If this option is set the client will use the "
3453 "whole screen area for drawing."),
3455 GEN_VIDEO_OPTION(gui_sdl3_screen, N_("Screen resolution"),
3456 N_("This option controls the resolution of the "
3457 "selected screen."),
3458 COC_INTERFACE, GUI_SDL3, 640, 480, NULL),
3459 GEN_BOOL_OPTION(gui_sdl3_do_cursor_animation, N_("Do cursor animation"),
3460 N_("If this option is disabled, the cursor will "
3461 "always be displayed as static."),
3463 GEN_BOOL_OPTION(gui_sdl3_use_color_cursors, N_("Use color cursors"),
3464 N_("If this option is disabled, the cursor will "
3465 "always be displayed in black and white."),
3467 GEN_FONT_OPTION(gui_sdl3_font_city_names, "FONT_CITY_NAME",
3468 N_("City Names"),
3469 N_("The size of font used to the display the city names "
3470 "on the map."),
3472 "10", font_changed_callback),
3473 GEN_FONT_OPTION(gui_sdl3_font_city_productions, "FONT_CITY_PROD",
3474 N_("City Productions"),
3475 N_("The size of font used to the display the city "
3476 "production names on the map."),
3478 "10", font_changed_callback),
3479 GEN_BOOL_OPTION(gui_sdl3_use_theme_font_size, N_("Use theme defined font size"),
3480 N_("Disable this to override base font size set by theme "
3481 "by the setting below."),
3483 GEN_INT_OPTION(gui_sdl3_font_size, N_("Base Font Size"),
3484 N_("Base Font Size. All the fonts' sizes are defined relative "
3485 "to this. This option has effect only if theme font sizes "
3486 "option is disabled."),
3487 COC_FONT, GUI_SDL3, 10, 6, 50, NULL),
3488
3489 /* gui-qt client specific options. */
3490 GEN_BOOL_OPTION(gui_qt_fullscreen, N_("Fullscreen"),
3491 N_("If this option is set the client will use the "
3492 "whole screen area for drawing."),
3494 GEN_BOOL_OPTION(gui_qt_show_titlebar, N_("Show titlebar"),
3495 N_("If this option is set the client will show a titlebar. "
3496 "If disabled, then no titlebar will be shown, and "
3497 "minimize/maximize/etc buttons will be placed on the "
3498 "menu bar."),
3500 GEN_FONT_OPTION(gui_qt_font_default, "default_font",
3501 N_("Default font"),
3502 N_("This is default font"),
3504 "Sans Serif,10,-1,5,75,0,0,0,0,0", font_changed_callback),
3505 GEN_FONT_OPTION(gui_qt_font_notify_label, "notify_label",
3506 N_("Notify Label"),
3507 N_("This font is used to display server reports such "
3508 "as the demographic report or historian publications."),
3510 "Monospace,9,-1,5,75,0,0,0,0,0", font_changed_callback),
3511 GEN_FONT_OPTION(gui_qt_font_help_label, "help_label",
3512 N_("Help Label"),
3513 N_("This font is used to display the help labels in the "
3514 "help window."),
3516 "Sans Serif,9,-1,5,50,0,0,0,0,0", font_changed_callback),
3517 GEN_FONT_OPTION(gui_qt_font_help_text, "help_text",
3518 N_("Help Text"),
3519 N_("This font is used to display the help body text in "
3520 "the help window."),
3522 "Monospace,8,-1,5,50,0,0,0,0,0", font_changed_callback),
3523 GEN_FONT_OPTION(gui_qt_font_chatline, "chatline",
3524 N_("Chatline Area"),
3525 N_("This font is used to display the text in the "
3526 "chatline area."),
3528 "Monospace,8,-1,5,50,0,0,0,0,0", font_changed_callback),
3529 GEN_FONT_OPTION(gui_qt_font_city_names, "city_names",
3530 N_("City Names"),
3531 N_("This font is used to the display the city names "
3532 "on the map."),
3534 "Sans Serif,10,-1,5,75,0,0,0,0,0", font_changed_callback),
3535 GEN_FONT_OPTION(gui_qt_font_city_productions, "city_productions",
3536 N_("City Productions"),
3537 N_("This font is used to display the city production "
3538 "on the map."),
3540 "Sans Serif,10,-1,5,50,1,0,0,0,0", font_changed_callback),
3541 GEN_FONT_OPTION(gui_qt_font_reqtree_text, "reqtree_text",
3542 N_("Requirement Tree"),
3543 N_("This font is used to the display the requirement tree "
3544 "in the Research report."),
3546 "Sans Serif,10,-1,5,50,1,0,0,0,0", font_changed_callback),
3547 GEN_BOOL_OPTION(gui_qt_show_preview, N_("Show savegame information"),
3548 N_("If this option is set the client will show "
3549 "information and map preview of current savegame."),
3551 GEN_BOOL_OPTION(gui_qt_sidebar_left, N_("Sidebar position"),
3552 N_("If this option is set, the sidebar will be to the left "
3553 "of the map, otherwise to the right."),
3555 GEN_STR_OPTION(gui_qt_wakeup_text,
3556 N_("Wake up sequence"),
3557 N_("String which will trigger sound in pregame page; "
3558 "%1 stands for username."),
3559 COC_INTERFACE, GUI_QT, "Wake up %1", NULL, 0),
3560 GEN_BOOL_OPTION(gui_qt_svgflags, N_("SVG flags features"),
3562 N_("Enable svgflags features, such as bigger flags "
3563 "on the diplomacy dialog. Change to this comes "
3564 "to an effect on next client start."),
3565#else /* FREECIV_SVG_FLAGS */
3566 N_("Enable svgflags features, such as bigger flags "
3567 "on the diplomacy dialog. This has no effect on "
3568 "this freeciv build, as the svg support has not "
3569 "been built in."),
3570#endif /* FREECIV_SVG_FLAGS */
3572};
3574
3575/* Iteration loop, including invalid options for the current gui type. */
3576#define client_options_iterate_all(poption) \
3577{ \
3578 const struct client_option *const poption##_max = \
3579 client_options + client_options_num; \
3580 struct client_option *client_##poption = client_options; \
3581 struct option *poption; \
3582 for (; client_##poption < poption##_max; client_##poption++) { \
3583 poption = OPTION(client_##poption);
3584
3585#define client_options_iterate_all_end \
3586 } \
3587}
3588
3589
3590/************************************************************************/
3593static struct client_option *
3595{
3596 const struct client_option *const max =
3598 const enum gui_type our_type = get_gui_type();
3599
3600 while (poption < max
3601 && poption->specific != GUI_STUB
3602 && poption->specific != our_type) {
3603 poption++;
3604 }
3605
3606 return (poption < max ? poption : NULL);
3607}
3608
3609/************************************************************************/
3613{
3614 if (0 > id || id > client_options_num) {
3615 return NULL;
3616 }
3617 return OPTION(client_options + id);
3618}
3619
3620/************************************************************************/
3627
3628/************************************************************************/
3632{
3633 return COC_MAX;
3634}
3635
3636/************************************************************************/
3639static const char *client_optset_category_name(int category)
3640{
3641 switch (category) {
3642 case COC_GRAPHICS:
3643 return _("Graphics");
3644 case COC_OVERVIEW:
3645 /* TRANS: Options section for overview map (mini-map) */
3646 return Q_("?map:Overview");
3647 case COC_SOUND:
3648 return _("Sound");
3649 case COC_INTERFACE:
3650 return _("Interface");
3651 case COC_MAPIMG:
3652 return _("Map Image");
3653 case COC_NETWORK:
3654 return _("Network");
3655 case COC_FONT:
3656 return _("Font");
3657 case COC_MAX:
3658 break;
3659 }
3660
3661 log_error("%s: invalid option category number %d.",
3662 __FUNCTION__, category);
3663 return NULL;
3664}
3665
3666/************************************************************************/
3669static int client_option_number(const struct option *poption)
3670{
3672}
3673
3674/************************************************************************/
3677static const char *client_option_name(const struct option *poption)
3678{
3679 return CLIENT_OPTION(poption)->name;
3680}
3681
3682/************************************************************************/
3685static const char *client_option_description(const struct option *poption)
3686{
3687 return _(CLIENT_OPTION(poption)->description);
3688}
3689
3690/************************************************************************/
3693static const char *client_option_help_text(const struct option *poption)
3694{
3695 return _(CLIENT_OPTION(poption)->help_text);
3696}
3697
3698/************************************************************************/
3701static int client_option_category(const struct option *poption)
3702{
3703 return CLIENT_OPTION(poption)->category;
3704}
3705
3706/************************************************************************/
3710{
3711 return TRUE;
3712}
3713
3714/************************************************************************/
3717static struct option *client_option_next(const struct option *poption)
3718{
3720}
3721
3722/************************************************************************/
3725static bool client_option_bool_get(const struct option *poption)
3726{
3727 return *(CLIENT_OPTION(poption)->boolean.pvalue);
3728}
3729
3730/************************************************************************/
3733static bool client_option_bool_def(const struct option *poption)
3734{
3735 return CLIENT_OPTION(poption)->boolean.def;
3736}
3737
3738/************************************************************************/
3742static bool client_option_bool_set(struct option *poption, bool val)
3743{
3745
3746 if (*pcoption->boolean.pvalue == val) {
3747 return FALSE;
3748 }
3749
3750 *pcoption->boolean.pvalue = val;
3751 return TRUE;
3752}
3753
3754/************************************************************************/
3757static int client_option_int_get(const struct option *poption)
3758{
3759 return *(CLIENT_OPTION(poption)->integer.pvalue);
3760}
3761
3762/************************************************************************/
3765static int client_option_int_def(const struct option *poption)
3766{
3767 return CLIENT_OPTION(poption)->integer.def;
3768}
3769
3770/************************************************************************/
3773static int client_option_int_min(const struct option *poption)
3774{
3775 return CLIENT_OPTION(poption)->integer.min;
3776}
3777
3778/************************************************************************/
3781static int client_option_int_max(const struct option *poption)
3782{
3783 return CLIENT_OPTION(poption)->integer.max;
3784}
3785
3786/************************************************************************/
3790static bool client_option_int_set(struct option *poption, int val)
3791{
3793
3795 || val > pcoption->integer.max
3796 || *pcoption->integer.pvalue == val) {
3797 return FALSE;
3798 }
3799
3800 *pcoption->integer.pvalue = val;
3801 return TRUE;
3802}
3803
3804/************************************************************************/
3807static const char *client_option_str_get(const struct option *poption)
3808{
3809 return CLIENT_OPTION(poption)->string.pvalue;
3810}
3811
3812/************************************************************************/
3815static const char *client_option_str_def(const struct option *poption)
3816{
3817 return CLIENT_OPTION(poption)->string.def;
3818}
3819
3820/************************************************************************/
3824static const struct strvec *
3826{
3827 return (CLIENT_OPTION(poption)->string.val_accessor
3828 ? CLIENT_OPTION(poption)->string.val_accessor(poption) : NULL);
3829}
3830
3831/************************************************************************/
3835static bool client_option_str_set(struct option *poption, const char *str)
3836{
3838
3839 if (strlen(str) >= pcoption->string.size
3840 || 0 == strcmp(pcoption->string.pvalue, str)) {
3841 return FALSE;
3842 }
3843
3844 fc_strlcpy(pcoption->string.pvalue, str, pcoption->string.size);
3845 return TRUE;
3846}
3847
3848/************************************************************************/
3851static int client_option_enum_get(const struct option *poption)
3852{
3853 return *(CLIENT_OPTION(poption)->enumerator.pvalue);
3854}
3855
3856/************************************************************************/
3859static int client_option_enum_def(const struct option *poption)
3860{
3861 return CLIENT_OPTION(poption)->enumerator.def;
3862}
3863
3864/************************************************************************/
3868static const struct strvec *
3870{
3871 return CLIENT_OPTION(poption)->enumerator.pretty_names;
3872}
3873
3874/************************************************************************/
3878static bool client_option_enum_set(struct option *poption, int val)
3879{
3881
3882 if (*pcoption->enumerator.pvalue == val
3883 || 0 > val
3884 || val >= strvec_size(pcoption->enumerator.support_names)) {
3885 return FALSE;
3886 }
3887
3888 *pcoption->enumerator.pvalue = val;
3889 return TRUE;
3890}
3891
3892/************************************************************************/
3898 int val)
3899{
3900 const struct strvec *names = CLIENT_OPTION(data)->enumerator.support_names;
3901
3902 return (0 <= val && val < strvec_size(names)
3903 ? strvec_get(names, val) : NULL);
3904}
3905
3906#if 0 /* There's no bitwise options currently */
3907/************************************************************************/
3910static unsigned client_option_bitwise_get(const struct option *poption)
3911{
3912 return *(CLIENT_OPTION(poption)->bitwise.pvalue);
3913}
3914
3915/************************************************************************/
3918static unsigned client_option_bitwise_def(const struct option *poption)
3919{
3920 return CLIENT_OPTION(poption)->bitwise.def;
3921}
3922
3923/************************************************************************/
3927static const struct strvec *
3929{
3930 return CLIENT_OPTION(poption)->bitwise.pretty_names;
3931}
3932
3933/************************************************************************/
3937static bool client_option_bitwise_set(struct option *poption, unsigned val)
3938{
3940
3941 if (*pcoption->bitwise.pvalue == val) {
3942 return FALSE;
3943 }
3944
3945 *pcoption->bitwise.pvalue = val;
3946 return TRUE;
3947}
3948#endif /* 0 */
3949
3950/************************************************************************/
3956 int val)
3957{
3958 const struct strvec *names = CLIENT_OPTION(data)->bitwise.support_names;
3959
3960 return (0 <= val && val < strvec_size(names)
3961 ? strvec_get(names, val) : NULL);
3962}
3963
3964/************************************************************************/
3967static const char *client_option_font_get(const struct option *poption)
3968{
3969 return CLIENT_OPTION(poption)->font.pvalue;
3970}
3971
3972/************************************************************************/
3975static const char *client_option_font_def(const struct option *poption)
3976{
3977 return CLIENT_OPTION(poption)->font.def;
3978}
3979
3980/************************************************************************/
3983static const char *client_option_font_target(const struct option *poption)
3984{
3985 return CLIENT_OPTION(poption)->font.target;
3986}
3987
3988/************************************************************************/
3992static bool client_option_font_set(struct option *poption, const char *font)
3993{
3995
3996 if (strlen(font) >= pcoption->font.size
3997 || 0 == strcmp(pcoption->font.pvalue, font)) {
3998 return FALSE;
3999 }
4000
4001 fc_strlcpy(pcoption->font.pvalue, font, pcoption->font.size);
4002 return TRUE;
4003}
4004
4005/************************************************************************/
4009{
4010 return *CLIENT_OPTION(poption)->color.pvalue;
4011}
4012
4013/************************************************************************/
4017{
4018 return CLIENT_OPTION(poption)->color.def;
4019}
4020
4021/************************************************************************/
4026 struct ft_color color)
4027{
4028 struct ft_color *pcolor = CLIENT_OPTION(poption)->color.pvalue;
4029 bool changed = FALSE;
4030
4031#define color_set(color_tgt, color) \
4032 if (NULL == color_tgt) { \
4033 if (NULL != color) { \
4034 color_tgt = fc_strdup(color); \
4035 changed = TRUE; \
4036 } \
4037 } else { \
4038 if (NULL == color) { \
4039 free((void *) color_tgt); \
4040 color_tgt = NULL; \
4041 changed = TRUE; \
4042 } else if (0 != strcmp(color_tgt, color)) { \
4043 free((void *) color_tgt); \
4044 color_tgt = fc_strdup(color); \
4045 changed = TRUE; \
4046 } \
4047 }
4048
4049 color_set(pcolor->foreground, color.foreground);
4050 color_set(pcolor->background, color.background);
4051
4052#undef color_set
4053
4054 return changed;
4055}
4056
4057/************************************************************************/
4060static struct video_mode
4062{
4063 return *CLIENT_OPTION(poption)->video_mode.pvalue;
4064}
4065
4066/************************************************************************/
4069static struct video_mode
4074
4075/************************************************************************/
4080 struct video_mode mode)
4081{
4083
4084 if (0 == memcmp(&mode, pcoption->video_mode.pvalue,
4085 sizeof(struct video_mode))) {
4086 return FALSE;
4087 }
4088
4089 *pcoption->video_mode.pvalue = mode;
4090 return TRUE;
4091}
4092
4093/************************************************************************/
4097 struct section_file *sf)
4098{
4101
4102 switch (option_type(poption)) {
4103 case OT_BOOLEAN:
4104 {
4105 bool value;
4106 const char *pname = option_name(poption);
4107 const char *old_paths = "draw_roads_rails";
4108
4109 if (!strcmp("draw_paths", pname)) {
4110 /* Renamed in freeciv-3.2 */
4111 if (secfile_lookup_bool(sf, &value, "client.draw_paths")
4112 && option_bool_set(poption, value)) {
4113 return TRUE;
4114 }
4115
4116 /* Try by old name. */
4117 pname = old_paths;
4118 }
4119
4120 return (secfile_lookup_bool(sf, &value, "client.%s",
4121 pname)
4122 && option_bool_set(poption, value));
4123 }
4124 case OT_INTEGER:
4125 {
4126 int value;
4127
4128 return (secfile_lookup_int(sf, &value, "client.%s",
4130 && option_int_set(poption, value));
4131 }
4132 case OT_STRING:
4133 {
4134 const char *string;
4135
4136 return ((string = secfile_lookup_str(sf, "client.%s",
4138 && option_str_set(poption, string));
4139 }
4140 case OT_ENUM:
4141 {
4142 int value;
4143
4144 return (secfile_lookup_enum_data(sf, &value, FALSE,
4146 poption, "client.%s",
4148 && option_enum_set_int(poption, value));
4149 }
4150 case OT_BITWISE:
4151 {
4152 int value;
4153
4154 return (secfile_lookup_enum_data(sf, &value, TRUE,
4156 poption, "client.%s",
4158 && option_bitwise_set(poption, value));
4159 }
4160 case OT_FONT:
4161 {
4162 const char *string;
4163
4164 return ((string = secfile_lookup_str(sf, "client.%s",
4166 && option_font_set(poption, string));
4167 }
4168 case OT_COLOR:
4169 {
4170 struct ft_color color;
4171
4172 return ((color.foreground =
4173 secfile_lookup_str(sf, "client.%s.foreground",
4175 && (color.background =
4176 secfile_lookup_str(sf, "client.%s.background",
4179 }
4180 case OT_VIDEO_MODE:
4181 {
4182 struct video_mode mode;
4183
4184 return (secfile_lookup_int(sf, &mode.width, "client.%s.width",
4186 && secfile_lookup_int(sf, &mode.height, "client.%s.height",
4188 && option_video_mode_set(poption, mode));
4189 }
4190 }
4191 return FALSE;
4192}
4193
4194/************************************************************************/
4198 struct section_file *sf)
4199{
4201 fc_assert_ret(NULL != sf);
4202
4203 switch (option_type(poption)) {
4204 case OT_BOOLEAN:
4206 "client.%s", option_name(poption));
4207 break;
4208 case OT_INTEGER:
4210 "client.%s", option_name(poption));
4211 break;
4212 case OT_STRING:
4214 "client.%s", option_name(poption));
4215 break;
4216 case OT_ENUM:
4219 "client.%s", option_name(poption));
4220 break;
4221 case OT_BITWISE:
4224 "client.%s", option_name(poption));
4225 break;
4226 case OT_FONT:
4228 "client.%s", option_name(poption));
4229 break;
4230 case OT_COLOR:
4231 {
4233
4234 secfile_insert_str(sf, color.foreground, "client.%s.foreground",
4236 secfile_insert_str(sf, color.background, "client.%s.background",
4238 }
4239 break;
4240 case OT_VIDEO_MODE:
4241 {
4243
4244 secfile_insert_int(sf, mode.width, "client.%s.width",
4246 secfile_insert_int(sf, mode.height, "client.%s.height",
4248 }
4249 break;
4250 }
4251}
4252
4253
4254/****************************************************************************
4255 Server options variables.
4256****************************************************************************/
4259
4261static int server_options_num = 0;
4262
4263
4264/****************************************************************************
4265 Server option set.
4266****************************************************************************/
4267static struct option *server_optset_option_by_number(int id);
4268static struct option *server_optset_option_first(void);
4269static int server_optset_category_number(void);
4270static const char *server_optset_category_name(int category);
4271
4274 .option_first = server_optset_option_first,
4275 .category_number = server_optset_category_number,
4276 .category_name = server_optset_category_name
4277};
4279
4280
4281/****************************************************************************
4282 Virtuals tables for the client options.
4283****************************************************************************/
4284static int server_option_number(const struct option *poption);
4285static const char *server_option_name(const struct option *poption);
4286static const char *server_option_description(const struct option *poption);
4287static const char *server_option_help_text(const struct option *poption);
4288static int server_option_category(const struct option *poption);
4289static bool server_option_is_changeable(const struct option *poption);
4290static struct option *server_option_next(const struct option *poption);
4291
4292static const struct option_common_vtable server_option_common_vtable = {
4293 .number = server_option_number,
4294 .name = server_option_name,
4295 .description = server_option_description,
4296 .help_text = server_option_help_text,
4297 .category = server_option_category,
4298 .is_changeable = server_option_is_changeable,
4299 .next = server_option_next
4300};
4301
4302static bool server_option_bool_get(const struct option *poption);
4303static bool server_option_bool_def(const struct option *poption);
4304static bool server_option_bool_set(struct option *poption, bool val);
4305
4306static const struct option_bool_vtable server_option_bool_vtable = {
4310};
4311
4312static int server_option_int_get(const struct option *poption);
4313static int server_option_int_def(const struct option *poption);
4314static int server_option_int_min(const struct option *poption);
4315static int server_option_int_max(const struct option *poption);
4316static bool server_option_int_set(struct option *poption, int val);
4317
4318static const struct option_int_vtable server_option_int_vtable = {
4319 .get = server_option_int_get,
4320 .def = server_option_int_def,
4321 .minimum = server_option_int_min,
4322 .maximum = server_option_int_max,
4324};
4325
4326static const char *server_option_str_get(const struct option *poption);
4327static const char *server_option_str_def(const struct option *poption);
4328static const struct strvec *
4330static bool server_option_str_set(struct option *poption, const char *str);
4331
4332static const struct option_str_vtable server_option_str_vtable = {
4333 .get = server_option_str_get,
4334 .def = server_option_str_def,
4335 .values = server_option_str_values,
4337};
4338
4339static int server_option_enum_get(const struct option *poption);
4340static int server_option_enum_def(const struct option *poption);
4341static const struct strvec *
4343static bool server_option_enum_set(struct option *poption, int val);
4344
4345static const struct option_enum_vtable server_option_enum_vtable = {
4348 .values = server_option_enum_pretty,
4350 .cmp = strcmp
4351};
4352
4353static unsigned server_option_bitwise_get(const struct option *poption);
4354static unsigned server_option_bitwise_def(const struct option *poption);
4355static const struct strvec *
4357static bool server_option_bitwise_set(struct option *poption, unsigned val);
4358
4359static const struct option_bitwise_vtable server_option_bitwise_vtable = {
4364};
4365
4366/****************************************************************************
4367 Derived class server option, inheriting from base class option.
4368****************************************************************************/
4370 struct option base_option; /* Base structure, must be the first! */
4371
4372 char *name; /* Short name - used as an identifier */
4373 char *description; /* One-line description */
4374 char *help_text; /* Paragraph-length help text */
4375 unsigned char category;
4380
4381 union {
4382 /* OT_BOOLEAN type option. */
4383 struct {
4384 bool value;
4385 bool def;
4386 } boolean;
4387 /* OT_INTEGER type option. */
4388 struct {
4390 int def, min, max;
4391 } integer;
4392 /* OT_STRING type option. */
4393 struct {
4394 char *value;
4395 char *def;
4396 } string;
4397 /* OT_ENUM type option. */
4398 struct {
4399 int value;
4400 int def;
4402 struct strvec *pretty_names; /* untranslated */
4403 } enumerator;
4404 /* OT_BITWISE type option. */
4405 struct {
4406 unsigned value;
4407 unsigned def;
4408 struct strvec *support_names;
4409 struct strvec *pretty_names; /* untranslated */
4410 } bitwise;
4411 };
4412};
4413
4414#define SERVER_OPTION(poption) ((struct server_option *) (poption))
4415
4416static void desired_settable_option_send(struct option *poption);
4417
4418
4419/************************************************************************/
4429
4430/************************************************************************/
4434{
4435 option_gui_remove(&(poption->base_option));
4436
4437 switch (poption->base_option.type) {
4438 case OT_STRING:
4439 if (NULL != poption->string.value) {
4440 FC_FREE(poption->string.value);
4441 }
4442 if (NULL != poption->string.def) {
4443 FC_FREE(poption->string.def);
4444 }
4445 break;
4446
4447 case OT_ENUM:
4448 if (NULL != poption->enumerator.support_names) {
4449 strvec_destroy(poption->enumerator.support_names);
4450 poption->enumerator.support_names = NULL;
4451 }
4452 if (NULL != poption->enumerator.pretty_names) {
4453 strvec_destroy(poption->enumerator.pretty_names);
4454 poption->enumerator.pretty_names = NULL;
4455 }
4456 break;
4457
4458 case OT_BITWISE:
4459 if (NULL != poption->bitwise.support_names) {
4460 strvec_destroy(poption->bitwise.support_names);
4461 poption->bitwise.support_names = NULL;
4462 }
4463 if (NULL != poption->bitwise.pretty_names) {
4464 strvec_destroy(poption->bitwise.pretty_names);
4465 poption->bitwise.pretty_names = NULL;
4466 }
4467 break;
4468
4469 case OT_BOOLEAN:
4470 case OT_INTEGER:
4471 case OT_FONT:
4472 case OT_COLOR:
4473 case OT_VIDEO_MODE:
4474 break;
4475 }
4476
4477 if (NULL != poption->name) {
4478 FC_FREE(poption->name);
4479 }
4480 if (NULL != poption->description) {
4481 FC_FREE(poption->description);
4482 }
4483 if (NULL != poption->help_text) {
4484 FC_FREE(poption->help_text);
4485 }
4486}
4487
4488/************************************************************************/
4492{
4493 int i;
4494
4495 /* Don't keep this dialog open. */
4497
4498 /* Free the options themselves. */
4499 if (NULL != server_options) {
4500 for (i = 0; i < server_options_num; i++) {
4502 }
4505 }
4506
4507 /* Free the categories. */
4509 for (i = 0; i < server_options_categories_num; i++) {
4512 }
4513 }
4516 }
4517}
4518
4519/************************************************************************/
4523 (const struct packet_server_setting_control *packet)
4524{
4525 int i;
4526
4527 /* This packet should be received only once. */
4532
4533 /* Allocate server option categories. */
4534 if (0 < packet->categories_num) {
4538 sizeof(*server_options_categories));
4539
4540 for (i = 0; i < server_options_categories_num; i++) {
4541 /* NB: Translate now. */
4543 }
4544 }
4545
4546 /* Allocate server options. */
4547 if (0 < packet->settings_num) {
4550 }
4551}
4552
4553/************************************************************************/
4557 (const struct packet_server_setting_const *packet)
4558{
4561
4563
4564 fc_assert(NULL == psoption->name);
4565 psoption->name = fc_strdup(packet->name);
4566 fc_assert(NULL == psoption->description);
4567 /* NB: Translate now. */
4568 psoption->description = fc_strdup(_(packet->short_help));
4569 fc_assert(NULL == psoption->help_text);
4570 /* NB: Translate now. */
4571 psoption->help_text = fc_strdup(_(packet->extra_help));
4572 psoption->category = packet->category;
4573}
4574
4575/****************************************************************************
4576 Common part of handle_server_setting_*() functions. See below.
4577****************************************************************************/
4578#define handle_server_setting_common(psoption, packet) \
4579 psoption->is_changeable = packet->is_changeable; \
4580 psoption->setdef = packet->setdef; \
4581 if (psoption->is_visible != packet->is_visible) { \
4582 if (psoption->is_visible) { \
4583 need_gui_remove = TRUE; \
4584 } else if (packet->is_visible) { \
4585 need_gui_add = TRUE; \
4586 } \
4587 psoption->is_visible = packet->is_visible; \
4588 } \
4589 \
4590 /* Keep this list of conditions in sync with one in \
4591 resend_desired_settable_options() */ \
4592 if (!psoption->desired_sent \
4593 && psoption->is_visible \
4594 && psoption->is_changeable \
4595 && gui_options.send_desired_settings \
4596 && is_server_running() \
4597 && packet->initial_setting) { \
4598 /* Only send our private settings if we are running \
4599 * on a forked local server, i.e. started by the \
4600 * client with the "Start New Game" button. \
4601 * Do now override settings that are already saved to savegame \
4602 * and now loaded. */ \
4603 desired_settable_option_send(OPTION(poption)); \
4604 dsend_packet_sync_serial(&client.conn, ++sync_serial); \
4605 psoption->desired_sent = TRUE; \
4606 } \
4607 \
4608 /* Update the GUI. */ \
4609 if (need_gui_remove) { \
4610 option_gui_remove(poption); \
4611 } else if (need_gui_add) { \
4612 option_gui_add(poption); \
4613 } else { \
4614 option_gui_update(poption); \
4616
4617/************************************************************************/
4621 (const struct packet_server_setting_bool *packet)
4622{
4625 bool need_gui_remove = FALSE;
4626 bool need_gui_add = FALSE;
4627
4629
4630 if (NULL == poption->common_vtable) {
4631 /* Not initialized yet. */
4632 poption->poptset = server_optset;
4633 poption->common_vtable = &server_option_common_vtable;
4634 poption->type = OT_BOOLEAN;
4635 poption->bool_vtable = &server_option_bool_vtable;
4636 }
4638 "Server setting \"%s\" (nb %d) has type %s (%d), "
4639 "expected %s (%d)",
4641 option_type_name(poption->type), poption->type,
4643
4644 if (packet->is_visible) {
4645 psoption->boolean.value = packet->val;
4646 psoption->boolean.def = packet->default_val;
4647 }
4648
4651
4652/************************************************************************/
4656 (const struct packet_server_setting_int *packet)
4657{
4660 bool need_gui_remove = FALSE;
4661 bool need_gui_add = FALSE;
4662
4664
4665 if (NULL == poption->common_vtable) {
4666 /* Not initialized yet. */
4667 poption->poptset = server_optset;
4668 poption->common_vtable = &server_option_common_vtable;
4669 poption->type = OT_INTEGER;
4670 poption->int_vtable = &server_option_int_vtable;
4671 }
4673 "Server setting \"%s\" (nb %d) has type %s (%d), "
4674 "expected %s (%d)",
4676 option_type_name(poption->type), poption->type,
4678
4679 if (packet->is_visible) {
4680 psoption->integer.value = packet->val;
4681 psoption->integer.def = packet->default_val;
4682 psoption->integer.min = packet->min_val;
4683 psoption->integer.max = packet->max_val;
4684 }
4685
4688
4689/************************************************************************/
4693 (const struct packet_server_setting_str *packet)
4694{
4697 bool need_gui_remove = FALSE;
4698 bool need_gui_add = FALSE;
4699
4701
4702 if (NULL == poption->common_vtable) {
4703 /* Not initialized yet. */
4704 poption->poptset = server_optset;
4705 poption->common_vtable = &server_option_common_vtable;
4706 poption->type = OT_STRING;
4707 poption->str_vtable = &server_option_str_vtable;
4708 }
4710 "Server setting \"%s\" (nb %d) has type %s (%d), "
4711 "expected %s (%d)",
4713 option_type_name(poption->type), poption->type,
4715
4716 if (packet->is_visible) {
4717 if (NULL == psoption->string.value) {
4718 psoption->string.value = fc_strdup(packet->val);
4719 } else if (0 != strcmp(packet->val, psoption->string.value)) {
4720 free(psoption->string.value);
4721 psoption->string.value = fc_strdup(packet->val);
4722 }
4723 if (NULL == psoption->string.def) {
4724 psoption->string.def = fc_strdup(packet->default_val);
4725 } else if (0 != strcmp(packet->default_val, psoption->string.def)) {
4726 free(psoption->string.def);
4727 psoption->string.def = fc_strdup(packet->default_val);
4728 }
4729 }
4730
4733
4734/************************************************************************/
4738 (const struct packet_server_setting_enum *packet)
4739{
4742 bool need_gui_remove = FALSE;
4743 bool need_gui_add = FALSE;
4744
4746
4747 if (NULL == poption->common_vtable) {
4748 /* Not initialized yet. */
4749 poption->poptset = server_optset;
4750 poption->common_vtable = &server_option_common_vtable;
4751 poption->type = OT_ENUM;
4752 poption->enum_vtable = &server_option_enum_vtable;
4753 }
4755 "Server setting \"%s\" (nb %d) has type %s (%d), "
4756 "expected %s (%d)",
4758 option_type_name(poption->type), poption->type,
4760
4761 if (packet->is_visible) {
4762 int i;
4763
4764 psoption->enumerator.value = packet->val;
4765 psoption->enumerator.def = packet->default_val;
4766
4767 if (NULL == psoption->enumerator.support_names) {
4768 /* First time we get this packet. */
4769 fc_assert(NULL == psoption->enumerator.pretty_names);
4770 psoption->enumerator.support_names = strvec_new();
4771 strvec_reserve(psoption->enumerator.support_names, packet->values_num);
4772 psoption->enumerator.pretty_names = strvec_new();
4773 strvec_reserve(psoption->enumerator.pretty_names, packet->values_num);
4774 for (i = 0; i < packet->values_num; i++) {
4775 strvec_set(psoption->enumerator.support_names, i,
4776 packet->support_names[i]);
4777 /* Store untranslated string from server. */
4778 strvec_set(psoption->enumerator.pretty_names, i,
4779 packet->pretty_names[i]);
4780 }
4781 } else if (strvec_size(psoption->enumerator.support_names)
4782 != packet->values_num) {
4783 fc_assert(strvec_size(psoption->enumerator.support_names)
4784 == strvec_size(psoption->enumerator.pretty_names));
4785 /* The number of values have changed, we need to reset the list
4786 * of possible values. */
4787 strvec_reserve(psoption->enumerator.support_names, packet->values_num);
4788 strvec_reserve(psoption->enumerator.pretty_names, packet->values_num);
4789 for (i = 0; i < packet->values_num; i++) {
4790 strvec_set(psoption->enumerator.support_names, i,
4791 packet->support_names[i]);
4792 /* Store untranslated string from server. */
4793 strvec_set(psoption->enumerator.pretty_names, i,
4794 packet->pretty_names[i]);
4795 }
4798 } else {
4799 /* Check if a value changed, then we need to reset the list
4800 * of possible values. */
4801 const char *str;
4802
4803 for (i = 0; i < packet->values_num; i++) {
4804 str = strvec_get(psoption->enumerator.pretty_names, i);
4805 if (NULL == str || 0 != strcmp(str, packet->pretty_names[i])) {
4806 /* Store untranslated string from server. */
4807 strvec_set(psoption->enumerator.pretty_names, i,
4808 packet->pretty_names[i]);
4811 }
4812 /* Support names are not visible, we don't need to check if it
4813 * has changed. */
4814 strvec_set(psoption->enumerator.support_names, i,
4815 packet->support_names[i]);
4816 }
4817 }
4818 }
4819
4822
4823/************************************************************************/
4827 (const struct packet_server_setting_bitwise *packet)
4828{
4831 bool need_gui_remove = FALSE;
4832 bool need_gui_add = FALSE;
4833
4835
4836 if (NULL == poption->common_vtable) {
4837 /* Not initialized yet. */
4838 poption->poptset = server_optset;
4839 poption->common_vtable = &server_option_common_vtable;
4840 poption->type = OT_BITWISE;
4841 poption->bitwise_vtable = &server_option_bitwise_vtable;
4842 }
4844 "Server setting \"%s\" (nb %d) has type %s (%d), "
4845 "expected %s (%d)",
4847 option_type_name(poption->type), poption->type,
4849
4850 if (packet->is_visible) {
4851 int i;
4852
4853 psoption->bitwise.value = packet->val;
4854 psoption->bitwise.def = packet->default_val;
4855
4856 if (NULL == psoption->bitwise.support_names) {
4857 /* First time we get this packet. */
4858 fc_assert(NULL == psoption->bitwise.pretty_names);
4859 psoption->bitwise.support_names = strvec_new();
4860 strvec_reserve(psoption->bitwise.support_names, packet->bits_num);
4861 psoption->bitwise.pretty_names = strvec_new();
4862 strvec_reserve(psoption->bitwise.pretty_names, packet->bits_num);
4863 for (i = 0; i < packet->bits_num; i++) {
4864 strvec_set(psoption->bitwise.support_names, i,
4865 packet->support_names[i]);
4866 /* Store untranslated string from server. */
4867 strvec_set(psoption->bitwise.pretty_names, i,
4868 packet->pretty_names[i]);
4869 }
4870 } else if (strvec_size(psoption->bitwise.support_names)
4871 != packet->bits_num) {
4872 fc_assert(strvec_size(psoption->bitwise.support_names)
4873 == strvec_size(psoption->bitwise.pretty_names));
4874 /* The number of values have changed, we need to reset the list
4875 * of possible values. */
4876 strvec_reserve(psoption->bitwise.support_names, packet->bits_num);
4877 strvec_reserve(psoption->bitwise.pretty_names, packet->bits_num);
4878 for (i = 0; i < packet->bits_num; i++) {
4879 strvec_set(psoption->bitwise.support_names, i,
4880 packet->support_names[i]);
4881 /* Store untranslated string from server. */
4882 strvec_set(psoption->bitwise.pretty_names, i,
4883 packet->pretty_names[i]);
4884 }
4887 } else {
4888 /* Check if a value changed, then we need to reset the list
4889 * of possible values. */
4890 const char *str;
4891
4892 for (i = 0; i < packet->bits_num; i++) {
4893 str = strvec_get(psoption->bitwise.pretty_names, i);
4894 if (NULL == str || 0 != strcmp(str, packet->pretty_names[i])) {
4895 /* Store untranslated string from server. */
4896 strvec_set(psoption->bitwise.pretty_names, i,
4897 packet->pretty_names[i]);
4900 }
4901 /* Support names are not visible, we don't need to check if it
4902 * has changed. */
4903 strvec_set(psoption->bitwise.support_names, i,
4904 packet->support_names[i]);
4905 }
4906 }
4907 }
4908
4910}
4912/************************************************************************/
4915static struct server_option *
4917{
4918 if (server_options != NULL) {
4919 const struct server_option *const max =
4921
4923 poption++;
4924 }
4925
4926 return (poption < max ? poption : NULL);
4927 }
4928
4929 return NULL;
4931
4932/************************************************************************/
4936{
4937 if (0 > id || id > server_options_num) {
4938 return NULL;
4939 }
4940 return OPTION(server_options + id);
4942
4943/************************************************************************/
4947{
4950
4951/************************************************************************/
4955{
4958
4959/************************************************************************/
4962const char *server_optset_category_name(int category)
4963{
4964 if (0 > category || category >= server_options_categories_num) {
4965 return NULL;
4966 }
4967
4968 return server_options_categories[category];
4970
4971/************************************************************************/
4974static int server_option_number(const struct option *poption)
4975{
4978
4979/************************************************************************/
4982static const char *server_option_name(const struct option *poption)
4983{
4984 return SERVER_OPTION(poption)->name;
4986
4987/************************************************************************/
4990static const char *server_option_description(const struct option *poption)
4991{
4992 return SERVER_OPTION(poption)->description;
4994
4995/************************************************************************/
4998static const char *server_option_help_text(const struct option *poption)
4999{
5000 return SERVER_OPTION(poption)->help_text;
5002
5003/************************************************************************/
5006static int server_option_category(const struct option *poption)
5007{
5008 return SERVER_OPTION(poption)->category;
5010
5011/************************************************************************/
5014static bool server_option_is_changeable(const struct option *poption)
5015{
5016 return SERVER_OPTION(poption)->is_changeable;
5018
5019/************************************************************************/
5022static struct option *server_option_next(const struct option *poption)
5023{
5026
5027/************************************************************************/
5030static bool server_option_bool_get(const struct option *poption)
5031{
5032 return SERVER_OPTION(poption)->boolean.value;
5034
5035/************************************************************************/
5038static bool server_option_bool_def(const struct option *poption)
5039{
5040 return SERVER_OPTION(poption)->boolean.def;
5041}
5043/************************************************************************/
5047static bool server_option_bool_set(struct option *poption, bool val)
5048{
5050
5051 if (psoption->boolean.value == val) {
5052 return FALSE;
5053 }
5054
5055 send_chat_printf("/set %s %s", psoption->name,
5056 val ? "enabled" : "disabled");
5057 return TRUE;
5059
5060/************************************************************************/
5063static int server_option_int_get(const struct option *poption)
5064{
5065 return SERVER_OPTION(poption)->integer.value;
5067
5068/************************************************************************/
5071static int server_option_int_def(const struct option *poption)
5072{
5073 return SERVER_OPTION(poption)->integer.def;
5075
5076/************************************************************************/
5079static int server_option_int_min(const struct option *poption)
5080{
5081 return SERVER_OPTION(poption)->integer.min;
5083
5084/************************************************************************/
5087static int server_option_int_max(const struct option *poption)
5088{
5089 return SERVER_OPTION(poption)->integer.max;
5090}
5092/************************************************************************/
5096static bool server_option_int_set(struct option *poption, int val)
5097{
5099
5101 || val > psoption->integer.max
5102 || psoption->integer.value == val) {
5103 return FALSE;
5104 }
5105
5106 send_chat_printf("/set %s %d", psoption->name, val);
5107 return TRUE;
5109
5110/************************************************************************/
5113static const char *server_option_str_get(const struct option *poption)
5114{
5115 return SERVER_OPTION(poption)->string.value;
5117
5118/************************************************************************/
5121static const char *server_option_str_def(const struct option *poption)
5122{
5123 return SERVER_OPTION(poption)->string.def;
5124}
5125
5126/************************************************************************/
5130static const struct strvec *
5132{
5133 return NULL;
5134}
5136/************************************************************************/
5140static bool server_option_str_set(struct option *poption, const char *str)
5141{
5143
5144 if (0 == strcmp(psoption->string.value, str)) {
5145 return FALSE;
5146 }
5147
5148 send_chat_printf("/set %s \"%s\"", psoption->name, str);
5149 return TRUE;
5151
5152/************************************************************************/
5155static int server_option_enum_get(const struct option *poption)
5156{
5157 return SERVER_OPTION(poption)->enumerator.value;
5159
5160/************************************************************************/
5163static int server_option_enum_def(const struct option *poption)
5164{
5165 return SERVER_OPTION(poption)->enumerator.def;
5166}
5167
5168/************************************************************************/
5172static const struct strvec *
5174{
5175 return SERVER_OPTION(poption)->enumerator.pretty_names;
5176}
5178/************************************************************************/
5182static bool server_option_enum_set(struct option *poption, int val)
5183{
5185 const char *name;
5186
5187 if (val == psoption->enumerator.value
5188 || !(name = strvec_get(psoption->enumerator.support_names, val))) {
5189 return FALSE;
5190 }
5191
5192 send_chat_printf("/set %s \"%s\"", psoption->name, name);
5193 return TRUE;
5194}
5196/************************************************************************/
5200static void server_option_enum_support_name(const struct option *poption,
5201 const char **pvalue,
5202 const char **pdefault)
5203{
5205 const struct strvec *values = psoption->enumerator.support_names;
5206
5207 if (NULL != pvalue) {
5208 *pvalue = strvec_get(values, psoption->enumerator.value);
5209 }
5210 if (NULL != pdefault) {
5211 *pdefault = strvec_get(values, psoption->enumerator.def);
5212 }
5214
5215/************************************************************************/
5218static unsigned server_option_bitwise_get(const struct option *poption)
5219{
5220 return SERVER_OPTION(poption)->bitwise.value;
5222
5223/************************************************************************/
5226static unsigned server_option_bitwise_def(const struct option *poption)
5227{
5228 return SERVER_OPTION(poption)->bitwise.def;
5229}
5230
5231/************************************************************************/
5235static const struct strvec *
5237{
5238 return SERVER_OPTION(poption)->bitwise.pretty_names;
5240
5241/************************************************************************/
5244static void server_option_bitwise_support_base(const struct strvec *values,
5245 unsigned val,
5246 char *buf, size_t buf_len)
5247{
5248 int bit;
5249
5250 buf[0] = '\0';
5251 for (bit = 0; bit < strvec_size(values); bit++) {
5252 if ((1 << bit) & val) {
5253 if ('\0' != buf[0]) {
5254 fc_strlcat(buf, "|", buf_len);
5255 }
5256 fc_strlcat(buf, strvec_get(values, bit), buf_len);
5257 }
5258 }
5259}
5261/************************************************************************/
5265static bool server_option_bitwise_set(struct option *poption, unsigned val)
5266{
5268 char name[MAX_LEN_MSG];
5269
5270 if (val == psoption->bitwise.value) {
5271 return FALSE;
5272 }
5273
5274 server_option_bitwise_support_base(psoption->bitwise.support_names, val,
5275 name, sizeof(name));
5276 send_chat_printf("/set %s \"%s\"", psoption->name, name);
5277 return TRUE;
5278}
5280/************************************************************************/
5284static void server_option_bitwise_support_name(const struct option *poption,
5285 char *val_buf, size_t val_len,
5286 char *def_buf, size_t def_len)
5287{
5289 const struct strvec *values = psoption->bitwise.support_names;
5290
5291 if (NULL != val_buf && 0 < val_len) {
5292 server_option_bitwise_support_base(values, psoption->bitwise.value,
5293 val_buf, val_len);
5294 }
5295 if (NULL != def_buf && 0 < def_len) {
5296 server_option_bitwise_support_base(values, psoption->bitwise.def,
5297 def_buf, def_len);
5298 }
5300
5301
5305
5307/************************************************************************/
5311static void message_options_init(void)
5312{
5313 int none[] = {
5319 };
5320 int out_only[] = {
5323 };
5324 int all[] = {
5326 };
5327 int i;
5328
5329 for (i = 0; i <= event_type_max(); i++) {
5330 /* Include possible undefined values. */
5332 }
5333 for (i = 0; i < ARRAY_SIZE(none); i++) {
5334 messages_where[none[i]] = 0;
5335 }
5336 for (i = 0; i < ARRAY_SIZE(out_only); i++) {
5338 }
5339 for (i = 0; i < ARRAY_SIZE(all); i++) {
5341 }
5342
5343 events_init();
5345
5346/************************************************************************/
5349static void message_options_free(void)
5350{
5351 events_free();
5352}
5354/************************************************************************/
5358static void message_options_load(struct section_file *file,
5359 const char *prefix)
5360{
5361 enum event_type event;
5362 int i, num_events;
5363 const char *p;
5364
5365 if (!secfile_lookup_int(file, &num_events, "messages.count")) {
5366 /* version < 2.2 */
5367 /* Order of the events in 2.1. */
5368 const enum event_type old_events[] = {
5397 };
5398 const size_t old_events_num = ARRAY_SIZE(old_events);
5399
5400 for (i = 0; i < old_events_num; i++) {
5403 "%s.message_where_%02d", prefix, i);
5404 }
5405 return;
5406 }
5407
5408 for (i = 0; i < num_events; i++) {
5409 p = secfile_lookup_str(file, "messages.event%d.name", i);
5410 if (NULL == p) {
5411 log_error("Corruption in file %s: %s",
5412 secfile_name(file), secfile_error());
5413 continue;
5414 }
5415 /* Compatibility: Before 3.0 E_UNIT_WIN_DEF was called E_UNIT_WIN. */
5416 if (!fc_strcasecmp("E_UNIT_WIN", p)) {
5417 log_deprecation(_("Deprecated event type E_UNIT_WIN in client options."));
5418 p = "E_UNIT_WIN_DEF";
5419 }
5420 event = event_type_by_name(p, strcmp);
5421 if (!event_type_is_valid(event)) {
5422 log_error("Event not supported: %s", p);
5423 continue;
5424 }
5425
5427 "messages.event%d.where", i)) {
5428 log_error("Corruption in file %s: %s",
5429 secfile_name(file), secfile_error());
5430 }
5431 }
5432}
5434/************************************************************************/
5438static void message_options_save(struct section_file *file,
5439 const char *prefix)
5440{
5441 enum event_type event;
5442 int i = 0;
5443
5444 for (event = event_type_begin(); event != event_type_end();
5445 event = event_type_next(event)) {
5447 "messages.event%d.name", i);
5449 "messages.event%d.where", i);
5450 i++;
5451 }
5452
5453 secfile_insert_int(file, i, "messages.count");
5455
5456/************************************************************************/
5459static void load_cma_preset(struct section_file *file, int i)
5460{
5461 struct cm_parameter parameter;
5462 const char *name =
5463 secfile_lookup_str_default(file, "preset",
5464 "cma.preset%d.name", i);
5465
5466 /* Init correct default values even for the fields that are not
5467 * loaded below. */
5468 cm_init_parameter(&parameter);
5469
5471 parameter.minimal_surplus[o] =
5472 secfile_lookup_int_default(file, 0, "cma.preset%d.minsurp%d", i, o);
5473 parameter.factor[o] =
5474 secfile_lookup_int_default(file, 0, "cma.preset%d.factor%d", i, o);
5476 parameter.require_happy =
5477 secfile_lookup_bool_default(file, FALSE, "cma.preset%d.reqhappy", i);
5478 parameter.happy_factor =
5479 secfile_lookup_int_default(file, 0, "cma.preset%d.happyfactor", i);
5480 parameter.allow_disorder = FALSE;
5481 parameter.allow_specialists = TRUE;
5482
5483 cmafec_preset_add(name, &parameter);
5485
5486/************************************************************************/
5489static void save_cma_preset(struct section_file *file, int i)
5490{
5491 const struct cm_parameter *const pparam = cmafec_preset_get_parameter(i);
5493
5494 secfile_insert_str(file, name, "cma.preset%d.name", i);
5495
5497 secfile_insert_int(file, pparam->minimal_surplus[o],
5498 "cma.preset%d.minsurp%d", i, o);
5499 secfile_insert_int(file, pparam->factor[o],
5500 "cma.preset%d.factor%d", i, o);
5502 secfile_insert_bool(file, pparam->require_happy,
5503 "cma.preset%d.reqhappy", i);
5504 secfile_insert_int(file, pparam->happy_factor,
5505 "cma.preset%d.happyfactor", i);
5507
5508/************************************************************************/
5511static void save_cma_presets(struct section_file *file)
5512{
5513 int i;
5514
5516 _("If you add a preset by hand,"
5517 " also update \"number_of_presets\""),
5518 "cma.number_of_presets");
5519 for (i = 0; i < cmafec_preset_num(); i++) {
5522}
5523
5524/* RC file name. */
5525#define MID_OPTION_FILE_NAME ".freeciv-client-rc-%d.%d"
5526#define NEW_OPTION_FILE_NAME "freeciv-client-rc-%d.%d"
5528/* The first version the new option name appeared (2.6). */
5529#define FIRST_MAJOR_NEW_OPTION_FILE_NAME 2
5530#define FIRST_MINOR_NEW_OPTION_FILE_NAME 6
5531/* The first version the mid option name appeared (2.2). */
5532#define FIRST_MAJOR_MID_OPTION_FILE_NAME 2
5533#define FIRST_MINOR_MID_OPTION_FILE_NAME 2
5534/* The first version the new boolean values appeared (2.3). */
5535#define FIRST_MAJOR_NEW_BOOLEAN 2
5536#define FIRST_MINOR_NEW_BOOLEAN 3
5537
5538/************************************************************************/
5545static const char *get_current_option_file_name(void)
5546{
5547 static char name_buffer[256];
5548 const char *name;
5549
5550 name = getenv("FREECIV_OPT");
5551
5552 if (name) {
5554 } else {
5555#ifdef OPTION_FILE_NAME
5557#else
5559 if (!name) {
5560 log_error(_("Cannot find freeciv storage directory"));
5561 return NULL;
5562 }
5566#endif /* OPTION_FILE_NAME */
5567 }
5568 log_verbose("settings file is %s", name_buffer);
5569 return name_buffer;
5570}
5571
5572/************************************************************************/
5580static const char *get_last_option_file_name(bool *allow_digital_boolean)
5581{
5582 static char name_buffer[256];
5583 const char *name;
5584 static int last_minors[] = {
5585 0, /* There was no 0.x releases */
5586 14, /* 1.14 */
5587 6 /* 2.6 */
5588 };
5589
5590#if MINOR_VERSION >= 90
5592#else
5594#endif
5595
5596 *allow_digital_boolean = FALSE;
5597 name = getenv("FREECIV_OPT");
5598 if (name) {
5600 } else {
5601#ifdef OPTION_FILE_NAME
5603#else
5604 int major, minor;
5605 struct stat buf;
5606
5608 if (name == NULL) {
5609 log_error(_("Cannot find freeciv storage directory"));
5610
5611 return NULL;
5612 }
5613
5619 : minor >= 0); minor--) {
5622 if (0 == fc_stat(name_buffer, &buf)) {
5625 log_normal(_("Didn't find '%s' option file, "
5626 "loading from '%s' instead."),
5628 name_buffer + strlen(name) + 1);
5629 }
5630
5631 return name_buffer;
5632 }
5633 }
5634 minor = last_minors[major - 1];
5635 }
5636
5637 /* Older versions had options file in user home directory */
5638 name = user_home_dir();
5639 if (name == NULL) {
5640 log_error(_("Cannot find your home directory"));
5641
5642 return NULL;
5643 }
5644
5645 /* Minor having max value of FIRST_MINOR_NEW_OPTION_FILE_NAME
5646 * works since MID versioning scheme was used within major version 2
5647 * only (2.2 - 2.6) so the last minor is bigger than any earlier minor. */
5651 minor--) {
5654 if (0 == fc_stat(name_buffer, &buf)) {
5655 log_normal(_("Didn't find '%s' option file, "
5656 "loading from '%s' instead."),
5658 name_buffer + strlen(name) + 1);
5659
5661 *allow_digital_boolean = TRUE;
5662 }
5663 return name_buffer;
5664 }
5665 }
5666
5667 return NULL;
5668#endif /* OPTION_FILE_NAME */
5669 }
5670 log_verbose("settings file is %s", name_buffer);
5671
5672 return name_buffer;
5673}
5674#undef MID_OPTION_FILE_NAME
5675#undef NEW_OPTION_FILE_NAME
5676#undef FIRST_MAJOR_NEW_OPTION_FILE_NAME
5677#undef FIRST_MINOR_NEW_OPTION_FILE_NAME
5678#undef FIRST_MAJOR_MID_OPTION_FILE_NAME
5679#undef FIRST_MINOR_MID_OPTION_FILE_NAME
5680#undef FIRST_MINOR_NEW_BOOLEAN
5683/****************************************************************************
5684 Desired settable options.
5685****************************************************************************/
5686#define SPECHASH_TAG settable_options
5687#define SPECHASH_ASTR_KEY_TYPE
5688#define SPECHASH_ASTR_DATA_TYPE
5689#include "spechash.h"
5690#define settable_options_hash_iterate(hash, name, value) \
5691 TYPED_HASH_ITERATE(const char *, const char *, hash, name, value)
5692#define settable_options_hash_iterate_end HASH_ITERATE_END
5693
5695
5696/************************************************************************/
5699static void settable_options_load(struct section_file *sf)
5700{
5701 char buf[64];
5702 const struct section *psection;
5703 const struct entry_list *entries;
5704 const char *string;
5705 bool bval;
5706 int ival;
5707
5709
5711
5712 psection = secfile_section_by_name(sf, "server");
5713 if (NULL == psection) {
5714 /* Does not exist! */
5715 return;
5716 }
5717
5718 entries = section_entries(psection);
5720 string = NULL;
5721 switch (entry_type_get(pentry)) {
5722 case ENTRY_BOOL:
5723 if (entry_bool_get(pentry, &bval)) {
5724 fc_strlcpy(buf, bval ? "enabled" : "disabled", sizeof(buf));
5725 string = buf;
5726 }
5727 break;
5728
5729 case ENTRY_INT:
5730 if (entry_int_get(pentry, &ival)) {
5731 fc_snprintf(buf, sizeof(buf), "%d", ival);
5732 string = buf;
5733 }
5734 break;
5735
5736 case ENTRY_STR:
5737 (void) entry_str_get(pentry, &string);
5738 break;
5739
5740 case ENTRY_FLOAT:
5742 /* Not supported yet */
5743 break;
5744 case ENTRY_LONG_COMMENT:
5746 break;
5747 case ENTRY_ILLEGAL:
5749 break;
5750 }
5751
5752 if (NULL == string) {
5753 log_error("Entry type variant of \"%s.%s\" is not supported.",
5754 section_name(psection), entry_name(pentry));
5755 continue;
5756 }
5757
5759 string);
5762
5763/************************************************************************/
5766static void settable_options_save(struct section_file *sf)
5767{
5769
5771 if (!fc_strcasecmp(name, "gameseed") || !fc_strcasecmp(name, "mapseed")) {
5772 /* Do not save mapseed or gameseed. */
5773 continue;
5774 }
5775 if (!fc_strcasecmp(name, "topology")) {
5776 /* client_start_server() sets topology based on tileset. Don't store
5777 * its choice. The tileset is already stored. Storing topology leads
5778 * to all sort of breakage:
5779 * - it breaks ruleset default topology.
5780 * - it interacts badly with tileset ruleset change, ruleset tileset
5781 * change and topology tileset change.
5782 * - its value is probably based on what tileset was loaded when
5783 * client_start_server() decided to set topology, not on player
5784 * choice.
5785 */
5786 continue;
5787 }
5788 secfile_insert_str(sf, value, "server.%s", name);
5790}
5792/************************************************************************/
5797{
5798 char val_buf[1024], def_buf[1024];
5799 const char *value, *def_val;
5800
5802
5805
5806 if (srv->setdef != SETDEF_CHANGED) {
5807 /* Some level default - do not store */
5810 } else {
5811 value = NULL;
5812 def_val = NULL;
5813 switch (option_type(poption)) {
5814 case OT_BOOLEAN:
5815 fc_strlcpy(val_buf, option_bool_get(poption) ? "enabled" : "disabled",
5816 sizeof(val_buf));
5817 value = val_buf;
5818 fc_strlcpy(def_buf, option_bool_def(poption) ? "enabled" : "disabled",
5819 sizeof(def_buf));
5820 def_val = def_buf;
5821 break;
5822 case OT_INTEGER:
5824 value = val_buf;
5826 def_val = def_buf;
5827 break;
5828 case OT_STRING:
5831 break;
5832 case OT_ENUM:
5834 break;
5835 case OT_BITWISE:
5837 def_buf, sizeof(def_buf));
5838 value = val_buf;
5839 def_val = def_buf;
5840 break;
5841 case OT_FONT:
5842 case OT_COLOR:
5843 case OT_VIDEO_MODE:
5844 break;
5845 }
5846
5847 if (NULL == value || NULL == def_val) {
5848 log_error("Option type %s (%d) not supported for '%s'.",
5851 continue;
5852 }
5853
5856 }
5858}
5860/************************************************************************/
5865 const char *op_value,
5866 bool allow_replace)
5867{
5869
5870 if (allow_replace) {
5872 } else {
5874 }
5875}
5877/************************************************************************/
5881static bool settable_option_upgrade_value(const struct option *poption,
5882 int old_value,
5883 char *buf, size_t buf_len)
5884{
5885 const char *name = option_name(poption);
5886
5887#define SETTING_CASE(ARG_name, ...) \
5888 if (0 == strcmp(ARG_name, name)) { \
5889 static const char *values[] = { __VA_ARGS__ }; \
5890 if (0 <= old_value && old_value < ARRAY_SIZE(values) \
5891 && NULL != values[old_value]) { \
5892 fc_strlcpy(buf, values[old_value], buf_len); \
5893 return TRUE; \
5894 } else { \
5895 return FALSE; \
5896 } \
5897 }
5898
5899 SETTING_CASE("topology", "", "WRAPX", "WRAPY", "WRAPX|WRAPY", "ISO",
5900 "WRAPX|ISO", "WRAPY|ISO", "WRAPX|WRAPY|ISO", "HEX",
5901 "WRAPX|HEX", "WRAPY|HEX", "WRAPX|WRAPY|HEX", "ISO|HEX",
5902 "WRAPX|ISO|HEX", "WRAPY|ISO|HEX", "WRAPX|WRAPY|ISO|HEX");
5903 SETTING_CASE("generator", NULL, "RANDOM", "FRACTAL", "ISLAND");
5904 SETTING_CASE("startpos", "DEFAULT", "SINGLE", "2or3", "ALL", "VARIABLE");
5905 SETTING_CASE("borders", "DISABLED", "ENABLED", "SEE_INSIDE", "EXPAND");
5906 SETTING_CASE("diplomacy", "ALL", "HUMAN", "AI", "TEAM", "DISABLED");
5907 SETTING_CASE("citynames", "NO_RESTRICTIONS", "PLAYER_UNIQUE",
5908 "GLOBAL_UNIQUE", "NO_STEALING");
5909 SETTING_CASE("barbarians", "DISABLED", "HUTS_ONLY", "NORMAL", "FREQUENT",
5910 "HORDES");
5911 SETTING_CASE("phasemode", "ALL", "PLAYER", "TEAM");
5912 SETTING_CASE("compresstype", "PLAIN", "LIBZ", "BZIP2");
5913
5914#undef SETTING_CASE
5915 return FALSE;
5917
5918/************************************************************************/
5921static void desired_settable_option_send(struct option *poption)
5922{
5923 char *desired;
5924 int value;
5925
5927
5930 /* No change explicitly desired. */
5931 return;
5932 }
5933
5934 switch (option_type(poption)) {
5935 case OT_BOOLEAN:
5936 if ((0 == fc_strcasecmp("enabled", desired)
5937 || (str_to_int(desired, &value) && 1 == value))
5938 && !option_bool_get(poption)) {
5939 send_chat_printf("/set %s enabled", option_name(poption));
5940 } else if ((0 == fc_strcasecmp("disabled", desired)
5941 || (str_to_int(desired, &value) && 0 == value))
5943 send_chat_printf("/set %s disabled", option_name(poption));
5944 }
5945 return;
5946 case OT_INTEGER:
5948 send_chat_printf("/set %s %d", option_name(poption), value);
5949 }
5950 return;
5951 case OT_STRING:
5952 if (0 != strcmp(desired, option_str_get(poption))) {
5953 send_chat_printf("/set %s \"%s\"", option_name(poption), desired);
5954 }
5955 return;
5956 case OT_ENUM:
5957 {
5958 char desired_buf[256];
5959 const char *value_str;
5960
5961 /* Handle old values. */
5962 if (str_to_int(desired, &value)
5964 sizeof(desired_buf))) {
5966 }
5967
5969 if (0 != strcmp(desired, value_str)) {
5970 send_chat_printf("/set %s \"%s\"", option_name(poption), desired);
5971 }
5972 }
5973 return;
5974 case OT_BITWISE:
5975 {
5976 char desired_buf[256], value_buf[256];
5977
5978 /* Handle old values. */
5979 if (str_to_int(desired, &value)
5981 sizeof(desired_buf))) {
5983 }
5984
5986 sizeof(value_buf), NULL, 0);
5987 if (0 != strcmp(desired, value_buf)) {
5988 send_chat_printf("/set %s \"%s\"", option_name(poption), desired);
5989 }
5990 }
5991 return;
5992 case OT_FONT:
5993 case OT_COLOR:
5994 case OT_VIDEO_MODE:
5995 break;
5996 }
5997
5998 log_error("Option type %s (%d) not supported for '%s'.",
6001}
6003/************************************************************************/
6008{
6011 (void) value; /* Silence compiler warning about unused variable */
6013
6014 if (poption != NULL) {
6016
6017 /* We only sent the option if it has been sent already in the past.
6018 * Otherwise we leave it for that "initial" sending functionality
6019 * to send it. That has the benefit that the initial send (can) check
6020 * that server is not currently using value from the savegame that
6021 * we should not override */
6022 if (psoption->desired_sent) {
6023 /* Keep this list of conditions in sync with one in
6024 * handle_server_setting_common()
6025 * For lacking initial_setting check here, see comment above about
6026 * checking psoption->desired_sent. */
6027 if (psoption->is_visible
6028 && psoption->is_changeable) {
6031 }
6032 }
6033 }
6035 }
6036}
6037
6038
6039/****************************************************************************
6040 City and player report dialog options.
6041****************************************************************************/
6042#define SPECHASH_TAG dialog_options
6043#define SPECHASH_ASTR_KEY_TYPE
6044#define SPECHASH_IDATA_TYPE bool
6045#define SPECHASH_UDATA_TO_IDATA FC_INT_TO_PTR
6046#define SPECHASH_IDATA_TO_UDATA FC_PTR_TO_INT
6047#define SPECHASH_VPTR_TO_IDATA FC_PTR_TO_INT
6048#include "spechash.h"
6049#define dialog_options_hash_iterate(hash, column, visible) \
6050 TYPED_HASH_ITERATE(const char *, intptr_t, hash, column, visible)
6051#define dialog_options_hash_iterate_end HASH_ITERATE_END
6052
6054
6055/************************************************************************/
6058static void options_dialogs_load(struct section_file *sf)
6059{
6060 const struct entry_list *entries;
6061 const char *prefixes[] = { "player_dlg_", "city_report_", NULL };
6062 const char **prefix;
6063 bool visible;
6064
6066
6068
6069 if (NULL != entries) {
6071 for (prefix = prefixes; NULL != *prefix; prefix++) {
6072 if (!fc_strncmp(*prefix, entry_name(pentry), strlen(*prefix))
6073 && secfile_lookup_bool(sf, &visible, "client.%s",
6074 entry_name(pentry))) {
6077 break;
6078 }
6079 }
6081 }
6083
6084/************************************************************************/
6087static void options_dialogs_save(struct section_file *sf)
6088{
6090
6093 secfile_insert_bool(sf, visible, "client.%s", column);
6095}
6096
6097/************************************************************************/
6102void options_dialogs_update(void)
6103{
6104 char buf[64];
6105 int i;
6106
6108
6109 /* Player report dialog options. */
6110 for (i = 1; i < num_player_dlg_columns; i++) {
6111 fc_snprintf(buf, sizeof(buf), "player_dlg_%s",
6112 player_dlg_columns[i].tagname);
6115 }
6116
6117 /* City report dialog options. */
6118 for (i = 0; i < num_city_report_spec(); i++) {
6119 fc_snprintf(buf, sizeof(buf), "city_report_%s",
6123 }
6124}
6126/************************************************************************/
6130void options_dialogs_set(void)
6131{
6132 char buf[64];
6133 bool visible;
6134 int i;
6135
6137
6138 /* Player report dialog options. */
6139 for (i = 1; i < num_player_dlg_columns; i++) {
6140 fc_snprintf(buf, sizeof(buf), "player_dlg_%s",
6141 player_dlg_columns[i].tagname);
6144 }
6145 }
6146
6147 /* City report dialog options. */
6148 for (i = 0; i < num_city_report_spec(); i++) {
6149 fc_snprintf(buf, sizeof(buf), "city_report_%s",
6153 }
6154 }
6155}
6156
6157/************************************************************************/
6163void options_load(void)
6164{
6165 struct section_file *sf;
6167 int i, num;
6168 const char *name;
6169 const char *const prefix = "client";
6170 const char *str;
6171
6173 if (!name) {
6174 log_normal(_("Didn't find the option file. Creating a new one."));
6178 return;
6179 }
6180 if (!(sf = secfile_load(name, TRUE))) {
6181 log_debug("Error loading option file '%s':\n%s", name, secfile_error());
6182 /* Try to create the rc file */
6183 sf = secfile_new(TRUE);
6184 secfile_insert_str(sf, VERSION_STRING, "client.version");
6185
6188 save_cma_presets(sf);
6189
6190 /* FIXME: need better messages */
6191 if (!secfile_save(sf, name, 0, FZ_PLAIN)) {
6192 log_error(_("Save failed, cannot write to file %s"), name);
6193 } else {
6194 log_normal(_("Saved settings to file %s"), name);
6195 }
6196 secfile_destroy(sf);
6198 return;
6199 }
6201
6202 /* A "secret" option for the lazy. TODO: make this saveable */
6204 secfile_lookup_str_default(sf, "", "%s.password", prefix));
6205
6208 "%s.save_options_on_exit", prefix);
6211 "%s.fullscreen_mode", prefix);
6212
6213 /* Settings migrations */
6216 "%s.migration_gtk3_from_gtk2", prefix);
6219 "%s.migration_gtk3_22_from_gtk3", prefix);
6222 "%s.migration_gtk4_from_gtk3_22", prefix);
6225 "%s.migration_gtk5_from_gtk4", prefix);
6228 "%s.migration_sdl2_from_sdl", prefix);
6231 "%s.migration_sdl3_from_sdl2", prefix);
6234 "%s.migration_gtk2_from_2_5", prefix);
6237 "%s.migration_gtk3_from_2_5", prefix);
6240 "%s.migration_qt_from_2_5", prefix);
6241
6242 /* Flag values */
6245 "%s.flag_qt_default_fonts_set", prefix);
6248 "%s.flag_sdl2_default_screen_size_set", prefix);
6251 "%s.flag_sdl3_default_screen_size_set", prefix);
6252
6253 /* These are not gui-enabled yet */
6255 = secfile_lookup_bool_default(sf, FALSE, "%s.zoom_set", prefix);
6258 "%s.zoom_default_level", prefix);
6259
6262 "%s.gui_qt_show_relations_panel", prefix);
6265 "%s.gui_qt_show_techs_panel", prefix);
6268 "%s.gui_qt_show_wonders_panel", prefix);
6269
6270 /* default_tileset_name present until freeciv-3.2 */
6271 str = secfile_lookup_str_default(sf, NULL, "client.default_tileset_name");
6272 if (str == NULL) {
6274 "client.default_topology");
6275 } else {
6277 }
6278 str = secfile_lookup_str_default(sf, NULL, "client.default_tileset_overhead_name");
6279 if (str != NULL) {
6281 }
6282 str = secfile_lookup_str_default(sf, NULL, "client.default_tileset_iso_name");
6283 if (str != NULL) {
6285 }
6286
6287 /* Backwards compatibility for removed options replaced by entirely "new"
6288 * options. The equivalent "new" option will override these, if set. */
6289
6290 /* Renamed in 2.6 */
6292 "%s.popup_caravan_arrival", prefix);
6293
6294 /* Load all the regular options */
6298
6299 /* More backwards compatibility, for removed options that had been
6300 * folded into then-existing options. Here, the backwards-compatibility
6301 * behaviour overrides the "destination" option. */
6302
6303 /* Removed in 2.4 */
6305 "%s.do_combat_animation", prefix)) {
6307 }
6308
6309 message_options_load(sf, prefix);
6311
6312 /* Load cma presets. If cma.number_of_presets doesn't exist, don't load
6313 * any, the order here should be reversed to keep the order the same */
6314 if (secfile_lookup_int(sf, &num, "cma.number_of_presets")) {
6315 for (i = num - 1; i >= 0; i--) {
6316 load_cma_preset(sf, i);
6317 }
6318 } else {
6320 }
6321
6324
6325 secfile_destroy(sf);
6328
6329/************************************************************************/
6333 const char *msg, ...)
6334{
6335 va_list args;
6336
6337 va_start(args, msg);
6339 va_end(args);
6341
6342/************************************************************************/
6346{
6347 struct section_file *sf;
6348 const char *name = get_current_option_file_name();
6349 char dir_name[2048];
6350 int i;
6351
6352 if (log_cb == NULL) {
6353 /* Default callback */
6355 }
6356
6357 if (!name) {
6358 log_cb(LOG_ERROR, _("Save failed, cannot find a filename."));
6359 return;
6360 }
6361
6362 sf = secfile_new(TRUE);
6363 secfile_insert_str(sf, VERSION_STRING, "client.version");
6364
6366 "client.save_options_on_exit");
6368 "deprecated", "client.fullscreen_mode");
6369
6370 /* Migrations */
6372 "client.migration_gtk3_from_gtk2");
6374 "client.migration_gtk3_22_from_gtk3");
6376 "client.migration_gtk4_from_gtk3_22");
6378 "client.migration_gtk5_from_gtk4");
6380 "client.migration_sdl2_from_sdl");
6382 "client.migration_sdl3_from_sdl2");
6384 "client.migration_gtk2_from_2_5");
6386 "client.migration_gtk3_from_2_5");
6388 "client.migration_qt_from_2_5");
6389
6390 /* Flag */
6392 "client.flag_qt_default_fonts_set");
6394 "client.flag_sdl2_default_screen_size_set");
6396 "client.flag_sdl3_default_screen_size_set");
6397
6398 /* gui-enabled options */
6403 /* Once options have been migrated from a client that no longer exist to a newer client,
6404 * there's no use for those settings of dropped client any more, so no point in saving them. */
6406 }
6408
6409 /* These are not gui-enabled yet. */
6410 secfile_insert_bool(sf, gui_options.zoom_set, "client.zoom_set");
6412 "client.zoom_default_level");
6413
6415 "client.gui_qt_show_relations_panel");
6417 "client.gui_qt_show_techs_panel");
6419 "client.gui_qt_show_wonders_panel");
6420
6421 if (tileset != NULL) {
6423 "client.default_topology");
6424 } else {
6426 "client.default_topology");
6427 }
6428
6429 message_options_save(sf, "client");
6431
6432 /* Server settings */
6433 save_cma_presets(sf);
6435
6436 /* Insert global worklists */
6438
6439 /* Directory name */
6441 for (i = strlen(dir_name) - 1 ; dir_name[i] != DIR_SEPARATOR_CHAR && i >= 0; i--) {
6442 /* Nothing */
6443 }
6444
6445 if (i > 0) {
6446 dir_name[i] = '\0';
6448 log_cb(LOG_ERROR, _("Saving options failed, cannot create directory %s"),
6449 dir_name);
6450 secfile_destroy(sf);
6451 return;
6452 }
6453 }
6454
6455 /* Save to disk */
6456 if (!secfile_save(sf, name, 0, FZ_PLAIN)) {
6457 log_cb(LOG_ERROR, _("Saving options failed, cannot write to file %s"), name);
6458 } else {
6459 log_cb(LOG_VERBOSE, _("Saved options to file %s"), name);
6460 }
6461 secfile_destroy(sf);
6463
6464/************************************************************************/
6467static void options_init_names(const struct copt_val_name *(*acc)(int),
6468 struct strvec **support, struct strvec **pretty)
6469{
6470 int val;
6471 const struct copt_val_name *name;
6472
6474 *support = strvec_new();
6475 *pretty = strvec_new();
6476 for (val = 0; (name = acc(val)); val++) {
6477 strvec_append(*support, name->support);
6478 strvec_append(*pretty, name->pretty);
6479 }
6481
6482/************************************************************************/
6485void options_init(void)
6486{
6490
6493
6496
6497 switch (option_type(poption)) {
6498 case OT_INTEGER:
6505
6506 log_error("option %s has default value of %d, which is "
6507 "out of its range [%d; %d], changing to %d.",
6510 new_default);
6511 *((int *) &(pcoption->integer.def)) = new_default;
6512 }
6513 break;
6514
6515 case OT_STRING:
6517 /* Hack to get a default value. */
6518 *((const char **) &(pcoption->string.def)) =
6520 }
6521
6522 if (NULL == option_str_def(poption)) {
6523 const struct strvec *values = option_str_values(poption);
6524
6525 if (NULL == values || strvec_size(values) == 0) {
6526 log_error("Invalid NULL default string for option %s.",
6528 } else {
6529 *((const char **) &(pcoption->string.def)) =
6530 strvec_get(values, 0);
6531 }
6532 }
6533 break;
6534
6535 case OT_ENUM:
6536 fc_assert(NULL == pcoption->enumerator.support_names);
6537 fc_assert(NULL == pcoption->enumerator.pretty_names);
6538 options_init_names(pcoption->enumerator.name_accessor,
6539 &pcoption->enumerator.support_names,
6540 &pcoption->enumerator.pretty_names);
6541 fc_assert(NULL != pcoption->enumerator.support_names);
6542 fc_assert(NULL != pcoption->enumerator.pretty_names);
6543 break;
6544
6545 case OT_BITWISE:
6546 fc_assert(NULL == pcoption->bitwise.support_names);
6547 fc_assert(NULL == pcoption->bitwise.pretty_names);
6548 options_init_names(pcoption->bitwise.name_accessor,
6549 &pcoption->bitwise.support_names,
6550 &pcoption->bitwise.pretty_names);
6551 fc_assert(NULL != pcoption->bitwise.support_names);
6552 fc_assert(NULL != pcoption->bitwise.pretty_names);
6553 break;
6554
6555 case OT_COLOR:
6556 {
6557 /* Duplicate the string pointers. */
6558 struct ft_color *pcolor = pcoption->color.pvalue;
6559
6560 if (NULL != pcolor->foreground) {
6561 pcolor->foreground = fc_strdup(pcolor->foreground);
6562 }
6563 if (NULL != pcolor->background) {
6564 pcolor->background = fc_strdup(pcolor->background);
6565 }
6566 }
6567 break;
6568
6569 case OT_BOOLEAN:
6570 case OT_FONT:
6571 case OT_VIDEO_MODE:
6572 break;
6573 }
6574
6575 /* Set to default. */
6579
6580/************************************************************************/
6583void options_free(void)
6584{
6587
6589
6590 switch (option_type(poption)) {
6591 case OT_ENUM:
6592 fc_assert_action(NULL != pcoption->enumerator.support_names, break);
6593 strvec_destroy(pcoption->enumerator.support_names);
6594 pcoption->enumerator.support_names = NULL;
6595 fc_assert_action(NULL != pcoption->enumerator.pretty_names, break);
6596 strvec_destroy(pcoption->enumerator.pretty_names);
6597 pcoption->enumerator.pretty_names = NULL;
6598 break;
6599
6600 case OT_BITWISE:
6601 fc_assert_action(NULL != pcoption->bitwise.support_names, break);
6602 strvec_destroy(pcoption->bitwise.support_names);
6603 pcoption->bitwise.support_names = NULL;
6604 fc_assert_action(NULL != pcoption->bitwise.pretty_names, break);
6605 strvec_destroy(pcoption->bitwise.pretty_names);
6606 pcoption->bitwise.pretty_names = NULL;
6607 break;
6608
6609 case OT_BOOLEAN:
6610 case OT_INTEGER:
6611 case OT_STRING:
6612 case OT_FONT:
6613 case OT_COLOR:
6614 case OT_VIDEO_MODE:
6615 break;
6616 }
6618
6619 if (NULL != settable_options_hash) {
6622 }
6623
6624 if (NULL != dialog_options_hash) {
6627 }
6628
6631}
6633/************************************************************************/
6637static void reqtree_show_icons_callback(struct option *poption)
6638{
6641
6642/************************************************************************/
6645static void view_option_changed_callback(struct option *poption)
6646{
6647 menus_init();
6650
6651/************************************************************************/
6654static void manual_turn_done_callback(struct option *poption)
6655{
6657
6659 struct player *pplayer = client_player();
6660
6661 if (pplayer != NULL && is_ai(pplayer)
6662 && can_end_turn()) {
6664 }
6665 }
6667
6668/****************************************************************************
6669 Callback for changing music volume
6670****************************************************************************/
6671static void sound_volume_callback(struct option *poption)
6672{
6675
6676/************************************************************************/
6679static void voteinfo_bar_callback(struct option *poption)
6680{
6683
6684/************************************************************************/
6687static void font_changed_callback(struct option *poption)
6688{
6692
6693/************************************************************************/
6696static void mapimg_changed_callback(struct option *poption)
6697{
6699#ifndef FREECIV_NDEBUG
6700 bool success;
6701#endif
6702
6703 log_normal("Error setting the value for %s (%s). Restoring the default "
6704 "value.", option_name(poption), mapimg_error());
6705
6706 /* Reset the value to the default value. */
6707#ifndef FREECIV_NDEBUG
6708 success =
6709#endif
6711
6713 "Failed to reset the option \"%s\".",
6715#ifndef FREECIV_NDEBUG
6716 success =
6717#endif
6719
6721 "Failed to restore mapimg definition for option \"%s\".",
6723 }
6725
6726/************************************************************************/
6729static void game_music_enable_callback(struct option *poption)
6730{
6731 if (client_state() == C_S_RUNNING) {
6734 } else {
6736 }
6737 }
6739
6740/************************************************************************/
6743static void menu_music_enable_callback(struct option *poption)
6744{
6745 if (client_state() != C_S_RUNNING) {
6747 start_menu_music("music_menu", NULL);
6748 } else {
6750 }
6751 }
6753
6754/************************************************************************/
6757bool video_mode_to_string(char *buf, size_t buf_len, struct video_mode *mode)
6758{
6759 return (2 < fc_snprintf(buf, buf_len, "%dx%d", mode->width, mode->height));
6761
6762/************************************************************************/
6765bool string_to_video_mode(const char *buf, struct video_mode *mode)
6766{
6767 return (2 == sscanf(buf, "%dx%d", &mode->width, &mode->height));
6769
6770/************************************************************************/
6773static const struct strvec *get_mapimg_format_list(const struct option *poption)
6774{
6775 return mapimg_get_format_list();
6777
6778/************************************************************************/
6781const char *tileset_name_for_topology(int topology_id)
6782{
6783 const char *tsn = NULL;
6784
6785 switch (topology_id & (TF_ISO | TF_HEX)) {
6786 case 0:
6787 case TF_ISO:
6789 break;
6790 case TF_HEX:
6792 break;
6793 case TF_ISO | TF_HEX:
6795 break;
6796 }
6797
6798 if (tsn == NULL) {
6800 }
6801
6802 return tsn;
6804
6805/************************************************************************/
6808void option_set_default_ts(struct tileset *t)
6809{
6810 const char *optname = "<not set>";
6811 struct option *opt;
6812
6813 switch (tileset_topo_index(t)) {
6814 case TS_TOPO_SQUARE:
6815 /* Overhead */
6816 optname = "default_tileset_square_name";
6817 break;
6818 case TS_TOPO_HEX:
6819 /* Hex */
6820 optname = "default_tileset_hex_name";
6821 break;
6822 case TS_TOPO_ISOHEX:
6823 /* Isohex */
6824 optname = "default_tileset_isohex_name";
6825 break;
6826 }
6827
6829
6830 if (opt == NULL) {
6831 log_error("Unknown option name \"%s\" in option_set_default_ts()", optname);
6832 return;
6833 }
6834
6835 /* Do not call option_str_set() since we don't want option changed callback
6836 * to reload this tileset. */
6837 opt->str_vtable->set(opt, tileset_basename(t));
6840
6841/************************************************************************/
6844static bool is_ts_option_unset(const char *optname)
6845{
6846 struct option *opt;
6847 const char *val;
6848
6850
6851 if (opt == NULL) {
6852 return TRUE;
6853 }
6854
6855 val = opt->str_vtable->get(opt);
6856
6857 if (val == NULL || val[0] == '\0') {
6858 return TRUE;
6859 }
6860
6861 return FALSE;
6863
6864/************************************************************************/
6867void fill_topo_ts_default(void)
6868{
6869 if (is_ts_option_unset("default_tileset_square_name")) {
6870 if (gui_options.default_tileset_iso_name[0] != '\0') {
6874 } else if (gui_options.default_tileset_overhead_name[0] != '\0') {
6878 } else {
6879 log_debug("Setting tileset for square topologies.");
6881 }
6882 }
6883 if (is_ts_option_unset("default_tileset_hex_name")) {
6884 log_debug("Setting tileset for hex topology.");
6886 }
6887 if (is_ts_option_unset("default_tileset_isohex_name")) {
6888 log_debug("Setting tileset for isohex topology.");
6890 }
6891}
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:1041
void option_dialog_popdown(const struct option_set *poptset)
Definition optiondlg.c:986
void option_gui_update(struct option *poption)
Definition optiondlg.c:1013
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:3623
void handle_server_setting_const(const struct packet_server_setting_const *packet)
Definition options.c:4557
void handle_server_setting_int(const struct packet_server_setting_int *packet)
Definition options.c:4651
static int server_option_int_max(const struct option *poption)
Definition options.c:5082
static bool client_option_font_set(struct option *poption, const char *font)
Definition options.c:3992
unsigned option_bitwise_mask(const struct option *poption)
Definition options.c:1132
void fill_topo_ts_default(void)
Definition options.c:6862
#define FIRST_MAJOR_MID_OPTION_FILE_NAME
Definition options.c:5527
#define client_options_iterate_all_end
Definition options.c:3585
static const struct strvec * server_option_str_values(const struct option *poption)
Definition options.c:5126
static int client_option_enum_get(const struct option *poption)
Definition options.c:3851
void resend_desired_settable_options(void)
Definition options.c:6002
const struct strvec * option_str_values(const struct option *poption)
Definition options.c:951
static void desired_settable_option_send(struct option *poption)
Definition options.c:5916
static const char * client_option_name(const struct option *poption)
Definition options.c:3677
static int sync_serial
Definition options.c:438
static unsigned server_option_bitwise_def(const struct option *poption)
Definition options.c:5221
#define FIRST_MAJOR_NEW_OPTION_FILE_NAME
Definition options.c:5524
static const struct option_video_mode_vtable client_option_video_mode_vtable
Definition options.c:1442
#define GEN_STR_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb, cbd)
Definition options.c:1619
static struct dialog_options_hash * dialog_options_hash
Definition options.c:6048
void option_changed(struct option *poption)
Definition options.c:784
static void menu_music_enable_callback(struct option *poption)
Definition options.c:6738
static bool options_fully_initialized
Definition options.c:436
static const struct option_str_vtable client_option_str_vtable
Definition options.c:1376
unsigned option_bitwise_def(const struct option *poption)
Definition options.c:1121
int option_enum_str_to_int(const struct option *poption, const char *str)
Definition options.c:979
static const char * client_option_description(const struct option *poption)
Definition options.c:3685
int option_int_min(const struct option *poption)
Definition options.c:892
static void option_save_output_window_callback(enum log_level lvl, const char *msg,...)
Definition options.c:6327
static void message_options_save(struct section_file *file, const char *prefix)
Definition options.c:5433
bool option_bool_def(const struct option *poption)
Definition options.c:844
static struct option * client_option_next(const struct option *poption)
Definition options.c:3717
static const char * server_option_name(const struct option *poption)
Definition options.c:4977
const char * option_font_def(const struct option *poption)
Definition options.c:1188
const char * tileset_name_for_topology(int topology_id)
Definition options.c:6776
static const struct copt_val_name * gui_gtk_message_chat_location_name(int value)
Definition options.c:1875
static bool server_option_str_set(struct option *poption, const char *str)
Definition options.c:5135
static const struct copt_val_name * gui_popup_tech_help_name(int value)
Definition options.c:1895
struct option * optset_option_first(const struct option_set *poptset)
Definition options.c:483
static const char * server_optset_category_name(int category)
Definition options.c:4957
const struct option_set * server_optset
Definition options.c:4278
static void view_option_changed_callback(struct option *poption)
Definition options.c:6640
static const char * client_option_font_target(const struct option *poption)
Definition options.c:3983
static void server_option_enum_support_name(const struct option *poption, const char **pvalue, const char **pdefault)
Definition options.c:5195
#define GEN_INT_OPTION(oname, odesc, ohelp, ocat, ospec, odef, omin, omax, ocb)
Definition options.c:1581
static const char * server_option_description(const struct option *poption)
Definition options.c:4985
static unsigned server_option_bitwise_get(const struct option *poption)
Definition options.c:5213
static bool client_option_is_changeable(const struct option *poption)
Definition options.c:3709
static int server_option_int_min(const struct option *poption)
Definition options.c:5074
static const char * client_optset_category_name(int category)
Definition options.c:3639
static struct option * server_option_next(const struct option *poption)
Definition options.c:5017
static struct client_option client_options[]
Definition options.c:1922
#define SERVER_OPTION(poption)
Definition options.c:4414
static void settable_options_save(struct section_file *sf)
Definition options.c:5761
static bool server_option_bool_get(const struct option *poption)
Definition options.c:5025
bool option_reset(struct option *poption)
Definition options.c:745
void options_free(void)
Definition options.c:6578
const char * option_description(const struct option *poption)
Definition options.c:674
const char * option_help_text(const struct option *poption)
Definition options.c:684
#define settable_options_hash_iterate_end
Definition options.c:5687
static const char * client_option_font_get(const struct option *poption)
Definition options.c:3967
static int server_option_enum_def(const struct option *poption)
Definition options.c:5158
static int server_option_int_def(const struct option *poption)
Definition options.c:5066
#define client_options_iterate_all(poption)
Definition options.c:3576
static int client_option_int_min(const struct option *poption)
Definition options.c:3773
static int server_options_categories_num
Definition options.c:4260
const char * option_enum_get_str(const struct option *poption)
Definition options.c:1028
static struct ft_color client_option_color_def(const struct option *poption)
Definition options.c:4016
static const struct strvec * client_option_enum_pretty_names(const struct option *poption)
Definition options.c:3869
static bool server_option_enum_set(struct option *poption, int val)
Definition options.c:5177
static void save_cma_presets(struct section_file *file)
Definition options.c:5506
struct ft_color option_color_get(const struct option *poption)
Definition options.c:1226
static struct video_mode client_option_video_mode_def(const struct option *poption)
Definition options.c:4070
static int client_option_int_get(const struct option *poption)
Definition options.c:3757
static char ** server_options_categories
Definition options.c:4257
int option_enum_get_int(const struct option *poption)
Definition options.c:1016
static void settable_options_load(struct section_file *sf)
Definition options.c:5694
int option_number(const struct option *poption)
Definition options.c:654
static struct option * server_optset_option_first(void)
Definition options.c:4941
static struct settable_options_hash * settable_options_hash
Definition options.c:5689
int option_category(const struct option *poption)
Definition options.c:704
static struct server_option * server_options
Definition options.c:4258
static const struct option_int_vtable server_option_int_vtable
Definition options.c:4318
static void options_dialogs_save(struct section_file *sf)
Definition options.c:6082
static struct option_set client_optset_static
Definition options.c:1310
static bool client_option_color_set(struct option *poption, struct ft_color color)
Definition options.c:4025
#define dialog_options_hash_iterate_end
Definition options.c:6046
static void save_cma_preset(struct section_file *file, int i)
Definition options.c:5484
static int client_optset_category_number(void)
Definition options.c:3631
static const char * client_option_str_def(const struct option *poption)
Definition options.c:3815
static bool client_option_video_mode_set(struct option *poption, struct video_mode mode)
Definition options.c:4079
void handle_server_setting_bitwise(const struct packet_server_setting_bitwise *packet)
Definition options.c:4822
static const struct option_font_vtable client_option_font_vtable
Definition options.c:1417
static bool client_option_enum_set(struct option *poption, int val)
Definition options.c:3878
void desired_settable_option_update(const char *op_name, const char *op_value, bool allow_replace)
Definition options.c:5859
void option_set_default_ts(struct tileset *t)
Definition options.c:6803
bool option_str_set(struct option *poption, const char *str)
Definition options.c:962
void handle_server_setting_bool(const struct packet_server_setting_bool *packet)
Definition options.c:4616
static const struct strvec * client_option_str_values(const struct option *poption)
Definition options.c:3825
const struct option_set * client_optset
Definition options.c:1316
static const struct option_bool_vtable server_option_bool_vtable
Definition options.c:4306
static const struct option_bitwise_vtable server_option_bitwise_vtable
Definition options.c:4359
const char * option_name(const struct option *poption)
Definition options.c:664
static const char * client_option_help_text(const struct option *poption)
Definition options.c:3693
static void message_options_init(void)
Definition options.c:5306
static int client_option_number(const struct option *poption)
Definition options.c:3669
void handle_server_setting_str(const struct packet_server_setting_str *packet)
Definition options.c:4688
int option_int_get(const struct option *poption)
Definition options.c:870
static void client_option_save(struct option *poption, struct section_file *sf)
Definition options.c:4197
void options_init(void)
Definition options.c:6480
static int client_option_int_def(const struct option *poption)
Definition options.c:3765
static int server_option_category(const struct option *poption)
Definition options.c:5001
#define FIRST_MINOR_MID_OPTION_FILE_NAME
Definition options.c:5528
static const struct option_enum_vtable client_option_enum_vtable
Definition options.c:1389
static const struct option_str_vtable server_option_str_vtable
Definition options.c:4332
static int server_options_num
Definition options.c:4261
#define handle_server_setting_common(psoption, packet)
Definition options.c:4578
static const struct option_color_vtable client_option_color_vtable
Definition options.c:1429
bool option_enum_set_str(struct option *poption, const char *str)
Definition options.c:1093
static const struct strvec * server_option_enum_pretty(const struct option *poption)
Definition options.c:5168
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:5279
bool option_color_set(struct option *poption, struct ft_color color)
Definition options.c:1249
#define SETTING_CASE(ARG_name,...)
static struct video_mode client_option_video_mode_get(const struct option *poption)
Definition options.c:4061
static bool is_ts_option_unset(const char *optname)
Definition options.c:6839
void option_set_changed_callback(struct option *poption, void(*callback)(struct option *))
Definition options.c:773
#define OPTION(poption)
Definition options.c:599
#define NEW_OPTION_FILE_NAME
Definition options.c:5521
static bool server_option_bool_set(struct option *poption, bool val)
Definition options.c:5042
bool option_bool_set(struct option *poption, bool val)
Definition options.c:855
bool option_is_changeable(const struct option *poption)
Definition options.c:725
#define GEN_ENUM_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb)
Definition options.c:1697
bool option_video_mode_set(struct option *poption, struct video_mode mode)
Definition options.c:1289
#define MID_OPTION_FILE_NAME
Definition options.c:5520
static int server_option_number(const struct option *poption)
Definition options.c:4969
#define dialog_options_hash_iterate(hash, column, visible)
Definition options.c:6044
#define FIRST_MINOR_NEW_BOOLEAN
Definition options.c:5531
static const char * server_option_str_get(const struct option *poption)
Definition options.c:5108
#define settable_options_hash_iterate(hash, name, value)
Definition options.c:5685
void option_set_gui_data(struct option *poption, void *data)
Definition options.c:803
#define FIRST_MINOR_NEW_OPTION_FILE_NAME
Definition options.c:5525
#define GEN_BOOL_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb)
Definition options.c:1545
const char * option_str_get(const struct option *poption)
Definition options.c:929
struct option * optset_option_by_number(const struct option_set *poptset, int id)
Definition options.c:456
static bool client_option_bool_get(const struct option *poption)
Definition options.c:3725
void * option_get_gui_data(const struct option *poption)
Definition options.c:813
static const char * server_option_str_def(const struct option *poption)
Definition options.c:5116
static const struct option_common_vtable client_option_common_vtable
Definition options.c:1336
static bool settable_option_upgrade_value(const struct option *poption, int old_value, char *buf, size_t buf_len)
Definition options.c:5876
const struct strvec * option_enum_values(const struct option *poption)
Definition options.c:1065
static const struct strvec * get_mapimg_format_list(const struct option *poption)
Definition options.c:6768
static void sound_volume_callback(struct option *poption)
Definition options.c:6666
bool option_enum_set_int(struct option *poption, int val)
Definition options.c:1076
bool option_bool_get(const struct option *poption)
Definition options.c:833
int optset_category_number(const struct option_set *poptset)
Definition options.c:493
#define color_set(color_tgt, color)
static bool client_option_bool_def(const struct option *poption)
Definition options.c:3733
static const struct strvec * server_option_bitwise_pretty(const struct option *poption)
Definition options.c:5231
void server_options_init(void)
Definition options.c:4422
enum option_type option_type(const struct option *poption)
Definition options.c:694
static int client_option_enum_def(const struct option *poption)
Definition options.c:3859
const char * option_enum_int_to_str(const struct option *poption, int val)
Definition options.c:1001
void options_dialogs_update(void)
Definition options.c:6097
int option_get_cb_data(const struct option *poption)
Definition options.c:823
bool video_mode_to_string(char *buf, size_t buf_len, struct video_mode *mode)
Definition options.c:6752
static void options_dialogs_load(struct section_file *sf)
Definition options.c:6053
const struct option_set * option_optset(const struct option *poption)
Definition options.c:644
void server_options_free(void)
Definition options.c:4491
struct video_mode option_video_mode_get(const struct option *poption)
Definition options.c:1264
static int server_option_enum_get(const struct option *poption)
Definition options.c:5150
struct option * option_next(const struct option *poption)
Definition options.c:735
static struct option * client_optset_option_by_number(int id)
Definition options.c:3612
static void font_changed_callback(struct option *poption)
Definition options.c:6682
const char * option_str_def(const struct option *poption)
Definition options.c:940
const char * optset_category_name(const struct option_set *poptset, int category)
Definition options.c:503
int option_int_max(const struct option *poption)
Definition options.c:903
#define GEN_COLOR_OPTION(oname, odesc, ohelp, ocat, ospec, odef_fg, odef_bg, ocb)
Definition options.c:1812
const char * option_enum_def_str(const struct option *poption)
Definition options.c:1052
void options_load(void)
Definition options.c:6158
static const char * client_option_str_get(const struct option *poption)
Definition options.c:3807
static const struct option_common_vtable server_option_common_vtable
Definition options.c:4292
static int server_optset_category_number(void)
Definition options.c:4949
static bool client_option_bool_set(struct option *poption, bool val)
Definition options.c:3742
static const char * server_option_help_text(const struct option *poption)
Definition options.c:4993
static const struct option_bool_vtable client_option_bool_vtable
Definition options.c:1350
static bool client_option_load(struct option *poption, struct section_file *sf)
Definition options.c:4096
bool option_font_set(struct option *poption, const char *font)
Definition options.c:1210
static bool server_option_bitwise_set(struct option *poption, unsigned val)
Definition options.c:5260
const char * option_font_target(const struct option *poption)
Definition options.c:1199
static const char * client_option_enum_secfile_str(secfile_data_t data, int val)
Definition options.c:3897
static struct server_option * server_option_next_valid(struct server_option *poption)
Definition options.c:4911
static void server_option_bitwise_support_base(const struct strvec *values, unsigned val, char *buf, size_t buf_len)
Definition options.c:5239
static void voteinfo_bar_callback(struct option *poption)
Definition options.c:6674
static struct option * server_optset_option_by_number(int id)
Definition options.c:4930
void options_save(option_save_log_callback log_cb)
Definition options.c:6340
static void message_options_free(void)
Definition options.c:5344
static const struct option_enum_vtable server_option_enum_vtable
Definition options.c:4345
bool string_to_video_mode(const char *buf, struct video_mode *mode)
Definition options.c:6760
const struct strvec * option_bitwise_values(const struct option *poption)
Definition options.c:1149
static bool server_option_int_set(struct option *poption, int val)
Definition options.c:5091
int messages_where[E_COUNT]
Definition options.c:5299
static void message_options_load(struct section_file *file, const char *prefix)
Definition options.c:5353
struct client_options gui_options
Definition options.c:71
static void server_option_free(struct server_option *poption)
Definition options.c:4433
#define CLIENT_OPTION(poption)
Definition options.c:1527
#define GEN_FONT_OPTION(oname, otgt, odesc, ohelp, ocat, ospec, odef, ocb)
Definition options.c:1776
static struct option_set server_optset_static
Definition options.c:4272
void handle_server_setting_control(const struct packet_server_setting_control *packet)
Definition options.c:4523
static void mapimg_changed_callback(struct option *poption)
Definition options.c:6691
bool option_bitwise_set(struct option *poption, unsigned val)
Definition options.c:1160
static int server_option_int_get(const struct option *poption)
Definition options.c:5058
static void manual_turn_done_callback(struct option *poption)
Definition options.c:6649
static void reqtree_show_icons_callback(struct option *poption)
Definition options.c:6632
const char * option_font_get(const struct option *poption)
Definition options.c:1177
void desired_settable_options_update(void)
Definition options.c:5791
static void load_cma_preset(struct section_file *file, int i)
Definition options.c:5454
static bool client_option_str_set(struct option *poption, const char *str)
Definition options.c:3835
void handle_server_setting_enum(const struct packet_server_setting_enum *packet)
Definition options.c:4733
struct ft_color option_color_def(const struct option *poption)
Definition options.c:1237
static int client_option_int_max(const struct option *poption)
Definition options.c:3781
#define GEN_STR_LIST_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb, cbd)
Definition options.c:1660
client_option_category
Definition options.c:1448
@ COC_MAX
Definition options.c:1456
@ COC_SOUND
Definition options.c:1451
@ COC_NETWORK
Definition options.c:1454
@ COC_INTERFACE
Definition options.c:1452
@ COC_GRAPHICS
Definition options.c:1449
@ COC_OVERVIEW
Definition options.c:1450
@ COC_FONT
Definition options.c:1455
@ COC_MAPIMG
Definition options.c:1453
unsigned option_bitwise_get(const struct option *poption)
Definition options.c:1110
static bool server_option_is_changeable(const struct option *poption)
Definition options.c:5009
static struct ft_color client_option_color_get(const struct option *poption)
Definition options.c:4008
int option_enum_def_int(const struct option *poption)
Definition options.c:1040
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:467
static const int client_options_num
Definition options.c:3573
static bool client_option_int_set(struct option *poption, int val)
Definition options.c:3790
void options_dialogs_set(void)
Definition options.c:6125
bool option_int_set(struct option *poption, int val)
Definition options.c:914
static struct client_option * client_option_next_valid(struct client_option *poption)
Definition options.c:3594
static const char * client_option_bitwise_secfile_str(secfile_data_t data, int val)
Definition options.c:3955
#define GEN_VIDEO_OPTION(oname, odesc, ohelp, ocat, ospec, odef_width, odef_height, ocb)
Definition options.c:1847
static const struct option_int_vtable client_option_int_vtable
Definition options.c:1362
static const char * client_option_font_def(const struct option *poption)
Definition options.c:3975
static const char * get_last_option_file_name(bool *allow_digital_boolean)
Definition options.c:5575
const char * option_category_name(const struct option *poption)
Definition options.c:714
static void game_music_enable_callback(struct option *poption)
Definition options.c:6724
static const char * get_current_option_file_name(void)
Definition options.c:5540
int option_int_def(const struct option *poption)
Definition options.c:881
static void options_init_names(const struct copt_val_name *(*acc)(int), struct strvec **support, struct strvec **pretty)
Definition options.c:6462
struct video_mode option_video_mode_def(const struct option *poption)
Definition options.c:1276
static bool server_option_bool_def(const struct option *poption)
Definition options.c:5033
#define GUI_GTK3_CITYDLG_DEFAULT_XSIZE
Definition options.h:638
#define GUI_GTK3_22_GOV_RANGE_MIN_DEFAULT
Definition options.h:663
#define GUI_GTK5_CITYDLG_DEFAULT_XSIZE
Definition options.h:689
@ GUI_GTK_MSGCHAT_SEPARATE
Definition options.h:68
#define MW_POPUP
Definition options.h:616
#define GUI_GTK3_CITYDLG_MAX_YSIZE
Definition options.h:644
#define GUI_GTK3_22_GOV_RANGE_MIN_MIN
Definition options.h:664
#define GUI_GTK3_GOV_RANGE_MIN_DEFAULT
Definition options.h:646
#define GUI_GTK4_GOV_RANGE_MIN_MAX
Definition options.h:682
#define GUI_GTK3_22_CITYDLG_MIN_YSIZE
Definition options.h:660
#define GUI_GTK4_CITYDLG_MAX_XSIZE
Definition options.h:674
#define GUI_GTK4_GOV_RANGE_MIN_DEFAULT
Definition options.h:680
#define GUI_GTK5_CITYDLG_MAX_XSIZE
Definition options.h:691
#define GUI_GTK3_GOV_RANGE_MAX_DEFAULT
Definition options.h:650
void(* option_save_log_callback)(enum log_level lvl, const char *msg,...)
Definition options.h:482
#define GUI_GTK4_CITYDLG_DEFAULT_XSIZE
Definition options.h:672
#define FC_SDL3_DEFAULT_THEME_NAME
Definition options.h:429
#define GUI_GTK2_CITYDLG_DEFAULT_YSIZE
Definition options.h:630
#define GUI_GTK5_GOV_RANGE_MAX_MAX
Definition options.h:703
#define FC_GTK3_22_DEFAULT_THEME_NAME
Definition options.h:301
#define GUI_GTK3_22_CITYDLG_DEFAULT_XSIZE
Definition options.h:655
#define FC_QT_DEFAULT_THEME_NAME
Definition options.h:441
#define GUI_GTK3_CITYDLG_MIN_YSIZE
Definition options.h:643
#define GUI_GTK3_CITYDLG_MIN_XSIZE
Definition options.h:639
#define GUI_GTK3_22_CITYDLG_DEFAULT_YSIZE
Definition options.h:659
#define GUI_GTK4_CITYDLG_MIN_YSIZE
Definition options.h:677
#define DEFAULT_FOLLOWTAG_OPTION
Definition options.h:30
#define GUI_GTK5_CITYDLG_DEFAULT_YSIZE
Definition options.h:693
#define GUI_GTK2_CITYDLG_MIN_YSIZE
Definition options.h:631
#define options_iterate(poptset, poption)
Definition options.h:587
#define GUI_GTK2_CITYDLG_MAX_XSIZE
Definition options.h:628
#define GUI_DEFAULT_CHAT_LOGFILE
Definition options.h:623
#define GUI_GTK5_CITYDLG_MAX_YSIZE
Definition options.h:695
#define GUI_GTK3_GOV_RANGE_MAX_MAX
Definition options.h:652
#define GUI_GTK4_CITYDLG_MIN_XSIZE
Definition options.h:673
#define GUI_GTK3_22_GOV_RANGE_MAX_DEFAULT
Definition options.h:667
#define DEFAULT_METASERVER_OPTION
Definition options.h:29
#define GUI_GTK3_CITYDLG_DEFAULT_YSIZE
Definition options.h:642
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:657
#define GUI_GTK3_22_GOV_RANGE_MAX_MIN
Definition options.h:668
#define GUI_GTK5_GOV_RANGE_MAX_MIN
Definition options.h:702
#define GUI_GTK3_GOV_RANGE_MIN_MIN
Definition options.h:647
#define GUI_GTK3_GOV_RANGE_MIN_MAX
Definition options.h:648
#define GUI_GTK3_22_CITYDLG_MIN_XSIZE
Definition options.h:656
@ GUI_POPUP_TECH_HELP_RULESET
Definition options.h:77
#define FC_GTK5_DEFAULT_THEME_NAME
Definition options.h:373
#define GUI_GTK4_GOV_RANGE_MAX_DEFAULT
Definition options.h:684
#define MAJOR_NEW_OPTION_FILE_NAME
Definition options.h:38
#define GUI_GTK3_GOV_RANGE_MAX_MIN
Definition options.h:651
#define GUI_GTK2_CITYDLG_MAX_YSIZE
Definition options.h:632
#define GUI_DEFAULT_MAPIMG_FILENAME
Definition options.h:705
#define GUI_GTK5_CITYDLG_MIN_XSIZE
Definition options.h:690
#define GUI_GTK3_22_CITYDLG_MAX_YSIZE
Definition options.h:661
#define GUI_GTK4_GOV_RANGE_MIN_MIN
Definition options.h:681
#define GUI_GTK5_GOV_RANGE_MIN_DEFAULT
Definition options.h:697
#define GUI_GTK4_CITYDLG_MAX_YSIZE
Definition options.h:678
#define MW_OUTPUT
Definition options.h:614
#define GUI_GTK5_GOV_RANGE_MAX_DEFAULT
Definition options.h:701
#define GUI_GTK4_CITYDLG_DEFAULT_YSIZE
Definition options.h:676
#define options_iterate_end
Definition options.h:592
#define GUI_GTK5_GOV_RANGE_MIN_MAX
Definition options.h:699
#define GUI_GTK4_GOV_RANGE_MAX_MAX
Definition options.h:686
#define MW_MESSAGES
Definition options.h:615
#define FC_GTK4_DEFAULT_THEME_NAME
Definition options.h:337
#define GUI_GTK3_22_GOV_RANGE_MIN_MAX
Definition options.h:665
#define MINOR_NEW_OPTION_FILE_NAME
Definition options.h:42
#define GUI_GTK2_CITYDLG_DEFAULT_XSIZE
Definition options.h:626
#define FC_SDL2_DEFAULT_THEME_NAME
Definition options.h:416
#define GUI_GTK3_22_GOV_RANGE_MAX_MAX
Definition options.h:669
#define VIDEO_MODE(ARG_width, ARG_height)
Definition options.h:51
#define GUI_GTK5_GOV_RANGE_MIN_MIN
Definition options.h:698
@ 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_GTK3_CITYDLG_MAX_XSIZE
Definition options.h:640
#define GUI_GTK4_GOV_RANGE_MAX_MIN
Definition options.h:685
#define GUI_GTK5_CITYDLG_MIN_YSIZE
Definition options.h:694
#define GUI_GTK2_CITYDLG_MIN_XSIZE
Definition options.h:627
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:1480
const unsigned def
Definition options.c:1503
enum gui_type specific
Definition options.c:1469
const char * description
Definition options.c:1466
const char *const def
Definition options.c:1486
struct ft_color *const pvalue
Definition options.c:1516
struct video_mode *const pvalue
Definition options.c:1521
const size_t size
Definition options.c:1485
char *const pvalue
Definition options.c:1484
struct client_option::@238::@245 font
struct client_option::@238::@241 integer
const int max
Definition options.c:1480
const bool def
Definition options.c:1475
const char *const target
Definition options.c:1512
bool *const pvalue
Definition options.c:1474
struct option base_option
Definition options.c:1463
const char * help_text
Definition options.c:1467
unsigned *const pvalue
Definition options.c:1502
enum client_option_category category
Definition options.c:1468
int *const pvalue
Definition options.c:1479
struct client_option::@238::@242 string
const char * name
Definition options.c:1465
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:457
char default_tileset_iso_name[512]
Definition options.h:132
bool gui_qt_show_techs_panel
Definition options.h:458
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:459
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:1319
const char * pretty
Definition options.c:1321
int(* number)(const struct option *)
Definition options.c:523
int(* category)(const struct option *)
Definition options.c:527
bool(* is_changeable)(const struct option *)
Definition options.c:528
struct option *(* option_by_number)(int)
Definition options.c:446
struct option *(* option_first)(void)
Definition options.c:447
const char *(* category_name)(int)
Definition options.c:450
int(* category_number)(void)
Definition options.c:449
const struct option::option_common_vtable * common_vtable
const struct option::@236::option_int_vtable * int_vtable
const struct option::@236::option_str_vtable * str_vtable
const struct option::@236::option_video_mode_vtable * video_mode_vtable
const struct option::@236::option_enum_vtable * enum_vtable
enum option_type type
Definition options.c:519
const struct option_set * poptset
Definition options.c:517
int callback_data
Definition options.c:593
const struct option::@236::option_color_vtable * color_vtable
void(* changed_callback)(struct option *option)
Definition options.c:591
void * gui_data
Definition options.c:596
const struct option::@236::option_bool_vtable * bool_vtable
const struct option::@236::option_bitwise_vtable * bitwise_vtable
const struct option::@236::option_font_vtable * font_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:4401
unsigned value
Definition options.c:4406
char * help_text
Definition options.c:4374
struct server_option::@248::@251 integer
char * name
Definition options.c:4372
bool is_visible
Definition options.c:4378
char * description
Definition options.c:4373
unsigned char category
Definition options.c:4375
struct strvec * pretty_names
Definition options.c:4402
enum setting_default_level setdef
Definition options.c:4379
unsigned def
Definition options.c:4407
bool is_changeable
Definition options.c:4377
char * value
Definition options.c:4394
struct option base_option
Definition options.c:4370
bool desired_sent
Definition options.c:4376
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:7791
#define TS_TOPO_ISOHEX
Definition tilespec.h:457
#define TS_TOPO_HEX
Definition tilespec.h:456
#define TS_TOPO_SQUARE
Definition tilespec.h:455