From 6ec2683deb7f7b7170147db1e6de9b38992f9eff Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 15 Sep 2023 14:14:28 +0300 Subject: [PATCH 12/12] Rename "draw_roads_rails" as "draw_paths" See osdn #47315 Signed-off-by: Marko Lindqvist --- client/control.c | 12 +++---- client/control.h | 4 +-- client/gui-gtk-3.22/menu.c | 14 ++++---- client/gui-gtk-4.0/menu.c | 4 +-- client/options.c | 71 ++++++++++++++++++++++---------------- client/options.h | 2 +- client/tilespec.c | 2 +- 7 files changed, 61 insertions(+), 48 deletions(-) diff --git a/client/control.c b/client/control.c index 458075944b..a9b2554b79 100644 --- a/client/control.c +++ b/client/control.c @@ -2541,15 +2541,15 @@ void request_toggle_coastline(void) } /**********************************************************************//** - Toggle display of roads and rails + Toggle display of paths **************************************************************************/ -void request_toggle_roads_rails(void) +void request_toggle_paths(void) { if (!can_client_change_view()) { return; } - gui_options.draw_roads_rails ^= 1; + gui_options.draw_paths ^= 1; update_map_canvas_visible(); } @@ -3920,11 +3920,11 @@ void key_coastline_toggle(void) } /**********************************************************************//** - Handle user 'toggle road/railroad display' input + Handle user 'toggle paths display' input **************************************************************************/ -void key_roads_rails_toggle(void) +void key_paths_toggle(void) { - request_toggle_roads_rails(); + request_toggle_paths(); } /**********************************************************************//** diff --git a/client/control.h b/client/control.h index cd45012208..40f82d526b 100644 --- a/client/control.h +++ b/client/control.h @@ -163,7 +163,7 @@ void request_toggle_city_trade_routes(void); void request_toggle_unit_stack_size(void); void request_toggle_terrain(void); void request_toggle_coastline(void); -void request_toggle_roads_rails(void); +void request_toggle_paths(void); void request_toggle_irrigation(void); void request_toggle_mines(void); void request_toggle_bases(void); @@ -220,7 +220,7 @@ void key_city_trade_routes_toggle(void); void key_unit_stack_size_toggle(void); void key_terrain_toggle(void); void key_coastline_toggle(void); -void key_roads_rails_toggle(void); +void key_paths_toggle(void); void key_irrigation_toggle(void); void key_mines_toggle(void); void key_bases_toggle(void); diff --git a/client/gui-gtk-3.22/menu.c b/client/gui-gtk-3.22/menu.c index 78c1c967da..3a3cfacd13 100644 --- a/client/gui-gtk-3.22/menu.c +++ b/client/gui-gtk-3.22/menu.c @@ -188,7 +188,7 @@ static void show_city_trade_routes_callback(GtkCheckMenuItem *item, gpointer data); static void show_terrain_callback(GtkCheckMenuItem *item, gpointer data); static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data); -static void show_road_rails_callback(GtkCheckMenuItem *item, gpointer data); +static void show_paths_callback(GtkCheckMenuItem *item, gpointer data); static void show_irrigation_callback(GtkCheckMenuItem *item, gpointer data); static void show_mine_callback(GtkCheckMenuItem *item, gpointer data); static void show_bases_callback(GtkCheckMenuItem *item, gpointer data); @@ -454,7 +454,7 @@ static struct menu_entry_info menu_entries[] = { "SHOW_COASTLINE", N_("C_oastline"), 0, 0, G_CALLBACK(show_coastline_callback), MGROUP_SAFE }, { "SHOW_PATHS", N_("_Paths"), 0, 0, - G_CALLBACK(show_road_rails_callback), MGROUP_SAFE }, + G_CALLBACK(show_paths_callback), MGROUP_SAFE }, { "SHOW_IRRIGATION", N_("_Irrigation"), 0, 0, G_CALLBACK(show_irrigation_callback), MGROUP_SAFE }, { "SHOW_MINES", N_("_Mines"), 0, 0, @@ -1299,12 +1299,12 @@ static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data) } /************************************************************************//** - Item "SHOW_ROAD_RAILS" callback. + Item "SHOW_PATHS" callback. ****************************************************************************/ -static void show_road_rails_callback(GtkCheckMenuItem *item, gpointer data) +static void show_paths_callback(GtkCheckMenuItem *item, gpointer data) { - if (gui_options.draw_roads_rails ^ gtk_check_menu_item_get_active(item)) { - key_roads_rails_toggle(); + if (gui_options.draw_paths ^ gtk_check_menu_item_get_active(item)) { + key_paths_toggle(); } } @@ -3164,7 +3164,7 @@ void real_menus_init(void) menu_entry_set_active("SHOW_COASTLINE", gui_options.draw_coastline); menu_entry_set_active("SHOW_PATHS", - gui_options.draw_roads_rails); + gui_options.draw_paths); menu_entry_set_active("SHOW_IRRIGATION", gui_options.draw_irrigation); menu_entry_set_active("SHOW_MINES", diff --git a/client/gui-gtk-4.0/menu.c b/client/gui-gtk-4.0/menu.c index b22bd41e32..32425f48cb 100644 --- a/client/gui-gtk-4.0/menu.c +++ b/client/gui-gtk-4.0/menu.c @@ -1754,7 +1754,7 @@ const struct menu_entry_option_map meoms[] = { VMENU_CITY_TRADE_ROUTES }, { "SHOW_TERRAIN", &gui_options.draw_terrain, VMENU_TERRAIN }, { "SHOW_COASTLINE", &gui_options.draw_coastline, VMENU_COASTLINE }, - { "SHOW_PATHS", &gui_options.draw_roads_rails, VMENU_PATHS }, + { "SHOW_PATHS", &gui_options.draw_paths, VMENU_PATHS }, { "SHOW_IRRIGATION", &gui_options.draw_irrigation, VMENU_IRRIGATION }, { "SHOW_MINES", &gui_options.draw_mines, VMENU_MINES }, { "SHOW_BASES", &gui_options.draw_fortress_airbase, VMENU_BASES }, @@ -1938,7 +1938,7 @@ static void show_paths_callback(GSimpleAction *action, GVariant *parameter, gpointer data) { - view_menu_item_toggle(key_roads_rails_toggle, FALSE, data); + view_menu_item_toggle(key_paths_toggle, FALSE, data); } /************************************************************************//** diff --git a/client/options.c b/client/options.c index 536ef68ec3..8ff357c940 100644 --- a/client/options.c +++ b/client/options.c @@ -167,7 +167,7 @@ struct client_options gui_options = { .draw_city_trade_routes = FALSE, .draw_terrain = TRUE, .draw_coastline = FALSE, - .draw_roads_rails = TRUE, + .draw_paths = TRUE, .draw_irrigation = TRUE, .draw_mines = TRUE, .draw_fortress_airbase = TRUE, @@ -187,7 +187,7 @@ struct client_options gui_options = { .reqtree_show_icons = TRUE, .reqtree_curved_lines = FALSE, -/* options for map images */ +/* Options for map images */ /* .mapimg_format, */ .mapimg_zoom = 2, /* See the definition of MAPIMG_LAYER in mapimg.h. */ @@ -1507,11 +1507,11 @@ struct client_option { /* * Generate a client option of type OT_BOOLEAN. * - * oname: The option data. Note it is used as name to be loaded or saved. + * oname: The option data. Note it is used as name to be loaded or saved. * So, you shouldn't change the name of this variable in any case. - * odesc: A short description of the client option. Should be used with the + * odesc: A short description of the client option. Should be used with the * N_() macro. - * ohelp: The help text for the client option. Should be used with the N_() + * ohelp: The help text for the client option. Should be used with the N_() * macro. * ocat: The client_option_class of this client option. * ospec: A gui_type enumerator which determin for what particular client @@ -1541,11 +1541,11 @@ struct client_option { /* * Generate a client option of type OT_INTEGER. * - * oname: The option data. Note it is used as name to be loaded or saved. + * oname: The option data. Note it is used as name to be loaded or saved. * So, you shouldn't change the name of this variable in any case. - * odesc: A short description of the client option. Should be used with the + * odesc: A short description of the client option. Should be used with the * N_() macro. - * ohelp: The help text for the client option. Should be used with the N_() + * ohelp: The help text for the client option. Should be used with the N_() * macro. * ocat: The client_option_class of this client option. * ospec: A gui_type enumerator which determin for what particular client @@ -1579,13 +1579,13 @@ struct client_option { /* * Generate a client option of type OT_STRING. * - * oname: The option data. Note it is used as name to be loaded or saved. + * oname: The option data. Note it is used as name to be loaded or saved. * So, you shouldn't change the name of this variable in any case. * Be sure to pass the array variable and not a pointer to it because * the size is calculated with sizeof(). - * odesc: A short description of the client option. Should be used with the + * odesc: A short description of the client option. Should be used with the * N_() macro. - * ohelp: The help text for the client option. Should be used with the N_() + * ohelp: The help text for the client option. Should be used with the N_() * macro. * ocat: The client_option_class of this client option. * ospec: A gui_type enumerator which determines for what particular client @@ -1618,13 +1618,13 @@ struct client_option { * Generate a client option of type OT_STRING with a string accessor * function. * - * oname: The option data. Note it is used as name to be loaded or saved. + * oname: The option data. Note it is used as name to be loaded or saved. * So, you shouldn't change the name of this variable in any case. * Be sure to pass the array variable and not a pointer to it because * the size is calculated with sizeof(). - * odesc: A short description of the client option. Should be used with the + * odesc: A short description of the client option. Should be used with the * N_() macro. - * ohelp: The help text for the client option. Should be used with the N_() + * ohelp: The help text for the client option. Should be used with the N_() * macro. * ocat: The client_option_class of this client option. * ospec: A gui_type enumerator which determin for what particular client @@ -1658,11 +1658,11 @@ struct client_option { /* * Generate a client option of type OT_ENUM. * - * oname: The option data. Note it is used as name to be loaded or saved. + * oname: The option data. Note it is used as name to be loaded or saved. * So, you shouldn't change the name of this variable in any case. - * odesc: A short description of the client option. Should be used with the + * odesc: A short description of the client option. Should be used with the * N_() macro. - * ohelp: The help text for the client option. Should be used with the N_() + * ohelp: The help text for the client option. Should be used with the N_() * macro. * ocat: The client_option_class of this client option. * ospec: A gui_type enumerator which determin for what particular client @@ -1696,11 +1696,11 @@ struct client_option { /* * Generate a client option of type OT_BITWISE. * - * oname: The option data. Note it is used as name to be loaded or saved. + * oname: The option data. Note it is used as name to be loaded or saved. * So, you shouldn't change the name of this variable in any case. - * odesc: A short description of the client option. Should be used with the + * odesc: A short description of the client option. Should be used with the * N_() macro. - * ohelp: The help text for the client option. Should be used with the N_() + * ohelp: The help text for the client option. Should be used with the N_() * macro. * ocat: The client_option_class of this client option. * ospec: A gui_type enumerator which determin for what particular client @@ -1809,11 +1809,11 @@ struct client_option { /* * Generate a client option of type OT_VIDEO_MODE. * - * oname: The option data. Note it is used as name to be loaded or saved. + * oname: The option data. Note it is used as name to be loaded or saved. * So, you shouldn't change the name of this variable in any case. - * odesc: A short description of the client option. Should be used with the + * odesc: A short description of the client option. Should be used with the * N_() macro. - * ohelp: The help text for the client option. Should be used with the N_() + * ohelp: The help text for the client option. Should be used with the N_() * macro. * ocat: The client_option_class of this client option. * ospec: A gui_type enumerator which determin for what particular client @@ -2094,9 +2094,9 @@ static struct client_option client_options[] = { "land from the ocean."), COC_GRAPHICS, GUI_STUB, FALSE, view_option_changed_callback), - GEN_BOOL_OPTION(draw_roads_rails, N_("Draw the roads and the railroads"), - N_("Setting this option will draw the roads and the " - "railroads on the map."), + GEN_BOOL_OPTION(draw_paths, N_("Draw the paths"), + N_("Setting this option will draw all kind of paths " + "on the map."), COC_GRAPHICS, GUI_STUB, TRUE, view_option_changed_callback), GEN_BOOL_OPTION(draw_irrigation, N_("Draw the irrigation"), @@ -3997,7 +3997,7 @@ static bool client_option_video_mode_set(struct option *poption, } /************************************************************************//** - Load the option from a file. Returns TRUE if the option changed. + Load the option from a file. Returns TRUE if the option changed. ****************************************************************************/ static bool client_option_load(struct option *poption, struct section_file *sf) @@ -4009,9 +4009,22 @@ static bool client_option_load(struct option *poption, case OT_BOOLEAN: { bool value; + const char *pname = option_name(poption); + const char *old_paths = "draw_roads_rails"; + + if (!strcmp("draw_paths", pname)) { + /* Renamed in freeciv-3.2 */ + if (secfile_lookup_bool(sf, &value, "client.draw_paths") + && option_bool_set(poption, value)) { + return TRUE; + } + + /* Try by old name. */ + pname = old_paths; + } return (secfile_lookup_bool(sf, &value, "client.%s", - option_name(poption)) + pname) && option_bool_set(poption, value)); } case OT_INTEGER: @@ -6104,7 +6117,7 @@ void options_load(void) } secfile_allow_digital_boolean(sf, allow_digital_boolean); - /* a "secret" option for the lazy. TODO: make this saveable */ + /* A "secret" option for the lazy. TODO: make this saveable */ sz_strlcpy(fc_password, secfile_lookup_str_default(sf, "", "%s.password", prefix)); diff --git a/client/options.h b/client/options.h index 7a6f117d51..20e6d6c752 100644 --- a/client/options.h +++ b/client/options.h @@ -195,7 +195,7 @@ struct client_options bool draw_city_trade_routes; bool draw_terrain; bool draw_coastline; - bool draw_roads_rails; + bool draw_paths; bool draw_irrigation; bool draw_mines; bool draw_fortress_airbase; diff --git a/client/tilespec.c b/client/tilespec.c index 2efbe98b32..13f6731c79 100644 --- a/client/tilespec.c +++ b/client/tilespec.c @@ -5792,7 +5792,7 @@ static bool is_extra_drawing_enabled(struct extra_type *pextra) no_disable = FALSE; } if (is_extra_caused_by(pextra, EC_ROAD)) { - if (gui_options.draw_roads_rails) { + if (gui_options.draw_paths) { return TRUE; } no_disable = FALSE; -- 2.40.1