From 443332f33bee734b310f7c948ae5257be18dbed9 Mon Sep 17 00:00:00 2001 From: Maksym H Date: Tue, 20 Sep 2022 19:57:44 +0200 Subject: [PATCH] Minor code sync --- src/client/gameui.cpp | 5 +++-- src/client/minimap.cpp | 3 +-- src/gui/guiEditBox.cpp | 2 +- src/gui/guiEditBox.h | 2 +- src/gui/guiEngine.cpp | 21 +++++++-------------- src/gui/guiScene.cpp | 2 +- src/gui/guiScene.h | 2 +- src/gui/guiScrollBar.cpp | 22 ++++++++++------------ src/gui/guiSkin.cpp | 3 +-- src/gui/guiTable.cpp | 2 +- src/irrlicht_changes/static_text.cpp | 4 ++++ src/irrlicht_changes/static_text.h | 5 +++++ src/serverenvironment.cpp | 6 ++++-- src/threading/thread.cpp | 2 +- src/util/Optional.h | 2 +- src/util/string.cpp | 3 +-- 16 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/client/gameui.cpp b/src/client/gameui.cpp index 64b57e581..838f1a709 100644 --- a/src/client/gameui.cpp +++ b/src/client/gameui.cpp @@ -277,9 +277,10 @@ void GameUI::updateChatSize() const v2u32 &window_size = RenderingEngine::get_instance()->getWindowSize(); - core::rect chat_size(10, chat_y, window_size.X - 20, 0); + core::rect chat_size(10, chat_y, + window_size.X - 20, 0); chat_size.LowerRightCorner.Y = std::min((s32)window_size.Y, - m_guitext_chat->getTextHeight() + chat_y); + m_guitext_chat->getTextHeight() + chat_y); if (chat_size == m_current_chat_size) return; diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index 412dba31f..c06b3a9cf 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -203,8 +203,7 @@ Minimap::Minimap(Client *client) addMode(MINIMAP_TYPE_RADAR, 256); addMode(MINIMAP_TYPE_RADAR, 128); #else - // Replicate old behaviour - addMode(MINIMAP_TYPE_RADAR, 32); + addMode(MINIMAP_TYPE_RADAR, 64); #endif // Initialize minimap data diff --git a/src/gui/guiEditBox.cpp b/src/gui/guiEditBox.cpp index 259c26be2..c2c46ef25 100644 --- a/src/gui/guiEditBox.cpp +++ b/src/gui/guiEditBox.cpp @@ -4,7 +4,7 @@ Copyright (C) 2021 Minetest This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or +the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/src/gui/guiEditBox.h b/src/gui/guiEditBox.h index c616d75d1..6f17ac96e 100644 --- a/src/gui/guiEditBox.h +++ b/src/gui/guiEditBox.h @@ -4,7 +4,7 @@ Copyright (C) 2021 Minetest This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or +the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/src/gui/guiEngine.cpp b/src/gui/guiEngine.cpp index 5f4889d40..78a47bc3e 100644 --- a/src/gui/guiEngine.cpp +++ b/src/gui/guiEngine.cpp @@ -329,26 +329,19 @@ void GUIEngine::run() driver->endScene(); -#if defined(__ANDROID__) || defined(__IOS__) - bool keyboardActive; - if (!porting::hasRealKeyboard()) - keyboardActive = m_menu->getAndroidUIInput(); -#endif - - u32 frametime_min = 1000 / g_settings->getFloat("fps_max_unfocused") - / 2; - -#ifdef __IOS__ - if (keyboardActive) - frametime_min = 1000 / g_settings->getFloat("fps_max"); -#endif - + u32 frametime_min = 1000 / (device->isWindowFocused() + ? g_settings->getFloat("fps_max") + : g_settings->getFloat("fps_max_unfocused")); if (m_clouds_enabled) cloudPostProcess(frametime_min, device); else sleep_ms(frametime_min); m_script->step(); + +#if defined(__ANDROID__) || defined(__IOS__) + m_menu->getAndroidUIInput(); +#endif } } diff --git a/src/gui/guiScene.cpp b/src/gui/guiScene.cpp index 95d168108..af3fe03e9 100644 --- a/src/gui/guiScene.cpp +++ b/src/gui/guiScene.cpp @@ -4,7 +4,7 @@ Copyright (C) 2020 Jean-Patrick Guerrero This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or +the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/src/gui/guiScene.h b/src/gui/guiScene.h index 0f5f3a891..7e06e854a 100644 --- a/src/gui/guiScene.h +++ b/src/gui/guiScene.h @@ -4,7 +4,7 @@ Copyright (C) 2020 Jean-Patrick Guerrero This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or +the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/src/gui/guiScrollBar.cpp b/src/gui/guiScrollBar.cpp index 7b0ff68b0..6b683c5ba 100644 --- a/src/gui/guiScrollBar.cpp +++ b/src/gui/guiScrollBar.cpp @@ -424,7 +424,6 @@ void GUIScrollBar::refreshControls() border_size = h < w * 4 ? 0 : w; up_button = Environment->addButton(core::rect(0, 0, w, w), this); - if (m_textures.size() >= 3) { up_button->setImage(m_textures[2]); up_button->setScaleImage(true); @@ -434,15 +433,15 @@ void GUIScrollBar::refreshControls() up_button->setSubElement(true); up_button->setTabStop(false); } - if (sprites && m_textures.size() < 3) { up_button->setSpriteBank(sprites); up_button->setSprite(EGBS_BUTTON_UP, - s32(skin->getIcon(EGDI_CURSOR_UP)), current_icon_color); + s32(skin->getIcon(EGDI_CURSOR_UP)), + current_icon_color); up_button->setSprite(EGBS_BUTTON_DOWN, - s32(skin->getIcon(EGDI_CURSOR_UP)), current_icon_color); + s32(skin->getIcon(EGDI_CURSOR_UP)), + current_icon_color); } - up_button->setRelativePosition(core::rect(0, 0, w, w)); up_button->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); @@ -455,20 +454,19 @@ void GUIScrollBar::refreshControls() } if (!down_button) { - if (!down_button) { - down_button->setSubElement(true); - down_button->setTabStop(false); - } + down_button->setSubElement(true); + down_button->setTabStop(false); } if (sprites && m_textures.size() < 4) { down_button->setSpriteBank(sprites); down_button->setSprite(EGBS_BUTTON_UP, - s32(skin->getIcon(EGDI_CURSOR_DOWN)), current_icon_color); + s32(skin->getIcon(EGDI_CURSOR_DOWN)), + current_icon_color); down_button->setSprite(EGBS_BUTTON_DOWN, - s32(skin->getIcon(EGDI_CURSOR_DOWN)), current_icon_color); + s32(skin->getIcon(EGDI_CURSOR_DOWN)), + current_icon_color); } - down_button->setRelativePosition( core::rect(0, RelativeRect.getHeight() - w, w, RelativeRect.getHeight())); diff --git a/src/gui/guiSkin.cpp b/src/gui/guiSkin.cpp index 1cb4b52c2..f7419d950 100644 --- a/src/gui/guiSkin.cpp +++ b/src/gui/guiSkin.cpp @@ -1006,11 +1006,10 @@ void GUISkin::drawColoredIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon, #if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR >= 9 if (icon == EGDI_CHECK_BOX_CHECKED) { // Scale checkbox check specifically - // TODO other icons int radius = getSize(EGDS_CHECK_BOX_WIDTH) * .38; core::recti rect{position.X - radius, position.Y - radius, position.X + radius, position.Y + radius}; SpriteBank->draw2DSprite(Icons[icon], rect, 0, - &colors[gray? EGDC_GRAY_WINDOW_SYMBOL : EGDC_WINDOW_SYMBOL], currenttime - starttime, loop); + &colors[gray ? EGDC_GRAY_WINDOW_SYMBOL : EGDC_WINDOW_SYMBOL], currenttime - starttime, loop); return; } #endif diff --git a/src/gui/guiTable.cpp b/src/gui/guiTable.cpp index c9715b289..cdd548ce1 100644 --- a/src/gui/guiTable.cpp +++ b/src/gui/guiTable.cpp @@ -764,7 +764,7 @@ void GUITable::drawCell(const Cell *cell, video::SColor color, else source_rect.LowerRightCorner.Y = rowh; - video::SColor colors[] = {color,color,color,color}; + video::SColor colors[] = {color, color, color, color}; core::rect image_pos(dest_pos.X, dest_pos.Y, dest_pos.X + (image->getOriginalSize().Width * scale), diff --git a/src/irrlicht_changes/static_text.cpp b/src/irrlicht_changes/static_text.cpp index 0499da29e..5899dec0f 100644 --- a/src/irrlicht_changes/static_text.cpp +++ b/src/irrlicht_changes/static_text.cpp @@ -5,6 +5,7 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "static_text.h" +#ifdef _IRR_COMPILE_WITH_GUI_ #include #include @@ -638,3 +639,6 @@ void StaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWr #endif // USE_FREETYPE } // end namespace irr + + +#endif // _IRR_COMPILE_WITH_GUI_ diff --git a/src/irrlicht_changes/static_text.h b/src/irrlicht_changes/static_text.h index d459f0b2c..9bbca4acc 100644 --- a/src/irrlicht_changes/static_text.h +++ b/src/irrlicht_changes/static_text.h @@ -6,6 +6,9 @@ #pragma once +#include "IrrCompileConfig.h" +#ifdef _IRR_COMPILE_WITH_GUI_ + #include "IGUIStaticText.h" #include "irrArray.h" @@ -273,3 +276,5 @@ inline void setStaticText(irr::gui::IGUIStaticText *static_text, const wchar_t * { setStaticText(static_text, EnrichedString(text, static_text->getOverrideColor())); } + +#endif // _IRR_COMPILE_WITH_GUI_ diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp index 383dd2ef4..c9c08157d 100644 --- a/src/serverenvironment.cpp +++ b/src/serverenvironment.cpp @@ -451,7 +451,8 @@ ServerEnvironment::ServerEnvironment(ServerMap *map, } } - /*if (player_backend_name == "files") { +#ifdef SERVER + if (player_backend_name == "files") { warningstream << "/!\\ You are using old player file backend. " << "This backend is deprecated and will be removed in a future release /!\\" << std::endl << "Switching to SQLite3 or PostgreSQL is advised, " @@ -463,7 +464,8 @@ ServerEnvironment::ServerEnvironment(ServerMap *map, << "This backend is deprecated and will be removed in a future release /!\\" << std::endl << "Switching to LevelDB or SQLite3 is advised, " << "please read http://wiki.minetest.net/Database_backends." << std::endl; - }*/ + } +#endif m_player_database = openPlayerDatabase(player_backend_name, path_world, conf); m_auth_database = openAuthDatabase(auth_backend_name, path_world, conf); diff --git a/src/threading/thread.cpp b/src/threading/thread.cpp index 724e0af03..318624234 100644 --- a/src/threading/thread.cpp +++ b/src/threading/thread.cpp @@ -300,7 +300,7 @@ bool Thread::bindToProcessor(unsigned int proc_number) return pthread_processor_bind_np(PTHREAD_BIND_ADVISORY_NP, &answer, proc_number, getThreadHandle()) == 0; -#elif defined(__APPLE__) || defined(__IOS__) +#elif defined(__APPLE__) struct thread_affinity_policy tapol; diff --git a/src/util/Optional.h b/src/util/Optional.h index 9c2842b43..5f070a54a 100644 --- a/src/util/Optional.h +++ b/src/util/Optional.h @@ -4,7 +4,7 @@ Copyright (C) 2021 rubenwardy This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or +the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/src/util/string.cpp b/src/util/string.cpp index 0a5189c25..0900eb9aa 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -51,7 +51,7 @@ static bool parseHexColorString(const std::string &value, video::SColor &color, static bool parseNamedColorString(const std::string &value, video::SColor &color); #if defined(__ANDROID__) || defined(__APPLE__) -// Android need manual caring to support the full character set possible with wchar_t +// On Android iconv disagrees how big a wchar_t is for whatever reason const char *DEFAULT_ENCODING = "UTF-32LE"; #else const char *DEFAULT_ENCODING = "WCHAR_T"; @@ -143,7 +143,6 @@ std::wstring utf8_to_wide(const std::string &input) out.resize(outbuf_size / sizeof(wchar_t)); #if defined(__ANDROID__) || defined(__APPLE__) - // Android need manual caring to support the full character set possible with wchar_t SANITY_CHECK(sizeof(wchar_t) == 4); #endif