1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Various random code cleanups

This commit is contained in:
sfan5 2025-03-01 11:53:37 +01:00
parent 358658fa34
commit 7892541383
73 changed files with 216 additions and 285 deletions

View file

@ -3194,7 +3194,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
pos_offset = v2f32();
// used for formspec versions < 3
std::list<IGUIElement *>::iterator legacy_sort_start = std::prev(Children.end()); // last element
auto legacy_sort_start = std::prev(Children.end()); // last element
if (enable_prepends) {
// Backup the coordinates so that prepends can use the coordinates of choice.
@ -3308,7 +3308,7 @@ void GUIFormSpecMenu::legacySortElements(std::list<IGUIElement *>::iterator from
else
++from;
std::list<IGUIElement *>::iterator to = Children.end();
auto to = Children.end();
// 1: Copy into a sortable container
std::vector<IGUIElement *> elements(from, to);
@ -4899,8 +4899,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
if (s.ftype == f_Unknown &&
s.fid == event.GUIEvent.Caller->getID()) {
current_field_enter_pending = s.fname;
std::unordered_map<std::string, bool>::const_iterator it =
field_close_on_enter.find(s.fname);
auto it = field_close_on_enter.find(s.fname);
if (it != field_close_on_enter.end())
close_on_enter = (*it).second;
@ -5085,7 +5084,7 @@ double GUIFormSpecMenu::calculateImgsize(const parserData &data)
((15.0 / 13.0) * (0.85 + data.invsize.Y));
}
double prefer_imgsize = getImgsize(v2u32(padded_screensize.X, padded_screensize.Y),
double prefer_imgsize = getImgsize(v2u32::from(padded_screensize),
screen_dpi, gui_scaling);
// Try to use the preferred imgsize, but if that's bigger than the maximum