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 = TRUE,
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_swrenderer = FALSE,
407 .gui_sdl3_do_cursor_animation = TRUE,
408 .gui_sdl3_use_color_cursors = TRUE,
409 .gui_sdl3_font_city_names = "10",
410 .gui_sdl3_font_city_productions = "10",
411 .gui_sdl3_use_theme_font_size = TRUE,
412 .gui_sdl3_font_size = 10,
413
414/* gui-qt client specific options. */
415 .gui_qt_fullscreen = FALSE,
416 .gui_qt_show_preview = TRUE,
417 .gui_qt_sidebar_left = TRUE,
418 .gui_qt_default_theme_name = FC_QT_DEFAULT_THEME_NAME,
419 .gui_qt_font_default = "Sans Serif,10,-1,5,75,0,0,0,0,0",
420 .gui_qt_font_notify_label = "Monospace,8,-1,5,75,0,0,0,0,0",
421 .gui_qt_font_help_label = "Sans Serif,9,-1,5,50,0,0,0,0,0",
422 .gui_qt_font_help_text = "Monospace,8,-1,5,50,0,0,0,0,0",
423 .gui_qt_font_chatline = "Monospace,8,-1,5,50,0,0,0,0,0",
424 .gui_qt_font_city_names = "Sans Serif,10,-1,5,75,0,0,0,0,0",
425 .gui_qt_font_city_productions = "Sans Serif,10,-1,5,50,1,0,0,0,0",
426 .gui_qt_font_reqtree_text = "Sans Serif,10,-1,5,50,1,0,0,0,0",
427 .gui_qt_show_titlebar = TRUE,
428 .gui_qt_wakeup_text = "Wake up %1",
429 .gui_qt_show_relations_panel = TRUE,
430 .gui_qt_show_techs_panel = TRUE,
431 .gui_qt_show_wonders_panel = TRUE,
432 .gui_qt_svgflags = TRUE
433};
434
435/* Set to TRUE after the first call to options_init(), to avoid the usage
436 * of non-initialized datas when calling the changed callback. */
438
439static const struct strvec *get_mapimg_format_list(const struct option *poption);
440
441/****************************************************************************
442 Option set structure.
443****************************************************************************/
445 struct option * (*option_by_number) (int);
446 struct option * (*option_first) (void);
447
449 const char * (*category_name) (int);
450};
451
452/************************************************************************/
456 int id)
457{
459
460 return poptset->option_by_number(id);
461}
462
463/************************************************************************/
467 const char *name)
468{
470
472 if (0 == strcmp(option_name(poption), name)) {
473 return poption;
474 }
476 return NULL;
477}
478
479/************************************************************************/
483{
485
486 return poptset->option_first();
487}
488
489/************************************************************************/
493{
495
496 return poptset->category_number();
497}
498
499/************************************************************************/
502const char *optset_category_name(const struct option_set *poptset,
503 int category)
504{
506
507 return poptset->category_name(category);
508}
509
510
511/****************************************************************************
512 The base class for options.
513****************************************************************************/
514struct option {
515 /* A link to the option set. */
516 const struct option_set *poptset;
517 /* Type of the option. */
519
520 /* Common accessors. */
521 const struct option_common_vtable {
522 int (*number) (const struct option *);
523 const char * (*name) (const struct option *);
524 const char * (*description) (const struct option *);
525 const char * (*help_text) (const struct option *);
526 int (*category) (const struct option *);
527 bool (*is_changeable) (const struct option *);
528 struct option * (*next) (const struct option *);
530 /* Specific typed accessors. */
531 union {
532 /* Specific boolean accessors (OT_BOOLEAN == type). */
533 const struct option_bool_vtable {
534 bool (*get) (const struct option *);
535 bool (*def) (const struct option *);
536 bool (*set) (struct option *, bool);
538 /* Specific integer accessors (OT_INTEGER == type). */
539 const struct option_int_vtable {
540 int (*get) (const struct option *);
541 int (*def) (const struct option *);
542 int (*minimum) (const struct option *);
543 int (*maximum) (const struct option *);
544 bool (*set) (struct option *, int);
546 /* Specific string accessors (OT_STRING == type). */
547 const struct option_str_vtable {
548 const char * (*get) (const struct option *);
549 const char * (*def) (const struct option *);
550 const struct strvec * (*values) (const struct option *);
551 bool (*set) (struct option *, const char *);
553 /* Specific enum accessors (OT_ENUM == type). */
554 const struct option_enum_vtable {
555 int (*get) (const struct option *);
556 int (*def) (const struct option *);
557 const struct strvec * (*values) (const struct option *);
558 bool (*set) (struct option *, int);
559 int (*cmp) (const char *, const char *);
561 /* Specific bitwise accessors (OT_BITWISE == type). */
562 const struct option_bitwise_vtable {
563 unsigned (*get) (const struct option *);
564 unsigned (*def) (const struct option *);
565 const struct strvec * (*values) (const struct option *);
566 bool (*set) (struct option *, unsigned);
568 /* Specific font accessors (OT_FONT == type). */
569 const struct option_font_vtable {
570 const char * (*get) (const struct option *);
571 const char * (*def) (const struct option *);
572 const char * (*target) (const struct option *);
573 bool (*set) (struct option *, const char *);
575 /* Specific color accessors (OT_COLOR == type). */
576 const struct option_color_vtable {
577 struct ft_color (*get) (const struct option *);
578 struct ft_color (*def) (const struct option *);
579 bool (*set) (struct option *, struct ft_color);
581 /* Specific video mode accessors (OT_VIDEO_MODE == type). */
582 const struct option_video_mode_vtable {
583 struct video_mode (*get) (const struct option *);
584 struct video_mode (*def) (const struct option *);
585 bool (*set) (struct option *, struct video_mode);
587 };
588
589 /* Called after the value changed. */
591
593
594 /* Volatile. */
595 void *gui_data;
596};
597
598#define OPTION(poption) ((struct option *) (poption))
599
600#define OPTION_INIT(optset, spec_type, spec_table_var, common_table, \
601 spec_table, changed_cb, cb_data) { \
602 .poptset = optset, \
603 .type = spec_type, \
604 .common_vtable = &common_table, \
605 INIT_BRACE_BEGIN \
606 .spec_table_var = &spec_table \
607 INIT_BRACE_END, \
608 .changed_callback = changed_cb, \
609 .callback_data = cb_data, \
610 .gui_data = NULL \
611}
612#define OPTION_BOOL_INIT(optset, common_table, bool_table, changed_cb) \
613 OPTION_INIT(optset, OT_BOOLEAN, bool_vtable, common_table, bool_table, \
614 changed_cb, 0)
615#define OPTION_INT_INIT(optset, common_table, int_table, changed_cb) \
616 OPTION_INIT(optset, OT_INTEGER, int_vtable, common_table, int_table, \
617 changed_cb, 0)
618#define OPTION_STR_INIT(optset, common_table, str_table, changed_cb, cb_data) \
619 OPTION_INIT(optset, OT_STRING, str_vtable, common_table, str_table, \
620 changed_cb, cb_data)
621#define OPTION_ENUM_INIT(optset, common_table, enum_table, changed_cb) \
622 OPTION_INIT(optset, OT_ENUM, enum_vtable, common_table, enum_table, \
623 changed_cb, 0)
624#define OPTION_BITWISE_INIT(optset, common_table, bitwise_table, \
625 changed_cb) \
626 OPTION_INIT(optset, OT_BITWISE, bitwise_vtable, common_table, \
627 bitwise_table, changed_cb, 0)
628#define OPTION_FONT_INIT(optset, common_table, font_table, changed_cb) \
629 OPTION_INIT(optset, OT_FONT, font_vtable, common_table, font_table, \
630 changed_cb, 0)
631#define OPTION_COLOR_INIT(optset, common_table, color_table, changed_cb) \
632 OPTION_INIT(optset, OT_COLOR, color_vtable, common_table, color_table, \
633 changed_cb, 0)
634#define OPTION_VIDEO_MODE_INIT(optset, common_table, video_mode_table, \
635 changed_cb) \
636 OPTION_INIT(optset, OT_VIDEO_MODE, video_mode_vtable, common_table, \
637 video_mode_table, changed_cb, 0)
638
639
640/************************************************************************/
643const struct option_set *option_optset(const struct option *poption)
644{
646
647 return poption->poptset;
648}
649
650/************************************************************************/
653int option_number(const struct option *poption)
654{
656
657 return poption->common_vtable->number(poption);
658}
659
660/************************************************************************/
663const char *option_name(const struct option *poption)
664{
666
667 return poption->common_vtable->name(poption);
668}
669
670/************************************************************************/
673const char *option_description(const struct option *poption)
674{
676
677 return poption->common_vtable->description(poption);
678}
679
680/************************************************************************/
683const char *option_help_text(const struct option *poption)
684{
686
687 return poption->common_vtable->help_text(poption);
688}
689
690/************************************************************************/
694{
696
697 return poption->type;
698}
699
700/************************************************************************/
704{
706
707 return poption->common_vtable->category(poption);
708}
709
710/************************************************************************/
713const char *option_category_name(const struct option *poption)
714{
716
717 return optset_category_name(poption->poptset,
718 poption->common_vtable->category(poption));
719}
720
721/************************************************************************/
725{
727
728 return poption->common_vtable->is_changeable(poption);
729}
730
731/************************************************************************/
734struct option *option_next(const struct option *poption)
735{
737
738 return poption->common_vtable->next(poption);
739}
740
741/************************************************************************/
768
769/************************************************************************/
773 void (*callback) (struct option *))
774{
776
777 poption->changed_callback = callback;
778}
779
780/************************************************************************/
784{
786
788 /* Prevent to use non-initialized datas. */
789 return;
790 }
791
792 if (poption->changed_callback) {
793 poption->changed_callback(poption);
794 }
795
797}
798
799/************************************************************************/
802void option_set_gui_data(struct option *poption, void *data)
803{
805
806 poption->gui_data = data;
807}
808
809/************************************************************************/
813{
815
816 return poption->gui_data;
817}
818
819/************************************************************************/
823{
825
826 return poption->callback_data;
827}
828
829/************************************************************************/
832bool option_bool_get(const struct option *poption)
833{
836
837 return poption->bool_vtable->get(poption);
838}
839
840/************************************************************************/
843bool option_bool_def(const struct option *poption)
844{
847
848 return poption->bool_vtable->def(poption);
849}
850
851/************************************************************************/
854bool option_bool_set(struct option *poption, bool val)
855{
858
859 if (poption->bool_vtable->set(poption, val)) {
861 return TRUE;
862 }
863 return FALSE;
864}
865
866/************************************************************************/
869int option_int_get(const struct option *poption)
870{
873
874 return poption->int_vtable->get(poption);
875}
876
877/************************************************************************/
880int option_int_def(const struct option *poption)
881{
884
885 return poption->int_vtable->def(poption);
886}
887
888/************************************************************************/
891int option_int_min(const struct option *poption)
892{
895
896 return poption->int_vtable->minimum(poption);
897}
898
899/************************************************************************/
902int option_int_max(const struct option *poption)
903{
906
907 return poption->int_vtable->maximum(poption);
908}
909
910/************************************************************************/
913bool option_int_set(struct option *poption, int val)
914{
917
918 if (poption->int_vtable->set(poption, val)) {
920 return TRUE;
921 }
922 return FALSE;
923}
924
925/************************************************************************/
928const char *option_str_get(const struct option *poption)
929{
932
933 return poption->str_vtable->get(poption);
934}
935
936/************************************************************************/
939const char *option_str_def(const struct option *poption)
940{
943
944 return poption->str_vtable->def(poption);
945}
946
947/************************************************************************/
950const struct strvec *option_str_values(const struct option *poption)
951{
954
955 return poption->str_vtable->values(poption);
956}
957
958/************************************************************************/
961bool option_str_set(struct option *poption, const char *str)
962{
966
967 if (poption->str_vtable->set(poption, str)) {
969 return TRUE;
970 }
971 return FALSE;
972}
973
974/************************************************************************/
978int option_enum_str_to_int(const struct option *poption, const char *str)
979{
980 const struct strvec *values;
981 int val;
982
984 fc_assert_ret_val(OT_ENUM == poption->type, -1);
985 values = poption->enum_vtable->values(poption);
986 fc_assert_ret_val(NULL != values, -1);
987
988 for (val = 0; val < strvec_size(values); val++) {
989 if (0 == poption->enum_vtable->cmp(strvec_get(values, val), str)) {
990 return val;
991 }
992 }
993 return -1;
994}
995
996/************************************************************************/
1000const char *option_enum_int_to_str(const struct option *poption, int val)
1001{
1002 const struct strvec *values;
1003
1006 values = poption->enum_vtable->values(poption);
1007 fc_assert_ret_val(NULL != values, NULL);
1008
1009 return strvec_get(values, val);
1010}
1011
1012/************************************************************************/
1016{
1018 fc_assert_ret_val(OT_ENUM == poption->type, -1);
1019
1020 return poption->enum_vtable->get(poption);
1021}
1022
1023/************************************************************************/
1027const char *option_enum_get_str(const struct option *poption)
1028{
1031
1032 return strvec_get(poption->enum_vtable->values(poption),
1033 poption->enum_vtable->get(poption));
1034}
1035
1036/************************************************************************/
1040{
1042 fc_assert_ret_val(OT_ENUM == poption->type, -1);
1043
1044 return poption->enum_vtable->def(poption);
1045}
1046
1047/************************************************************************/
1051const char *option_enum_def_str(const struct option *poption)
1052{
1055
1056 return strvec_get(poption->enum_vtable->values(poption),
1057 poption->enum_vtable->def(poption));
1058}
1059
1060/************************************************************************/
1064const struct strvec *option_enum_values(const struct option *poption)
1065{
1068
1069 return poption->enum_vtable->values(poption);
1070}
1071
1072/************************************************************************/
1075bool option_enum_set_int(struct option *poption, int val)
1076{
1079
1080 if (poption->enum_vtable->set(poption, val)) {
1082 return TRUE;
1083 }
1084 return FALSE;
1085}
1086
1087/************************************************************************/
1092bool option_enum_set_str(struct option *poption, const char *str)
1093{
1097
1098 if (poption->enum_vtable->set(poption,
1101 return TRUE;
1102 }
1103 return FALSE;
1104}
1105
1106/************************************************************************/
1109unsigned option_bitwise_get(const struct option *poption)
1110{
1113
1114 return poption->bitwise_vtable->get(poption);
1115}
1116
1117/************************************************************************/
1120unsigned option_bitwise_def(const struct option *poption)
1121{
1124
1125 return poption->bitwise_vtable->def(poption);
1126}
1127
1128/************************************************************************/
1131unsigned option_bitwise_mask(const struct option *poption)
1132{
1133 const struct strvec *values;
1134
1137
1138 values = poption->bitwise_vtable->values(poption);
1139 fc_assert_ret_val(NULL != values, 0);
1140
1141 return (1 << strvec_size(values)) - 1;
1142}
1143
1144/************************************************************************/
1148const struct strvec *option_bitwise_values(const struct option *poption)
1149{
1152
1153 return poption->bitwise_vtable->values(poption);
1154}
1155
1156/************************************************************************/
1159bool option_bitwise_set(struct option *poption, unsigned val)
1160{
1163
1164 if (0 != (val & ~option_bitwise_mask(poption))
1165 || !poption->bitwise_vtable->set(poption, val)) {
1166 return FALSE;
1167 }
1168
1170 return TRUE;
1171}
1172
1173/************************************************************************/
1176const char *option_font_get(const struct option *poption)
1177{
1180
1181 return poption->font_vtable->get(poption);
1182}
1183
1184/************************************************************************/
1187const char *option_font_def(const struct option *poption)
1188{
1191
1192 return poption->font_vtable->def(poption);
1193}
1194
1195/************************************************************************/
1198const char *option_font_target(const struct option *poption)
1199{
1202
1203 return poption->font_vtable->target(poption);
1204}
1205
1206/************************************************************************/
1209bool option_font_set(struct option *poption, const char *font)
1210{
1213 fc_assert_ret_val(NULL != font, FALSE);
1214
1215 if (poption->font_vtable->set(poption, font)) {
1217 return TRUE;
1218 }
1219 return FALSE;
1220}
1221
1222/************************************************************************/
1232
1233/************************************************************************/
1243
1244/************************************************************************/
1249{
1252
1253 if (poption->color_vtable->set(poption, color)) {
1255 return TRUE;
1256 }
1257 return FALSE;
1258}
1259
1260/************************************************************************/
1264{
1267 video_mode_construct(-1, -1));
1268
1269 return poption->video_mode_vtable->get(poption);
1270}
1271
1272/************************************************************************/
1276{
1279 video_mode_construct(-1, -1));
1280
1281 return poption->video_mode_vtable->def(poption);
1282}
1283
1284/************************************************************************/
1289{
1292
1293 if (poption->video_mode_vtable->set(poption, mode)) {
1295 return TRUE;
1296 }
1297 return FALSE;
1298}
1299
1300
1301/****************************************************************************
1302 Client option set.
1303****************************************************************************/
1304static struct option *client_optset_option_by_number(int id);
1305static struct option *client_optset_option_first(void);
1306static int client_optset_category_number(void);
1307static const char *client_optset_category_name(int category);
1308
1311 .option_first = client_optset_option_first,
1312 .category_number = client_optset_category_number,
1313 .category_name = client_optset_category_name
1314};
1316
1318 const char *support; /* Untranslated long support name, used
1319 * for saving. */
1320 const char *pretty; /* Translated, used to display to the
1321 * users. */
1322};
1323
1324/****************************************************************************
1325 Virtuals tables for the client options.
1326****************************************************************************/
1327static int client_option_number(const struct option *poption);
1328static const char *client_option_name(const struct option *poption);
1329static const char *client_option_description(const struct option *poption);
1330static const char *client_option_help_text(const struct option *poption);
1331static int client_option_category(const struct option *poption);
1332static bool client_option_is_changeable(const struct option *poption);
1333static struct option *client_option_next(const struct option *poption);
1334
1335static const struct option_common_vtable client_option_common_vtable = {
1336 .number = client_option_number,
1337 .name = client_option_name,
1338 .description = client_option_description,
1339 .help_text = client_option_help_text,
1340 .category = client_option_category,
1341 .is_changeable = client_option_is_changeable,
1342 .next = client_option_next
1343};
1344
1345static bool client_option_bool_get(const struct option *poption);
1346static bool client_option_bool_def(const struct option *poption);
1347static bool client_option_bool_set(struct option *poption, bool val);
1348
1349static const struct option_bool_vtable client_option_bool_vtable = {
1353};
1354
1355static int client_option_int_get(const struct option *poption);
1356static int client_option_int_def(const struct option *poption);
1357static int client_option_int_min(const struct option *poption);
1358static int client_option_int_max(const struct option *poption);
1359static bool client_option_int_set(struct option *poption, int val);
1360
1361static const struct option_int_vtable client_option_int_vtable = {
1362 .get = client_option_int_get,
1363 .def = client_option_int_def,
1364 .minimum = client_option_int_min,
1365 .maximum = client_option_int_max,
1367};
1368
1369static const char *client_option_str_get(const struct option *poption);
1370static const char *client_option_str_def(const struct option *poption);
1371static const struct strvec *
1373static bool client_option_str_set(struct option *poption, const char *str);
1374
1375static const struct option_str_vtable client_option_str_vtable = {
1376 .get = client_option_str_get,
1377 .def = client_option_str_def,
1378 .values = client_option_str_values,
1380};
1381
1382static int client_option_enum_get(const struct option *poption);
1383static int client_option_enum_def(const struct option *poption);
1384static const struct strvec *
1386static bool client_option_enum_set(struct option *poption, int val);
1387
1388static const struct option_enum_vtable client_option_enum_vtable = {
1393 .cmp = fc_strcasecmp
1394};
1395
1396#if 0 /* There's no bitwise options currently */
1397static unsigned client_option_bitwise_get(const struct option *poption);
1398static unsigned client_option_bitwise_def(const struct option *poption);
1399static const struct strvec *
1401static bool client_option_bitwise_set(struct option *poption, unsigned val);
1402
1403static const struct option_bitwise_vtable client_option_bitwise_vtable = {
1408};
1409#endif /* 0 */
1410
1411static const char *client_option_font_get(const struct option *poption);
1412static const char *client_option_font_def(const struct option *poption);
1413static const char *client_option_font_target(const struct option *poption);
1414static bool client_option_font_set(struct option *poption, const char *font);
1415
1416static const struct option_font_vtable client_option_font_vtable = {
1419 .target = client_option_font_target,
1421};
1422
1425static bool client_option_color_set(struct option *poption,
1426 struct ft_color color);
1427
1428static const struct option_color_vtable client_option_color_vtable = {
1432};
1433
1434static struct video_mode
1436static struct video_mode
1438static bool client_option_video_mode_set(struct option *poption,
1439 struct video_mode mode);
1440
1441static const struct option_video_mode_vtable client_option_video_mode_vtable = {
1445};
1446
1457
1458/****************************************************************************
1459 Derived class client option, inherinting of base class option.
1460****************************************************************************/
1462 struct option base_option; /* Base structure, must be the first! */
1463
1464 const char *name; /* Short name - used as an identifier */
1465 const char *description; /* One-line description */
1466 const char *help_text; /* Paragraph-length help text */
1468 enum gui_type specific; /* GUI_STUB for common options. */
1469
1470 union {
1471 /* OT_BOOLEAN type option. */
1472 struct {
1473 bool *const pvalue;
1474 const bool def;
1475 } boolean;
1476 /* OT_INTEGER type option. */
1477 struct {
1478 int *const pvalue;
1479 const int def, min, max;
1480 } integer;
1481 /* OT_STRING type option. */
1482 struct {
1483 char *const pvalue;
1484 const size_t size;
1485 const char *const def;
1486 /*
1487 * A function to return a string vector of possible string values,
1488 * or NULL for none.
1489 */
1490 const struct strvec *(*const val_accessor) (const struct option *);
1491 } string;
1492 /* OT_ENUM type option. */
1493 struct {
1494 int *const pvalue;
1495 const int def;
1496 struct strvec *support_names, *pretty_names; /* untranslated */
1497 const struct copt_val_name * (*const name_accessor) (int value);
1498 } enumerator;
1499 /* OT_BITWISE type option. */
1500 struct {
1501 unsigned *const pvalue;
1502 const unsigned def;
1503 struct strvec *support_names, *pretty_names; /* untranslated */
1504 const struct copt_val_name * (*const name_accessor) (int value);
1505 } bitwise;
1506 /* OT_FONT type option. */
1507 struct {
1508 char *const pvalue;
1509 const size_t size;
1510 const char *const def;
1511 const char *const target;
1512 } font;
1513 /* OT_COLOR type option. */
1514 struct {
1515 struct ft_color *const pvalue;
1516 const struct ft_color def;
1518 /* OT_VIDEO_MODE type option. */
1519 struct {
1520 struct video_mode *const pvalue;
1521 const struct video_mode def;
1523 };
1524};
1525
1526#define CLIENT_OPTION(poption) ((struct client_option *) (poption))
1527
1528/*
1529 * Generate a client option of type OT_BOOLEAN.
1530 *
1531 * oname: The option data. Note it is used as name to be loaded or saved.
1532 * So, you shouldn't change the name of this variable in any case.
1533 * odesc: A short description of the client option. Should be used with the
1534 * N_() macro.
1535 * ohelp: The help text for the client option. Should be used with the N_()
1536 * macro.
1537 * ocat: The client_option_class of this client option.
1538 * ospec: A gui_type enumerator which determine for what particular client
1539 * gui this option is for. Sets to GUI_STUB for common options.
1540 * odef: The default value of this client option (FALSE or TRUE).
1541 * ocb: A callback function of type void (*)(struct option *) called when
1542 * the option changed.
1543 */
1544#define GEN_BOOL_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb) \
1545{ \
1546 .base_option = OPTION_BOOL_INIT(&client_optset_static, \
1547 client_option_common_vtable, \
1548 client_option_bool_vtable, ocb), \
1549 .name = #oname, \
1550 .description = odesc, \
1551 .help_text = ohelp, \
1552 .category = ocat, \
1553 .specific = ospec, \
1554 INIT_BRACE_BEGIN \
1555 .boolean = { \
1556 .pvalue = &gui_options.oname, \
1557 .def = odef, \
1558 } \
1559 INIT_BRACE_END \
1560}
1561
1562/*
1563 * Generate a client option of type OT_INTEGER.
1564 *
1565 * oname: The option data. Note it is used as name to be loaded or saved.
1566 * So, you shouldn't change the name of this variable in any case.
1567 * odesc: A short description of the client option. Should be used with the
1568 * N_() macro.
1569 * ohelp: The help text for the client option. Should be used with the N_()
1570 * macro.
1571 * ocat: The client_option_class of this client option.
1572 * ospec: A gui_type enumerator which determine for what particular client
1573 * gui this option is for. Sets to GUI_STUB for common options.
1574 * odef: The default value of this client option.
1575 * omin: The minimal value of this client option.
1576 * omax: The maximal value of this client option.
1577 * ocb: A callback function of type void (*)(struct option *) called when
1578 * the option changed.
1579 */
1580#define GEN_INT_OPTION(oname, odesc, ohelp, ocat, ospec, odef, omin, omax, ocb) \
1581{ \
1582 .base_option = OPTION_INT_INIT(&client_optset_static, \
1583 client_option_common_vtable, \
1584 client_option_int_vtable, ocb), \
1585 .name = #oname, \
1586 .description = odesc, \
1587 .help_text = ohelp, \
1588 .category = ocat, \
1589 .specific = ospec, \
1590 INIT_BRACE_BEGIN \
1591 .integer = { \
1592 .pvalue = &gui_options.oname, \
1593 .def = odef, \
1594 .min = omin, \
1595 .max = omax \
1596 } \
1597 INIT_BRACE_END \
1598}
1599
1600/*
1601 * Generate a client option of type OT_STRING.
1602 *
1603 * oname: The option data. Note it is used as name to be loaded or saved.
1604 * So, you shouldn't change the name of this variable in any case.
1605 * Be sure to pass the array variable and not a pointer to it because
1606 * the size is calculated with sizeof().
1607 * odesc: A short description of the client option. Should be used with the
1608 * N_() macro.
1609 * ohelp: The help text for the client option. Should be used with the N_()
1610 * macro.
1611 * ocat: The client_option_class of this client option.
1612 * ospec: A gui_type enumerator which determines for what particular client
1613 * gui this option is for. Set to GUI_STUB for common options.
1614 * odef: The default string for this client option.
1615 * ocb: A callback function of type void (*)(struct option *) called when
1616 * the option changed.
1617 */
1618#define GEN_STR_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb, cbd) \
1619{ \
1620 .base_option = OPTION_STR_INIT(&client_optset_static, \
1621 client_option_common_vtable, \
1622 client_option_str_vtable, ocb, cbd), \
1623 .name = #oname, \
1624 .description = odesc, \
1625 .help_text = ohelp, \
1626 .category = ocat, \
1627 .specific = ospec, \
1628 INIT_BRACE_BEGIN \
1629 .string = { \
1630 .pvalue = gui_options.oname, \
1631 .size = sizeof(gui_options.oname), \
1632 .def = odef, \
1633 .val_accessor = NULL \
1634 } \
1635 INIT_BRACE_END \
1636}
1637
1638/*
1639 * Generate a client option of type OT_STRING with a string accessor
1640 * function.
1641 *
1642 * oname: The option data. Note it is used as name to be loaded or saved.
1643 * So, you shouldn't change the name of this variable in any case.
1644 * Be sure to pass the array variable and not a pointer to it because
1645 * the size is calculated with sizeof().
1646 * odesc: A short description of the client option. Should be used with the
1647 * N_() macro.
1648 * ohelp: The help text for the client option. Should be used with the N_()
1649 * macro.
1650 * ocat: The client_option_class of this client option.
1651 * ospec: A gui_type enumerator which determine for what particular client
1652 * gui this option is for. Sets to GUI_STUB for common options.
1653 * odef: The default string for this client option.
1654 * oacc: The string accessor where to find the allowed values of type
1655 * 'const struct strvec * (*) (void)'.
1656 * ocb: A callback function of type void (*)(struct option *) called when
1657 * the option changed.
1658 */
1659#define GEN_STR_LIST_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb, cbd) \
1660{ \
1661 .base_option = OPTION_STR_INIT(&client_optset_static, \
1662 client_option_common_vtable, \
1663 client_option_str_vtable, ocb, cbd), \
1664 .name = #oname, \
1665 .description = odesc, \
1666 .help_text = ohelp, \
1667 .category = ocat, \
1668 .specific = ospec, \
1669 INIT_BRACE_BEGIN \
1670 .string = { \
1671 .pvalue = gui_options.oname, \
1672 .size = sizeof(gui_options.oname), \
1673 .def = odef, \
1674 .val_accessor = oacc \
1675 } \
1676 INIT_BRACE_END \
1677}
1678
1679/*
1680 * Generate a client option of type OT_ENUM.
1681 *
1682 * oname: The option data. Note it is used as name to be loaded or saved.
1683 * So, you shouldn't change the name of this variable in any case.
1684 * odesc: A short description of the client option. Should be used with the
1685 * N_() macro.
1686 * ohelp: The help text for the client option. Should be used with the N_()
1687 * macro.
1688 * ocat: The client_option_class of this client option.
1689 * ospec: A gui_type enumerator which determine for what particular client
1690 * gui this option is for. Sets to GUI_STUB for common options.
1691 * odef: The default value for this client option.
1692 * oacc: The name accessor of type 'const struct copt_val_name * (*) (int)'.
1693 * ocb: A callback function of type void (*) (struct option *) called when
1694 * the option changed.
1695 */
1696#define GEN_ENUM_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb) \
1697{ \
1698 .base_option = OPTION_ENUM_INIT(&client_optset_static, \
1699 client_option_common_vtable, \
1700 client_option_enum_vtable, ocb), \
1701 .name = #oname, \
1702 .description = odesc, \
1703 .help_text = ohelp, \
1704 .category = ocat, \
1705 .specific = ospec, \
1706 INIT_BRACE_BEGIN \
1707 .enumerator = { \
1708 .pvalue = (int *) &gui_options.oname, \
1709 .def = odef, \
1710 .support_names = NULL, /* Set in options_init(). */ \
1711 .pretty_names = NULL, \
1712 .name_accessor = oacc \
1713 } \
1714 INIT_BRACE_END \
1715}
1716
1717/*
1718 * Generate a client option of type OT_BITWISE.
1719 *
1720 * oname: The option data. Note it is used as name to be loaded or saved.
1721 * So, you shouldn't change the name of this variable in any case.
1722 * odesc: A short description of the client option. Should be used with the
1723 * N_() macro.
1724 * ohelp: The help text for the client option. Should be used with the N_()
1725 * macro.
1726 * ocat: The client_option_class of this client option.
1727 * ospec: A gui_type enumerator which determine for what particular client
1728 * gui this option is for. Sets to GUI_STUB for common options.
1729 * odef: The default value for this client option.
1730 * oacc: The name accessor of type 'const struct copt_val_name * (*) (int)'.
1731 * ocb: A callback function of type void (*) (struct option *) called when
1732 * the option changed.
1733 */
1734#define GEN_BITWISE_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, \
1735 ocb) \
1736{ \
1737 .base_option = OPTION_BITWISE_INIT(&client_optset_static, \
1738 client_option_common_vtable, \
1739 client_option_bitwise_vtable, ocb), \
1740 .name = #oname, \
1741 .description = odesc, \
1742 .help_text = ohelp, \
1743 .category = ocat, \
1744 .specific = ospec, \
1745 INIT_BRACE_BEGIN \
1746 .bitwise = { \
1747 .pvalue = &gui_options.oname, \
1748 .def = odef, \
1749 .support_names = NULL, /* Set in options_init(). */ \
1750 .pretty_names = NULL, \
1751 .name_accessor = oacc \
1752 } \
1753 INIT_BRACE_END \
1754}
1755
1756/*
1757 * Generate a client option of type OT_FONT.
1758 *
1759 * oname: The option data. Note it is used as name to be loaded or saved.
1760 * So, you shouldn't change the name of this variable in any case.
1761 * Be sure to pass the array variable and not a pointer to it because
1762 * the size is calculated with sizeof().
1763 * otgt: The target widget style.
1764 * odesc: A short description of the client option. Should be used with the
1765 * N_() macro.
1766 * ohelp: The help text for the client option. Should be used with the N_()
1767 * macro.
1768 * ocat: The client_option_class of this client option.
1769 * ospec: A gui_type enumerator which determine for what particular client
1770 * gui this option is for. Sets to GUI_STUB for common options.
1771 * odef: The default string for this client option.
1772 * ocb: A callback function of type void (*)(struct option *) called when
1773 * the option changed.
1774 */
1775#define GEN_FONT_OPTION(oname, otgt, odesc, ohelp, ocat, ospec, odef, ocb) \
1776{ \
1777 .base_option = OPTION_FONT_INIT(&client_optset_static, \
1778 client_option_common_vtable, \
1779 client_option_font_vtable, ocb), \
1780 .name = #oname, \
1781 .description = odesc, \
1782 .help_text = ohelp, \
1783 .category = ocat, \
1784 .specific = ospec, \
1785 INIT_BRACE_BEGIN \
1786 .font = { \
1787 .pvalue = gui_options.oname, \
1788 .size = sizeof(gui_options.oname), \
1789 .def = odef, \
1790 .target = otgt, \
1791 } \
1792 INIT_BRACE_END \
1793}
1794
1795/*
1796 * Generate a client option of type OT_COLOR.
1797 *
1798 * oname: The option data. Note it is used as name to be loaded or saved.
1799 * So, you shouldn't change the name of this variable in any case.
1800 * odesc: A short description of the client option. Should be used with the
1801 * N_() macro.
1802 * ohelp: The help text for the client option. Should be used with the N_()
1803 * macro.
1804 * ocat: The client_option_class of this client option.
1805 * ospec: A gui_type enumerator which determine for what particular client
1806 * gui this option is for. Sets to GUI_STUB for common options.
1807 * odef_fg, odef_bg: The default values for this client option.
1808 * ocb: A callback function of type void (*)(struct option *) called when
1809 * the option changed.
1810 */
1811#define GEN_COLOR_OPTION(oname, odesc, ohelp, ocat, ospec, odef_fg, \
1812 odef_bg, ocb) \
1813{ \
1814 .base_option = OPTION_COLOR_INIT(&client_optset_static, \
1815 client_option_common_vtable, \
1816 client_option_color_vtable, ocb), \
1817 .name = #oname, \
1818 .description = odesc, \
1819 .help_text = ohelp, \
1820 .category = ocat, \
1821 .specific = ospec, \
1822 INIT_BRACE_BEGIN \
1823 .color = { \
1824 .pvalue = &gui_options.oname, \
1825 .def = FT_COLOR(odef_fg, odef_bg) \
1826 } \
1827 INIT_BRACE_END \
1828}
1829
1830/*
1831 * Generate a client option of type OT_VIDEO_MODE.
1832 *
1833 * oname: The option data. Note it is used as name to be loaded or saved.
1834 * So, you shouldn't change the name of this variable in any case.
1835 * odesc: A short description of the client option. Should be used with the
1836 * N_() macro.
1837 * ohelp: The help text for the client option. Should be used with the N_()
1838 * macro.
1839 * ocat: The client_option_class of this client option.
1840 * ospec: A gui_type enumerator which determine for what particular client
1841 * gui this option is for. Sets to GUI_STUB for common options.
1842 * odef_width, odef_height: The default values for this client option.
1843 * ocb: A callback function of type void (*)(struct option *) called when
1844 * the option changed.
1845 */
1846#define GEN_VIDEO_OPTION(oname, odesc, ohelp, ocat, ospec, odef_width, \
1847 odef_height, ocb) \
1848{ \
1849 .base_option = OPTION_VIDEO_MODE_INIT(&client_optset_static, \
1850 client_option_common_vtable, \
1851 client_option_video_mode_vtable, \
1852 ocb), \
1853 .name = #oname, \
1854 .description = odesc, \
1855 .help_text = ohelp, \
1856 .category = ocat, \
1857 .specific = ospec, \
1858 INIT_BRACE_BEGIN \
1859 .video_mode = { \
1860 .pvalue = &gui_options.oname, \
1861 .def = VIDEO_MODE(odef_width, odef_height) \
1862 } \
1863 INIT_BRACE_END \
1864}
1865
1866/****************************************************************************
1867 Enumerator name accessors.
1868****************************************************************************/
1869
1870/************************************************************************/
1873static const struct copt_val_name
1875{
1876 /* Order must match enum GUI_GTK_MSGCHAT_* */
1877 static const struct copt_val_name names[] = {
1878 /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */
1879 { "SPLIT", N_("Split") },
1880 /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */
1881 { "SEPARATE", N_("Separate") },
1882 /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */
1883 { "MERGED", N_("Merged") }
1884 };
1885
1886 return (0 <= value && value < ARRAY_SIZE(names)
1887 ? names + value : NULL);
1888}
1889
1890/************************************************************************/
1893static const struct copt_val_name
1895{
1896 /* Order must match enum GUI_POPUP_TECH_HELP_* */
1897 static const struct copt_val_name names[] = {
1898 /* TRANS: enum value for 'gui_popup_tech_help' */
1899 { "ENABLED", N_("Enabled") },
1900 /* TRANS: enum value for 'gui_popup_tech_help' */
1901 { "DISABLED", N_("Disabled") },
1902 /* TRANS: enum value for 'gui_popup_tech_help' */
1903 { "RULESET", N_("Ruleset") }
1904 };
1905
1906 return (0 <= value && value < ARRAY_SIZE(names)
1907 ? names + value : NULL);
1908}
1909
1910/* Some changed callbacks. */
1911static void reqtree_show_icons_callback(struct option *poption);
1912static void view_option_changed_callback(struct option *poption);
1913static void manual_turn_done_callback(struct option *poption);
1914static void voteinfo_bar_callback(struct option *poption);
1915static void font_changed_callback(struct option *poption);
1916static void mapimg_changed_callback(struct option *poption);
1917static void game_music_enable_callback(struct option *poption);
1918static void menu_music_enable_callback(struct option *poption);
1919static void sound_volume_callback(struct option *poption);
1920
1922 GEN_STR_OPTION(default_user_name,
1923 N_("Login name"),
1924 N_("This is the default login username that will be used "
1925 "in the connection dialogs or with the -a command-line "
1926 "parameter."),
1928 GEN_BOOL_OPTION(use_prev_server, N_("Default to previously used server"),
1929 N_("Automatically update \"Server\" and \"Server port\" "
1930 "options to match your latest connection, so by "
1931 "default you connect to the same server you used "
1932 "on the previous run. You should enable "
1933 "saving options on exit too, so that the automatic "
1934 "updates to the options get saved too."),
1936 GEN_STR_OPTION(default_server_host,
1937 N_("Server"),
1938 N_("This is the default server hostname that will be used "
1939 "in the connection dialogs or with the -a command-line "
1940 "parameter."),
1941 COC_NETWORK, GUI_STUB, "localhost", NULL, 0),
1942 GEN_INT_OPTION(default_server_port,
1943 N_("Server port"),
1944 N_("This is the default server port that will be used "
1945 "in the connection dialogs or with the -a command-line "
1946 "parameter."),
1948 GEN_STR_OPTION(default_metaserver,
1949 N_("Metaserver"),
1950 N_("The metaserver is a host that the client contacts to "
1951 "find out about games on the internet. Don't change "
1952 "this from its default value unless you know what "
1953 "you're doing."),
1955 GEN_BOOL_OPTION(heartbeat_enabled,
1956 N_("Send heartbeat messages to the server"),
1957 N_("Periodically send an empty heartbeat message to the "
1958 "server to probe whether the connection is still up. "
1959 "This can help to make it obvious when the server has "
1960 "cut the connection due to a connectivity outage, if "
1961 "the client would otherwise sit idle for a long period."),
1963 GEN_STR_OPTION(followtag_override,
1964 N_("Followtag override"),
1965 /* TRANS: Leave 'builtin' untranslated */
1966 N_("Followtag determines which kind of new freeciv versions' "
1967 "availability gets checked from the metaserver. Special "
1968 "value 'builtin' means that value builtin to the client "
1969 "gets used."),
1971 GEN_BOOL_OPTION(send_desired_settings,
1972 N_("Send desired settings to the server"),
1973 N_("In single-player mode client usually sends user's "
1974 "desired server settings to the server it has "
1975 "launched internally. By disabling this option one "
1976 "can prevent such override of server settings from "
1977 "other sources, such as settings balanced for a "
1978 "custom ruleset."),
1980 GEN_STR_LIST_OPTION(default_sound_set_name,
1981 N_("Soundset"),
1982 N_("This is the soundset that will be used. Changing "
1983 "this is the same as using the -S command-line "
1984 "parameter. Use modpack installer utility to install "
1985 "additional soundsets."),
1986 COC_SOUND, GUI_STUB, "stdsounds", get_soundset_list, NULL, 0),
1987 GEN_STR_LIST_OPTION(default_music_set_name,
1988 N_("Musicset"),
1989 N_("This is the musicset that will be used. Changing "
1990 "this is the same as using the -m command-line "
1991 "parameter. Use modpack installer utility to install "
1992 "additional musicsets."),
1993 COC_SOUND, GUI_STUB, "stdmusic", get_musicset_list,
1995 GEN_STR_LIST_OPTION(default_sound_plugin_name,
1996 N_("Sound plugin"),
1997 N_("If you have a problem with sound, try changing "
1998 "the sound plugin. The new plugin won't take "
1999 "effect until you restart Freeciv. Changing this "
2000 "is the same as using the -P command-line option."),
2002 GEN_STR_OPTION(default_chat_logfile,
2003 N_("The chat log file"),
2004 N_("The name of the chat log file."),
2006 /* gui_gtk3_22/4/5_default_theme_name and gui_sdl2/3_default_theme_name are
2007 * different settings to avoid client crash after loading the
2008 * style for the other gui. Keeps 6 different options! */
2009 GEN_STR_LIST_OPTION(gui_gtk3_22_default_theme_name, N_("Theme"),
2010 N_("By changing this option you change the "
2011 "active theme."),
2014 GEN_STR_LIST_OPTION(gui_gtk4_default_theme_name, N_("Theme"),
2015 N_("By changing this option you change the "
2016 "active theme."),
2019 GEN_STR_LIST_OPTION(gui_gtk5_default_theme_name, N_("Theme"),
2020 N_("By changing this option you change the "
2021 "active theme."),
2024 GEN_STR_LIST_OPTION(gui_sdl2_default_theme_name, N_("Theme"),
2025 N_("By changing this option you change the "
2026 "active theme."),
2029 GEN_STR_LIST_OPTION(gui_sdl3_default_theme_name, N_("Theme"),
2030 N_("By changing this option you change the "
2031 "active theme."),
2034 GEN_STR_LIST_OPTION(gui_qt_default_theme_name, N_("Theme"),
2035 N_("By changing this option you change the "
2036 "active theme."),
2039
2040 /* It's important to give empty string instead of NULL as as default
2041 * value. For NULL value it would default to assigning first value
2042 * from the tileset list returned by get_tileset_list() as default
2043 * tileset. We don't want default tileset assigned at all here, but
2044 * leave it to tilespec code that can handle tileset priority. */
2045 GEN_STR_LIST_OPTION(default_tileset_square_name, N_("Tileset (Square)"),
2046 N_("Select the tileset used with Square based maps. "
2047 "This may change the currently active tileset, if "
2048 "you are playing on such a map, in which "
2049 "case this is the same as using the -t "
2050 "command-line parameter. "
2051 "Use modpack installer utility to install "
2052 "additional tilesets."),
2055 GEN_STR_LIST_OPTION(default_tileset_hex_name, N_("Tileset (Hex)"),
2056 N_("Select the tileset used with Hex maps. "
2057 "This may change the currently active tileset, if "
2058 "you are playing on such a map, in which "
2059 "case this is the same as using the -t "
2060 "command-line parameter. "
2061 "Use modpack installer utility to install "
2062 "additional tilesets."),
2065 GEN_STR_LIST_OPTION(default_tileset_isohex_name, N_("Tileset (Iso-Hex)"),
2066 N_("Select the tileset used with Iso-Hex maps. "
2067 "This may change the currently active tileset, if "
2068 "you are playing on such a map, in which "
2069 "case this is the same as using the -t "
2070 "command-line parameter."
2071 "Use modpack installer utility to install "
2072 "additional tilesets."),
2075
2076 GEN_BOOL_OPTION(draw_city_outlines, N_("Draw city outlines"),
2077 N_("Setting this option will draw a line at the city "
2078 "workable limit."),
2081 GEN_BOOL_OPTION(draw_city_output, N_("Draw city output"),
2082 N_("Setting this option will draw city output for every "
2083 "citizen."),
2086 GEN_BOOL_OPTION(draw_map_grid, N_("Draw the map grid"),
2087 N_("Setting this option will draw a grid over the map."),
2090 GEN_BOOL_OPTION(draw_full_citybar, N_("Draw the city bar"),
2091 N_("Setting this option will display a 'city bar' "
2092 "containing useful information beneath each city. "
2093 "Disabling this option will display only the city's "
2094 "name and, optionally, production."),
2097 GEN_BOOL_OPTION(draw_city_names, N_("Draw the city names"),
2098 N_("Setting this option will draw the names of the cities "
2099 "on the map."),
2102 GEN_BOOL_OPTION(draw_city_growth, N_("Draw the city growth"),
2103 N_("Setting this option will draw in how many turns the "
2104 "cities will grow or shrink."),
2107 GEN_BOOL_OPTION(draw_city_productions, N_("Draw the city productions"),
2108 N_("Setting this option will draw what the cities are "
2109 "currently building on the map."),
2112 GEN_BOOL_OPTION(draw_city_buycost, N_("Draw the city buy costs"),
2113 N_("Setting this option will draw how much gold is "
2114 "needed to buy the production of the cities."),
2117 GEN_BOOL_OPTION(draw_city_trade_routes, N_("Draw the city trade routes"),
2118 N_("Setting this option will draw trade route lines "
2119 "between cities which have trade routes."),
2122 GEN_BOOL_OPTION(draw_terrain, N_("Draw the terrain"),
2123 N_("Setting this option will draw the terrain."),
2126 GEN_BOOL_OPTION(draw_coastline, N_("Draw the coast line"),
2127 N_("Setting this option will draw a line to separate the "
2128 "land from the ocean."),
2131 GEN_BOOL_OPTION(draw_paths, N_("Draw the paths"),
2132 N_("Setting this option will draw all kind of paths "
2133 "on the map."),
2136 GEN_BOOL_OPTION(draw_irrigation, N_("Draw the irrigation"),
2137 N_("Setting this option will draw the irrigation systems "
2138 "on the map."),
2141 GEN_BOOL_OPTION(draw_mines, N_("Draw the mines"),
2142 N_("Setting this option will draw the mines on the map."),
2145 GEN_BOOL_OPTION(draw_fortress_airbase, N_("Draw the bases"),
2146 N_("Setting this option will draw the bases on the map."),
2149 GEN_BOOL_OPTION(draw_specials, N_("Draw the resources"),
2150 N_("Setting this option will draw the resources on the "
2151 "map."),
2154 GEN_BOOL_OPTION(draw_huts, N_("Draw the huts"),
2155 N_("Setting this option will draw the huts on the "
2156 "map."),
2159 GEN_BOOL_OPTION(draw_pollution, N_("Draw the pollution/nuclear fallout"),
2160 N_("Setting this option will draw pollution and "
2161 "nuclear fallout on the map."),
2164 GEN_BOOL_OPTION(draw_cities, N_("Draw the cities"),
2165 N_("Setting this option will draw the cities on the map."),
2168 GEN_BOOL_OPTION(draw_units, N_("Draw the units"),
2169 N_("Setting this option will draw the units on the map."),
2172 GEN_BOOL_OPTION(solid_color_behind_units,
2173 N_("Solid unit background color"),
2174 N_("Setting this option will cause units on the map "
2175 "view to be drawn with a solid background color "
2176 "instead of the flag backdrop."),
2179 GEN_BOOL_OPTION(draw_unit_shields, N_("Draw shield graphics for units"),
2180 N_("Setting this option will draw a shield icon "
2181 "as the flags on units. If unset, the full flag will "
2182 "be drawn."),
2184 GEN_BOOL_OPTION(draw_unit_stack_size, N_("Draw size of the unit stacks"),
2185 N_("Setting this option will draw a numbers indicating "
2186 "size of the unit stacks. Not all clients support "
2187 "this."),
2189 GEN_BOOL_OPTION(draw_focus_unit, N_("Draw the units in focus"),
2190 N_("Setting this option will cause the currently focused "
2191 "unit(s) to always be drawn, even if units are not "
2192 "otherwise being drawn (for instance if 'Draw the units' "
2193 "is unset)."),
2196 GEN_BOOL_OPTION(draw_fog_of_war, N_("Draw the fog of war"),
2197 N_("Setting this option will draw the fog of war."),
2200 GEN_BOOL_OPTION(draw_borders, N_("Draw the borders"),
2201 N_("Setting this option will draw the national borders."),
2204 GEN_BOOL_OPTION(draw_native, N_("Draw whether tiles are native to "
2205 "selected unit"),
2206 N_("Setting this option will highlight tiles that the "
2207 "currently selected unit cannot enter unaided due to "
2208 "non-native terrain. (If multiple units are selected, "
2209 "only tiles that all of them can enter are indicated.)"),
2212 GEN_BOOL_OPTION(player_dlg_show_dead_players,
2213 N_("Show dead players in Nations report"),
2214 N_("This option controls whether defeated nations are "
2215 "shown on the Nations report page."),
2218 GEN_BOOL_OPTION(sound_bell_at_new_turn, N_("Sound bell at new turn"),
2219 N_("Set this option to have a \"bell\" event be generated "
2220 "at the start of a new turn. You can control the "
2221 "behavior of the \"bell\" event by editing the message "
2222 "options."),
2224 GEN_INT_OPTION(smooth_move_unit_msec,
2225 N_("Unit movement animation time (milliseconds)"),
2226 N_("This option controls how long unit \"animation\" takes "
2227 "when a unit moves on the map view. Set it to 0 to "
2228 "disable animation entirely."),
2229 COC_GRAPHICS, GUI_STUB, 30, 0, 2000, NULL),
2230 GEN_INT_OPTION(smooth_center_slide_msec,
2231 N_("Mapview recentering time (milliseconds)"),
2232 N_("When the map view is recentered, it will slide "
2233 "smoothly over the map to its new position. This "
2234 "option controls how long this slide lasts. Set it to "
2235 "0 to disable mapview sliding entirely."),
2236 COC_GRAPHICS, GUI_STUB, 200, 0, 5000, NULL),
2237 GEN_INT_OPTION(smooth_combat_step_msec,
2238 N_("Combat animation step time (milliseconds)"),
2239 N_("This option controls the speed of combat animation "
2240 "between units on the mapview. Set it to 0 to disable "
2241 "animation entirely."),
2242 COC_GRAPHICS, GUI_STUB, 10, 0, 100, NULL),
2243 GEN_BOOL_OPTION(reqtree_show_icons,
2244 N_("Show icons in the technology tree"),
2245 N_("Setting this option will display icons "
2246 "on the technology tree diagram. Turning "
2247 "this option off makes the technology tree "
2248 "more compact."),
2250 GEN_BOOL_OPTION(reqtree_curved_lines,
2251 N_("Use curved lines in the technology tree"),
2252 N_("Setting this option make the technology tree "
2253 "diagram use curved lines to show technology "
2254 "relations. Turning this option off causes "
2255 "the lines to be drawn straight."),
2258 GEN_COLOR_OPTION(highlight_our_names,
2259 N_("Color to highlight your player/user name"),
2260 N_("If set, your player and user name in the new chat "
2261 "messages will be highlighted using this color as "
2262 "background. If not set, it will just not highlight "
2263 "anything."),
2264 COC_GRAPHICS, GUI_STUB, "#000000", "#FFFF00", NULL),
2265 GEN_BOOL_OPTION(ai_manual_turn_done, N_("Manual Turn Done in AI mode"),
2266 N_("Disable this option if you do not want to "
2267 "press the Turn Done button manually when watching "
2268 "an AI player."),
2270 GEN_BOOL_OPTION(auto_center_on_unit, N_("Auto center on units"),
2271 N_("Set this option to have the active unit centered "
2272 "automatically when the unit focus changes."),
2274 GEN_BOOL_OPTION(auto_center_on_automated, N_("Show automated units"),
2275 N_("Disable this option if you do not want to see "
2276 "automated units autocentered and animated."),
2278 GEN_BOOL_OPTION(auto_center_on_combat, N_("Auto center on combat"),
2279 N_("Set this option to have any combat be centered "
2280 "automatically. Disabling this will speed up the time "
2281 "between turns but may cause you to miss combat "
2282 "entirely."),
2284 GEN_BOOL_OPTION(auto_center_each_turn, N_("Auto center on new turn"),
2285 N_("Set this option to have the client automatically "
2286 "recenter the map on a suitable location at the "
2287 "start of each turn."),
2289 GEN_BOOL_OPTION(wakeup_focus, N_("Focus on awakened units"),
2290 N_("Set this option to have newly awoken units be "
2291 "focused automatically."),
2293 GEN_BOOL_OPTION(keyboardless_goto, N_("Keyboardless goto"),
2294 N_("If this option is set then a goto may be initiated "
2295 "by left-clicking and then holding down the mouse "
2296 "button while dragging the mouse onto a different "
2297 "tile."),
2299 GEN_BOOL_OPTION(goto_into_unknown, N_("Allow goto into the unknown"),
2300 N_("Setting this option will make the game consider "
2301 "moving into unknown tiles. If not, then goto routes "
2302 "will detour around or be blocked by unknown tiles."),
2304 GEN_BOOL_OPTION(center_when_popup_city, N_("Center map when popup city"),
2305 N_("Setting this option makes the mapview center on a "
2306 "city when its city dialog is popped up."),
2308 GEN_BOOL_OPTION(show_previous_turn_messages, N_("Show messages from previous turn"),
2309 N_("Message Window shows messages also from previous turn. "
2310 "This makes sure you don't miss messages received in the end of "
2311 "the turn, just before the window gets cleared."),
2313 GEN_BOOL_OPTION(concise_city_production, N_("Concise city production"),
2314 N_("Set this option to make the city production (as shown "
2315 "in the city dialog) to be more compact."),
2317 GEN_BOOL_OPTION(auto_turn_done, N_("End turn when done moving"),
2318 N_("Setting this option makes your turn end automatically "
2319 "when all your units are done moving."),
2321 GEN_BOOL_OPTION(ask_city_name, N_("Prompt for city names"),
2322 N_("Disabling this option will make the names of newly "
2323 "founded cities be chosen automatically by the server."),
2325 GEN_BOOL_OPTION(popup_new_cities, N_("Pop up city dialog for new cities"),
2326 N_("Setting this option will pop up a newly-founded "
2327 "city's city dialog automatically."),
2329 GEN_BOOL_OPTION(popup_actor_arrival, N_("Pop up caravan and spy actions"),
2330 N_("If this option is enabled, when a unit arrives at "
2331 "a city where it can perform an action like "
2332 "establishing a trade route, helping build a wonder, or "
2333 "establishing an embassy, a window will pop up asking "
2334 "which action should be performed. "
2335 "Disabling this option means you will have to do the "
2336 "action manually by pressing either 'r' (for a trade "
2337 "route), 'b' (for building a wonder) or 'd' (for a "
2338 "spy action) when the unit is in the city."),
2340 GEN_BOOL_OPTION(popup_attack_actions, N_("Pop up attack questions"),
2341 N_("If this option is enabled, when a unit arrives at a "
2342 "target it can attack, a window will pop up asking "
2343 "which action should be performed even if an attack "
2344 "action is legal and no other interesting action are. "
2345 "This allows you to change your mind or to select an "
2346 "uninteresting action."),
2348 GEN_BOOL_OPTION(popup_last_move_to_allied,
2349 /* TODO: Rename option ..._last_... to match _final_ in
2350 * the descriptions.
2351 * Changes options file format, needs migration
2352 * when loading old version. */
2353 N_("Pop up actions when final move to allied tile"),
2354 N_("If this option is enabled the final move in a unit's"
2355 " orders to a tile with allied units or cities it can"
2356 " perform an action to is interpreted as an attempted"
2357 " action. This makes the action selection dialog pop up"
2358 " while the unit is at the adjacent tile."
2359 " This can, in cases where the action requires that"
2360 " the actor unit has moves left, save a turn."
2361 " The down side is that the unit remains adjacent to"
2362 " rather than inside the protection of an allied city"
2363 " or unit stack."),
2365 GEN_BOOL_OPTION(enable_cursor_changes, N_("Enable cursor changing"),
2366 N_("This option controls whether the client should "
2367 "try to change the mouse cursor depending on what "
2368 "is being pointed at, as well as to indicate "
2369 "changes in the client or server state."),
2371 GEN_BOOL_OPTION(separate_unit_selection, N_("Select cities before units"),
2372 N_("If this option is enabled, when both cities and "
2373 "units are present in the selection rectangle, only "
2374 "cities will be selected. See the help on Controls."),
2376 GEN_BOOL_OPTION(unit_selection_clears_orders,
2377 N_("Clear unit orders on selection"),
2378 N_("Enabling this option will cause unit orders to be "
2379 "cleared as soon as one or more units are selected. If "
2380 "this option is disabled, busy units will not stop "
2381 "their current activity when selected. Giving them "
2382 "new orders will clear their current ones; pressing "
2383 "<space> once will clear their orders and leave them "
2384 "selected, and pressing <space> a second time will "
2385 "dismiss them."),
2387 GEN_BOOL_OPTION(voteinfo_bar_use, N_("Enable vote bar"),
2388 N_("If this option is turned on, the vote bar will be "
2389 "displayed to show vote information."),
2391 GEN_BOOL_OPTION(voteinfo_bar_always_show,
2392 N_("Always display the vote bar"),
2393 N_("If this option is turned on, the vote bar will never "
2394 "be hidden, even if there is no running vote."),
2396 GEN_BOOL_OPTION(voteinfo_bar_hide_when_not_player,
2397 N_("Do not show vote bar if not a player"),
2398 N_("If this option is enabled, the client won't show the "
2399 "vote bar if you are not a player."),
2401 GEN_BOOL_OPTION(voteinfo_bar_new_at_front, N_("Set new votes at front"),
2402 N_("If this option is enabled, then new votes will go "
2403 "to the front of the vote list."),
2405 GEN_BOOL_OPTION(autoaccept_tileset_suggestion,
2406 N_("Autoaccept tileset suggestions"),
2407 N_("If this option is enabled, any tileset suggested by "
2408 "the ruleset is automatically used; otherwise you "
2409 "are prompted to change tileset."),
2411
2412 GEN_BOOL_OPTION(sound_enable_effects,
2413 N_("Enable sound effects"),
2414 N_("Play sound effects, assuming there's suitable "
2415 "sound plugin and soundset with the sounds."),
2417 GEN_BOOL_OPTION(sound_enable_game_music,
2418 N_("Enable in-game music"),
2419 N_("Play music during the game, assuming there's suitable "
2420 "sound plugin and musicset with in-game tracks."),
2422 GEN_BOOL_OPTION(sound_enable_menu_music,
2423 N_("Enable menu music"),
2424 N_("Play music while not in actual game, "
2425 "assuming there's suitable "
2426 "sound plugin and musicset with menu music tracks."),
2428 GEN_BOOL_OPTION(silent_when_not_in_focus,
2429 N_("Silent when not in focus"),
2430 N_("Fade all sound out when the client is not in focus. "
2431 "Not all clients support this."),
2433 GEN_INT_OPTION(sound_effects_volume,
2434 N_("Sound volume"),
2435 N_("Volume scale from 0-100"),
2436 COC_SOUND, GUI_STUB, 100,
2437 0, 100,
2439
2440 GEN_BOOL_OPTION(autoaccept_soundset_suggestion,
2441 N_("Autoaccept soundset suggestions"),
2442 N_("If this option is enabled, any soundset suggested by "
2443 "the ruleset is automatically used."),
2445 GEN_BOOL_OPTION(autoaccept_musicset_suggestion,
2446 N_("Autoaccept musicset suggestions"),
2447 N_("If this option is enabled, any musicset suggested by "
2448 "the ruleset is automatically used."),
2450
2452 N_("Background layer"),
2453 N_("The background layer of the overview shows just "
2454 "ocean and land."),
2457 N_("Terrain relief map layer"),
2458 N_("The relief layer shows all terrains on the map."),
2461 N_("Borders layer"),
2462 N_("The borders layer of the overview shows which tiles "
2463 "are owned by each player."),
2466 N_("Borders layer on ocean tiles"),
2467 N_("The borders layer of the overview are drawn on "
2468 "ocean tiles as well (this may look ugly with many "
2469 "islands). This option is only of interest if you "
2470 "have set the option \"Borders layer\" already."),
2473 N_("Units layer"),
2474 N_("Enabling this will draw units on the overview."),
2477 N_("Cities layer"),
2478 N_("Enabling this will draw cities on the overview."),
2481 N_("Overview fog of war"),
2482 N_("Enabling this will show fog of war on the "
2483 "overview."),
2485
2486 /* options for map images */
2487 GEN_STR_LIST_OPTION(mapimg_format,
2488 N_("Image format"),
2489 N_("The image toolkit and file format used for "
2490 "map images."),
2492 NULL, 0),
2493 GEN_INT_OPTION(mapimg_zoom,
2494 N_("Zoom factor for map images"),
2495 N_("The magnification used for map images."),
2497 GEN_BOOL_OPTION(mapimg_layer[MAPIMG_LAYER_AREA],
2498 N_("Show area within borders"),
2499 N_("If set, the territory of each nation is shown "
2500 "on the saved image."),
2503 N_("Show borders"),
2504 N_("If set, the border of each nation is shown on the "
2505 "saved image."),
2508 N_("Show cities"),
2509 N_("If set, cities are shown on the saved image."),
2512 N_("Show fog of war"),
2513 N_("If set, the extent of fog of war is shown on the "
2514 "saved image."),
2517 N_("Show full terrain"),
2518 N_("If set, terrain relief is shown with different colors "
2519 "in the saved image; otherwise, only land and water are "
2520 "distinguished."),
2522 GEN_BOOL_OPTION(mapimg_layer[MAPIMG_LAYER_UNITS],
2523 N_("Show units"),
2524 N_("If set, units are shown in the saved image."),
2526 GEN_STR_OPTION(mapimg_filename,
2527 N_("Map image file name"),
2528 N_("The base part of the filename for saved map images. "
2529 "A string identifying the game turn and map options will "
2530 "be appended."),
2532
2533 /* gui-gtk-2.0 client specific options.
2534 * These are still kept just so users can migrate them to later gtk-clients */
2535 GEN_BOOL_OPTION(gui_gtk2_map_scrollbars, NULL, NULL,
2537 GEN_BOOL_OPTION(gui_gtk2_dialogs_on_top, NULL, NULL,
2539 GEN_BOOL_OPTION(gui_gtk2_show_task_icons, NULL, NULL,
2541 GEN_BOOL_OPTION(gui_gtk2_enable_tabs, NULL, NULL,
2543 GEN_BOOL_OPTION(gui_gtk2_better_fog, NULL, NULL,
2546 GEN_BOOL_OPTION(gui_gtk2_show_chat_message_time, NULL, NULL,
2548 GEN_BOOL_OPTION(gui_gtk2_new_messages_go_to_top, NULL, NULL,
2550 GEN_BOOL_OPTION(gui_gtk2_show_message_window_buttons, NULL, NULL,
2552 GEN_BOOL_OPTION(gui_gtk2_metaserver_tab_first, NULL, NULL,
2554 GEN_BOOL_OPTION(gui_gtk2_allied_chat_only, NULL, NULL,
2556 GEN_BOOL_OPTION(gui_gtk2_mouse_over_map_focus, NULL, NULL,
2558 GEN_BOOL_OPTION(gui_gtk2_chatline_autocompletion, NULL, NULL,
2560 GEN_INT_OPTION(gui_gtk2_citydlg_xsize, NULL, NULL,
2563 NULL),
2564 GEN_INT_OPTION(gui_gtk2_citydlg_ysize, NULL, NULL,
2567 NULL),
2568 GEN_ENUM_OPTION(gui_gtk2_popup_tech_help, NULL, NULL,
2572 GEN_FONT_OPTION(gui_gtk2_font_city_label, "city_label",
2573 NULL, NULL,
2575 "Monospace 8", font_changed_callback),
2576 GEN_FONT_OPTION(gui_gtk2_font_notify_label, "notify_label",
2577 NULL, NULL,
2579 "Monospace Bold 9", font_changed_callback),
2580 GEN_FONT_OPTION(gui_gtk2_font_spaceship_label, "spaceship_label",
2581 NULL, NULL,
2583 "Monospace 8", font_changed_callback),
2584 GEN_FONT_OPTION(gui_gtk2_font_help_label, "help_label",
2585 NULL, NULL,
2587 "Sans Bold 10", font_changed_callback),
2588 GEN_FONT_OPTION(gui_gtk2_font_help_link, "help_link",
2589 NULL, NULL,
2591 "Sans 9", font_changed_callback),
2592 GEN_FONT_OPTION(gui_gtk2_font_help_text, "help_text",
2593 NULL, NULL,
2595 "Monospace 8", font_changed_callback),
2596 GEN_FONT_OPTION(gui_gtk2_font_chatline, "chatline",
2597 NULL, NULL,
2599 "Monospace 8", font_changed_callback),
2600 GEN_FONT_OPTION(gui_gtk2_font_beta_label, "beta_label",
2601 NULL, NULL,
2603 "Sans Italic 10", font_changed_callback),
2604 GEN_FONT_OPTION(gui_gtk2_font_small, "small_font",
2605 NULL, NULL,
2607 "Sans 9", NULL),
2608 GEN_FONT_OPTION(gui_gtk2_font_comment_label, "comment_label",
2609 NULL, NULL,
2611 "Sans Italic 9", font_changed_callback),
2612 GEN_FONT_OPTION(gui_gtk2_font_city_names, "city_names",
2613 NULL, NULL,
2615 "Sans Bold 10", NULL),
2616 GEN_FONT_OPTION(gui_gtk2_font_city_productions, "city_productions",
2617 NULL, NULL,
2619 "Serif 10", NULL),
2620 GEN_FONT_OPTION(gui_gtk2_font_reqtree_text, "reqtree_text",
2621 NULL, NULL,
2623 "Serif 10", NULL),
2624
2625 /* gui-gtk-3.0 client specific options.
2626 * These are still kept just so users can migrate them to later gtk-clients */
2627 GEN_BOOL_OPTION(gui_gtk3_fullscreen, NULL, NULL,
2629 GEN_BOOL_OPTION(gui_gtk3_map_scrollbars, N_("Show map scrollbars"),
2630 N_("Disable this option to hide the scrollbars on the "
2631 "map view."),
2633 GEN_BOOL_OPTION(gui_gtk3_dialogs_on_top, NULL, NULL,
2635 GEN_BOOL_OPTION(gui_gtk3_show_task_icons, NULL, NULL,
2637 GEN_BOOL_OPTION(gui_gtk3_enable_tabs, NULL, NULL,
2639 GEN_BOOL_OPTION(gui_gtk3_show_chat_message_time, NULL, NULL,
2641 GEN_BOOL_OPTION(gui_gtk3_new_messages_go_to_top, NULL, NULL,
2643 GEN_BOOL_OPTION(gui_gtk3_show_message_window_buttons, NULL, NULL,
2645 GEN_BOOL_OPTION(gui_gtk3_metaserver_tab_first, NULL, NULL,
2647 GEN_BOOL_OPTION(gui_gtk3_allied_chat_only, NULL, NULL,
2649 GEN_ENUM_OPTION(gui_gtk3_message_chat_location, NULL, NULL,
2653 GEN_BOOL_OPTION(gui_gtk3_small_display_layout, NULL, NULL,
2655 GEN_BOOL_OPTION(gui_gtk3_mouse_over_map_focus, NULL, NULL,
2657 GEN_BOOL_OPTION(gui_gtk3_chatline_autocompletion, NULL, NULL,
2659 GEN_INT_OPTION(gui_gtk3_citydlg_xsize, NULL, NULL,
2662 NULL),
2663 GEN_INT_OPTION(gui_gtk3_citydlg_ysize, NULL, NULL,
2666 NULL),
2667 GEN_ENUM_OPTION(gui_gtk3_popup_tech_help, NULL, NULL,
2671 GEN_INT_OPTION(gui_gtk3_governor_range_min, NULL, NULL,
2674 NULL),
2675 GEN_INT_OPTION(gui_gtk3_governor_range_max, NULL, NULL,
2678 NULL),
2679 GEN_FONT_OPTION(gui_gtk3_font_city_label, "city_label",
2680 NULL, NULL,
2682 "Monospace 8", font_changed_callback),
2683 GEN_FONT_OPTION(gui_gtk3_font_notify_label, "notify_label",
2684 NULL, NULL,
2686 "Monospace Bold 9", font_changed_callback),
2687 GEN_FONT_OPTION(gui_gtk3_font_spaceship_label, "spaceship_label",
2688 NULL, NULL,
2690 "Monospace 8", font_changed_callback),
2691 GEN_FONT_OPTION(gui_gtk3_font_help_label, "help_label",
2692 NULL, NULL,
2694 "Sans Bold 10", font_changed_callback),
2695 GEN_FONT_OPTION(gui_gtk3_font_help_link, "help_link",
2696 NULL, NULL,
2698 "Sans 9", font_changed_callback),
2699 GEN_FONT_OPTION(gui_gtk3_font_help_text, "help_text",
2700 NULL, NULL,
2702 "Monospace 8", font_changed_callback),
2703 GEN_FONT_OPTION(gui_gtk3_font_chatline, "chatline",
2704 NULL, NULL,
2706 "Monospace 8", font_changed_callback),
2707 GEN_FONT_OPTION(gui_gtk3_font_beta_label, "beta_label",
2708 NULL, NULL,
2710 "Sans Italic 10", font_changed_callback),
2711 GEN_FONT_OPTION(gui_gtk3_font_small, "small_font",
2712 NULL, NULL,
2714 "Sans 9", NULL),
2715 GEN_FONT_OPTION(gui_gtk3_font_comment_label, "comment_label",
2716 NULL, NULL,
2718 "Sans Italic 9", font_changed_callback),
2719 GEN_FONT_OPTION(gui_gtk3_font_city_names, "city_names",
2720 NULL, NULL,
2722 "Sans Bold 10", NULL),
2723 GEN_FONT_OPTION(gui_gtk3_font_city_productions, "city_productions",
2724 NULL, NULL,
2726 "Serif 10", NULL),
2727 GEN_FONT_OPTION(gui_gtk3_font_reqtree_text, "reqtree_text",
2728 NULL, NULL,
2730 "Serif 10", NULL),
2731
2732 /* gui-gtk-3.22 client specific options. */
2733 GEN_BOOL_OPTION(gui_gtk3_22_fullscreen, N_("Fullscreen"),
2734 N_("If this option is set the client will use the "
2735 "whole screen area for drawing."),
2737 GEN_BOOL_OPTION(gui_gtk3_22_map_scrollbars, N_("Show map scrollbars"),
2738 N_("Disable this option to hide the scrollbars on the "
2739 "map view."),
2741 GEN_BOOL_OPTION(gui_gtk3_22_dialogs_on_top, N_("Keep dialogs on top"),
2742 N_("If this option is set then dialog windows will always "
2743 "remain in front of the main Freeciv window. "
2744 "Disabling this has no effect in fullscreen mode."),
2746 GEN_BOOL_OPTION(gui_gtk3_22_show_task_icons, N_("Show worklist task icons"),
2747 N_("Disabling this will turn off the unit and building "
2748 "icons in the worklist dialog and the production "
2749 "tab of the city dialog."),
2751 GEN_BOOL_OPTION(gui_gtk3_22_enable_tabs, N_("Enable status report tabs"),
2752 N_("If this option is enabled then report dialogs will "
2753 "be shown as separate tabs rather than in popup "
2754 "dialogs."),
2756 GEN_BOOL_OPTION(gui_gtk3_22_show_chat_message_time,
2757 N_("Show time for each chat message"),
2758 N_("If this option is enabled then all chat messages "
2759 "will be prefixed by a time string of the form "
2760 "[hour:minute:second]."),
2762 GEN_BOOL_OPTION(gui_gtk3_22_new_messages_go_to_top,
2763 N_("New message events go to top of list"),
2764 N_("If this option is enabled, new events in the "
2765 "message window will appear at the top of the list, "
2766 "rather than being appended at the bottom."),
2768 GEN_BOOL_OPTION(gui_gtk3_22_show_message_window_buttons,
2769 N_("Show extra message window buttons"),
2770 N_("If this option is enabled, there will be two "
2771 "buttons displayed in the message window for "
2772 "inspecting a city and going to a location. If this "
2773 "option is disabled, these buttons will not appear "
2774 "(you can still double-click with the left mouse "
2775 "button or right-click on a row to inspect or goto "
2776 "respectively). This option will only take effect "
2777 "once the message window is closed and reopened."),
2779 GEN_BOOL_OPTION(gui_gtk3_22_metaserver_tab_first,
2780 N_("Metaserver tab first in network page"),
2781 N_("If this option is enabled, the metaserver tab will "
2782 "be the first notebook tab in the network page. This "
2783 "option requires a restart in order to take effect."),
2785 GEN_BOOL_OPTION(gui_gtk3_22_allied_chat_only,
2786 N_("Plain chat messages are sent to allies only"),
2787 N_("If this option is enabled, then plain messages "
2788 "typed into the chat entry while the game is "
2789 "running will only be sent to your allies. "
2790 "Otherwise plain messages will be sent as "
2791 "public chat messages. To send a public chat "
2792 "message with this option enabled, prefix the "
2793 "message with a single colon ':'. This option "
2794 "can also be set using a toggle button beside "
2795 "the chat entry (only visible in multiplayer "
2796 "games)."),
2798 GEN_ENUM_OPTION(gui_gtk3_22_message_chat_location,
2799 N_("Messages and Chat reports location"),
2800 /* TRANS: The strings used in the UI for 'Split' etc are
2801 * tagged 'gui_gtk3_22/gtk4/gtk4_message_chat_location' */
2802 N_("Controls where the Messages and Chat reports "
2803 "appear relative to the main view containing the map.\n"
2804 "'Split' allows all three to be seen simultaneously, "
2805 "which is best for multiplayer, but requires a large "
2806 "window to be usable.\n"
2807 "'Separate' puts Messages and Chat in a notebook "
2808 "separate from the main view, so that one of them "
2809 "can always be seen alongside the main view.\n"
2810 "'Merged' makes the Messages and Chat reports into "
2811 "tabs alongside the map and other reports; this "
2812 "allows a larger map view on small screens.\n"
2813 "This option requires a restart in order to take "
2814 "effect."), COC_INTERFACE, GUI_GTK3_22,
2817 GEN_BOOL_OPTION(gui_gtk3_22_small_display_layout,
2818 N_("Arrange widgets for small displays"),
2819 N_("If this option is enabled, widgets in the main "
2820 "window will be arranged so that they take up the "
2821 "least amount of total screen space. Specifically, "
2822 "the left panel containing the overview, player "
2823 "status, and the unit information box will be "
2824 "extended over the entire left side of the window. "
2825 "This option requires a restart in order to take "
2826 "effect."), COC_INTERFACE, GUI_GTK3_22, FALSE, NULL),
2827 GEN_BOOL_OPTION(gui_gtk3_22_mouse_over_map_focus,
2828 N_("Mouse over the map widget selects it automatically"),
2829 N_("If this option is enabled, then the map will be "
2830 "focused when the mouse hovers over it."),
2832 GEN_BOOL_OPTION(gui_gtk3_22_chatline_autocompletion,
2833 N_("Player or user name autocompletion"),
2834 N_("If this option is turned on, the tabulation key "
2835 "will be used in the chatline to complete the word you "
2836 "are typing with the name of a player or a user."),
2838 GEN_INT_OPTION(gui_gtk3_22_citydlg_xsize,
2839 N_("Width of the city dialog"),
2840 N_("This value is only used if the width of the city "
2841 "dialog is saved."),
2844 NULL),
2845 GEN_INT_OPTION(gui_gtk3_22_citydlg_ysize,
2846 N_("Height of the city dialog"),
2847 N_("This value is only used if the height of the city "
2848 "dialog is saved."),
2851 NULL),
2852 GEN_ENUM_OPTION(gui_gtk3_22_popup_tech_help,
2853 N_("Popup tech help when gained"),
2854 N_("Controls if tech help should be opened when "
2855 "new tech has been gained.\n"
2856 "'Ruleset' means that behavior suggested by "
2857 "current ruleset is used."), COC_INTERFACE, GUI_GTK3_22,
2860 GEN_INT_OPTION(gui_gtk3_22_governor_range_min,
2861 N_("Minimum surplus for a governor"),
2862 N_("The lower limit of the range for requesting surpluses "
2863 "from the governor."),
2866 NULL),
2867 GEN_INT_OPTION(gui_gtk3_22_governor_range_max,
2868 N_("Maximum surplus for a governor"),
2869 N_("The higher limit of the range for requesting surpluses "
2870 "from the governor."),
2873 NULL),
2874 GEN_FONT_OPTION(gui_gtk3_22_font_city_label, "city_label",
2875 N_("City Label"),
2876 N_("This font is used to display the city labels on city "
2877 "dialogs."),
2879 "Monospace 8", font_changed_callback),
2880 GEN_FONT_OPTION(gui_gtk3_22_font_notify_label, "notify_label",
2881 N_("Notify Label"),
2882 N_("This font is used to display server reports such "
2883 "as the demographic report or historian publications."),
2885 "Monospace Bold 9", font_changed_callback),
2886 GEN_FONT_OPTION(gui_gtk3_22_font_spaceship_label, "spaceship_label",
2887 N_("Spaceship Label"),
2888 N_("This font is used to display the spaceship widgets."),
2890 "Monospace 8", font_changed_callback),
2891 GEN_FONT_OPTION(gui_gtk3_22_font_help_label, "help_label",
2892 N_("Help Label"),
2893 N_("This font is used to display the help headers in the "
2894 "help window."),
2896 "Sans Bold 10", font_changed_callback),
2897 GEN_FONT_OPTION(gui_gtk3_22_font_help_link, "help_link",
2898 N_("Help Link"),
2899 N_("This font is used to display the help links in the "
2900 "help window."),
2902 "Sans 9", font_changed_callback),
2903 GEN_FONT_OPTION(gui_gtk3_22_font_help_text, "help_text",
2904 N_("Help Text"),
2905 N_("This font is used to display the help body text in "
2906 "the help window."),
2908 "Monospace 8", font_changed_callback),
2909 GEN_FONT_OPTION(gui_gtk3_22_font_chatline, "chatline",
2910 N_("Chatline Area"),
2911 N_("This font is used to display the text in the "
2912 "chatline area."),
2914 "Monospace 8", font_changed_callback),
2915 GEN_FONT_OPTION(gui_gtk3_22_font_beta_label, "beta_label",
2916 N_("Beta Label"),
2917 N_("This font is used to display the beta label."),
2919 "Sans Italic 10", font_changed_callback),
2920 GEN_FONT_OPTION(gui_gtk3_22_font_small, "small_font",
2921 N_("Small Font"),
2922 N_("This font is used for any small font request. For "
2923 "example, it is used for display the building lists "
2924 "in the city dialog, the Economy report or the Units "
2925 "report."),
2927 "Sans 9", font_changed_callback),
2928 GEN_FONT_OPTION(gui_gtk3_22_font_comment_label, "comment_label",
2929 N_("Comment Label"),
2930 N_("This font is used to display comment labels, such as "
2931 "in the governor page of the city dialogs."),
2933 "Sans Italic 9", font_changed_callback),
2934 GEN_FONT_OPTION(gui_gtk3_22_font_city_names, "city_names",
2935 N_("City Names"),
2936 N_("This font is used to the display the city names "
2937 "on the map."),
2939 "Sans Bold 10", NULL),
2940 GEN_FONT_OPTION(gui_gtk3_22_font_city_productions, "city_productions",
2941 N_("City Productions"),
2942 N_("This font is used to display the city production "
2943 "on the map."),
2945 "Serif 10", NULL),
2946 GEN_FONT_OPTION(gui_gtk3_22_font_reqtree_text, "reqtree_text",
2947 N_("Requirement Tree"),
2948 N_("This font is used to the display the requirement tree "
2949 "in the Research report."),
2951 "Serif 10", NULL),
2952
2953 /* gui-gtk-4.0 client specific options. */
2954 GEN_BOOL_OPTION(gui_gtk4_fullscreen, N_("Fullscreen"),
2955 N_("If this option is set the client will use the "
2956 "whole screen area for drawing."),
2958 GEN_BOOL_OPTION(gui_gtk4_map_scrollbars, N_("Show map scrollbars"),
2959 N_("Disable this option to hide the scrollbars on the "
2960 "map view."),
2962 GEN_BOOL_OPTION(gui_gtk4_dialogs_on_top, N_("Keep dialogs on top"),
2963 N_("If this option is set then dialog windows will always "
2964 "remain in front of the main Freeciv window. "
2965 "Disabling this has no effect in fullscreen mode."),
2967 GEN_BOOL_OPTION(gui_gtk4_show_task_icons, N_("Show worklist task icons"),
2968 N_("Disabling this will turn off the unit and building "
2969 "icons in the worklist dialog and the production "
2970 "tab of the city dialog."),
2972 GEN_BOOL_OPTION(gui_gtk4_enable_tabs, N_("Enable status report tabs"),
2973 N_("If this option is enabled then report dialogs will "
2974 "be shown as separate tabs rather than in popup "
2975 "dialogs."),
2977 GEN_BOOL_OPTION(gui_gtk4_show_chat_message_time,
2978 N_("Show time for each chat message"),
2979 N_("If this option is enabled then all chat messages "
2980 "will be prefixed by a time string of the form "
2981 "[hour:minute:second]."),
2983 GEN_BOOL_OPTION(gui_gtk4_new_messages_go_to_top,
2984 N_("New message events go to top of list"),
2985 N_("If this option is enabled, new events in the "
2986 "message window will appear at the top of the list, "
2987 "rather than being appended at the bottom."),
2989 GEN_BOOL_OPTION(gui_gtk4_show_message_window_buttons,
2990 N_("Show extra message window buttons"),
2991 N_("If this option is enabled, there will be two "
2992 "buttons displayed in the message window for "
2993 "inspecting a city and going to a location. If this "
2994 "option is disabled, these buttons will not appear "
2995 "(you can still double-click with the left mouse "
2996 "button or right-click on a row to inspect or goto "
2997 "respectively). This option will only take effect "
2998 "once the message window is closed and reopened."),
3000 GEN_BOOL_OPTION(gui_gtk4_metaserver_tab_first,
3001 N_("Metaserver tab first in network page"),
3002 N_("If this option is enabled, the metaserver tab will "
3003 "be the first notebook tab in the network page. This "
3004 "option requires a restart in order to take effect."),
3006 GEN_BOOL_OPTION(gui_gtk4_allied_chat_only,
3007 N_("Plain chat messages are sent to allies only"),
3008 N_("If this option is enabled, then plain messages "
3009 "typed into the chat entry while the game is "
3010 "running will only be sent to your allies. "
3011 "Otherwise plain messages will be sent as "
3012 "public chat messages. To send a public chat "
3013 "message with this option enabled, prefix the "
3014 "message with a single colon ':'. This option "
3015 "can also be set using a toggle button beside "
3016 "the chat entry (only visible in multiplayer "
3017 "games)."),
3019 GEN_ENUM_OPTION(gui_gtk4_message_chat_location,
3020 N_("Messages and Chat reports location"),
3021 /* TRANS: The strings used in the UI for 'Split' etc are
3022 * tagged 'gui_gtk3_22/gtk4/gtk5_message_chat_location' */
3023 N_("Controls where the Messages and Chat reports "
3024 "appear relative to the main view containing the map.\n"
3025 "'Split' allows all three to be seen simultaneously, "
3026 "which is best for multiplayer, but requires a large "
3027 "window to be usable.\n"
3028 "'Separate' puts Messages and Chat in a notebook "
3029 "separate from the main view, so that one of them "
3030 "can always be seen alongside the main view.\n"
3031 "'Merged' makes the Messages and Chat reports into "
3032 "tabs alongside the map and other reports; this "
3033 "allows a larger map view on small screens.\n"
3034 "This option requires a restart in order to take "
3035 "effect."), COC_INTERFACE, GUI_GTK4,
3038 GEN_BOOL_OPTION(gui_gtk4_small_display_layout,
3039 N_("Arrange widgets for small displays"),
3040 N_("If this option is enabled, widgets in the main "
3041 "window will be arranged so that they take up the "
3042 "least amount of total screen space. Specifically, "
3043 "the left panel containing the overview, player "
3044 "status, and the unit information box will be "
3045 "extended over the entire left side of the window. "
3046 "This option requires a restart in order to take "
3047 "effect."), COC_INTERFACE, GUI_GTK4, FALSE, NULL),
3048 GEN_BOOL_OPTION(gui_gtk4_mouse_over_map_focus,
3049 N_("Mouse over the map widget selects it automatically"),
3050 N_("If this option is enabled, then the map will be "
3051 "focused when the mouse hovers over it."),
3053 GEN_BOOL_OPTION(gui_gtk4_chatline_autocompletion,
3054 N_("Player or user name autocompletion"),
3055 N_("If this option is turned on, the tabulation key "
3056 "will be used in the chatline to complete the word you "
3057 "are typing with the name of a player or a user."),
3059 GEN_INT_OPTION(gui_gtk4_citydlg_xsize,
3060 N_("Width of the city dialog"),
3061 N_("This value is only used if the width of the city "
3062 "dialog is saved."),
3065 NULL),
3066 GEN_INT_OPTION(gui_gtk4_citydlg_ysize,
3067 N_("Height of the city dialog"),
3068 N_("This value is only used if the height of the city "
3069 "dialog is saved."),
3072 NULL),
3073 GEN_ENUM_OPTION(gui_gtk4_popup_tech_help,
3074 N_("Popup tech help when gained"),
3075 N_("Controls if tech help should be opened when "
3076 "new tech has been gained.\n"
3077 "'Ruleset' means that behavior suggested by "
3078 "current ruleset is used."), COC_INTERFACE, GUI_GTK4,
3081 GEN_INT_OPTION(gui_gtk4_governor_range_min,
3082 N_("Minimum surplus for a governor"),
3083 N_("The lower limit of the range for requesting surpluses "
3084 "from the governor."),
3087 NULL),
3088 GEN_INT_OPTION(gui_gtk4_governor_range_max,
3089 N_("Maximum surplus for a governor"),
3090 N_("The higher limit of the range for requesting surpluses "
3091 "from the governor."),
3094 NULL),
3095 GEN_FONT_OPTION(gui_gtk4_font_city_label, "city_label",
3096 N_("City Label"),
3097 N_("This font is used to display the city labels on city "
3098 "dialogs."),
3100 "Monospace 8", font_changed_callback),
3101 GEN_FONT_OPTION(gui_gtk4_font_notify_label, "notify_label",
3102 N_("Notify Label"),
3103 N_("This font is used to display server reports such "
3104 "as the demographic report or historian publications."),
3106 "Monospace Bold 9", font_changed_callback),
3107 GEN_FONT_OPTION(gui_gtk4_font_spaceship_label, "spaceship_label",
3108 N_("Spaceship Label"),
3109 N_("This font is used to display the spaceship widgets."),
3111 "Monospace 8", font_changed_callback),
3112 GEN_FONT_OPTION(gui_gtk4_font_help_label, "help_label",
3113 N_("Help Label"),
3114 N_("This font is used to display the help headers in the "
3115 "help window."),
3117 "Sans Bold 10", font_changed_callback),
3118 GEN_FONT_OPTION(gui_gtk4_font_help_link, "help_link",
3119 N_("Help Link"),
3120 N_("This font is used to display the help links in the "
3121 "help window."),
3123 "Sans 9", font_changed_callback),
3124 GEN_FONT_OPTION(gui_gtk4_font_help_text, "help_text",
3125 N_("Help Text"),
3126 N_("This font is used to display the help body text in "
3127 "the help window."),
3129 "Monospace 8", font_changed_callback),
3130 GEN_FONT_OPTION(gui_gtk4_font_chatline, "chatline",
3131 N_("Chatline Area"),
3132 N_("This font is used to display the text in the "
3133 "chatline area."),
3135 "Monospace 8", font_changed_callback),
3136 GEN_FONT_OPTION(gui_gtk4_font_beta_label, "beta_label",
3137 N_("Beta Label"),
3138 N_("This font is used to display the beta label."),
3140 "Sans Italic 10", font_changed_callback),
3141 GEN_FONT_OPTION(gui_gtk4_font_small, "small_font",
3142 N_("Small Font"),
3143 N_("This font is used for any small font request. For "
3144 "example, it is used for display the building lists "
3145 "in the city dialog, the Economy report or the Units "
3146 "report."),
3148 "Sans 9", font_changed_callback),
3149 GEN_FONT_OPTION(gui_gtk4_font_comment_label, "comment_label",
3150 N_("Comment Label"),
3151 N_("This font is used to display comment labels, such as "
3152 "in the governor page of the city dialogs."),
3154 "Sans Italic 9", font_changed_callback),
3155 GEN_FONT_OPTION(gui_gtk4_font_city_names, "city_names",
3156 N_("City Names"),
3157 N_("This font is used to the display the city names "
3158 "on the map."),
3160 "Sans Bold 10", NULL),
3161 GEN_FONT_OPTION(gui_gtk4_font_city_productions, "city_productions",
3162 N_("City Productions"),
3163 N_("This font is used to display the city production "
3164 "on the map."),
3166 "Serif 10", NULL),
3167 GEN_FONT_OPTION(gui_gtk4_font_reqtree_text, "reqtree_text",
3168 N_("Requirement Tree"),
3169 N_("This font is used to the display the requirement tree "
3170 "in the Research report."),
3172 "Serif 10", NULL),
3173
3174 /* gui-gtk-5.0 client specific options. */
3175 GEN_BOOL_OPTION(gui_gtk5_fullscreen, N_("Fullscreen"),
3176 N_("If this option is set the client will use the "
3177 "whole screen area for drawing."),
3179 GEN_BOOL_OPTION(gui_gtk5_map_scrollbars, N_("Show map scrollbars"),
3180 N_("Disable this option to hide the scrollbars on the "
3181 "map view."),
3183 GEN_BOOL_OPTION(gui_gtk5_dialogs_on_top, N_("Keep dialogs on top"),
3184 N_("If this option is set then dialog windows will always "
3185 "remain in front of the main Freeciv window. "
3186 "Disabling this has no effect in fullscreen mode."),
3188 GEN_BOOL_OPTION(gui_gtk5_show_task_icons, N_("Show worklist task icons"),
3189 N_("Disabling this will turn off the unit and building "
3190 "icons in the worklist dialog and the production "
3191 "tab of the city dialog."),
3193 GEN_BOOL_OPTION(gui_gtk5_enable_tabs, N_("Enable status report tabs"),
3194 N_("If this option is enabled then report dialogs will "
3195 "be shown as separate tabs rather than in popup "
3196 "dialogs."),
3198 GEN_BOOL_OPTION(gui_gtk5_show_chat_message_time,
3199 N_("Show time for each chat message"),
3200 N_("If this option is enabled then all chat messages "
3201 "will be prefixed by a time string of the form "
3202 "[hour:minute:second]."),
3204 GEN_BOOL_OPTION(gui_gtk5_new_messages_go_to_top,
3205 N_("New message events go to top of list"),
3206 N_("If this option is enabled, new events in the "
3207 "message window will appear at the top of the list, "
3208 "rather than being appended at the bottom."),
3210 GEN_BOOL_OPTION(gui_gtk5_show_message_window_buttons,
3211 N_("Show extra message window buttons"),
3212 N_("If this option is enabled, there will be two "
3213 "buttons displayed in the message window for "
3214 "inspecting a city and going to a location. If this "
3215 "option is disabled, these buttons will not appear "
3216 "(you can still double-click with the left mouse "
3217 "button or right-click on a row to inspect or goto "
3218 "respectively). This option will only take effect "
3219 "once the message window is closed and reopened."),
3221 GEN_BOOL_OPTION(gui_gtk5_metaserver_tab_first,
3222 N_("Metaserver tab first in network page"),
3223 N_("If this option is enabled, the metaserver tab will "
3224 "be the first notebook tab in the network page. This "
3225 "option requires a restart in order to take effect."),
3227 GEN_BOOL_OPTION(gui_gtk5_allied_chat_only,
3228 N_("Plain chat messages are sent to allies only"),
3229 N_("If this option is enabled, then plain messages "
3230 "typed into the chat entry while the game is "
3231 "running will only be sent to your allies. "
3232 "Otherwise plain messages will be sent as "
3233 "public chat messages. To send a public chat "
3234 "message with this option enabled, prefix the "
3235 "message with a single colon ':'. This option "
3236 "can also be set using a toggle button beside "
3237 "the chat entry (only visible in multiplayer "
3238 "games)."),
3240 GEN_ENUM_OPTION(gui_gtk5_message_chat_location,
3241 N_("Messages and Chat reports location"),
3242 /* TRANS: The strings used in the UI for 'Split' etc are
3243 * tagged 'gui_gtk3_22/gtk4/gtk5_message_chat_location' */
3244 N_("Controls where the Messages and Chat reports "
3245 "appear relative to the main view containing the map.\n"
3246 "'Split' allows all three to be seen simultaneously, "
3247 "which is best for multiplayer, but requires a large "
3248 "window to be usable.\n"
3249 "'Separate' puts Messages and Chat in a notebook "
3250 "separate from the main view, so that one of them "
3251 "can always be seen alongside the main view.\n"
3252 "'Merged' makes the Messages and Chat reports into "
3253 "tabs alongside the map and other reports; this "
3254 "allows a larger map view on small screens.\n"
3255 "This option requires a restart in order to take "
3256 "effect."), COC_INTERFACE, GUI_GTK5,
3259 GEN_BOOL_OPTION(gui_gtk5_small_display_layout,
3260 N_("Arrange widgets for small displays"),
3261 N_("If this option is enabled, widgets in the main "
3262 "window will be arranged so that they take up the "
3263 "least amount of total screen space. Specifically, "
3264 "the left panel containing the overview, player "
3265 "status, and the unit information box will be "
3266 "extended over the entire left side of the window. "
3267 "This option requires a restart in order to take "
3268 "effect."), COC_INTERFACE, GUI_GTK5, FALSE, NULL),
3269 GEN_BOOL_OPTION(gui_gtk5_mouse_over_map_focus,
3270 N_("Mouse over the map widget selects it automatically"),
3271 N_("If this option is enabled, then the map will be "
3272 "focused when the mouse hovers over it."),
3274 GEN_BOOL_OPTION(gui_gtk5_chatline_autocompletion,
3275 N_("Player or user name autocompletion"),
3276 N_("If this option is turned on, the tabulation key "
3277 "will be used in the chatline to complete the word you "
3278 "are typing with the name of a player or a user."),
3280 GEN_INT_OPTION(gui_gtk5_citydlg_xsize,
3281 N_("Width of the city dialog"),
3282 N_("This value is only used if the width of the city "
3283 "dialog is saved."),
3286 NULL),
3287 GEN_INT_OPTION(gui_gtk5_citydlg_ysize,
3288 N_("Height of the city dialog"),
3289 N_("This value is only used if the height of the city "
3290 "dialog is saved."),
3293 NULL),
3294 GEN_ENUM_OPTION(gui_gtk5_popup_tech_help,
3295 N_("Popup tech help when gained"),
3296 N_("Controls if tech help should be opened when "
3297 "new tech has been gained.\n"
3298 "'Ruleset' means that behavior suggested by "
3299 "current ruleset is used."), COC_INTERFACE, GUI_GTK5,
3302 GEN_INT_OPTION(gui_gtk5_governor_range_min,
3303 N_("Minimum surplus for a governor"),
3304 N_("The lower limit of the range for requesting surpluses "
3305 "from the governor."),
3308 NULL),
3309 GEN_INT_OPTION(gui_gtk5_governor_range_max,
3310 N_("Maximum surplus for a governor"),
3311 N_("The higher limit of the range for requesting surpluses "
3312 "from the governor."),
3315 NULL),
3316 GEN_FONT_OPTION(gui_gtk5_font_city_label, "city_label",
3317 N_("City Label"),
3318 N_("This font is used to display the city labels on city "
3319 "dialogs."),
3321 "Monospace 8", font_changed_callback),
3322 GEN_FONT_OPTION(gui_gtk5_font_notify_label, "notify_label",
3323 N_("Notify Label"),
3324 N_("This font is used to display server reports such "
3325 "as the demographic report or historian publications."),
3327 "Monospace Bold 9", font_changed_callback),
3328 GEN_FONT_OPTION(gui_gtk5_font_spaceship_label, "spaceship_label",
3329 N_("Spaceship Label"),
3330 N_("This font is used to display the spaceship widgets."),
3332 "Monospace 8", font_changed_callback),
3333 GEN_FONT_OPTION(gui_gtk5_font_help_label, "help_label",
3334 N_("Help Label"),
3335 N_("This font is used to display the help headers in the "
3336 "help window."),
3338 "Sans Bold 10", font_changed_callback),
3339 GEN_FONT_OPTION(gui_gtk5_font_help_link, "help_link",
3340 N_("Help Link"),
3341 N_("This font is used to display the help links in the "
3342 "help window."),
3344 "Sans 9", font_changed_callback),
3345 GEN_FONT_OPTION(gui_gtk5_font_help_text, "help_text",
3346 N_("Help Text"),
3347 N_("This font is used to display the help body text in "
3348 "the help window."),
3350 "Monospace 8", font_changed_callback),
3351 GEN_FONT_OPTION(gui_gtk5_font_chatline, "chatline",
3352 N_("Chatline Area"),
3353 N_("This font is used to display the text in the "
3354 "chatline area."),
3356 "Monospace 8", font_changed_callback),
3357 GEN_FONT_OPTION(gui_gtk5_font_beta_label, "beta_label",
3358 N_("Beta Label"),
3359 N_("This font is used to display the beta label."),
3361 "Sans Italic 10", font_changed_callback),
3362 GEN_FONT_OPTION(gui_gtk5_font_small, "small_font",
3363 N_("Small Font"),
3364 N_("This font is used for any small font request. For "
3365 "example, it is used for display the building lists "
3366 "in the city dialog, the Economy report or the Units "
3367 "report."),
3369 "Sans 9", font_changed_callback),
3370 GEN_FONT_OPTION(gui_gtk5_font_comment_label, "comment_label",
3371 N_("Comment Label"),
3372 N_("This font is used to display comment labels, such as "
3373 "in the governor page of the city dialogs."),
3375 "Sans Italic 9", font_changed_callback),
3376 GEN_FONT_OPTION(gui_gtk5_font_city_names, "city_names",
3377 N_("City Names"),
3378 N_("This font is used to the display the city names "
3379 "on the map."),
3381 "Sans Bold 10", NULL),
3382 GEN_FONT_OPTION(gui_gtk5_font_city_productions, "city_productions",
3383 N_("City Productions"),
3384 N_("This font is used to display the city production "
3385 "on the map."),
3387 "Serif 10", NULL),
3388 GEN_FONT_OPTION(gui_gtk5_font_reqtree_text, "reqtree_text",
3389 N_("Requirement Tree"),
3390 N_("This font is used to the display the requirement tree "
3391 "in the Research report."),
3393 "Serif 10", NULL),
3394
3395 /* gui-sdl client specific options.
3396 * These are still kept just so users can migrate them to sdl2-client */
3397 GEN_BOOL_OPTION(gui_sdl_fullscreen, NULL, NULL,
3399 GEN_VIDEO_OPTION(gui_sdl_screen, NULL, NULL,
3400 COC_INTERFACE, GUI_SDL, 640, 480, NULL),
3401 GEN_BOOL_OPTION(gui_sdl_do_cursor_animation, NULL, NULL,
3403 GEN_BOOL_OPTION(gui_sdl_use_color_cursors, NULL, NULL,
3405
3406 /* gui-sdl2 client specific options. */
3407 GEN_BOOL_OPTION(gui_sdl2_fullscreen, N_("Fullscreen"),
3408 N_("If this option is set the client will use the "
3409 "whole screen area for drawing."),
3411 GEN_VIDEO_OPTION(gui_sdl2_screen, N_("Screen resolution"),
3412 N_("This option controls the resolution of the "
3413 "selected screen."),
3414 COC_INTERFACE, GUI_SDL2, 640, 480, NULL),
3415 GEN_BOOL_OPTION(gui_sdl2_swrenderer, N_("Use software rendering"),
3416 N_("Usually hardware rendering is used when possible. "
3417 "With this option set, software rendering is always used."),
3419 GEN_BOOL_OPTION(gui_sdl2_do_cursor_animation, N_("Do cursor animation"),
3420 N_("If this option is disabled, the cursor will "
3421 "always be displayed as static."),
3423 GEN_BOOL_OPTION(gui_sdl2_use_color_cursors, N_("Use color cursors"),
3424 N_("If this option is disabled, the cursor will "
3425 "always be displayed in black and white."),
3427 GEN_FONT_OPTION(gui_sdl2_font_city_names, "FONT_CITY_NAME",
3428 N_("City Names"),
3429 N_("The size of font used to the display the city names "
3430 "on the map."),
3432 "10", font_changed_callback),
3433 GEN_FONT_OPTION(gui_sdl2_font_city_productions, "FONT_CITY_PROD",
3434 N_("City Productions"),
3435 N_("The size of font used to the display the city "
3436 "production names on the map."),
3438 "10", font_changed_callback),
3439 GEN_BOOL_OPTION(gui_sdl2_use_theme_font_size, N_("Use theme defined font size"),
3440 N_("Disable this to override base font size set by theme "
3441 "by the setting below."),
3443 GEN_INT_OPTION(gui_sdl2_font_size, N_("Base Font Size"),
3444 N_("Base Font Size. All the fonts' sizes are defined relative "
3445 "to this. This option has effect only if theme font sizes "
3446 "option is disabled."),
3447 COC_FONT, GUI_SDL2, 10, 6, 50, NULL),
3448
3449 /* gui-sdl3 client specific options. */
3450 GEN_BOOL_OPTION(gui_sdl3_fullscreen, N_("Fullscreen"),
3451 N_("If this option is set the client will use the "
3452 "whole screen area for drawing."),
3454 GEN_VIDEO_OPTION(gui_sdl3_screen, N_("Screen resolution"),
3455 N_("This option controls the resolution of the "
3456 "selected screen."),
3457 COC_INTERFACE, GUI_SDL3, 640, 480, NULL),
3458 GEN_BOOL_OPTION(gui_sdl3_swrenderer, N_("Use software rendering"),
3459 N_("Usually hardware rendering is used when possible. "
3460 "With this option set, software rendering is always used."),
3462 GEN_BOOL_OPTION(gui_sdl3_do_cursor_animation, N_("Do cursor animation"),
3463 N_("If this option is disabled, the cursor will "
3464 "always be displayed as static."),
3466 GEN_BOOL_OPTION(gui_sdl3_use_color_cursors, N_("Use color cursors"),
3467 N_("If this option is disabled, the cursor will "
3468 "always be displayed in black and white."),
3470 GEN_FONT_OPTION(gui_sdl3_font_city_names, "FONT_CITY_NAME",
3471 N_("City Names"),
3472 N_("The size of font used to the display the city names "
3473 "on the map."),
3475 "10", font_changed_callback),
3476 GEN_FONT_OPTION(gui_sdl3_font_city_productions, "FONT_CITY_PROD",
3477 N_("City Productions"),
3478 N_("The size of font used to the display the city "
3479 "production names on the map."),
3481 "10", font_changed_callback),
3482 GEN_BOOL_OPTION(gui_sdl3_use_theme_font_size, N_("Use theme defined font size"),
3483 N_("Disable this to override base font size set by theme "
3484 "by the setting below."),
3486 GEN_INT_OPTION(gui_sdl3_font_size, N_("Base Font Size"),
3487 N_("Base Font Size. All the fonts' sizes are defined relative "
3488 "to this. This option has effect only if theme font sizes "
3489 "option is disabled."),
3490 COC_FONT, GUI_SDL3, 10, 6, 50, NULL),
3491
3492 /* gui-qt client specific options. */
3493 GEN_BOOL_OPTION(gui_qt_fullscreen, N_("Fullscreen"),
3494 N_("If this option is set the client will use the "
3495 "whole screen area for drawing."),
3497 GEN_BOOL_OPTION(gui_qt_show_titlebar, N_("Show titlebar"),
3498 N_("If this option is set the client will show a titlebar. "
3499 "If disabled, then no titlebar will be shown, and "
3500 "minimize/maximize/etc buttons will be placed on the "
3501 "menu bar."),
3503 GEN_FONT_OPTION(gui_qt_font_default, "default_font",
3504 N_("Default font"),
3505 N_("This is default font"),
3507 "Sans Serif,10,-1,5,75,0,0,0,0,0", font_changed_callback),
3508 GEN_FONT_OPTION(gui_qt_font_notify_label, "notify_label",
3509 N_("Notify Label"),
3510 N_("This font is used to display server reports such "
3511 "as the demographic report or historian publications."),
3513 "Monospace,9,-1,5,75,0,0,0,0,0", font_changed_callback),
3514 GEN_FONT_OPTION(gui_qt_font_help_label, "help_label",
3515 N_("Help Label"),
3516 N_("This font is used to display the help labels in the "
3517 "help window."),
3519 "Sans Serif,9,-1,5,50,0,0,0,0,0", font_changed_callback),
3520 GEN_FONT_OPTION(gui_qt_font_help_text, "help_text",
3521 N_("Help Text"),
3522 N_("This font is used to display the help body text in "
3523 "the help window."),
3525 "Monospace,8,-1,5,50,0,0,0,0,0", font_changed_callback),
3526 GEN_FONT_OPTION(gui_qt_font_chatline, "chatline",
3527 N_("Chatline Area"),
3528 N_("This font is used to display the text in the "
3529 "chatline area."),
3531 "Monospace,8,-1,5,50,0,0,0,0,0", font_changed_callback),
3532 GEN_FONT_OPTION(gui_qt_font_city_names, "city_names",
3533 N_("City Names"),
3534 N_("This font is used to the display the city names "
3535 "on the map."),
3537 "Sans Serif,10,-1,5,75,0,0,0,0,0", font_changed_callback),
3538 GEN_FONT_OPTION(gui_qt_font_city_productions, "city_productions",
3539 N_("City Productions"),
3540 N_("This font is used to display the city production "
3541 "on the map."),
3543 "Sans Serif,10,-1,5,50,1,0,0,0,0", font_changed_callback),
3544 GEN_FONT_OPTION(gui_qt_font_reqtree_text, "reqtree_text",
3545 N_("Requirement Tree"),
3546 N_("This font is used to the display the requirement tree "
3547 "in the Research report."),
3549 "Sans Serif,10,-1,5,50,1,0,0,0,0", font_changed_callback),
3550 GEN_BOOL_OPTION(gui_qt_show_preview, N_("Show savegame information"),
3551 N_("If this option is set the client will show "
3552 "information and map preview of current savegame."),
3554 GEN_BOOL_OPTION(gui_qt_sidebar_left, N_("Sidebar position"),
3555 N_("If this option is set, the sidebar will be to the left "
3556 "of the map, otherwise to the right."),
3558 GEN_STR_OPTION(gui_qt_wakeup_text,
3559 N_("Wake up sequence"),
3560 N_("String which will trigger sound in pregame page; "
3561 "%1 stands for username."),
3562 COC_INTERFACE, GUI_QT, "Wake up %1", NULL, 0),
3563 GEN_BOOL_OPTION(gui_qt_svgflags, N_("SVG flags features"),
3565 N_("Enable svgflags features, such as bigger flags "
3566 "on the diplomacy dialog. Change to this comes "
3567 "to an effect on next client start."),
3568#else /* FREECIV_SVG_FLAGS */
3569 N_("Enable svgflags features, such as bigger flags "
3570 "on the diplomacy dialog. This has no effect on "
3571 "this freeciv build, as the svg support has not "
3572 "been built in."),
3573#endif /* FREECIV_SVG_FLAGS */
3575};
3577
3578/* Iteration loop, including invalid options for the current gui type. */
3579#define client_options_iterate_all(poption) \
3580{ \
3581 const struct client_option *const poption##_max = \
3582 client_options + client_options_num; \
3583 struct client_option *client_##poption = client_options; \
3584 struct option *poption; \
3585 for (; client_##poption < poption##_max; client_##poption++) { \
3586 poption = OPTION(client_##poption);
3587
3588#define client_options_iterate_all_end \
3589 } \
3590}
3591
3592
3593/************************************************************************/
3596static struct client_option *
3598{
3599 const struct client_option *const max =
3601 const enum gui_type our_type = get_gui_type();
3602
3603 while (poption < max
3604 && poption->specific != GUI_STUB
3605 && poption->specific != our_type) {
3606 poption++;
3607 }
3608
3609 return (poption < max ? poption : NULL);
3610}
3611
3612/************************************************************************/
3616{
3617 if (0 > id || id > client_options_num) {
3618 return NULL;
3619 }
3620 return OPTION(client_options + id);
3621}
3622
3623/************************************************************************/
3630
3631/************************************************************************/
3635{
3636 return COC_MAX;
3637}
3638
3639/************************************************************************/
3642static const char *client_optset_category_name(int category)
3643{
3644 switch (category) {
3645 case COC_GRAPHICS:
3646 return _("Graphics");
3647 case COC_OVERVIEW:
3648 /* TRANS: Options section for overview map (mini-map) */
3649 return Q_("?map:Overview");
3650 case COC_SOUND:
3651 return _("Sound");
3652 case COC_INTERFACE:
3653 return _("Interface");
3654 case COC_MAPIMG:
3655 return _("Map Image");
3656 case COC_NETWORK:
3657 return _("Network");
3658 case COC_FONT:
3659 return _("Font");
3660 case COC_MAX:
3661 break;
3662 }
3663
3664 log_error("%s: invalid option category number %d.",
3665 __FUNCTION__, category);
3666 return NULL;
3667}
3668
3669/************************************************************************/
3672static int client_option_number(const struct option *poption)
3673{
3675}
3676
3677/************************************************************************/
3680static const char *client_option_name(const struct option *poption)
3681{
3682 return CLIENT_OPTION(poption)->name;
3683}
3684
3685/************************************************************************/
3688static const char *client_option_description(const struct option *poption)
3689{
3690 return _(CLIENT_OPTION(poption)->description);
3691}
3692
3693/************************************************************************/
3696static const char *client_option_help_text(const struct option *poption)
3697{
3698 return _(CLIENT_OPTION(poption)->help_text);
3699}
3700
3701/************************************************************************/
3704static int client_option_category(const struct option *poption)
3705{
3706 return CLIENT_OPTION(poption)->category;
3707}
3708
3709/************************************************************************/
3713{
3714 return TRUE;
3715}
3716
3717/************************************************************************/
3720static struct option *client_option_next(const struct option *poption)
3721{
3723}
3724
3725/************************************************************************/
3728static bool client_option_bool_get(const struct option *poption)
3729{
3730 return *(CLIENT_OPTION(poption)->boolean.pvalue);
3731}
3732
3733/************************************************************************/
3736static bool client_option_bool_def(const struct option *poption)
3737{
3738 return CLIENT_OPTION(poption)->boolean.def;
3739}
3740
3741/************************************************************************/
3745static bool client_option_bool_set(struct option *poption, bool val)
3746{
3748
3749 if (*pcoption->boolean.pvalue == val) {
3750 return FALSE;
3751 }
3752
3753 *pcoption->boolean.pvalue = val;
3754 return TRUE;
3755}
3756
3757/************************************************************************/
3760static int client_option_int_get(const struct option *poption)
3761{
3762 return *(CLIENT_OPTION(poption)->integer.pvalue);
3763}
3764
3765/************************************************************************/
3768static int client_option_int_def(const struct option *poption)
3769{
3770 return CLIENT_OPTION(poption)->integer.def;
3771}
3772
3773/************************************************************************/
3776static int client_option_int_min(const struct option *poption)
3777{
3778 return CLIENT_OPTION(poption)->integer.min;
3779}
3780
3781/************************************************************************/
3784static int client_option_int_max(const struct option *poption)
3785{
3786 return CLIENT_OPTION(poption)->integer.max;
3787}
3788
3789/************************************************************************/
3793static bool client_option_int_set(struct option *poption, int val)
3794{
3796
3798 || val > pcoption->integer.max
3799 || *pcoption->integer.pvalue == val) {
3800 return FALSE;
3801 }
3802
3803 *pcoption->integer.pvalue = val;
3804 return TRUE;
3805}
3806
3807/************************************************************************/
3810static const char *client_option_str_get(const struct option *poption)
3811{
3812 return CLIENT_OPTION(poption)->string.pvalue;
3813}
3814
3815/************************************************************************/
3818static const char *client_option_str_def(const struct option *poption)
3819{
3820 return CLIENT_OPTION(poption)->string.def;
3821}
3822
3823/************************************************************************/
3827static const struct strvec *
3829{
3830 return (CLIENT_OPTION(poption)->string.val_accessor
3831 ? CLIENT_OPTION(poption)->string.val_accessor(poption) : NULL);
3832}
3833
3834/************************************************************************/
3838static bool client_option_str_set(struct option *poption, const char *str)
3839{
3841
3842 if (strlen(str) >= pcoption->string.size
3843 || 0 == strcmp(pcoption->string.pvalue, str)) {
3844 return FALSE;
3845 }
3846
3847 fc_strlcpy(pcoption->string.pvalue, str, pcoption->string.size);
3848 return TRUE;
3849}
3850
3851/************************************************************************/
3854static int client_option_enum_get(const struct option *poption)
3855{
3856 return *(CLIENT_OPTION(poption)->enumerator.pvalue);
3857}
3858
3859/************************************************************************/
3862static int client_option_enum_def(const struct option *poption)
3863{
3864 return CLIENT_OPTION(poption)->enumerator.def;
3865}
3866
3867/************************************************************************/
3871static const struct strvec *
3873{
3874 return CLIENT_OPTION(poption)->enumerator.pretty_names;
3875}
3876
3877/************************************************************************/
3881static bool client_option_enum_set(struct option *poption, int val)
3882{
3884
3885 if (*pcoption->enumerator.pvalue == val
3886 || 0 > val
3887 || val >= strvec_size(pcoption->enumerator.support_names)) {
3888 return FALSE;
3889 }
3890
3891 *pcoption->enumerator.pvalue = val;
3892 return TRUE;
3893}
3894
3895/************************************************************************/
3901 int val)
3902{
3903 const struct strvec *names = CLIENT_OPTION(data)->enumerator.support_names;
3904
3905 return (0 <= val && val < strvec_size(names)
3906 ? strvec_get(names, val) : NULL);
3907}
3908
3909#if 0 /* There's no bitwise options currently */
3910/************************************************************************/
3913static unsigned client_option_bitwise_get(const struct option *poption)
3914{
3915 return *(CLIENT_OPTION(poption)->bitwise.pvalue);
3916}
3917
3918/************************************************************************/
3921static unsigned client_option_bitwise_def(const struct option *poption)
3922{
3923 return CLIENT_OPTION(poption)->bitwise.def;
3924}
3925
3926/************************************************************************/
3930static const struct strvec *
3932{
3933 return CLIENT_OPTION(poption)->bitwise.pretty_names;
3934}
3935
3936/************************************************************************/
3940static bool client_option_bitwise_set(struct option *poption, unsigned val)
3941{
3943
3944 if (*pcoption->bitwise.pvalue == val) {
3945 return FALSE;
3946 }
3947
3948 *pcoption->bitwise.pvalue = val;
3949 return TRUE;
3950}
3951#endif /* 0 */
3952
3953/************************************************************************/
3959 int val)
3960{
3961 const struct strvec *names = CLIENT_OPTION(data)->bitwise.support_names;
3962
3963 return (0 <= val && val < strvec_size(names)
3964 ? strvec_get(names, val) : NULL);
3965}
3966
3967/************************************************************************/
3970static const char *client_option_font_get(const struct option *poption)
3971{
3972 return CLIENT_OPTION(poption)->font.pvalue;
3973}
3974
3975/************************************************************************/
3978static const char *client_option_font_def(const struct option *poption)
3979{
3980 return CLIENT_OPTION(poption)->font.def;
3981}
3982
3983/************************************************************************/
3986static const char *client_option_font_target(const struct option *poption)
3987{
3988 return CLIENT_OPTION(poption)->font.target;
3989}
3990
3991/************************************************************************/
3995static bool client_option_font_set(struct option *poption, const char *font)
3996{
3998
3999 if (strlen(font) >= pcoption->font.size
4000 || 0 == strcmp(pcoption->font.pvalue, font)) {
4001 return FALSE;
4002 }
4003
4004 fc_strlcpy(pcoption->font.pvalue, font, pcoption->font.size);
4005 return TRUE;
4006}
4007
4008/************************************************************************/
4012{
4013 return *CLIENT_OPTION(poption)->color.pvalue;
4014}
4015
4016/************************************************************************/
4020{
4021 return CLIENT_OPTION(poption)->color.def;
4022}
4023
4024/************************************************************************/
4029 struct ft_color color)
4030{
4031 struct ft_color *pcolor = CLIENT_OPTION(poption)->color.pvalue;
4032 bool changed = FALSE;
4033
4034#define color_set(color_tgt, color) \
4035 if (NULL == color_tgt) { \
4036 if (NULL != color) { \
4037 color_tgt = fc_strdup(color); \
4038 changed = TRUE; \
4039 } \
4040 } else { \
4041 if (NULL == color) { \
4042 free((void *) color_tgt); \
4043 color_tgt = NULL; \
4044 changed = TRUE; \
4045 } else if (0 != strcmp(color_tgt, color)) { \
4046 free((void *) color_tgt); \
4047 color_tgt = fc_strdup(color); \
4048 changed = TRUE; \
4049 } \
4050 }
4051
4052 color_set(pcolor->foreground, color.foreground);
4053 color_set(pcolor->background, color.background);
4054
4055#undef color_set
4056
4057 return changed;
4058}
4059
4060/************************************************************************/
4063static struct video_mode
4065{
4066 return *CLIENT_OPTION(poption)->video_mode.pvalue;
4067}
4068
4069/************************************************************************/
4072static struct video_mode
4077
4078/************************************************************************/
4083 struct video_mode mode)
4084{
4086
4087 if (0 == memcmp(&mode, pcoption->video_mode.pvalue,
4088 sizeof(struct video_mode))) {
4089 return FALSE;
4090 }
4091
4092 *pcoption->video_mode.pvalue = mode;
4093 return TRUE;
4094}
4095
4096/************************************************************************/
4100 struct section_file *sf)
4101{
4104
4105 switch (option_type(poption)) {
4106 case OT_BOOLEAN:
4107 {
4108 bool value;
4109 const char *pname = option_name(poption);
4110 const char *old_paths = "draw_roads_rails";
4111
4112 if (!strcmp("draw_paths", pname)) {
4113 /* Renamed in freeciv-3.2 */
4114 if (secfile_lookup_bool(sf, &value, "client.draw_paths")
4115 && option_bool_set(poption, value)) {
4116 return TRUE;
4117 }
4118
4119 /* Try by old name. */
4120 pname = old_paths;
4121 }
4122
4123 return (secfile_lookup_bool(sf, &value, "client.%s",
4124 pname)
4125 && option_bool_set(poption, value));
4126 }
4127 case OT_INTEGER:
4128 {
4129 int value;
4130
4131 return (secfile_lookup_int(sf, &value, "client.%s",
4133 && option_int_set(poption, value));
4134 }
4135 case OT_STRING:
4136 {
4137 const char *string;
4138
4139 return ((string = secfile_lookup_str(sf, "client.%s",
4141 && option_str_set(poption, string));
4142 }
4143 case OT_ENUM:
4144 {
4145 int value;
4146
4147 return (secfile_lookup_enum_data(sf, &value, FALSE,
4149 poption, "client.%s",
4151 && option_enum_set_int(poption, value));
4152 }
4153 case OT_BITWISE:
4154 {
4155 int value;
4156
4157 return (secfile_lookup_enum_data(sf, &value, TRUE,
4159 poption, "client.%s",
4161 && option_bitwise_set(poption, value));
4162 }
4163 case OT_FONT:
4164 {
4165 const char *string;
4166
4167 return ((string = secfile_lookup_str(sf, "client.%s",
4169 && option_font_set(poption, string));
4170 }
4171 case OT_COLOR:
4172 {
4173 struct ft_color color;
4174
4175 return ((color.foreground =
4176 secfile_lookup_str(sf, "client.%s.foreground",
4178 && (color.background =
4179 secfile_lookup_str(sf, "client.%s.background",
4182 }
4183 case OT_VIDEO_MODE:
4184 {
4185 struct video_mode mode;
4186
4187 return (secfile_lookup_int(sf, &mode.width, "client.%s.width",
4189 && secfile_lookup_int(sf, &mode.height, "client.%s.height",
4191 && option_video_mode_set(poption, mode));
4192 }
4193 }
4194 return FALSE;
4195}
4196
4197/************************************************************************/
4201 struct section_file *sf)
4202{
4204 fc_assert_ret(NULL != sf);
4205
4206 switch (option_type(poption)) {
4207 case OT_BOOLEAN:
4209 "client.%s", option_name(poption));
4210 break;
4211 case OT_INTEGER:
4213 "client.%s", option_name(poption));
4214 break;
4215 case OT_STRING:
4217 "client.%s", option_name(poption));
4218 break;
4219 case OT_ENUM:
4222 "client.%s", option_name(poption));
4223 break;
4224 case OT_BITWISE:
4227 "client.%s", option_name(poption));
4228 break;
4229 case OT_FONT:
4231 "client.%s", option_name(poption));
4232 break;
4233 case OT_COLOR:
4234 {
4236
4237 secfile_insert_str(sf, color.foreground, "client.%s.foreground",
4239 secfile_insert_str(sf, color.background, "client.%s.background",
4241 }
4242 break;
4243 case OT_VIDEO_MODE:
4244 {
4246
4247 secfile_insert_int(sf, mode.width, "client.%s.width",
4249 secfile_insert_int(sf, mode.height, "client.%s.height",
4251 }
4252 break;
4253 }
4254}
4255
4256
4257/****************************************************************************
4258 Server options variables.
4259****************************************************************************/
4262
4264static int server_options_num = 0;
4265
4266
4267/****************************************************************************
4268 Server option set.
4269****************************************************************************/
4270static struct option *server_optset_option_by_number(int id);
4271static struct option *server_optset_option_first(void);
4272static int server_optset_category_number(void);
4273static const char *server_optset_category_name(int category);
4274
4277 .option_first = server_optset_option_first,
4278 .category_number = server_optset_category_number,
4279 .category_name = server_optset_category_name
4280};
4282
4283
4284/****************************************************************************
4285 Virtuals tables for the client options.
4286****************************************************************************/
4287static int server_option_number(const struct option *poption);
4288static const char *server_option_name(const struct option *poption);
4289static const char *server_option_description(const struct option *poption);
4290static const char *server_option_help_text(const struct option *poption);
4291static int server_option_category(const struct option *poption);
4292static bool server_option_is_changeable(const struct option *poption);
4293static struct option *server_option_next(const struct option *poption);
4294
4295static const struct option_common_vtable server_option_common_vtable = {
4296 .number = server_option_number,
4297 .name = server_option_name,
4298 .description = server_option_description,
4299 .help_text = server_option_help_text,
4300 .category = server_option_category,
4301 .is_changeable = server_option_is_changeable,
4302 .next = server_option_next
4303};
4304
4305static bool server_option_bool_get(const struct option *poption);
4306static bool server_option_bool_def(const struct option *poption);
4307static bool server_option_bool_set(struct option *poption, bool val);
4308
4309static const struct option_bool_vtable server_option_bool_vtable = {
4313};
4314
4315static int server_option_int_get(const struct option *poption);
4316static int server_option_int_def(const struct option *poption);
4317static int server_option_int_min(const struct option *poption);
4318static int server_option_int_max(const struct option *poption);
4319static bool server_option_int_set(struct option *poption, int val);
4320
4321static const struct option_int_vtable server_option_int_vtable = {
4322 .get = server_option_int_get,
4323 .def = server_option_int_def,
4324 .minimum = server_option_int_min,
4325 .maximum = server_option_int_max,
4327};
4328
4329static const char *server_option_str_get(const struct option *poption);
4330static const char *server_option_str_def(const struct option *poption);
4331static const struct strvec *
4333static bool server_option_str_set(struct option *poption, const char *str);
4334
4335static const struct option_str_vtable server_option_str_vtable = {
4336 .get = server_option_str_get,
4337 .def = server_option_str_def,
4338 .values = server_option_str_values,
4340};
4341
4342static int server_option_enum_get(const struct option *poption);
4343static int server_option_enum_def(const struct option *poption);
4344static const struct strvec *
4346static bool server_option_enum_set(struct option *poption, int val);
4347
4348static const struct option_enum_vtable server_option_enum_vtable = {
4351 .values = server_option_enum_pretty,
4353 .cmp = strcmp
4354};
4355
4356static unsigned server_option_bitwise_get(const struct option *poption);
4357static unsigned server_option_bitwise_def(const struct option *poption);
4358static const struct strvec *
4360static bool server_option_bitwise_set(struct option *poption, unsigned val);
4361
4362static const struct option_bitwise_vtable server_option_bitwise_vtable = {
4367};
4368
4369/****************************************************************************
4370 Derived class server option, inheriting from base class option.
4371****************************************************************************/
4373 struct option base_option; /* Base structure, must be the first! */
4374
4375 char *name; /* Short name - used as an identifier */
4376 char *description; /* One-line description */
4377 char *help_text; /* Paragraph-length help text */
4378 unsigned char category;
4383
4384 union {
4385 /* OT_BOOLEAN type option. */
4386 struct {
4387 bool value;
4388 bool def;
4389 } boolean;
4390 /* OT_INTEGER type option. */
4391 struct {
4393 int def, min, max;
4394 } integer;
4395 /* OT_STRING type option. */
4396 struct {
4397 char *value;
4398 char *def;
4399 } string;
4400 /* OT_ENUM type option. */
4401 struct {
4402 int value;
4403 int def;
4405 struct strvec *pretty_names; /* untranslated */
4406 } enumerator;
4407 /* OT_BITWISE type option. */
4408 struct {
4409 unsigned value;
4410 unsigned def;
4411 struct strvec *support_names;
4412 struct strvec *pretty_names; /* untranslated */
4413 } bitwise;
4414 };
4415};
4416
4417#define SERVER_OPTION(poption) ((struct server_option *) (poption))
4418
4419static void desired_settable_option_send(struct option *poption);
4420
4421
4422/************************************************************************/
4432
4433/************************************************************************/
4437{
4438 option_gui_remove(&(poption->base_option));
4439
4440 switch (poption->base_option.type) {
4441 case OT_STRING:
4442 if (NULL != poption->string.value) {
4443 FC_FREE(poption->string.value);
4444 }
4445 if (NULL != poption->string.def) {
4446 FC_FREE(poption->string.def);
4447 }
4448 break;
4449
4450 case OT_ENUM:
4451 if (NULL != poption->enumerator.support_names) {
4452 strvec_destroy(poption->enumerator.support_names);
4453 poption->enumerator.support_names = NULL;
4454 }
4455 if (NULL != poption->enumerator.pretty_names) {
4456 strvec_destroy(poption->enumerator.pretty_names);
4457 poption->enumerator.pretty_names = NULL;
4458 }
4459 break;
4460
4461 case OT_BITWISE:
4462 if (NULL != poption->bitwise.support_names) {
4463 strvec_destroy(poption->bitwise.support_names);
4464 poption->bitwise.support_names = NULL;
4465 }
4466 if (NULL != poption->bitwise.pretty_names) {
4467 strvec_destroy(poption->bitwise.pretty_names);
4468 poption->bitwise.pretty_names = NULL;
4469 }
4470 break;
4471
4472 case OT_BOOLEAN:
4473 case OT_INTEGER:
4474 case OT_FONT:
4475 case OT_COLOR:
4476 case OT_VIDEO_MODE:
4477 break;
4478 }
4479
4480 if (NULL != poption->name) {
4481 FC_FREE(poption->name);
4482 }
4483 if (NULL != poption->description) {
4484 FC_FREE(poption->description);
4485 }
4486 if (NULL != poption->help_text) {
4487 FC_FREE(poption->help_text);
4488 }
4489}
4490
4491/************************************************************************/
4495{
4496 int i;
4497
4498 /* Don't keep this dialog open. */
4500
4501 /* Free the options themselves. */
4502 if (NULL != server_options) {
4503 for (i = 0; i < server_options_num; i++) {
4505 }
4508 }
4509
4510 /* Free the categories. */
4512 for (i = 0; i < server_options_categories_num; i++) {
4515 }
4516 }
4519 }
4520}
4521
4522/************************************************************************/
4526 (const struct packet_server_setting_control *packet)
4527{
4528 int i;
4529
4530 /* This packet should be received only once. */
4535
4536 /* Allocate server option categories. */
4537 if (0 < packet->categories_num) {
4541 sizeof(*server_options_categories));
4542
4543 for (i = 0; i < server_options_categories_num; i++) {
4544 /* NB: Translate now. */
4546 }
4547 }
4548
4549 /* Allocate server options. */
4550 if (0 < packet->settings_num) {
4553 }
4554}
4555
4556/************************************************************************/
4560 (const struct packet_server_setting_const *packet)
4561{
4564
4566
4567 fc_assert(NULL == psoption->name);
4568 psoption->name = fc_strdup(packet->name);
4569 fc_assert(NULL == psoption->description);
4570 /* NB: Translate now. */
4571 psoption->description = fc_strdup(_(packet->short_help));
4572 fc_assert(NULL == psoption->help_text);
4573 /* NB: Translate now. */
4574 psoption->help_text = fc_strdup(_(packet->extra_help));
4575 psoption->category = packet->category;
4576}
4577
4578/****************************************************************************
4579 Common part of handle_server_setting_*() functions. See below.
4580****************************************************************************/
4581#define handle_server_setting_common(psoption, packet) \
4582 psoption->is_changeable = packet->is_changeable; \
4583 psoption->setdef = packet->setdef; \
4584 if (psoption->is_visible != packet->is_visible) { \
4585 if (psoption->is_visible) { \
4586 need_gui_remove = TRUE; \
4587 } else if (packet->is_visible) { \
4588 need_gui_add = TRUE; \
4589 } \
4590 psoption->is_visible = packet->is_visible; \
4591 } \
4592 \
4593 /* Keep this list of conditions in sync with one in \
4594 resend_desired_settable_options() */ \
4595 if (!psoption->desired_sent \
4596 && psoption->is_visible \
4597 && psoption->is_changeable \
4598 && gui_options.send_desired_settings \
4599 && is_server_running() \
4600 && packet->initial_setting) { \
4601 /* Only send our private settings if we are running \
4602 * on a forked local server, i.e. started by the \
4603 * client with the "Start New Game" button. \
4604 * Do now override settings that are already saved to savegame \
4605 * and now loaded. */ \
4606 desired_settable_option_send(OPTION(poption)); \
4607 psoption->desired_sent = TRUE; \
4608 } \
4609 \
4610 /* Update the GUI. */ \
4611 if (need_gui_remove) { \
4612 option_gui_remove(poption); \
4613 } else if (need_gui_add) { \
4614 option_gui_add(poption); \
4615 } else { \
4616 option_gui_update(poption); \
4618
4619/************************************************************************/
4623 (const struct packet_server_setting_bool *packet)
4624{
4627 bool need_gui_remove = FALSE;
4628 bool need_gui_add = FALSE;
4629
4631
4632 if (NULL == poption->common_vtable) {
4633 /* Not initialized yet. */
4634 poption->poptset = server_optset;
4635 poption->common_vtable = &server_option_common_vtable;
4636 poption->type = OT_BOOLEAN;
4637 poption->bool_vtable = &server_option_bool_vtable;
4638 }
4640 "Server setting \"%s\" (nb %d) has type %s (%d), "
4641 "expected %s (%d)",
4643 option_type_name(poption->type), poption->type,
4645
4646 if (packet->is_visible) {
4647 psoption->boolean.value = packet->val;
4648 psoption->boolean.def = packet->default_val;
4649 }
4650
4653
4654/************************************************************************/
4658 (const struct packet_server_setting_int *packet)
4659{
4662 bool need_gui_remove = FALSE;
4663 bool need_gui_add = FALSE;
4664
4666
4667 if (NULL == poption->common_vtable) {
4668 /* Not initialized yet. */
4669 poption->poptset = server_optset;
4670 poption->common_vtable = &server_option_common_vtable;
4671 poption->type = OT_INTEGER;
4672 poption->int_vtable = &server_option_int_vtable;
4673 }
4675 "Server setting \"%s\" (nb %d) has type %s (%d), "
4676 "expected %s (%d)",
4678 option_type_name(poption->type), poption->type,
4680
4681 if (packet->is_visible) {
4682 psoption->integer.value = packet->val;
4683 psoption->integer.def = packet->default_val;
4684 psoption->integer.min = packet->min_val;
4685 psoption->integer.max = packet->max_val;
4686 }
4687
4690
4691/************************************************************************/
4695 (const struct packet_server_setting_str *packet)
4696{
4699 bool need_gui_remove = FALSE;
4700 bool need_gui_add = FALSE;
4701
4703
4704 if (NULL == poption->common_vtable) {
4705 /* Not initialized yet. */
4706 poption->poptset = server_optset;
4707 poption->common_vtable = &server_option_common_vtable;
4708 poption->type = OT_STRING;
4709 poption->str_vtable = &server_option_str_vtable;
4710 }
4712 "Server setting \"%s\" (nb %d) has type %s (%d), "
4713 "expected %s (%d)",
4715 option_type_name(poption->type), poption->type,
4717
4718 if (packet->is_visible) {
4719 if (NULL == psoption->string.value) {
4720 psoption->string.value = fc_strdup(packet->val);
4721 } else if (0 != strcmp(packet->val, psoption->string.value)) {
4722 free(psoption->string.value);
4723 psoption->string.value = fc_strdup(packet->val);
4724 }
4725 if (NULL == psoption->string.def) {
4726 psoption->string.def = fc_strdup(packet->default_val);
4727 } else if (0 != strcmp(packet->default_val, psoption->string.def)) {
4728 free(psoption->string.def);
4729 psoption->string.def = fc_strdup(packet->default_val);
4730 }
4731 }
4732
4735
4736/************************************************************************/
4740 (const struct packet_server_setting_enum *packet)
4741{
4744 bool need_gui_remove = FALSE;
4745 bool need_gui_add = FALSE;
4746
4748
4749 if (NULL == poption->common_vtable) {
4750 /* Not initialized yet. */
4751 poption->poptset = server_optset;
4752 poption->common_vtable = &server_option_common_vtable;
4753 poption->type = OT_ENUM;
4754 poption->enum_vtable = &server_option_enum_vtable;
4755 }
4757 "Server setting \"%s\" (nb %d) has type %s (%d), "
4758 "expected %s (%d)",
4760 option_type_name(poption->type), poption->type,
4762
4763 if (packet->is_visible) {
4764 int i;
4765
4766 psoption->enumerator.value = packet->val;
4767 psoption->enumerator.def = packet->default_val;
4768
4769 if (NULL == psoption->enumerator.support_names) {
4770 /* First time we get this packet. */
4771 fc_assert(NULL == psoption->enumerator.pretty_names);
4772 psoption->enumerator.support_names = strvec_new();
4773 strvec_reserve(psoption->enumerator.support_names, packet->values_num);
4774 psoption->enumerator.pretty_names = strvec_new();
4775 strvec_reserve(psoption->enumerator.pretty_names, packet->values_num);
4776 for (i = 0; i < packet->values_num; i++) {
4777 strvec_set(psoption->enumerator.support_names, i,
4778 packet->support_names[i]);
4779 /* Store untranslated string from server. */
4780 strvec_set(psoption->enumerator.pretty_names, i,
4781 packet->pretty_names[i]);
4782 }
4783 } else if (strvec_size(psoption->enumerator.support_names)
4784 != packet->values_num) {
4785 fc_assert(strvec_size(psoption->enumerator.support_names)
4786 == strvec_size(psoption->enumerator.pretty_names));
4787 /* The number of values have changed, we need to reset the list
4788 * of possible values. */
4789 strvec_reserve(psoption->enumerator.support_names, packet->values_num);
4790 strvec_reserve(psoption->enumerator.pretty_names, packet->values_num);
4791 for (i = 0; i < packet->values_num; i++) {
4792 strvec_set(psoption->enumerator.support_names, i,
4793 packet->support_names[i]);
4794 /* Store untranslated string from server. */
4795 strvec_set(psoption->enumerator.pretty_names, i,
4796 packet->pretty_names[i]);
4797 }
4800 } else {
4801 /* Check if a value changed, then we need to reset the list
4802 * of possible values. */
4803 const char *str;
4804
4805 for (i = 0; i < packet->values_num; i++) {
4806 str = strvec_get(psoption->enumerator.pretty_names, i);
4807 if (NULL == str || 0 != strcmp(str, packet->pretty_names[i])) {
4808 /* Store untranslated string from server. */
4809 strvec_set(psoption->enumerator.pretty_names, i,
4810 packet->pretty_names[i]);
4813 }
4814 /* Support names are not visible, we don't need to check if it
4815 * has changed. */
4816 strvec_set(psoption->enumerator.support_names, i,
4817 packet->support_names[i]);
4818 }
4819 }
4820 }
4821
4824
4825/************************************************************************/
4829 (const struct packet_server_setting_bitwise *packet)
4830{
4833 bool need_gui_remove = FALSE;
4834 bool need_gui_add = FALSE;
4835
4837
4838 if (NULL == poption->common_vtable) {
4839 /* Not initialized yet. */
4840 poption->poptset = server_optset;
4841 poption->common_vtable = &server_option_common_vtable;
4842 poption->type = OT_BITWISE;
4843 poption->bitwise_vtable = &server_option_bitwise_vtable;
4844 }
4846 "Server setting \"%s\" (nb %d) has type %s (%d), "
4847 "expected %s (%d)",
4849 option_type_name(poption->type), poption->type,
4851
4852 if (packet->is_visible) {
4853 int i;
4854
4855 psoption->bitwise.value = packet->val;
4856 psoption->bitwise.def = packet->default_val;
4857
4858 if (NULL == psoption->bitwise.support_names) {
4859 /* First time we get this packet. */
4860 fc_assert(NULL == psoption->bitwise.pretty_names);
4861 psoption->bitwise.support_names = strvec_new();
4862 strvec_reserve(psoption->bitwise.support_names, packet->bits_num);
4863 psoption->bitwise.pretty_names = strvec_new();
4864 strvec_reserve(psoption->bitwise.pretty_names, packet->bits_num);
4865 for (i = 0; i < packet->bits_num; i++) {
4866 strvec_set(psoption->bitwise.support_names, i,
4867 packet->support_names[i]);
4868 /* Store untranslated string from server. */
4869 strvec_set(psoption->bitwise.pretty_names, i,
4870 packet->pretty_names[i]);
4871 }
4872 } else if (strvec_size(psoption->bitwise.support_names)
4873 != packet->bits_num) {
4874 fc_assert(strvec_size(psoption->bitwise.support_names)
4875 == strvec_size(psoption->bitwise.pretty_names));
4876 /* The number of values have changed, we need to reset the list
4877 * of possible values. */
4878 strvec_reserve(psoption->bitwise.support_names, packet->bits_num);
4879 strvec_reserve(psoption->bitwise.pretty_names, packet->bits_num);
4880 for (i = 0; i < packet->bits_num; i++) {
4881 strvec_set(psoption->bitwise.support_names, i,
4882 packet->support_names[i]);
4883 /* Store untranslated string from server. */
4884 strvec_set(psoption->bitwise.pretty_names, i,
4885 packet->pretty_names[i]);
4886 }
4889 } else {
4890 /* Check if a value changed, then we need to reset the list
4891 * of possible values. */
4892 const char *str;
4893
4894 for (i = 0; i < packet->bits_num; i++) {
4895 str = strvec_get(psoption->bitwise.pretty_names, i);
4896 if (NULL == str || 0 != strcmp(str, packet->pretty_names[i])) {
4897 /* Store untranslated string from server. */
4898 strvec_set(psoption->bitwise.pretty_names, i,
4899 packet->pretty_names[i]);
4902 }
4903 /* Support names are not visible, we don't need to check if it
4904 * has changed. */
4905 strvec_set(psoption->bitwise.support_names, i,
4906 packet->support_names[i]);
4907 }
4908 }
4909 }
4910
4912}
4914/************************************************************************/
4917static struct server_option *
4919{
4920 if (server_options != NULL) {
4921 const struct server_option *const max =
4923
4925 poption++;
4926 }
4927
4928 return (poption < max ? poption : NULL);
4929 }
4930
4931 return NULL;
4933
4934/************************************************************************/
4938{
4939 if (0 > id || id > server_options_num) {
4940 return NULL;
4941 }
4942 return OPTION(server_options + id);
4944
4945/************************************************************************/
4949{
4952
4953/************************************************************************/
4957{
4960
4961/************************************************************************/
4964const char *server_optset_category_name(int category)
4965{
4966 if (0 > category || category >= server_options_categories_num) {
4967 return NULL;
4968 }
4969
4970 return server_options_categories[category];
4972
4973/************************************************************************/
4976static int server_option_number(const struct option *poption)
4977{
4980
4981/************************************************************************/
4984static const char *server_option_name(const struct option *poption)
4985{
4986 return SERVER_OPTION(poption)->name;
4988
4989/************************************************************************/
4992static const char *server_option_description(const struct option *poption)
4993{
4994 return SERVER_OPTION(poption)->description;
4996
4997/************************************************************************/
5000static const char *server_option_help_text(const struct option *poption)
5001{
5002 return SERVER_OPTION(poption)->help_text;
5004
5005/************************************************************************/
5008static int server_option_category(const struct option *poption)
5009{
5010 return SERVER_OPTION(poption)->category;
5012
5013/************************************************************************/
5016static bool server_option_is_changeable(const struct option *poption)
5017{
5018 return SERVER_OPTION(poption)->is_changeable;
5020
5021/************************************************************************/
5024static struct option *server_option_next(const struct option *poption)
5025{
5028
5029/************************************************************************/
5032static bool server_option_bool_get(const struct option *poption)
5033{
5034 return SERVER_OPTION(poption)->boolean.value;
5036
5037/************************************************************************/
5040static bool server_option_bool_def(const struct option *poption)
5041{
5042 return SERVER_OPTION(poption)->boolean.def;
5043}
5045/************************************************************************/
5049static bool server_option_bool_set(struct option *poption, bool val)
5050{
5052
5053 if (psoption->boolean.value == val) {
5054 return FALSE;
5055 }
5056
5057 send_chat_printf("/set %s %s", psoption->name,
5058 val ? "enabled" : "disabled");
5059 return TRUE;
5061
5062/************************************************************************/
5065static int server_option_int_get(const struct option *poption)
5066{
5067 return SERVER_OPTION(poption)->integer.value;
5069
5070/************************************************************************/
5073static int server_option_int_def(const struct option *poption)
5074{
5075 return SERVER_OPTION(poption)->integer.def;
5077
5078/************************************************************************/
5081static int server_option_int_min(const struct option *poption)
5082{
5083 return SERVER_OPTION(poption)->integer.min;
5085
5086/************************************************************************/
5089static int server_option_int_max(const struct option *poption)
5090{
5091 return SERVER_OPTION(poption)->integer.max;
5092}
5094/************************************************************************/
5098static bool server_option_int_set(struct option *poption, int val)
5099{
5101
5103 || val > psoption->integer.max
5104 || psoption->integer.value == val) {
5105 return FALSE;
5106 }
5107
5108 send_chat_printf("/set %s %d", psoption->name, val);
5109 return TRUE;
5111
5112/************************************************************************/
5115static const char *server_option_str_get(const struct option *poption)
5116{
5117 return SERVER_OPTION(poption)->string.value;
5119
5120/************************************************************************/
5123static const char *server_option_str_def(const struct option *poption)
5124{
5125 return SERVER_OPTION(poption)->string.def;
5126}
5127
5128/************************************************************************/
5132static const struct strvec *
5134{
5135 return NULL;
5136}
5138/************************************************************************/
5142static bool server_option_str_set(struct option *poption, const char *str)
5143{
5145
5146 if (0 == strcmp(psoption->string.value, str)) {
5147 return FALSE;
5148 }
5149
5150 send_chat_printf("/set %s \"%s\"", psoption->name, str);
5151 return TRUE;
5153
5154/************************************************************************/
5157static int server_option_enum_get(const struct option *poption)
5158{
5159 return SERVER_OPTION(poption)->enumerator.value;
5161
5162/************************************************************************/
5165static int server_option_enum_def(const struct option *poption)
5166{
5167 return SERVER_OPTION(poption)->enumerator.def;
5168}
5169
5170/************************************************************************/
5174static const struct strvec *
5176{
5177 return SERVER_OPTION(poption)->enumerator.pretty_names;
5178}
5180/************************************************************************/
5184static bool server_option_enum_set(struct option *poption, int val)
5185{
5187 const char *name;
5188
5189 if (val == psoption->enumerator.value
5190 || !(name = strvec_get(psoption->enumerator.support_names, val))) {
5191 return FALSE;
5192 }
5193
5194 send_chat_printf("/set %s \"%s\"", psoption->name, name);
5195 return TRUE;
5196}
5198/************************************************************************/
5202static void server_option_enum_support_name(const struct option *poption,
5203 const char **pvalue,
5204 const char **pdefault)
5205{
5207 const struct strvec *values = psoption->enumerator.support_names;
5208
5209 if (NULL != pvalue) {
5210 *pvalue = strvec_get(values, psoption->enumerator.value);
5211 }
5212 if (NULL != pdefault) {
5213 *pdefault = strvec_get(values, psoption->enumerator.def);
5214 }
5216
5217/************************************************************************/
5220static unsigned server_option_bitwise_get(const struct option *poption)
5221{
5222 return SERVER_OPTION(poption)->bitwise.value;
5224
5225/************************************************************************/
5228static unsigned server_option_bitwise_def(const struct option *poption)
5229{
5230 return SERVER_OPTION(poption)->bitwise.def;
5231}
5232
5233/************************************************************************/
5237static const struct strvec *
5239{
5240 return SERVER_OPTION(poption)->bitwise.pretty_names;
5242
5243/************************************************************************/
5246static void server_option_bitwise_support_base(const struct strvec *values,
5247 unsigned val,
5248 char *buf, size_t buf_len)
5249{
5250 int bit;
5251
5252 buf[0] = '\0';
5253 for (bit = 0; bit < strvec_size(values); bit++) {
5254 if ((1 << bit) & val) {
5255 if ('\0' != buf[0]) {
5256 fc_strlcat(buf, "|", buf_len);
5257 }
5258 fc_strlcat(buf, strvec_get(values, bit), buf_len);
5259 }
5260 }
5261}
5263/************************************************************************/
5267static bool server_option_bitwise_set(struct option *poption, unsigned val)
5268{
5270 char name[MAX_LEN_MSG];
5271
5272 if (val == psoption->bitwise.value) {
5273 return FALSE;
5274 }
5275
5276 server_option_bitwise_support_base(psoption->bitwise.support_names, val,
5277 name, sizeof(name));
5278 send_chat_printf("/set %s \"%s\"", psoption->name, name);
5279 return TRUE;
5280}
5282/************************************************************************/
5286static void server_option_bitwise_support_name(const struct option *poption,
5287 char *val_buf, size_t val_len,
5288 char *def_buf, size_t def_len)
5289{
5291 const struct strvec *values = psoption->bitwise.support_names;
5292
5293 if (NULL != val_buf && 0 < val_len) {
5294 server_option_bitwise_support_base(values, psoption->bitwise.value,
5295 val_buf, val_len);
5296 }
5297 if (NULL != def_buf && 0 < def_len) {
5298 server_option_bitwise_support_base(values, psoption->bitwise.def,
5299 def_buf, def_len);
5300 }
5302
5303
5307
5309/************************************************************************/
5313static void message_options_init(void)
5314{
5315 int none[] = {
5321 };
5322 int out_only[] = {
5325 };
5326 int all[] = {
5328 };
5329 int i;
5330
5331 for (i = 0; i <= event_type_max(); i++) {
5332 /* Include possible undefined values. */
5334 }
5335 for (i = 0; i < ARRAY_SIZE(none); i++) {
5336 messages_where[none[i]] = 0;
5337 }
5338 for (i = 0; i < ARRAY_SIZE(out_only); i++) {
5340 }
5341 for (i = 0; i < ARRAY_SIZE(all); i++) {
5343 }
5344
5345 events_init();
5347
5348/************************************************************************/
5351static void message_options_free(void)
5352{
5353 events_free();
5354}
5356/************************************************************************/
5360static void message_options_load(struct section_file *file,
5361 const char *prefix)
5362{
5363 enum event_type event;
5364 int i, num_events;
5365 const char *p;
5366
5367 if (!secfile_lookup_int(file, &num_events, "messages.count")) {
5368 /* version < 2.2 */
5369 /* Order of the events in 2.1. */
5370 const enum event_type old_events[] = {
5399 };
5400 const size_t old_events_num = ARRAY_SIZE(old_events);
5401
5402 for (i = 0; i < old_events_num; i++) {
5405 "%s.message_where_%02d", prefix, i);
5406 }
5407 return;
5408 }
5409
5410 for (i = 0; i < num_events; i++) {
5411 p = secfile_lookup_str(file, "messages.event%d.name", i);
5412 if (NULL == p) {
5413 log_error("Corruption in file %s: %s",
5414 secfile_name(file), secfile_error());
5415 continue;
5416 }
5417 /* Compatibility: Before 3.0 E_UNIT_WIN_DEF was called E_UNIT_WIN. */
5418 if (!fc_strcasecmp("E_UNIT_WIN", p)) {
5419 log_deprecation(_("Deprecated event type E_UNIT_WIN in client options."));
5420 p = "E_UNIT_WIN_DEF";
5421 }
5422 event = event_type_by_name(p, strcmp);
5423 if (!event_type_is_valid(event)) {
5424 log_error("Event not supported: %s", p);
5425 continue;
5426 }
5427
5429 "messages.event%d.where", i)) {
5430 log_error("Corruption in file %s: %s",
5431 secfile_name(file), secfile_error());
5432 }
5433 }
5434}
5436/************************************************************************/
5440static void message_options_save(struct section_file *file,
5441 const char *prefix)
5442{
5443 enum event_type event;
5444 int i = 0;
5445
5446 for (event = event_type_begin(); event != event_type_end();
5447 event = event_type_next(event)) {
5449 "messages.event%d.name", i);
5451 "messages.event%d.where", i);
5452 i++;
5453 }
5454
5455 secfile_insert_int(file, i, "messages.count");
5457
5458/************************************************************************/
5461static void load_cma_preset(struct section_file *file, int i)
5462{
5463 struct cm_parameter parameter;
5464 const char *name =
5465 secfile_lookup_str_default(file, "preset",
5466 "cma.preset%d.name", i);
5467
5468 /* Init correct default values even for the fields that are not
5469 * loaded below. */
5470 cm_init_parameter(&parameter);
5471
5473 parameter.minimal_surplus[o] =
5474 secfile_lookup_int_default(file, 0, "cma.preset%d.minsurp%d", i, o);
5475 parameter.factor[o] =
5476 secfile_lookup_int_default(file, 0, "cma.preset%d.factor%d", i, o);
5478 parameter.require_happy =
5479 secfile_lookup_bool_default(file, FALSE, "cma.preset%d.reqhappy", i);
5480 parameter.happy_factor =
5481 secfile_lookup_int_default(file, 0, "cma.preset%d.happyfactor", i);
5482 parameter.allow_disorder = FALSE;
5483 parameter.allow_specialists = TRUE;
5484
5485 cmafec_preset_add(name, &parameter);
5487
5488/************************************************************************/
5491static void save_cma_preset(struct section_file *file, int i)
5492{
5493 const struct cm_parameter *const pparam = cmafec_preset_get_parameter(i);
5495
5496 secfile_insert_str(file, name, "cma.preset%d.name", i);
5497
5499 secfile_insert_int(file, pparam->minimal_surplus[o],
5500 "cma.preset%d.minsurp%d", i, o);
5501 secfile_insert_int(file, pparam->factor[o],
5502 "cma.preset%d.factor%d", i, o);
5504 secfile_insert_bool(file, pparam->require_happy,
5505 "cma.preset%d.reqhappy", i);
5506 secfile_insert_int(file, pparam->happy_factor,
5507 "cma.preset%d.happyfactor", i);
5509
5510/************************************************************************/
5513static void save_cma_presets(struct section_file *file)
5514{
5515 int i;
5516
5518 _("If you add a preset by hand,"
5519 " also update \"number_of_presets\""),
5520 "cma.number_of_presets");
5521 for (i = 0; i < cmafec_preset_num(); i++) {
5524}
5525
5526/* RC file name. */
5527#define MID_OPTION_FILE_NAME ".freeciv-client-rc-%d.%d"
5528#define NEW_OPTION_FILE_NAME "freeciv-client-rc-%d.%d"
5530/* The first version the new option name appeared (2.6). */
5531#define FIRST_MAJOR_NEW_OPTION_FILE_NAME 2
5532#define FIRST_MINOR_NEW_OPTION_FILE_NAME 6
5533/* The first version the mid option name appeared (2.2). */
5534#define FIRST_MAJOR_MID_OPTION_FILE_NAME 2
5535#define FIRST_MINOR_MID_OPTION_FILE_NAME 2
5536/* The first version the new boolean values appeared (2.3). */
5537#define FIRST_MAJOR_NEW_BOOLEAN 2
5538#define FIRST_MINOR_NEW_BOOLEAN 3
5539
5540/************************************************************************/
5547static const char *get_current_option_file_name(void)
5548{
5549 static char name_buffer[256];
5550 const char *name;
5551
5552 name = getenv("FREECIV_OPT");
5553
5554 if (name) {
5556 } else {
5557#ifdef OPTION_FILE_NAME
5559#else
5561 if (!name) {
5562 log_error(_("Cannot find freeciv storage directory"));
5563 return NULL;
5564 }
5568#endif /* OPTION_FILE_NAME */
5569 }
5570 log_verbose("settings file is %s", name_buffer);
5571 return name_buffer;
5572}
5573
5574/************************************************************************/
5582static const char *get_last_option_file_name(bool *allow_digital_boolean)
5583{
5584 static char name_buffer[256];
5585 const char *name;
5586 static int last_minors[] = {
5587 0, /* There was no 0.x releases */
5588 14, /* 1.14 */
5589 6 /* 2.6 */
5590 };
5591
5592#if MINOR_VERSION >= 90
5594#else
5596#endif
5597
5598 *allow_digital_boolean = FALSE;
5599 name = getenv("FREECIV_OPT");
5600 if (name) {
5602 } else {
5603#ifdef OPTION_FILE_NAME
5605#else
5606 int major, minor;
5607 struct stat buf;
5608
5610 if (name == NULL) {
5611 log_error(_("Cannot find freeciv storage directory"));
5612
5613 return NULL;
5614 }
5615
5621 : minor >= 0); minor--) {
5624 if (0 == fc_stat(name_buffer, &buf)) {
5627 log_normal(_("Didn't find '%s' option file, "
5628 "loading from '%s' instead."),
5630 name_buffer + strlen(name) + 1);
5631 }
5632
5633 return name_buffer;
5634 }
5635 }
5636 minor = last_minors[major - 1];
5637 }
5638
5639 /* Older versions had options file in user home directory */
5640 name = user_home_dir();
5641 if (name == NULL) {
5642 log_error(_("Cannot find your home directory"));
5643
5644 return NULL;
5645 }
5646
5647 /* Minor having max value of FIRST_MINOR_NEW_OPTION_FILE_NAME
5648 * works since MID versioning scheme was used within major version 2
5649 * only (2.2 - 2.6) so the last minor is bigger than any earlier minor. */
5653 minor--) {
5656 if (0 == fc_stat(name_buffer, &buf)) {
5657 log_normal(_("Didn't find '%s' option file, "
5658 "loading from '%s' instead."),
5660 name_buffer + strlen(name) + 1);
5661
5663 *allow_digital_boolean = TRUE;
5664 }
5665 return name_buffer;
5666 }
5667 }
5668
5669 return NULL;
5670#endif /* OPTION_FILE_NAME */
5671 }
5672 log_verbose("settings file is %s", name_buffer);
5673
5674 return name_buffer;
5675}
5676#undef MID_OPTION_FILE_NAME
5677#undef NEW_OPTION_FILE_NAME
5678#undef FIRST_MAJOR_NEW_OPTION_FILE_NAME
5679#undef FIRST_MINOR_NEW_OPTION_FILE_NAME
5680#undef FIRST_MAJOR_MID_OPTION_FILE_NAME
5681#undef FIRST_MINOR_MID_OPTION_FILE_NAME
5682#undef FIRST_MINOR_NEW_BOOLEAN
5685/****************************************************************************
5686 Desired settable options.
5687****************************************************************************/
5688#define SPECHASH_TAG settable_options
5689#define SPECHASH_ASTR_KEY_TYPE
5690#define SPECHASH_ASTR_DATA_TYPE
5691#include "spechash.h"
5692#define settable_options_hash_iterate(hash, name, value) \
5693 TYPED_HASH_ITERATE(const char *, const char *, hash, name, value)
5694#define settable_options_hash_iterate_end HASH_ITERATE_END
5695
5697
5698/************************************************************************/
5701static void settable_options_load(struct section_file *sf)
5702{
5703 char buf[64];
5704 const struct section *psection;
5705 const struct entry_list *entries;
5706 const char *string;
5707 bool bval;
5708 int ival;
5709
5711
5713
5714 psection = secfile_section_by_name(sf, "server");
5715 if (NULL == psection) {
5716 /* Does not exist! */
5717 return;
5718 }
5719
5720 entries = section_entries(psection);
5722 string = NULL;
5723 switch (entry_type_get(pentry)) {
5724 case ENTRY_BOOL:
5725 if (entry_bool_get(pentry, &bval)) {
5726 fc_strlcpy(buf, bval ? "enabled" : "disabled", sizeof(buf));
5727 string = buf;
5728 }
5729 break;
5730
5731 case ENTRY_INT:
5732 if (entry_int_get(pentry, &ival)) {
5733 fc_snprintf(buf, sizeof(buf), "%d", ival);
5734 string = buf;
5735 }
5736 break;
5737
5738 case ENTRY_STR:
5739 (void) entry_str_get(pentry, &string);
5740 break;
5741
5742 case ENTRY_FLOAT:
5744 /* Not supported yet */
5745 break;
5746 case ENTRY_LONG_COMMENT:
5748 break;
5749 case ENTRY_ILLEGAL:
5751 break;
5752 }
5753
5754 if (NULL == string) {
5755 log_error("Entry type variant of \"%s.%s\" is not supported.",
5756 section_name(psection), entry_name(pentry));
5757 continue;
5758 }
5759
5761 string);
5764
5765/************************************************************************/
5768static void settable_options_save(struct section_file *sf)
5769{
5771
5773 if (!fc_strcasecmp(name, "gameseed") || !fc_strcasecmp(name, "mapseed")) {
5774 /* Do not save mapseed or gameseed. */
5775 continue;
5776 }
5777 if (!fc_strcasecmp(name, "topology")) {
5778 /* client_start_server() sets topology based on tileset. Don't store
5779 * its choice. The tileset is already stored. Storing topology leads
5780 * to all sort of breakage:
5781 * - it breaks ruleset default topology.
5782 * - it interacts badly with tileset ruleset change, ruleset tileset
5783 * change and topology tileset change.
5784 * - its value is probably based on what tileset was loaded when
5785 * client_start_server() decided to set topology, not on player
5786 * choice.
5787 */
5788 continue;
5789 }
5790 secfile_insert_str(sf, value, "server.%s", name);
5792}
5794/************************************************************************/
5799{
5800 char val_buf[1024], def_buf[1024];
5801 const char *value, *def_val;
5802
5804
5807
5808 if (srv->setdef != SETDEF_CHANGED) {
5809 /* Some level default - do not store */
5812 } else {
5813 value = NULL;
5814 def_val = NULL;
5815 switch (option_type(poption)) {
5816 case OT_BOOLEAN:
5817 fc_strlcpy(val_buf, option_bool_get(poption) ? "enabled" : "disabled",
5818 sizeof(val_buf));
5819 value = val_buf;
5820 fc_strlcpy(def_buf, option_bool_def(poption) ? "enabled" : "disabled",
5821 sizeof(def_buf));
5822 def_val = def_buf;
5823 break;
5824 case OT_INTEGER:
5826 value = val_buf;
5828 def_val = def_buf;
5829 break;
5830 case OT_STRING:
5833 break;
5834 case OT_ENUM:
5836 break;
5837 case OT_BITWISE:
5839 def_buf, sizeof(def_buf));
5840 value = val_buf;
5841 def_val = def_buf;
5842 break;
5843 case OT_FONT:
5844 case OT_COLOR:
5845 case OT_VIDEO_MODE:
5846 break;
5847 }
5848
5849 if (NULL == value || NULL == def_val) {
5850 log_error("Option type %s (%d) not supported for '%s'.",
5853 continue;
5854 }
5855
5858 }
5860}
5862/************************************************************************/
5867 const char *op_value,
5868 bool allow_replace)
5869{
5871
5872 if (allow_replace) {
5874 } else {
5876 }
5877}
5879/************************************************************************/
5883static bool settable_option_upgrade_value(const struct option *poption,
5884 int old_value,
5885 char *buf, size_t buf_len)
5886{
5887 const char *name = option_name(poption);
5888
5889#define SETTING_CASE(ARG_name, ...) \
5890 if (0 == strcmp(ARG_name, name)) { \
5891 static const char *values[] = { __VA_ARGS__ }; \
5892 if (0 <= old_value && old_value < ARRAY_SIZE(values) \
5893 && NULL != values[old_value]) { \
5894 fc_strlcpy(buf, values[old_value], buf_len); \
5895 return TRUE; \
5896 } else { \
5897 return FALSE; \
5898 } \
5899 }
5900
5901 SETTING_CASE("topology", "", "WRAPX", "WRAPY", "WRAPX|WRAPY", "ISO",
5902 "WRAPX|ISO", "WRAPY|ISO", "WRAPX|WRAPY|ISO", "HEX",
5903 "WRAPX|HEX", "WRAPY|HEX", "WRAPX|WRAPY|HEX", "ISO|HEX",
5904 "WRAPX|ISO|HEX", "WRAPY|ISO|HEX", "WRAPX|WRAPY|ISO|HEX");
5905 SETTING_CASE("generator", NULL, "RANDOM", "FRACTAL", "ISLAND");
5906 SETTING_CASE("startpos", "DEFAULT", "SINGLE", "2or3", "ALL", "VARIABLE");
5907 SETTING_CASE("borders", "DISABLED", "ENABLED", "SEE_INSIDE", "EXPAND");
5908 SETTING_CASE("diplomacy", "ALL", "HUMAN", "AI", "TEAM", "DISABLED");
5909 SETTING_CASE("citynames", "NO_RESTRICTIONS", "PLAYER_UNIQUE",
5910 "GLOBAL_UNIQUE", "NO_STEALING");
5911 SETTING_CASE("barbarians", "DISABLED", "HUTS_ONLY", "NORMAL", "FREQUENT",
5912 "HORDES");
5913 SETTING_CASE("phasemode", "ALL", "PLAYER", "TEAM");
5914 SETTING_CASE("compresstype", "PLAIN", "LIBZ", "BZIP2");
5915
5916#undef SETTING_CASE
5917 return FALSE;
5919
5920/************************************************************************/
5923static void desired_settable_option_send(struct option *poption)
5924{
5925 char *desired;
5926 int value;
5927
5929
5932 /* No change explicitly desired. */
5933 return;
5934 }
5935
5936 switch (option_type(poption)) {
5937 case OT_BOOLEAN:
5938 if ((0 == fc_strcasecmp("enabled", desired)
5939 || (str_to_int(desired, &value) && 1 == value))
5940 && !option_bool_get(poption)) {
5941 send_chat_printf("/set %s enabled", option_name(poption));
5942 } else if ((0 == fc_strcasecmp("disabled", desired)
5943 || (str_to_int(desired, &value) && 0 == value))
5945 send_chat_printf("/set %s disabled", option_name(poption));
5946 }
5947 return;
5948 case OT_INTEGER:
5950 send_chat_printf("/set %s %d", option_name(poption), value);
5951 }
5952 return;
5953 case OT_STRING:
5954 if (0 != strcmp(desired, option_str_get(poption))) {
5955 send_chat_printf("/set %s \"%s\"", option_name(poption), desired);
5956 }
5957 return;
5958 case OT_ENUM:
5959 {
5960 char desired_buf[256];
5961 const char *value_str;
5962
5963 /* Handle old values. */
5964 if (str_to_int(desired, &value)
5966 sizeof(desired_buf))) {
5968 }
5969
5971 if (0 != strcmp(desired, value_str)) {
5972 send_chat_printf("/set %s \"%s\"", option_name(poption), desired);
5973 }
5974 }
5975 return;
5976 case OT_BITWISE:
5977 {
5978 char desired_buf[256], value_buf[256];
5979
5980 /* Handle old values. */
5981 if (str_to_int(desired, &value)
5983 sizeof(desired_buf))) {
5985 }
5986
5988 sizeof(value_buf), NULL, 0);
5989 if (0 != strcmp(desired, value_buf)) {
5990 send_chat_printf("/set %s \"%s\"", option_name(poption), desired);
5991 }
5992 }
5993 return;
5994 case OT_FONT:
5995 case OT_COLOR:
5996 case OT_VIDEO_MODE:
5997 break;
5998 }
5999
6000 log_error("Option type %s (%d) not supported for '%s'.",
6003}
6005/************************************************************************/
6010{
6013 (void) value; /* Silence compiler warning about unused variable */
6015
6016 if (poption != NULL) {
6018
6019 /* We only sent the option if it has been sent already in the past.
6020 * Otherwise we leave it for that "initial" sending functionality
6021 * to send it. That has the benefit that the initial send (can) check
6022 * that server is not currently using value from the savegame that
6023 * we should not override */
6024 if (psoption->desired_sent) {
6025 /* Keep this list of conditions in sync with one in
6026 * handle_server_setting_common()
6027 * For lacking initial_setting check here, see comment above about
6028 * checking psoption->desired_sent. */
6029 if (psoption->is_visible
6030 && psoption->is_changeable) {
6032 }
6033 }
6034 }
6036 }
6037}
6038
6039
6040/****************************************************************************
6041 City and player report dialog options.
6042****************************************************************************/
6043#define SPECHASH_TAG dialog_options
6044#define SPECHASH_ASTR_KEY_TYPE
6045#define SPECHASH_IDATA_TYPE bool
6046#define SPECHASH_UDATA_TO_IDATA FC_INT_TO_PTR
6047#define SPECHASH_IDATA_TO_UDATA FC_PTR_TO_INT
6048#define SPECHASH_VPTR_TO_IDATA FC_PTR_TO_INT
6049#include "spechash.h"
6050#define dialog_options_hash_iterate(hash, column, visible) \
6051 TYPED_HASH_ITERATE(const char *, intptr_t, hash, column, visible)
6052#define dialog_options_hash_iterate_end HASH_ITERATE_END
6053
6055
6056/************************************************************************/
6059static void options_dialogs_load(struct section_file *sf)
6060{
6061 const struct entry_list *entries;
6062 const char *prefixes[] = { "player_dlg_", "city_report_", NULL };
6063 const char **prefix;
6064 bool visible;
6065
6067
6069
6070 if (NULL != entries) {
6072 for (prefix = prefixes; NULL != *prefix; prefix++) {
6073 if (!fc_strncmp(*prefix, entry_name(pentry), strlen(*prefix))
6074 && secfile_lookup_bool(sf, &visible, "client.%s",
6075 entry_name(pentry))) {
6078 break;
6079 }
6080 }
6082 }
6084
6085/************************************************************************/
6088static void options_dialogs_save(struct section_file *sf)
6089{
6091
6094 secfile_insert_bool(sf, visible, "client.%s", column);
6096}
6097
6098/************************************************************************/
6103void options_dialogs_update(void)
6104{
6105 char buf[64];
6106 int i;
6107
6109
6110 /* Player report dialog options. */
6111 for (i = 1; i < num_player_dlg_columns; i++) {
6112 fc_snprintf(buf, sizeof(buf), "player_dlg_%s",
6113 player_dlg_columns[i].tagname);
6116 }
6117
6118 /* City report dialog options. */
6119 for (i = 0; i < num_city_report_spec(); i++) {
6120 fc_snprintf(buf, sizeof(buf), "city_report_%s",
6124 }
6125}
6127/************************************************************************/
6131void options_dialogs_set(void)
6132{
6133 char buf[64];
6134 bool visible;
6135 int i;
6136
6138
6139 /* Player report dialog options. */
6140 for (i = 1; i < num_player_dlg_columns; i++) {
6141 fc_snprintf(buf, sizeof(buf), "player_dlg_%s",
6142 player_dlg_columns[i].tagname);
6145 }
6146 }
6147
6148 /* City report dialog options. */
6149 for (i = 0; i < num_city_report_spec(); i++) {
6150 fc_snprintf(buf, sizeof(buf), "city_report_%s",
6154 }
6155 }
6156}
6157
6158/************************************************************************/
6164void options_load(void)
6165{
6166 struct section_file *sf;
6168 int i, num;
6169 const char *name;
6170 const char *const prefix = "client";
6171 const char *str;
6172
6174 if (!name) {
6175 log_normal(_("Didn't find the option file. Creating a new one."));
6179 return;
6180 }
6181 if (!(sf = secfile_load(name, TRUE))) {
6182 log_debug("Error loading option file '%s':\n%s", name, secfile_error());
6183 /* Try to create the rc file */
6184 sf = secfile_new(TRUE);
6185 secfile_insert_str(sf, VERSION_STRING, "client.version");
6186
6189 save_cma_presets(sf);
6190
6191 /* FIXME: need better messages */
6192 if (!secfile_save(sf, name, 0, FZ_PLAIN)) {
6193 log_error(_("Save failed, cannot write to file %s"), name);
6194 } else {
6195 log_normal(_("Saved settings to file %s"), name);
6196 }
6197 secfile_destroy(sf);
6199 return;
6200 }
6202
6203 /* A "secret" option for the lazy. TODO: make this saveable */
6205 secfile_lookup_str_default(sf, "", "%s.password", prefix));
6206
6209 "%s.save_options_on_exit", prefix);
6212 "%s.fullscreen_mode", prefix);
6213
6214 /* Settings migrations */
6217 "%s.migration_gtk3_from_gtk2", prefix);
6220 "%s.migration_gtk3_22_from_gtk3", prefix);
6223 "%s.migration_gtk4_from_gtk3_22", prefix);
6226 "%s.migration_gtk5_from_gtk4", prefix);
6229 "%s.migration_sdl2_from_sdl", prefix);
6232 "%s.migration_sdl3_from_sdl2", prefix);
6235 "%s.migration_gtk2_from_2_5", prefix);
6238 "%s.migration_gtk3_from_2_5", prefix);
6241 "%s.migration_qt_from_2_5", prefix);
6242
6243 /* Flag values */
6246 "%s.flag_qt_default_fonts_set", prefix);
6249 "%s.flag_sdl2_default_screen_size_set", prefix);
6252 "%s.flag_sdl3_default_screen_size_set", prefix);
6253
6254 /* These are not gui-enabled yet */
6256 = secfile_lookup_bool_default(sf, FALSE, "%s.zoom_set", prefix);
6259 "%s.zoom_default_level", prefix);
6260
6263 "%s.gui_qt_show_relations_panel", prefix);
6266 "%s.gui_qt_show_techs_panel", prefix);
6269 "%s.gui_qt_show_wonders_panel", prefix);
6270
6271 /* default_tileset_name present until freeciv-3.2 */
6272 str = secfile_lookup_str_default(sf, NULL, "client.default_tileset_name");
6273 if (str == NULL) {
6275 "client.default_topology");
6276 } else {
6278 }
6279 str = secfile_lookup_str_default(sf, NULL, "client.default_tileset_overhead_name");
6280 if (str != NULL) {
6282 }
6283 str = secfile_lookup_str_default(sf, NULL, "client.default_tileset_iso_name");
6284 if (str != NULL) {
6286 }
6287
6288 /* Backwards compatibility for removed options replaced by entirely "new"
6289 * options. The equivalent "new" option will override these, if set. */
6290
6291 /* Renamed in 2.6 */
6293 "%s.popup_caravan_arrival", prefix);
6294
6295 /* Load all the regular options */
6299
6300 /* More backwards compatibility, for removed options that had been
6301 * folded into then-existing options. Here, the backwards-compatibility
6302 * behaviour overrides the "destination" option. */
6303
6304 /* Removed in 2.4 */
6306 "%s.do_combat_animation", prefix)) {
6308 }
6309
6310 message_options_load(sf, prefix);
6312
6313 /* Load cma presets. If cma.number_of_presets doesn't exist, don't load
6314 * any, the order here should be reversed to keep the order the same */
6315 if (secfile_lookup_int(sf, &num, "cma.number_of_presets")) {
6316 for (i = num - 1; i >= 0; i--) {
6317 load_cma_preset(sf, i);
6318 }
6319 } else {
6321 }
6322
6325
6326 secfile_destroy(sf);
6329
6330/************************************************************************/
6334 const char *msg, ...)
6335{
6336 va_list args;
6337
6338 va_start(args, msg);
6340 va_end(args);
6342
6343/************************************************************************/
6347{
6348 struct section_file *sf;
6349 const char *name = get_current_option_file_name();
6350 char dir_name[2048];
6351 int i;
6352
6353 if (log_cb == NULL) {
6354 /* Default callback */
6356 }
6357
6358 if (!name) {
6359 log_cb(LOG_ERROR, _("Save failed, cannot find a filename."));
6360 return;
6361 }
6362
6363 sf = secfile_new(TRUE);
6364 secfile_insert_str(sf, VERSION_STRING, "client.version");
6365
6367 "client.save_options_on_exit");
6369 "deprecated", "client.fullscreen_mode");
6370
6371 /* Migrations */
6373 "client.migration_gtk3_from_gtk2");
6375 "client.migration_gtk3_22_from_gtk3");
6377 "client.migration_gtk4_from_gtk3_22");
6379 "client.migration_gtk5_from_gtk4");
6381 "client.migration_sdl2_from_sdl");
6383 "client.migration_sdl3_from_sdl2");
6385 "client.migration_gtk2_from_2_5");
6387 "client.migration_gtk3_from_2_5");
6389 "client.migration_qt_from_2_5");
6390
6391 /* Flag */
6393 "client.flag_qt_default_fonts_set");
6395 "client.flag_sdl2_default_screen_size_set");
6397 "client.flag_sdl3_default_screen_size_set");
6398
6399 /* gui-enabled options */
6404 /* Once options have been migrated from a client that no longer exist to a newer client,
6405 * there's no use for those settings of dropped client any more, so no point in saving them. */
6407 }
6409
6410 /* These are not gui-enabled yet. */
6411 secfile_insert_bool(sf, gui_options.zoom_set, "client.zoom_set");
6413 "client.zoom_default_level");
6414
6416 "client.gui_qt_show_relations_panel");
6418 "client.gui_qt_show_techs_panel");
6420 "client.gui_qt_show_wonders_panel");
6421
6422 if (tileset != NULL) {
6424 "client.default_topology");
6425 } else {
6427 "client.default_topology");
6428 }
6429
6430 message_options_save(sf, "client");
6432
6433 /* Server settings */
6434 save_cma_presets(sf);
6436
6437 /* Insert global worklists */
6439
6440 /* Directory name */
6442 for (i = strlen(dir_name) - 1 ; dir_name[i] != DIR_SEPARATOR_CHAR && i >= 0; i--) {
6443 /* Nothing */
6444 }
6445
6446 if (i > 0) {
6447 dir_name[i] = '\0';
6449 log_cb(LOG_ERROR, _("Saving options failed, cannot create directory %s"),
6450 dir_name);
6451 secfile_destroy(sf);
6452 return;
6453 }
6454 }
6455
6456 /* Save to disk */
6457 if (!secfile_save(sf, name, 0, FZ_PLAIN)) {
6458 log_cb(LOG_ERROR, _("Saving options failed, cannot write to file %s"), name);
6459 } else {
6460 log_cb(LOG_VERBOSE, _("Saved options to file %s"), name);
6461 }
6462 secfile_destroy(sf);
6464
6465/************************************************************************/
6468static void options_init_names(const struct copt_val_name *(*acc)(int),
6469 struct strvec **support, struct strvec **pretty)
6470{
6471 int val;
6472 const struct copt_val_name *name;
6473
6475 *support = strvec_new();
6476 *pretty = strvec_new();
6477 for (val = 0; (name = acc(val)); val++) {
6478 strvec_append(*support, name->support);
6479 strvec_append(*pretty, name->pretty);
6480 }
6482
6483/************************************************************************/
6486void options_init(void)
6487{
6491
6494
6497
6498 switch (option_type(poption)) {
6499 case OT_INTEGER:
6506
6507 log_error("option %s has default value of %d, which is "
6508 "out of its range [%d; %d], changing to %d.",
6511 new_default);
6512 *((int *) &(pcoption->integer.def)) = new_default;
6513 }
6514 break;
6515
6516 case OT_STRING:
6518 /* Hack to get a default value. */
6519 *((const char **) &(pcoption->string.def)) =
6521 }
6522
6523 if (NULL == option_str_def(poption)) {
6524 const struct strvec *values = option_str_values(poption);
6525
6526 if (NULL == values || strvec_size(values) == 0) {
6527 log_error("Invalid NULL default string for option %s.",
6529 } else {
6530 *((const char **) &(pcoption->string.def)) =
6531 strvec_get(values, 0);
6532 }
6533 }
6534 break;
6535
6536 case OT_ENUM:
6537 fc_assert(NULL == pcoption->enumerator.support_names);
6538 fc_assert(NULL == pcoption->enumerator.pretty_names);
6539 options_init_names(pcoption->enumerator.name_accessor,
6540 &pcoption->enumerator.support_names,
6541 &pcoption->enumerator.pretty_names);
6542 fc_assert(NULL != pcoption->enumerator.support_names);
6543 fc_assert(NULL != pcoption->enumerator.pretty_names);
6544 break;
6545
6546 case OT_BITWISE:
6547 fc_assert(NULL == pcoption->bitwise.support_names);
6548 fc_assert(NULL == pcoption->bitwise.pretty_names);
6549 options_init_names(pcoption->bitwise.name_accessor,
6550 &pcoption->bitwise.support_names,
6551 &pcoption->bitwise.pretty_names);
6552 fc_assert(NULL != pcoption->bitwise.support_names);
6553 fc_assert(NULL != pcoption->bitwise.pretty_names);
6554 break;
6555
6556 case OT_COLOR:
6557 {
6558 /* Duplicate the string pointers. */
6559 struct ft_color *pcolor = pcoption->color.pvalue;
6560
6561 if (NULL != pcolor->foreground) {
6562 pcolor->foreground = fc_strdup(pcolor->foreground);
6563 }
6564 if (NULL != pcolor->background) {
6565 pcolor->background = fc_strdup(pcolor->background);
6566 }
6567 }
6568 break;
6569
6570 case OT_BOOLEAN:
6571 case OT_FONT:
6572 case OT_VIDEO_MODE:
6573 break;
6574 }
6575
6576 /* Set to default. */
6580
6581/************************************************************************/
6584void options_free(void)
6585{
6588
6590
6591 switch (option_type(poption)) {
6592 case OT_ENUM:
6593 fc_assert_action(NULL != pcoption->enumerator.support_names, break);
6594 strvec_destroy(pcoption->enumerator.support_names);
6595 pcoption->enumerator.support_names = NULL;
6596 fc_assert_action(NULL != pcoption->enumerator.pretty_names, break);
6597 strvec_destroy(pcoption->enumerator.pretty_names);
6598 pcoption->enumerator.pretty_names = NULL;
6599 break;
6600
6601 case OT_BITWISE:
6602 fc_assert_action(NULL != pcoption->bitwise.support_names, break);
6603 strvec_destroy(pcoption->bitwise.support_names);
6604 pcoption->bitwise.support_names = NULL;
6605 fc_assert_action(NULL != pcoption->bitwise.pretty_names, break);
6606 strvec_destroy(pcoption->bitwise.pretty_names);
6607 pcoption->bitwise.pretty_names = NULL;
6608 break;
6609
6610 case OT_BOOLEAN:
6611 case OT_INTEGER:
6612 case OT_STRING:
6613 case OT_FONT:
6614 case OT_COLOR:
6615 case OT_VIDEO_MODE:
6616 break;
6617 }
6619
6620 if (NULL != settable_options_hash) {
6623 }
6624
6625 if (NULL != dialog_options_hash) {
6628 }
6629
6632}
6634/************************************************************************/
6638static void reqtree_show_icons_callback(struct option *poption)
6639{
6642
6643/************************************************************************/
6646static void view_option_changed_callback(struct option *poption)
6647{
6648 menus_init();
6651
6652/************************************************************************/
6655static void manual_turn_done_callback(struct option *poption)
6656{
6658
6660 struct player *pplayer = client_player();
6661
6662 if (pplayer != NULL && is_ai(pplayer)
6663 && can_end_turn()) {
6665 }
6666 }
6668
6669/****************************************************************************
6670 Callback for changing music volume
6671****************************************************************************/
6672static void sound_volume_callback(struct option *poption)
6673{
6676
6677/************************************************************************/
6680static void voteinfo_bar_callback(struct option *poption)
6681{
6684
6685/************************************************************************/
6688static void font_changed_callback(struct option *poption)
6689{
6693
6694/************************************************************************/
6697static void mapimg_changed_callback(struct option *poption)
6698{
6700#ifndef FREECIV_NDEBUG
6701 bool success;
6702#endif
6703
6704 log_normal("Error setting the value for %s (%s). Restoring the default "
6705 "value.", option_name(poption), mapimg_error());
6706
6707 /* Reset the value to the default value. */
6708#ifndef FREECIV_NDEBUG
6709 success =
6710#endif
6712
6714 "Failed to reset the option \"%s\".",
6716#ifndef FREECIV_NDEBUG
6717 success =
6718#endif
6720
6722 "Failed to restore mapimg definition for option \"%s\".",
6724 }
6726
6727/************************************************************************/
6730static void game_music_enable_callback(struct option *poption)
6731{
6732 if (client_state() == C_S_RUNNING) {
6735 } else {
6737 }
6738 }
6740
6741/************************************************************************/
6744static void menu_music_enable_callback(struct option *poption)
6745{
6746 if (client_state() != C_S_RUNNING) {
6748 start_menu_music("music_menu", NULL);
6749 } else {
6751 }
6752 }
6754
6755/************************************************************************/
6758bool video_mode_to_string(char *buf, size_t buf_len, struct video_mode *mode)
6759{
6760 return (2 < fc_snprintf(buf, buf_len, "%dx%d", mode->width, mode->height));
6762
6763/************************************************************************/
6766bool string_to_video_mode(const char *buf, struct video_mode *mode)
6767{
6768 return (2 == sscanf(buf, "%dx%d", &mode->width, &mode->height));
6770
6771/************************************************************************/
6774static const struct strvec *get_mapimg_format_list(const struct option *poption)
6775{
6776 return mapimg_get_format_list();
6778
6779/************************************************************************/
6782const char *tileset_name_for_topology(int topology_id)
6783{
6784 const char *tsn = NULL;
6785
6786 switch (topology_id & (TF_ISO | TF_HEX)) {
6787 case 0:
6788 case TF_ISO:
6790 break;
6791 case TF_HEX:
6793 break;
6794 case TF_ISO | TF_HEX:
6796 break;
6797 }
6798
6799 if (tsn == NULL) {
6801 }
6802
6803 return tsn;
6805
6806/************************************************************************/
6809void option_set_default_ts(struct tileset *t)
6810{
6811 const char *optname = "<not set>";
6812 struct option *opt;
6813
6814 switch (tileset_topo_index(t)) {
6815 case TS_TOPO_SQUARE:
6816 /* Overhead */
6817 optname = "default_tileset_square_name";
6818 break;
6819 case TS_TOPO_HEX:
6820 /* Hex */
6821 optname = "default_tileset_hex_name";
6822 break;
6823 case TS_TOPO_ISOHEX:
6824 /* Isohex */
6825 optname = "default_tileset_isohex_name";
6826 break;
6827 }
6828
6830
6831 if (opt == NULL) {
6832 log_error("Unknown option name \"%s\" in option_set_default_ts()", optname);
6833 return;
6834 }
6835
6836 /* Do not call option_str_set() since we don't want option changed callback
6837 * to reload this tileset. */
6838 opt->str_vtable->set(opt, tileset_basename(t));
6841
6842/************************************************************************/
6845static bool is_ts_option_unset(const char *optname)
6846{
6847 struct option *opt;
6848 const char *val;
6849
6851
6852 if (opt == NULL) {
6853 return TRUE;
6854 }
6855
6856 val = opt->str_vtable->get(opt);
6857
6858 if (val == NULL || val[0] == '\0') {
6859 return TRUE;
6860 }
6861
6862 return FALSE;
6864
6865/************************************************************************/
6868void fill_topo_ts_default(void)
6869{
6870 if (is_ts_option_unset("default_tileset_square_name")) {
6871 if (gui_options.default_tileset_iso_name[0] != '\0') {
6875 } else if (gui_options.default_tileset_overhead_name[0] != '\0') {
6879 } else {
6880 log_debug("Setting tileset for square topologies.");
6882 }
6883 }
6884 if (is_ts_option_unset("default_tileset_hex_name")) {
6885 log_debug("Setting tileset for hex topology.");
6887 }
6888 if (is_ts_option_unset("default_tileset_isohex_name")) {
6889 log_debug("Setting tileset for isohex topology.");
6891 }
6892}
struct @126::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:836
#define output_type_iterate_end
Definition city.h:842
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)
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:1398
void cm_init_parameter(struct cm_parameter *dest)
Definition cm.c:2180
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:74
#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:2100
void options_extra_init(void)
Definition gui_main.c:2502
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:37
#define fc_assert_msg(condition, message,...)
Definition log.h:181
#define fc_assert_ret(condition)
Definition log.h:191
#define log_verbose(message,...)
Definition log.h:109
#define fc_assert(condition)
Definition log.h:176
#define fc_assert_ret_msg(condition, message,...)
Definition log.h:205
#define fc_assert_ret_val(condition, val)
Definition log.h:194
#define fc_assert_action(condition, action)
Definition log.h:187
#define log_debug(message,...)
Definition log.h:115
#define log_normal(message,...)
Definition log.h:107
log_level
Definition log.h:28
@ LOG_ERROR
Definition log.h:30
@ LOG_VERBOSE
Definition log.h:33
#define log_error(message,...)
Definition log.h:103
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:235
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:3626
void handle_server_setting_const(const struct packet_server_setting_const *packet)
Definition options.c:4560
void handle_server_setting_int(const struct packet_server_setting_int *packet)
Definition options.c:4653
static int server_option_int_max(const struct option *poption)
Definition options.c:5084
static bool client_option_font_set(struct option *poption, const char *font)
Definition options.c:3995
unsigned option_bitwise_mask(const struct option *poption)
Definition options.c:1131
void fill_topo_ts_default(void)
Definition options.c:6863
#define FIRST_MAJOR_MID_OPTION_FILE_NAME
Definition options.c:5529
#define client_options_iterate_all_end
Definition options.c:3588
static const struct strvec * server_option_str_values(const struct option *poption)
Definition options.c:5128
static int client_option_enum_get(const struct option *poption)
Definition options.c:3854
void resend_desired_settable_options(void)
Definition options.c:6004
const struct strvec * option_str_values(const struct option *poption)
Definition options.c:950
static void desired_settable_option_send(struct option *poption)
Definition options.c:5918
static const char * client_option_name(const struct option *poption)
Definition options.c:3680
static unsigned server_option_bitwise_def(const struct option *poption)
Definition options.c:5223
#define FIRST_MAJOR_NEW_OPTION_FILE_NAME
Definition options.c:5526
static const struct option_video_mode_vtable client_option_video_mode_vtable
Definition options.c:1441
#define GEN_STR_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb, cbd)
Definition options.c:1618
static struct dialog_options_hash * dialog_options_hash
Definition options.c:6049
void option_changed(struct option *poption)
Definition options.c:783
static void menu_music_enable_callback(struct option *poption)
Definition options.c:6739
static bool options_fully_initialized
Definition options.c:437
static const struct option_str_vtable client_option_str_vtable
Definition options.c:1375
unsigned option_bitwise_def(const struct option *poption)
Definition options.c:1120
int option_enum_str_to_int(const struct option *poption, const char *str)
Definition options.c:978
static const char * client_option_description(const struct option *poption)
Definition options.c:3688
int option_int_min(const struct option *poption)
Definition options.c:891
static void option_save_output_window_callback(enum log_level lvl, const char *msg,...)
Definition options.c:6328
static void message_options_save(struct section_file *file, const char *prefix)
Definition options.c:5435
bool option_bool_def(const struct option *poption)
Definition options.c:843
static struct option * client_option_next(const struct option *poption)
Definition options.c:3720
static const char * server_option_name(const struct option *poption)
Definition options.c:4979
const char * option_font_def(const struct option *poption)
Definition options.c:1187
const char * tileset_name_for_topology(int topology_id)
Definition options.c:6777
static const struct copt_val_name * gui_gtk_message_chat_location_name(int value)
Definition options.c:1874
static bool server_option_str_set(struct option *poption, const char *str)
Definition options.c:5137
static const struct copt_val_name * gui_popup_tech_help_name(int value)
Definition options.c:1894
struct option * optset_option_first(const struct option_set *poptset)
Definition options.c:482
static const char * server_optset_category_name(int category)
Definition options.c:4959
const struct option_set * server_optset
Definition options.c:4281
static void view_option_changed_callback(struct option *poption)
Definition options.c:6641
static const char * client_option_font_target(const struct option *poption)
Definition options.c:3986
static void server_option_enum_support_name(const struct option *poption, const char **pvalue, const char **pdefault)
Definition options.c:5197
#define GEN_INT_OPTION(oname, odesc, ohelp, ocat, ospec, odef, omin, omax, ocb)
Definition options.c:1580
static const char * server_option_description(const struct option *poption)
Definition options.c:4987
static unsigned server_option_bitwise_get(const struct option *poption)
Definition options.c:5215
static bool client_option_is_changeable(const struct option *poption)
Definition options.c:3712
static int server_option_int_min(const struct option *poption)
Definition options.c:5076
static const char * client_optset_category_name(int category)
Definition options.c:3642
static struct option * server_option_next(const struct option *poption)
Definition options.c:5019
static struct client_option client_options[]
Definition options.c:1921
#define SERVER_OPTION(poption)
Definition options.c:4417
static void settable_options_save(struct section_file *sf)
Definition options.c:5763
static bool server_option_bool_get(const struct option *poption)
Definition options.c:5027
bool option_reset(struct option *poption)
Definition options.c:744
void options_free(void)
Definition options.c:6579
const char * option_description(const struct option *poption)
Definition options.c:673
const char * option_help_text(const struct option *poption)
Definition options.c:683
#define settable_options_hash_iterate_end
Definition options.c:5689
static const char * client_option_font_get(const struct option *poption)
Definition options.c:3970
static int server_option_enum_def(const struct option *poption)
Definition options.c:5160
static int server_option_int_def(const struct option *poption)
Definition options.c:5068
#define client_options_iterate_all(poption)
Definition options.c:3579
static int client_option_int_min(const struct option *poption)
Definition options.c:3776
static int server_options_categories_num
Definition options.c:4263
const char * option_enum_get_str(const struct option *poption)
Definition options.c:1027
static struct ft_color client_option_color_def(const struct option *poption)
Definition options.c:4019
static const struct strvec * client_option_enum_pretty_names(const struct option *poption)
Definition options.c:3872
static bool server_option_enum_set(struct option *poption, int val)
Definition options.c:5179
static void save_cma_presets(struct section_file *file)
Definition options.c:5508
struct ft_color option_color_get(const struct option *poption)
Definition options.c:1225
static struct video_mode client_option_video_mode_def(const struct option *poption)
Definition options.c:4073
static int client_option_int_get(const struct option *poption)
Definition options.c:3760
static char ** server_options_categories
Definition options.c:4260
int option_enum_get_int(const struct option *poption)
Definition options.c:1015
static void settable_options_load(struct section_file *sf)
Definition options.c:5696
int option_number(const struct option *poption)
Definition options.c:653
static struct option * server_optset_option_first(void)
Definition options.c:4943
static struct settable_options_hash * settable_options_hash
Definition options.c:5691
int option_category(const struct option *poption)
Definition options.c:703
static struct server_option * server_options
Definition options.c:4261
static const struct option_int_vtable server_option_int_vtable
Definition options.c:4321
static void options_dialogs_save(struct section_file *sf)
Definition options.c:6083
static struct option_set client_optset_static
Definition options.c:1309
static bool client_option_color_set(struct option *poption, struct ft_color color)
Definition options.c:4028
#define dialog_options_hash_iterate_end
Definition options.c:6047
static void save_cma_preset(struct section_file *file, int i)
Definition options.c:5486
static int client_optset_category_number(void)
Definition options.c:3634
static const char * client_option_str_def(const struct option *poption)
Definition options.c:3818
static bool client_option_video_mode_set(struct option *poption, struct video_mode mode)
Definition options.c:4082
void handle_server_setting_bitwise(const struct packet_server_setting_bitwise *packet)
Definition options.c:4824
static const struct option_font_vtable client_option_font_vtable
Definition options.c:1416
static bool client_option_enum_set(struct option *poption, int val)
Definition options.c:3881
void desired_settable_option_update(const char *op_name, const char *op_value, bool allow_replace)
Definition options.c:5861
void option_set_default_ts(struct tileset *t)
Definition options.c:6804
bool option_str_set(struct option *poption, const char *str)
Definition options.c:961
void handle_server_setting_bool(const struct packet_server_setting_bool *packet)
Definition options.c:4618
static const struct strvec * client_option_str_values(const struct option *poption)
Definition options.c:3828
const struct option_set * client_optset
Definition options.c:1315
static const struct option_bool_vtable server_option_bool_vtable
Definition options.c:4309
static const struct option_bitwise_vtable server_option_bitwise_vtable
Definition options.c:4362
const char * option_name(const struct option *poption)
Definition options.c:663
static const char * client_option_help_text(const struct option *poption)
Definition options.c:3696
static void message_options_init(void)
Definition options.c:5308
static int client_option_number(const struct option *poption)
Definition options.c:3672
void handle_server_setting_str(const struct packet_server_setting_str *packet)
Definition options.c:4690
int option_int_get(const struct option *poption)
Definition options.c:869
static void client_option_save(struct option *poption, struct section_file *sf)
Definition options.c:4200
void options_init(void)
Definition options.c:6481
static int client_option_int_def(const struct option *poption)
Definition options.c:3768
static int server_option_category(const struct option *poption)
Definition options.c:5003
#define FIRST_MINOR_MID_OPTION_FILE_NAME
Definition options.c:5530
static const struct option_enum_vtable client_option_enum_vtable
Definition options.c:1388
static const struct option_str_vtable server_option_str_vtable
Definition options.c:4335
static int server_options_num
Definition options.c:4264
#define handle_server_setting_common(psoption, packet)
Definition options.c:4581
static const struct option_color_vtable client_option_color_vtable
Definition options.c:1428
bool option_enum_set_str(struct option *poption, const char *str)
Definition options.c:1092
static const struct strvec * server_option_enum_pretty(const struct option *poption)
Definition options.c:5170
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:5281
bool option_color_set(struct option *poption, struct ft_color color)
Definition options.c:1248
#define SETTING_CASE(ARG_name,...)
static struct video_mode client_option_video_mode_get(const struct option *poption)
Definition options.c:4064
static bool is_ts_option_unset(const char *optname)
Definition options.c:6840
void option_set_changed_callback(struct option *poption, void(*callback)(struct option *))
Definition options.c:772
#define OPTION(poption)
Definition options.c:598
#define NEW_OPTION_FILE_NAME
Definition options.c:5523
static bool server_option_bool_set(struct option *poption, bool val)
Definition options.c:5044
bool option_bool_set(struct option *poption, bool val)
Definition options.c:854
bool option_is_changeable(const struct option *poption)
Definition options.c:724
#define GEN_ENUM_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb)
Definition options.c:1696
bool option_video_mode_set(struct option *poption, struct video_mode mode)
Definition options.c:1288
#define MID_OPTION_FILE_NAME
Definition options.c:5522
static int server_option_number(const struct option *poption)
Definition options.c:4971
#define dialog_options_hash_iterate(hash, column, visible)
Definition options.c:6045
#define FIRST_MINOR_NEW_BOOLEAN
Definition options.c:5533
static const char * server_option_str_get(const struct option *poption)
Definition options.c:5110
#define settable_options_hash_iterate(hash, name, value)
Definition options.c:5687
void option_set_gui_data(struct option *poption, void *data)
Definition options.c:802
#define FIRST_MINOR_NEW_OPTION_FILE_NAME
Definition options.c:5527
#define GEN_BOOL_OPTION(oname, odesc, ohelp, ocat, ospec, odef, ocb)
Definition options.c:1544
const char * option_str_get(const struct option *poption)
Definition options.c:928
struct option * optset_option_by_number(const struct option_set *poptset, int id)
Definition options.c:455
static bool client_option_bool_get(const struct option *poption)
Definition options.c:3728
void * option_get_gui_data(const struct option *poption)
Definition options.c:812
static const char * server_option_str_def(const struct option *poption)
Definition options.c:5118
static const struct option_common_vtable client_option_common_vtable
Definition options.c:1335
static bool settable_option_upgrade_value(const struct option *poption, int old_value, char *buf, size_t buf_len)
Definition options.c:5878
const struct strvec * option_enum_values(const struct option *poption)
Definition options.c:1064
static const struct strvec * get_mapimg_format_list(const struct option *poption)
Definition options.c:6769
static void sound_volume_callback(struct option *poption)
Definition options.c:6667
bool option_enum_set_int(struct option *poption, int val)
Definition options.c:1075
bool option_bool_get(const struct option *poption)
Definition options.c:832
int optset_category_number(const struct option_set *poptset)
Definition options.c:492
#define color_set(color_tgt, color)
static bool client_option_bool_def(const struct option *poption)
Definition options.c:3736
static const struct strvec * server_option_bitwise_pretty(const struct option *poption)
Definition options.c:5233
void server_options_init(void)
Definition options.c:4425
enum option_type option_type(const struct option *poption)
Definition options.c:693
static int client_option_enum_def(const struct option *poption)
Definition options.c:3862
const char * option_enum_int_to_str(const struct option *poption, int val)
Definition options.c:1000
void options_dialogs_update(void)
Definition options.c:6098
int option_get_cb_data(const struct option *poption)
Definition options.c:822
bool video_mode_to_string(char *buf, size_t buf_len, struct video_mode *mode)
Definition options.c:6753
static void options_dialogs_load(struct section_file *sf)
Definition options.c:6054
const struct option_set * option_optset(const struct option *poption)
Definition options.c:643
void server_options_free(void)
Definition options.c:4494
struct video_mode option_video_mode_get(const struct option *poption)
Definition options.c:1263
static int server_option_enum_get(const struct option *poption)
Definition options.c:5152
struct option * option_next(const struct option *poption)
Definition options.c:734
static struct option * client_optset_option_by_number(int id)
Definition options.c:3615
static void font_changed_callback(struct option *poption)
Definition options.c:6683
const char * option_str_def(const struct option *poption)
Definition options.c:939
const char * optset_category_name(const struct option_set *poptset, int category)
Definition options.c:502
int option_int_max(const struct option *poption)
Definition options.c:902
#define GEN_COLOR_OPTION(oname, odesc, ohelp, ocat, ospec, odef_fg, odef_bg, ocb)
Definition options.c:1811
const char * option_enum_def_str(const struct option *poption)
Definition options.c:1051
void options_load(void)
Definition options.c:6159
static const char * client_option_str_get(const struct option *poption)
Definition options.c:3810
static const struct option_common_vtable server_option_common_vtable
Definition options.c:4295
static int server_optset_category_number(void)
Definition options.c:4951
static bool client_option_bool_set(struct option *poption, bool val)
Definition options.c:3745
static const char * server_option_help_text(const struct option *poption)
Definition options.c:4995
static const struct option_bool_vtable client_option_bool_vtable
Definition options.c:1349
static bool client_option_load(struct option *poption, struct section_file *sf)
Definition options.c:4099
bool option_font_set(struct option *poption, const char *font)
Definition options.c:1209
static bool server_option_bitwise_set(struct option *poption, unsigned val)
Definition options.c:5262
const char * option_font_target(const struct option *poption)
Definition options.c:1198
static const char * client_option_enum_secfile_str(secfile_data_t data, int val)
Definition options.c:3900
static struct server_option * server_option_next_valid(struct server_option *poption)
Definition options.c:4913
static void server_option_bitwise_support_base(const struct strvec *values, unsigned val, char *buf, size_t buf_len)
Definition options.c:5241
static void voteinfo_bar_callback(struct option *poption)
Definition options.c:6675
static struct option * server_optset_option_by_number(int id)
Definition options.c:4932
void options_save(option_save_log_callback log_cb)
Definition options.c:6341
static void message_options_free(void)
Definition options.c:5346
static const struct option_enum_vtable server_option_enum_vtable
Definition options.c:4348
bool string_to_video_mode(const char *buf, struct video_mode *mode)
Definition options.c:6761
const struct strvec * option_bitwise_values(const struct option *poption)
Definition options.c:1148
static bool server_option_int_set(struct option *poption, int val)
Definition options.c:5093
int messages_where[E_COUNT]
Definition options.c:5301
static void message_options_load(struct section_file *file, const char *prefix)
Definition options.c:5355
struct client_options gui_options
Definition options.c:71
static void server_option_free(struct server_option *poption)
Definition options.c:4436
#define CLIENT_OPTION(poption)
Definition options.c:1526
#define GEN_FONT_OPTION(oname, otgt, odesc, ohelp, ocat, ospec, odef, ocb)
Definition options.c:1775
static struct option_set server_optset_static
Definition options.c:4275
void handle_server_setting_control(const struct packet_server_setting_control *packet)
Definition options.c:4526
static void mapimg_changed_callback(struct option *poption)
Definition options.c:6692
bool option_bitwise_set(struct option *poption, unsigned val)
Definition options.c:1159
static int server_option_int_get(const struct option *poption)
Definition options.c:5060
static void manual_turn_done_callback(struct option *poption)
Definition options.c:6650
static void reqtree_show_icons_callback(struct option *poption)
Definition options.c:6633
const char * option_font_get(const struct option *poption)
Definition options.c:1176
void desired_settable_options_update(void)
Definition options.c:5793
static void load_cma_preset(struct section_file *file, int i)
Definition options.c:5456
static bool client_option_str_set(struct option *poption, const char *str)
Definition options.c:3838
void handle_server_setting_enum(const struct packet_server_setting_enum *packet)
Definition options.c:4735
struct ft_color option_color_def(const struct option *poption)
Definition options.c:1236
static int client_option_int_max(const struct option *poption)
Definition options.c:3784
#define GEN_STR_LIST_OPTION(oname, odesc, ohelp, ocat, ospec, odef, oacc, ocb, cbd)
Definition options.c:1659
client_option_category
Definition options.c:1447
@ COC_MAX
Definition options.c:1455
@ COC_SOUND
Definition options.c:1450
@ COC_NETWORK
Definition options.c:1453
@ COC_INTERFACE
Definition options.c:1451
@ COC_GRAPHICS
Definition options.c:1448
@ COC_OVERVIEW
Definition options.c:1449
@ COC_FONT
Definition options.c:1454
@ COC_MAPIMG
Definition options.c:1452
unsigned option_bitwise_get(const struct option *poption)
Definition options.c:1109
static bool server_option_is_changeable(const struct option *poption)
Definition options.c:5011
static struct ft_color client_option_color_get(const struct option *poption)
Definition options.c:4011
int option_enum_def_int(const struct option *poption)
Definition options.c:1039
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:466
static const int client_options_num
Definition options.c:3576
static bool client_option_int_set(struct option *poption, int val)
Definition options.c:3793
void options_dialogs_set(void)
Definition options.c:6126
bool option_int_set(struct option *poption, int val)
Definition options.c:913
static struct client_option * client_option_next_valid(struct client_option *poption)
Definition options.c:3597
static const char * client_option_bitwise_secfile_str(secfile_data_t data, int val)
Definition options.c:3958
#define GEN_VIDEO_OPTION(oname, odesc, ohelp, ocat, ospec, odef_width, odef_height, ocb)
Definition options.c:1846
static const struct option_int_vtable client_option_int_vtable
Definition options.c:1361
static const char * client_option_font_def(const struct option *poption)
Definition options.c:3978
static const char * get_last_option_file_name(bool *allow_digital_boolean)
Definition options.c:5577
const char * option_category_name(const struct option *poption)
Definition options.c:713
static void game_music_enable_callback(struct option *poption)
Definition options.c:6725
static const char * get_current_option_file_name(void)
Definition options.c:5542
int option_int_def(const struct option *poption)
Definition options.c:880
static void options_init_names(const struct copt_val_name *(*acc)(int), struct strvec **support, struct strvec **pretty)
Definition options.c:6463
struct video_mode option_video_mode_def(const struct option *poption)
Definition options.c:1275
static bool server_option_bool_def(const struct option *poption)
Definition options.c:5035
#define GUI_GTK3_CITYDLG_DEFAULT_XSIZE
Definition options.h:639
#define GUI_GTK3_22_GOV_RANGE_MIN_DEFAULT
Definition options.h:664
#define GUI_GTK5_CITYDLG_DEFAULT_XSIZE
Definition options.h:690
#define MW_POPUP
Definition options.h:617
#define GUI_GTK3_CITYDLG_MAX_YSIZE
Definition options.h:645
#define GUI_GTK3_22_GOV_RANGE_MIN_MIN
Definition options.h:665
#define GUI_GTK3_GOV_RANGE_MIN_DEFAULT
Definition options.h:647
#define GUI_GTK4_GOV_RANGE_MIN_MAX
Definition options.h:683
#define GUI_GTK3_22_CITYDLG_MIN_YSIZE
Definition options.h:661
#define GUI_GTK4_CITYDLG_MAX_XSIZE
Definition options.h:675
#define GUI_GTK4_GOV_RANGE_MIN_DEFAULT
Definition options.h:681
#define GUI_GTK5_CITYDLG_MAX_XSIZE
Definition options.h:692
#define GUI_GTK3_GOV_RANGE_MAX_DEFAULT
Definition options.h:651
void(* option_save_log_callback)(enum log_level lvl, const char *msg,...)
Definition options.h:483
#define GUI_GTK4_CITYDLG_DEFAULT_XSIZE
Definition options.h:673
#define FC_SDL3_DEFAULT_THEME_NAME
Definition options.h:429
#define GUI_GTK2_CITYDLG_DEFAULT_YSIZE
Definition options.h:631
#define GUI_GTK5_GOV_RANGE_MAX_MAX
Definition options.h:704
#define FC_GTK3_22_DEFAULT_THEME_NAME
Definition options.h:301
#define GUI_GTK3_22_CITYDLG_DEFAULT_XSIZE
Definition options.h:656
#define FC_QT_DEFAULT_THEME_NAME
Definition options.h:442
@ GUI_GTK_MSGCHAT_SEPARATE
Definition options.h:68
#define GUI_GTK3_CITYDLG_MIN_YSIZE
Definition options.h:644
#define GUI_GTK3_CITYDLG_MIN_XSIZE
Definition options.h:640
#define GUI_GTK3_22_CITYDLG_DEFAULT_YSIZE
Definition options.h:660
#define GUI_GTK4_CITYDLG_MIN_YSIZE
Definition options.h:678
#define DEFAULT_FOLLOWTAG_OPTION
Definition options.h:30
#define GUI_GTK5_CITYDLG_DEFAULT_YSIZE
Definition options.h:694
#define GUI_GTK2_CITYDLG_MIN_YSIZE
Definition options.h:632
#define options_iterate(poptset, poption)
Definition options.h:588
#define GUI_GTK2_CITYDLG_MAX_XSIZE
Definition options.h:629
#define GUI_DEFAULT_CHAT_LOGFILE
Definition options.h:624
#define GUI_GTK5_CITYDLG_MAX_YSIZE
Definition options.h:696
#define GUI_GTK3_GOV_RANGE_MAX_MAX
Definition options.h:653
#define GUI_GTK4_CITYDLG_MIN_XSIZE
Definition options.h:674
#define GUI_GTK3_22_GOV_RANGE_MAX_DEFAULT
Definition options.h:668
#define DEFAULT_METASERVER_OPTION
Definition options.h:29
#define GUI_GTK3_CITYDLG_DEFAULT_YSIZE
Definition options.h:643
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:658
#define GUI_GTK3_22_GOV_RANGE_MAX_MIN
Definition options.h:669
#define GUI_GTK5_GOV_RANGE_MAX_MIN
Definition options.h:703
#define GUI_GTK3_GOV_RANGE_MIN_MIN
Definition options.h:648
#define GUI_GTK3_GOV_RANGE_MIN_MAX
Definition options.h:649
#define GUI_GTK3_22_CITYDLG_MIN_XSIZE
Definition options.h:657
@ 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:685
#define MAJOR_NEW_OPTION_FILE_NAME
Definition options.h:38
#define GUI_GTK3_GOV_RANGE_MAX_MIN
Definition options.h:652
#define GUI_GTK2_CITYDLG_MAX_YSIZE
Definition options.h:633
#define GUI_DEFAULT_MAPIMG_FILENAME
Definition options.h:706
#define GUI_GTK5_CITYDLG_MIN_XSIZE
Definition options.h:691
#define GUI_GTK3_22_CITYDLG_MAX_YSIZE
Definition options.h:662
#define GUI_GTK4_GOV_RANGE_MIN_MIN
Definition options.h:682
#define GUI_GTK5_GOV_RANGE_MIN_DEFAULT
Definition options.h:698
#define GUI_GTK4_CITYDLG_MAX_YSIZE
Definition options.h:679
#define MW_OUTPUT
Definition options.h:615
#define GUI_GTK5_GOV_RANGE_MAX_DEFAULT
Definition options.h:702
#define GUI_GTK4_CITYDLG_DEFAULT_YSIZE
Definition options.h:677
#define options_iterate_end
Definition options.h:593
#define GUI_GTK5_GOV_RANGE_MIN_MAX
Definition options.h:700
#define GUI_GTK4_GOV_RANGE_MAX_MAX
Definition options.h:687
#define MW_MESSAGES
Definition options.h:616
#define FC_GTK4_DEFAULT_THEME_NAME
Definition options.h:337
#define GUI_GTK3_22_GOV_RANGE_MIN_MAX
Definition options.h:666
#define MINOR_NEW_OPTION_FILE_NAME
Definition options.h:42
#define GUI_GTK2_CITYDLG_DEFAULT_XSIZE
Definition options.h:627
#define FC_SDL2_DEFAULT_THEME_NAME
Definition options.h:416
#define GUI_GTK3_22_GOV_RANGE_MAX_MAX
Definition options.h:670
#define VIDEO_MODE(ARG_width, ARG_height)
Definition options.h:51
#define GUI_GTK5_GOV_RANGE_MIN_MIN
Definition options.h:699
@ 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:641
#define GUI_GTK4_GOV_RANGE_MAX_MIN
Definition options.h:686
#define GUI_GTK5_CITYDLG_MIN_YSIZE
Definition options.h:695
#define GUI_GTK2_CITYDLG_MIN_XSIZE
Definition options.h:628
void overview_redraw_callback(struct option *option)
#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)
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:1776
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)
const int def
Definition options.c:1479
const unsigned def
Definition options.c:1502
enum gui_type specific
Definition options.c:1468
const char * description
Definition options.c:1465
const char *const def
Definition options.c:1485
struct ft_color *const pvalue
Definition options.c:1515
struct video_mode *const pvalue
Definition options.c:1520
const size_t size
Definition options.c:1484
char *const pvalue
Definition options.c:1483
struct client_option::@232::@239 font
struct client_option::@232::@236 string
const int max
Definition options.c:1479
const bool def
Definition options.c:1474
const char *const target
Definition options.c:1511
bool *const pvalue
Definition options.c:1473
struct option base_option
Definition options.c:1462
const char * help_text
Definition options.c:1466
unsigned *const pvalue
Definition options.c:1501
enum client_option_category category
Definition options.c:1467
int *const pvalue
Definition options.c:1478
struct client_option::@232::@235 integer
const char * name
Definition options.c:1464
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:458
char default_tileset_iso_name[512]
Definition options.h:132
bool gui_qt_show_techs_panel
Definition options.h:459
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:460
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:1318
const char * pretty
Definition options.c:1320
int(* number)(const struct option *)
Definition options.c:522
int(* category)(const struct option *)
Definition options.c:526
bool(* is_changeable)(const struct option *)
Definition options.c:527
struct option *(* option_by_number)(int)
Definition options.c:445
struct option *(* option_first)(void)
Definition options.c:446
const char *(* category_name)(int)
Definition options.c:449
int(* category_number)(void)
Definition options.c:448
const struct option::option_common_vtable * common_vtable
const struct option::@230::option_video_mode_vtable * video_mode_vtable
const struct option::@230::option_bool_vtable * bool_vtable
const struct option::@230::option_font_vtable * font_vtable
const struct option::@230::option_int_vtable * int_vtable
const struct option::@230::option_str_vtable * str_vtable
enum option_type type
Definition options.c:518
const struct option_set * poptset
Definition options.c:516
const struct option::@230::option_color_vtable * color_vtable
int callback_data
Definition options.c:592
void(* changed_callback)(struct option *option)
Definition options.c:590
void * gui_data
Definition options.c:595
const struct option::@230::option_enum_vtable * enum_vtable
const struct option::@230::option_bitwise_vtable * bitwise_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:4404
unsigned value
Definition options.c:4409
char * help_text
Definition options.c:4377
char * name
Definition options.c:4375
bool is_visible
Definition options.c:4381
char * description
Definition options.c:4376
unsigned char category
Definition options.c:4378
struct strvec * pretty_names
Definition options.c:4405
enum setting_default_level setdef
Definition options.c:4382
unsigned def
Definition options.c:4410
bool is_changeable
Definition options.c:4380
char * value
Definition options.c:4397
struct server_option::@242::@245 integer
struct option base_option
Definition options.c:4373
bool desired_sent
Definition options.c:4379
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:189
#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:154
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:1335
const struct strvec * get_tileset_list(const struct option *poption)
Definition tilespec.c:1125
const char * tileset_basename(const struct tileset *t)
Definition tilespec.c:705
void tilespec_reread_callback(struct option *poption)
Definition tilespec.c:1530
int tileset_topo_index(struct tileset *t)
Definition tilespec.c:7605
#define TS_TOPO_ISOHEX
Definition tilespec.h:457
#define TS_TOPO_HEX
Definition tilespec.h:456
#define TS_TOPO_SQUARE
Definition tilespec.h:455