diff --git a/rsrc/dialogs/preferences.xml b/rsrc/dialogs/preferences.xml index 8b96f093..831fc711 100644 --- a/rsrc/dialogs/preferences.xml +++ b/rsrc/dialogs/preferences.xml @@ -45,7 +45,7 @@ 2 3 4 - other + Scale Map: @@ -54,7 +54,7 @@ 2 3 4 - other + diff --git a/src/game/boe.dlgutil.cpp b/src/game/boe.dlgutil.cpp index ae56c397..93068c16 100644 --- a/src/game/boe.dlgutil.cpp +++ b/src/game/boe.dlgutil.cpp @@ -1249,6 +1249,31 @@ void pick_preferences() { else if (ui_map_scale>2.95 && ui_map_scale<3.05) uiMapScale.setSelected("3"); else if (ui_map_scale>3.95 && ui_map_scale<4.05) uiMapScale.setSelected("4"); else uiMapScale.setSelected("other"); + + if(uiScale.getSelected() == "other") { + auto val = std::to_string(ui_scale); + while(val.length() > 2 && val[val.length() - 1] == val[val.length() - 2]) { + val.pop_back(); + } + while(val.length() > 1 && (val.back() == '.' || val.back() == '0')) { + val.pop_back(); + } + uiScale["other"].setText("Custom: " + val); + } else { + uiScale["other"].hide(); + } + if(uiMapScale.getSelected() == "other") { + auto val = std::to_string(ui_map_scale); + while(val.length() > 2 && val[val.length() - 1] == val[val.length() - 2]) { + val.pop_back(); + } + while(val.length() > 1 && (val.back() == '.' || val.back() == '0')) { + val.pop_back(); + } + uiMapScale["other"].setText("Custom: " + val); + } else { + uiMapScale["other"].hide(); + } void (*give_help)(short,short,cDialog&) = ::give_help;