From 04e9086384a7f19d1e68b3373638485237ed2fcd Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 24 Apr 2023 02:12:45 +0300 Subject: [PATCH 35/35] sdl2: Fix dead 'i' assignments in popup_races_dialog() See osdn #47926 Signed-off-by: Marko Lindqvist --- client/gui-sdl2/dialogs.c | 49 ++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/client/gui-sdl2/dialogs.c b/client/gui-sdl2/dialogs.c index b3df293146..979822dc7e 100644 --- a/client/gui-sdl2/dialogs.c +++ b/client/gui-sdl2/dialogs.c @@ -3118,7 +3118,7 @@ void popup_races_dialog(struct player *pplayer) nation_dlg = fc_calloc(1, sizeof(struct advanced_dialog)); - /* create window widget */ + /* Create window widget */ pstr = create_utf8_from_char(_("What nation will you be?"), adj_font(12)); pstr->style |= TTF_STYLE_BOLD; @@ -3131,7 +3131,7 @@ void popup_races_dialog(struct player *pplayer) nation_dlg->end_widget_list = pwindow; add_to_gui_list(ID_NATION_WIZARD_WINDOW, pwindow); /* --------------------------------------------------------- */ - /* create nations list */ + /* Create nations list */ /* Create Imprv Background Icon */ main_bg = create_surf(adj_size(96*2), adj_size(64), SDL_SWSURFACE); @@ -3146,7 +3146,7 @@ void popup_races_dialog(struct player *pplayer) pstr->style |= (SF_CENTER|TTF_STYLE_BOLD); pstr->bgcol = (SDL_Color) {0, 0, 0, 0}; - /* fill list */ + /* Fill list */ nations_iterate(pnation) { if (!is_nation_playable(pnation) || !is_nation_pickable(pnation)) { @@ -3159,7 +3159,8 @@ void popup_races_dialog(struct player *pplayer) copy_chars_to_utf8_str(pstr, nation_plural_translation(pnation)); change_ptsize_utf8(pstr, adj_font(12)); - text_name = create_text_surf_smaller_than_w(pstr, tmp_surf->w - adj_size(4)); + text_name + = create_text_surf_smaller_than_w(pstr, tmp_surf->w - adj_size(4)); dst.x = (tmp_surf->w - tmp_surf_zoomed->w) / 2; len = tmp_surf_zoomed->h + @@ -3206,7 +3207,7 @@ void popup_races_dialog(struct player *pplayer) /* ----------------------------------------------------------------- */ - /* nation set selection */ + /* Nation set selection */ if (nation_set_count() > 1) { utf8_str *natset_str; struct option *poption; @@ -3216,7 +3217,7 @@ void popup_races_dialog(struct player *pplayer) nationsets = create_iconlabel(NULL, pwindow->dst, natset_str, 0); add_to_gui_list(ID_LABEL, nationsets); - /* create nation set name label */ + /* Create nation set name label */ poption = optset_option_by_name(server_optset, "nationset"); setup->set = nation_set_by_setting_value(option_str_get(poption)); @@ -3229,7 +3230,7 @@ void popup_races_dialog(struct player *pplayer) add_to_gui_list(ID_LABEL, pwidget); setup->pset_name = pwidget; - /* create next nationset button */ + /* Create next nationset button */ pwidget = create_themeicon_button(current_theme->r_arrow_icon, pwindow->dst, NULL, 0); pwidget->action = next_set_callback; @@ -3240,7 +3241,7 @@ void popup_races_dialog(struct player *pplayer) pwidget->size.h = pwidget->next->size.h; setup->pset_next = pwidget; - /* create prev nationset button */ + /* Create prev nationset button */ pwidget = create_themeicon_button(current_theme->l_arrow_icon, pwindow->dst, NULL, 0); pwidget->action = prev_set_callback; @@ -3252,7 +3253,7 @@ void popup_races_dialog(struct player *pplayer) setup->pset_prev = pwidget; } - /* nation name */ + /* Nation name */ setup->nation = fc_rand(get_playable_nation_count()); pnat = nation_by_number(setup->nation); setup->nation_style = style_number(style_of_nation(pnat)); @@ -3274,7 +3275,7 @@ void popup_races_dialog(struct player *pplayer) add_to_gui_list(ID_LABEL, pwidget); - /* create leader name edit */ + /* Create leader name edit */ pwidget = create_edit_from_chars(NULL, pwindow->dst, NULL, adj_font(16), adj_size(200), 0); pwidget->size.h = adj_size(24); @@ -3284,7 +3285,7 @@ void popup_races_dialog(struct player *pplayer) add_to_gui_list(ID_NATION_WIZARD_LEADER_NAME_EDIT, pwidget); setup->name_edit = pwidget; - /* create next leader name button */ + /* Create next leader name button */ pwidget = create_themeicon_button(current_theme->r_arrow_icon, pwindow->dst, NULL, 0); pwidget->action = next_name_callback; @@ -3292,7 +3293,7 @@ void popup_races_dialog(struct player *pplayer) pwidget->size.h = pwidget->next->size.h; setup->name_next = pwidget; - /* create prev leader name button */ + /* Create prev leader name button */ pwidget = create_themeicon_button(current_theme->l_arrow_icon, pwindow->dst, NULL, 0); pwidget->action = prev_name_callback; @@ -3300,7 +3301,7 @@ void popup_races_dialog(struct player *pplayer) pwidget->size.h = pwidget->next->size.h; setup->name_prev = pwidget; - /* change sex button */ + /* Change sex button */ pwidget = create_icon_button_from_chars(NULL, pwindow->dst, sex_name_translation(SEX_MALE), adj_font(14), 0); @@ -3310,38 +3311,38 @@ void popup_races_dialog(struct player *pplayer) set_wstate(pwidget, FC_WS_NORMAL); setup->change_sex = pwidget; - /* add to main widget list */ + /* Add to main widget list */ add_to_gui_list(ID_NATION_WIZARD_CHANGE_SEX_BUTTON, pwidget); /* ---------------------------------------------------------- */ - i = 0; zoom = DEFAULT_ZOOM * 1.0; len = 0; styles_iterate(pstyle) { - i = basic_city_style_for_style(pstyle); + int sn = basic_city_style_for_style(pstyle); - tmp_surf = get_sample_city_surface(i); + tmp_surf = get_sample_city_surface(sn); if (tmp_surf->w > 48) { zoom = DEFAULT_ZOOM * (48.0 / tmp_surf->w); } - tmp_surf_zoomed = zoomSurface(get_sample_city_surface(i), zoom, zoom, 0); + tmp_surf_zoomed = zoomSurface(get_sample_city_surface(sn), zoom, zoom, 0); - pwidget = create_icon2(tmp_surf_zoomed, pwindow->dst, WF_RESTORE_BACKGROUND); + pwidget = create_icon2(tmp_surf_zoomed, pwindow->dst, + WF_RESTORE_BACKGROUND); pwidget->action = style_callback; - if (i != setup->nation_style) { + if (sn != setup->nation_style) { set_wstate(pwidget, FC_WS_NORMAL); } len += pwidget->size.w; - add_to_gui_list(MAX_ID - 1000 - i, pwidget); + add_to_gui_list(MAX_ID - 1000 - sn, pwidget); } styles_iterate_end; last_City_Style = pwidget; /* ---------------------------------------------------------- */ - /* create Cancel button */ + /* Create Cancel button */ pwidget = create_themeicon_button_from_chars(current_theme->cancel_icon, pwindow->dst, _("Cancel"), adj_font(12), 0); @@ -3350,7 +3351,7 @@ void popup_races_dialog(struct player *pplayer) add_to_gui_list(ID_NATION_WIZARD_DISCONNECT_BUTTON, pwidget); - /* create OK button */ + /* Create OK button */ pwidget = create_themeicon_button_from_chars(current_theme->ok_icon, pwindow->dst, _("OK"), adj_font(12), 0); @@ -3375,7 +3376,7 @@ void popup_races_dialog(struct player *pplayer) (main_window_width() - pwindow->size.w) / 2, (main_window_height() - pwindow->size.h) / 2); - /* nations */ + /* Nations */ h = nation_dlg->end_active_widget_list->size.h * TARGETS_ROW; i = (area.h - adj_size(43) - h) / 2; -- 2.39.2