Fix cases of assigning get_float_pref() to a float variable
It's called "get_float_pref" because it returns a floating-point. However, that floating-point is in double precision.
This commit is contained in:
@@ -1233,7 +1233,7 @@ void pick_preferences() {
|
||||
}
|
||||
|
||||
cLedGroup& uiScale = dynamic_cast<cLedGroup&>(prefsDlog["scaleui"]);
|
||||
float ui_scale = get_float_pref("UIScale", 1.0);
|
||||
double ui_scale = get_float_pref("UIScale", 1.0);
|
||||
if (ui_scale>0.95 && ui_scale<1.05) uiScale.setSelected("1");
|
||||
else if (ui_scale>1.45 && ui_scale<1.55) uiScale.setSelected("1_5");
|
||||
else if (ui_scale>1.95 && ui_scale<2.05) uiScale.setSelected("2");
|
||||
@@ -1242,7 +1242,7 @@ void pick_preferences() {
|
||||
else uiScale.setSelected("other");
|
||||
|
||||
cLedGroup& uiMapScale = dynamic_cast<cLedGroup&>(prefsDlog["scalemap"]);
|
||||
float ui_map_scale = get_float_pref("UIScaleMap", 1.0);
|
||||
double ui_map_scale = get_float_pref("UIScaleMap", 1.0);
|
||||
if (ui_map_scale>0.95 && ui_map_scale<1.05) uiMapScale.setSelected("1");
|
||||
else if (ui_map_scale>1.45 && ui_map_scale<1.55) uiMapScale.setSelected("1_5");
|
||||
else if (ui_map_scale>1.95 && ui_map_scale<2.05) uiMapScale.setSelected("2");
|
||||
|
@@ -137,7 +137,7 @@ void adjust_window_mode() {
|
||||
winSettings.stencilBits = 1;
|
||||
sf::VideoMode desktop = sf::VideoMode::getDesktopMode();
|
||||
hideMenuBar();
|
||||
float ui_scale = get_float_pref("UIScale", 1.0);
|
||||
double ui_scale = get_float_pref("UIScale", 1.0);
|
||||
if(ui_scale < 0.1) ui_scale = 1.0;
|
||||
float width = 605 * ui_scale, height = 430 * ui_scale;
|
||||
|
||||
|
@@ -673,7 +673,7 @@ short get_num_of_items(short max_num) {
|
||||
}
|
||||
|
||||
void init_mini_map() {
|
||||
float ui_scale = get_float_pref("UIScaleMap", 1.0);
|
||||
double ui_scale = get_float_pref("UIScaleMap", 1.0);
|
||||
if (ui_scale < 0.1) ui_scale = 1.0;
|
||||
if (mini_map.isOpen()) mini_map.close();
|
||||
mini_map.create(sf::VideoMode(ui_scale*296,ui_scale*277), "Map", sf::Style::Titlebar | sf::Style::Close);
|
||||
|
@@ -145,7 +145,7 @@ sf::FloatRect compute_viewport(const sf::RenderWindow& mainPtr, float ui_scale)
|
||||
|
||||
void adjust_window (sf::RenderWindow& mainPtr, sf::View& mainView) {
|
||||
|
||||
float ui_scale = get_float_pref("UIScaleCharEd", 1.0);
|
||||
double ui_scale = get_float_pref("UIScaleCharEd", 1.0);
|
||||
|
||||
int const width = ui_scale * 590;
|
||||
int const height = ui_scale * 440
|
||||
@@ -532,7 +532,7 @@ void pick_preferences() {
|
||||
cDialog prefsDlog(*ResMgr::dialogs.get("pref-character"));
|
||||
prefsDlog.attachClickHandlers(&prefs_event_filter, {"okay", "cancel"});
|
||||
|
||||
float ui_scale = get_float_pref("UIScaleCharEd", 1.0);
|
||||
double ui_scale = get_float_pref("UIScaleCharEd", 1.0);
|
||||
dynamic_cast<cLed&>(prefsDlog["scaleui"]).setState(ui_scale == 1.0 ? led_off : (ui_scale == 2.0 ? led_red : led_green));
|
||||
dynamic_cast<cLed&>(prefsDlog["nosound"]).setState(get_bool_pref("PlaySoundsCharEd", true) ? led_off : led_red);
|
||||
|
||||
|
@@ -165,7 +165,7 @@ void adjust_windows (sf::RenderWindow & mainPtr, sf::View & mainView) {
|
||||
// TODO: things might still be broken when upscaled.
|
||||
// translate_mouse_coordinates has been applied in some places but more work might be needed.
|
||||
// In particular, the white area on the right side of the main menu needs fixing.
|
||||
float ui_scale = get_float_pref("UIScaleScenEd", 1.0);
|
||||
double ui_scale = get_float_pref("UIScaleScenEd", 1.0);
|
||||
|
||||
const int width = ui_scale * 584;
|
||||
const int height = ui_scale * 420
|
||||
@@ -692,7 +692,7 @@ void pick_preferences() {
|
||||
cDialog prefsDlog(*ResMgr::dialogs.get("pref-scenario"));
|
||||
prefsDlog.attachClickHandlers(&prefs_event_filter, {"okay", "cancel"});
|
||||
|
||||
float ui_scale = get_float_pref("UIScaleScenEd", 1.0);
|
||||
double ui_scale = get_float_pref("UIScaleScenEd", 1.0);
|
||||
dynamic_cast<cLed&>(prefsDlog["scaleui"]).setState(ui_scale == 1.0 ? led_off : (ui_scale == 2.0 ? led_red : led_green));
|
||||
dynamic_cast<cLed&>(prefsDlog["nosound"]).setState(get_bool_pref("PlaySoundsScenEd", true) ? led_off : led_red);
|
||||
|
||||
|
Reference in New Issue
Block a user