mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-10 20:40:40 +00:00
tpreferences: use initializer list for accl speeds
This commit is contained in:
parent
3ac7f8d970
commit
1ae22aa046
@ -116,7 +116,10 @@ tpreferences::tpreferences(CVideo& video, const config& game_cfg)
|
|||||||
, adv_preferences_cfg_()
|
, adv_preferences_cfg_()
|
||||||
, friend_names_()
|
, friend_names_()
|
||||||
, last_selected_item_(0)
|
, last_selected_item_(0)
|
||||||
, accl_speeds_()
|
, accl_speeds_(
|
||||||
|
// IMPORTANT: NEVER have trailing zeroes here, or else the cast from doubles
|
||||||
|
// to string will not match, since lexical_cast strips trailing zeroes.
|
||||||
|
{"0.25", "0.5", "0.75", "1", "1.25", "1.5", "1.75", "2", "3", "4", "8", "16" })
|
||||||
, visible_hotkeys_()
|
, visible_hotkeys_()
|
||||||
, font_scaling_(font_scaling())
|
, font_scaling_(font_scaling())
|
||||||
, index_(0,0)
|
, index_(0,0)
|
||||||
@ -127,14 +130,6 @@ tpreferences::tpreferences(CVideo& video, const config& game_cfg)
|
|||||||
|
|
||||||
std::sort(adv_preferences_cfg_.begin(), adv_preferences_cfg_.end(),
|
std::sort(adv_preferences_cfg_.begin(), adv_preferences_cfg_.end(),
|
||||||
advanced_preferences_sorter());
|
advanced_preferences_sorter());
|
||||||
|
|
||||||
// IMPORTANT: NEVER have trailing zeroes here, or else the cast from doubles
|
|
||||||
// to string will not match, since lexical_cast strips trailing zeroes.
|
|
||||||
static const char* const speeds[] = {
|
|
||||||
"0.25", "0.5", "0.75", "1", "1.25", "1.5", "1.75", "2", "3", "4", "8", "16" };
|
|
||||||
|
|
||||||
const size_t num_items = sizeof(speeds)/sizeof(const char*);
|
|
||||||
accl_speeds_.insert(accl_speeds_.end(), speeds, &speeds[num_items]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the template type in order to use the correct value getter
|
// Determine the template type in order to use the correct value getter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user