Respond to review, make char_slider take String

This commit is contained in:
juliancoffee 2022-08-07 13:38:36 +03:00
parent a994984b09
commit 94dbd4cb25

View File

@ -1052,7 +1052,7 @@ impl Controls {
const SLIDER_HEIGHT: u16 = 30; const SLIDER_HEIGHT: u16 = 30;
fn char_slider<'a>( fn char_slider<'a>(
text: &str, text: String,
state: &'a mut slider::State, state: &'a mut slider::State,
max: u8, max: u8,
selected_val: u8, selected_val: u8,
@ -1079,7 +1079,7 @@ impl Controls {
} }
fn char_slider_greyable<'a>( fn char_slider_greyable<'a>(
active: bool, active: bool,
text: &str, text: String,
state: &'a mut slider::State, state: &'a mut slider::State,
max: u8, max: u8,
selected_val: u8, selected_val: u8,
@ -1117,7 +1117,7 @@ impl Controls {
let slider_options = Column::with_children(vec![ let slider_options = Column::with_children(vec![
char_slider( char_slider(
&i18n.get("char_selection.hair_style"), i18n.get("char_selection.hair_style").into_owned(),
&mut sliders.hair_style, &mut sliders.hair_style,
body.species.num_hair_styles(body.body_type) - 1, body.species.num_hair_styles(body.body_type) - 1,
body.hair_style, body.hair_style,
@ -1125,7 +1125,7 @@ impl Controls {
(fonts, imgs), (fonts, imgs),
), ),
char_slider( char_slider(
&i18n.get("char_selection.hair_color"), i18n.get("char_selection.hair_color").into_owned(),
&mut sliders.hair_color, &mut sliders.hair_color,
body.species.num_hair_colors() - 1, body.species.num_hair_colors() - 1,
body.hair_color, body.hair_color,
@ -1133,7 +1133,7 @@ impl Controls {
(fonts, imgs), (fonts, imgs),
), ),
char_slider( char_slider(
&i18n.get("char_selection.skin"), i18n.get("char_selection.skin").into_owned(),
&mut sliders.skin, &mut sliders.skin,
body.species.num_skin_colors() - 1, body.species.num_skin_colors() - 1,
body.skin, body.skin,
@ -1141,7 +1141,7 @@ impl Controls {
(fonts, imgs), (fonts, imgs),
), ),
char_slider( char_slider(
&i18n.get("char_selection.eyeshape"), i18n.get("char_selection.eyeshape").into_owned(),
&mut sliders.eyes, &mut sliders.eyes,
body.species.num_eyes(body.body_type) - 1, body.species.num_eyes(body.body_type) - 1,
body.eyes, body.eyes,
@ -1149,7 +1149,7 @@ impl Controls {
(fonts, imgs), (fonts, imgs),
), ),
char_slider( char_slider(
&i18n.get("char_selection.eye_color"), i18n.get("char_selection.eye_color").into_owned(),
&mut sliders.eye_color, &mut sliders.eye_color,
body.species.num_eye_colors() - 1, body.species.num_eye_colors() - 1,
body.eye_color, body.eye_color,
@ -1158,7 +1158,7 @@ impl Controls {
), ),
char_slider_greyable( char_slider_greyable(
body.species.num_accessories(body.body_type) > 1, body.species.num_accessories(body.body_type) > 1,
&i18n.get("char_selection.accessories"), i18n.get("char_selection.accessories").into_owned(),
&mut sliders.accessory, &mut sliders.accessory,
body.species.num_accessories(body.body_type) - 1, body.species.num_accessories(body.body_type) - 1,
body.accessory, body.accessory,
@ -1167,7 +1167,7 @@ impl Controls {
), ),
char_slider_greyable( char_slider_greyable(
body.species.num_beards(body.body_type) > 1, body.species.num_beards(body.body_type) > 1,
&i18n.get("char_selection.beard"), i18n.get("char_selection.beard").into_owned(),
&mut sliders.beard, &mut sliders.beard,
body.species.num_beards(body.body_type) - 1, body.species.num_beards(body.body_type) - 1,
body.beard, body.beard,