From f4285a59ac59452ef50fd09f78fcc0ea60aa982c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Sun, 4 May 2025 16:31:44 +0200 Subject: [PATCH] Purge some dead code (mostly Irrlicht) (#16111) * Remove obsolete Irrlicht attributes system * Remove dead GUI element types * Remove some obsolete Irrlicht headers * Fix some oopsies from d96f5e1 --- irr/LICENSE | 4 +- irr/include/EAttributes.h | 32 ------- irr/include/EGUIElementTypes.h | 64 +------------- irr/include/IAttributes.h | 87 ------------------- irr/include/IFileSystem.h | 1 - irr/include/IGUIElement.h | 7 -- irr/include/ISceneManager.h | 7 -- irr/include/IVideoDriver.h | 19 ----- irr/include/IrrCompileConfig.h | 11 --- irr/include/IrrlichtDevice.h | 3 +- irr/include/SMaterial.h | 3 +- irr/include/SceneParameters.h | 50 ----------- irr/include/exampleHelper.h | 21 ----- irr/include/irrlicht.h | 5 +- irr/include/matrix4.h | 3 +- irr/include/mt_opengl.h | 3 +- irr/scripts/BindingGenerator.lua | 3 +- irr/src/CAttributeImpl.h | 141 ------------------------------- irr/src/CAttributes.cpp | 121 -------------------------- irr/src/CAttributes.h | 102 ---------------------- irr/src/CGUISkin.cpp | 1 - irr/src/CIrrDeviceStub.cpp | 1 - irr/src/CMakeLists.txt | 1 - irr/src/CNullDriver.cpp | 26 +----- irr/src/CNullDriver.h | 6 -- irr/src/COBJMeshFileLoader.cpp | 20 +---- irr/src/COpenGLDriver.cpp | 12 --- irr/src/CSceneManager.cpp | 17 +--- irr/src/CSceneManager.h | 8 -- irr/src/IAttribute.h | 35 -------- irr/src/Irrlicht.cpp | 6 +- irr/src/OpenGL/Driver.cpp | 10 --- src/client/clientlauncher.cpp | 4 - src/client/game.cpp | 3 - src/gui/guiFormSpecMenu.cpp | 4 +- src/gui/guiScene.cpp | 3 - src/gui/guiTable.cpp | 5 -- src/gui/guiTable.h | 3 - src/util/string.cpp | 3 +- 39 files changed, 24 insertions(+), 831 deletions(-) delete mode 100644 irr/include/EAttributes.h delete mode 100644 irr/include/IAttributes.h delete mode 100644 irr/include/IrrCompileConfig.h delete mode 100644 irr/include/SceneParameters.h delete mode 100755 irr/include/exampleHelper.h delete mode 100644 irr/src/CAttributeImpl.h delete mode 100644 irr/src/CAttributes.cpp delete mode 100644 irr/src/CAttributes.h delete mode 100644 irr/src/IAttribute.h diff --git a/irr/LICENSE b/irr/LICENSE index 8ad1f24ca..67d7bc787 100644 --- a/irr/LICENSE +++ b/irr/LICENSE @@ -21,6 +21,4 @@ Copyright (C) 2002-2012 Nikolaus Gebhardt the Irrlicht Engine in your product, you must acknowledge somewhere in your documentation that you've used the IJPG code. It would also be nice to mention that you use the Irrlicht Engine, the zlib, libPng and aesGladman. See the - corresponding license files for further informations. It is also possible to disable - usage of those additional libraries by defines in the IrrCompileConfig.h header and - recompiling the engine. + corresponding license files for further informations. diff --git a/irr/include/EAttributes.h b/irr/include/EAttributes.h deleted file mode 100644 index 54954ca41..000000000 --- a/irr/include/EAttributes.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#pragma once - -namespace irr -{ -namespace io -{ - -//! Types of attributes available for IAttributes -enum E_ATTRIBUTE_TYPE -{ - // integer attribute - EAT_INT = 0, - - // float attribute - EAT_FLOAT, - - // boolean attribute - EAT_BOOL, - - // known attribute type count - EAT_COUNT, - - // unknown attribute - EAT_UNKNOWN -}; - -} // end namespace io -} // end namespace irr diff --git a/irr/include/EGUIElementTypes.h b/irr/include/EGUIElementTypes.h index 557969e44..d5c5d94ce 100644 --- a/irr/include/EGUIElementTypes.h +++ b/irr/include/EGUIElementTypes.h @@ -24,9 +24,6 @@ enum EGUI_ELEMENT_TYPE //! A combo box (IGUIComboBox) EGUIET_COMBO_BOX, - //! A context menu (IGUIContextMenu) - EGUIET_CONTEXT_MENU, - //! A menu (IGUIMenu) EGUIET_MENU, @@ -36,54 +33,30 @@ enum EGUI_ELEMENT_TYPE //! A file open dialog (IGUIFileOpenDialog) EGUIET_FILE_OPEN_DIALOG, - //! A color select open dialog (IGUIColorSelectDialog) - EGUIET_COLOR_SELECT_DIALOG, - - //! A in/out fader (IGUIInOutFader) - EGUIET_IN_OUT_FADER, - //! An image (IGUIImage) EGUIET_IMAGE, //! A list box (IGUIListBox) EGUIET_LIST_BOX, - //! A mesh viewer (IGUIMeshViewer) - EGUIET_MESH_VIEWER, - - //! A message box (IGUIWindow) - EGUIET_MESSAGE_BOX, - - //! A modal screen - EGUIET_MODAL_SCREEN, - //! A scroll bar (IGUIScrollBar) EGUIET_SCROLL_BAR, - //! A spin box (IGUISpinBox) - EGUIET_SPIN_BOX, - //! A static text (IGUIStaticText) EGUIET_STATIC_TEXT, + //! A table (GUITable) + EGUIET_TABLE, + //! A tab (IGUITab) EGUIET_TAB, //! A tab control EGUIET_TAB_CONTROL, - //! A Table - EGUIET_TABLE, - //! A tool bar (IGUIToolBar) EGUIET_TOOL_BAR, - //! A Tree View - EGUIET_TREE_VIEW, - - //! A window - EGUIET_WINDOW, - //! Unknown type. EGUIET_ELEMENT, @@ -98,36 +71,5 @@ enum EGUI_ELEMENT_TYPE }; -//! Names for built-in element types -const c8 *const GUIElementTypeNames[] = { - "button", - "checkBox", - "comboBox", - "contextMenu", - "menu", - "editBox", - "fileOpenDialog", - "colorSelectDialog", - "inOutFader", - "image", - "listBox", - "meshViewer", - "messageBox", - "modalScreen", - "scrollBar", - "spinBox", - "staticText", - "tab", - "tabControl", - "table", - "toolBar", - "treeview", - "window", - "element", - "root", - "profiler", - 0, - }; - } // end namespace gui } // end namespace irr diff --git a/irr/include/IAttributes.h b/irr/include/IAttributes.h deleted file mode 100644 index 1f35732f0..000000000 --- a/irr/include/IAttributes.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#pragma once - -#include "IReferenceCounted.h" -#include "EAttributes.h" - -namespace irr -{ -namespace video -{ -class ITexture; -} // end namespace video -namespace io -{ - -//! Provides a generic interface for attributes and their values and the possibility to serialize them -class IAttributes : public virtual IReferenceCounted -{ -public: - //! Returns the type of an attribute - //! \param attributeName: Name for the attribute - virtual E_ATTRIBUTE_TYPE getAttributeType(const c8 *attributeName) const = 0; - - //! Returns if an attribute with a name exists - virtual bool existsAttribute(const c8 *attributeName) const = 0; - - //! Removes all attributes - virtual void clear() = 0; - - /* - - Integer Attribute - - */ - - //! Adds an attribute as integer - virtual void addInt(const c8 *attributeName, s32 value) = 0; - - //! Sets an attribute as integer value - virtual void setAttribute(const c8 *attributeName, s32 value) = 0; - - //! Gets an attribute as integer value - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual s32 getAttributeAsInt(const c8 *attributeName, irr::s32 defaultNotFound = 0) const = 0; - - /* - - Float Attribute - - */ - - //! Adds an attribute as float - virtual void addFloat(const c8 *attributeName, f32 value) = 0; - - //! Sets a attribute as float value - virtual void setAttribute(const c8 *attributeName, f32 value) = 0; - - //! Gets an attribute as float value - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual f32 getAttributeAsFloat(const c8 *attributeName, irr::f32 defaultNotFound = 0.f) const = 0; - - /* - Bool Attribute - */ - - //! Adds an attribute as bool - virtual void addBool(const c8 *attributeName, bool value) = 0; - - //! Sets an attribute as boolean value - virtual void setAttribute(const c8 *attributeName, bool value) = 0; - - //! Gets an attribute as boolean value - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual bool getAttributeAsBool(const c8 *attributeName, bool defaultNotFound = false) const = 0; -}; - -} // end namespace io -} // end namespace irr diff --git a/irr/include/IFileSystem.h b/irr/include/IFileSystem.h index f144bbaee..30cace199 100644 --- a/irr/include/IFileSystem.h +++ b/irr/include/IFileSystem.h @@ -19,7 +19,6 @@ namespace io class IReadFile; class IWriteFile; class IFileList; -class IAttributes; //! The FileSystem manages files and archives and provides access to them. /** It manages where files are, so that modules which use the the IO do not diff --git a/irr/include/IGUIElement.h b/irr/include/IGUIElement.h index cdd3d7487..d90f88bf3 100644 --- a/irr/include/IGUIElement.h +++ b/irr/include/IGUIElement.h @@ -662,13 +662,6 @@ public: return type == Type; } - //! Returns the type name of the gui element. - /** This is needed serializing elements. */ - virtual const c8 *getTypeName() const - { - return GUIElementTypeNames[Type]; - } - //! Returns the name of the element. /** \return Name as character string. */ virtual const c8 *getName() const diff --git a/irr/include/ISceneManager.h b/irr/include/ISceneManager.h index 31604214f..847666450 100644 --- a/irr/include/ISceneManager.h +++ b/irr/include/ISceneManager.h @@ -10,7 +10,6 @@ #include "dimension2d.h" #include "SColor.h" #include "ESceneNodeTypes.h" -#include "SceneParameters.h" // IWYU pragma: export namespace irr { @@ -20,7 +19,6 @@ struct SEvent; namespace io { class IReadFile; -class IAttributes; class IWriteFile; class IFileSystem; } // end namespace io @@ -373,11 +371,6 @@ public: /** All scene nodes are removed. */ virtual void clear() = 0; - //! Get interface to the parameters set in this scene. - /** String parameters can be used by plugins and mesh loaders. - See COLLADA_CREATE_SCENE_INSTANCES and DMF_USE_MATERIALS_DIRS */ - virtual io::IAttributes *getParameters() = 0; - //! Get current render pass. /** All scene nodes are being rendered in a specific order. First lights, cameras, sky boxes, solid geometry, and then transparent diff --git a/irr/include/IVideoDriver.h b/irr/include/IVideoDriver.h index 950723941..f392eb636 100644 --- a/irr/include/IVideoDriver.h +++ b/irr/include/IVideoDriver.h @@ -25,7 +25,6 @@ namespace irr { namespace io { -class IAttributes; class IReadFile; class IWriteFile; } // end namespace io @@ -127,23 +126,6 @@ public: \param flag When true the feature is disabled, otherwise it is enabled. */ virtual void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag = true) = 0; - //! Get attributes of the actual video driver - /** The following names can be queried for the given types: - MaxTextures (int) The maximum number of simultaneous textures supported by the driver. This can be less than the supported number of textures of the driver. Use _IRR_MATERIAL_MAX_TEXTURES_ to adapt the number. - MaxSupportedTextures (int) The maximum number of simultaneous textures supported by the fixed function pipeline of the (hw) driver. The actual supported number of textures supported by the engine can be lower. - MaxAnisotropy (int) Number of anisotropy levels supported for filtering. At least 1, max is typically at 16 or 32. - MaxAuxBuffers (int) Special render buffers, which are currently not really usable inside Irrlicht. Only supported by OpenGL - MaxMultipleRenderTargets (int) Number of render targets which can be bound simultaneously. Rendering to MRTs is done via shaders. - MaxIndices (int) Number of indices which can be used in one render call (i.e. one mesh buffer). - MaxTextureSize (int) Dimension that a texture may have, both in width and height. - MaxGeometryVerticesOut (int) Number of vertices the geometry shader can output in one pass. Only OpenGL so far. - MaxTextureLODBias (float) Maximum value for LOD bias. Is usually at around 16, but can be lower on some systems. - Version (int) Version of the driver. Should be Major*100+Minor - ShaderLanguageVersion (int) Version of the high level shader language. Should be Major*100+Minor. - AntiAlias (int) Number of Samples the driver uses for each pixel. 0 and 1 means anti aliasing is off, typical values are 2,4,8,16,32 - */ - virtual const io::IAttributes &getDriverAttributes() const = 0; - //! Sets transformation matrices. /** \param state Transformation type to be set, e.g. view, world, or projection. @@ -1132,7 +1114,6 @@ public: //! Only used by the engine internally. /** Passes the global material flag AllowZWriteOnTransparent. - Use the SceneManager attribute to set this value from your app. \param flag Default behavior is to disable ZWrite, i.e. false. */ virtual void setAllowZWriteOnTransparent(bool flag) = 0; diff --git a/irr/include/IrrCompileConfig.h b/irr/include/IrrCompileConfig.h deleted file mode 100644 index eaa6f1dd1..000000000 --- a/irr/include/IrrCompileConfig.h +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#pragma once - -// these are obsolete and never pre-defined - -#define IRRCALLCONV - -#define IRRLICHT_API diff --git a/irr/include/IrrlichtDevice.h b/irr/include/IrrlichtDevice.h index d159142c4..ed77f979e 100644 --- a/irr/include/IrrlichtDevice.h +++ b/irr/include/IrrlichtDevice.h @@ -13,7 +13,6 @@ #include "ITimer.h" #include "IOSOperator.h" #include "irrArray.h" -#include "IrrCompileConfig.h" #include "position2d.h" #include "SColor.h" // video::ECOLOR_FORMAT #include @@ -45,7 +44,7 @@ class IContextManager; class IImage; class ITexture; class IVideoDriver; -extern "C" IRRLICHT_API bool IRRCALLCONV isDriverSupported(E_DRIVER_TYPE driver); +extern "C" bool isDriverSupported(E_DRIVER_TYPE driver); } // end namespace video //! The Irrlicht device. You can create it with createDevice() or createDeviceEx(). diff --git a/irr/include/SMaterial.h b/irr/include/SMaterial.h index d5b9341f4..0b032e2b2 100644 --- a/irr/include/SMaterial.h +++ b/irr/include/SMaterial.h @@ -10,7 +10,6 @@ #include "EMaterialTypes.h" // IWYU pragma: export #include "EMaterialProps.h" // IWYU pragma: export #include "SMaterialLayer.h" -#include "IrrCompileConfig.h" // for IRRLICHT_API namespace irr { @@ -472,7 +471,7 @@ public: }; //! global const identity Material -IRRLICHT_API extern const SMaterial IdentityMaterial; +extern const SMaterial IdentityMaterial; } // end namespace video } // end namespace irr diff --git a/irr/include/SceneParameters.h b/irr/include/SceneParameters.h deleted file mode 100644 index 717797e26..000000000 --- a/irr/include/SceneParameters.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#pragma once - -#include "irrTypes.h" - -/*! \file SceneParameters.h - \brief Header file containing all scene parameters for modifying mesh loading etc. - - This file includes all parameter names which can be set using ISceneManager::getParameters() - to modify the behavior of plugins and mesh loaders. -*/ - -namespace irr -{ -namespace scene -{ -//! Name of the parameter for changing how Irrlicht handles the ZWrite flag for transparent (blending) materials -/** The default behavior in Irrlicht is to disable writing to the -z-buffer for all really transparent, i.e. blending materials. This -avoids problems with intersecting faces, but can also break renderings. -If transparent materials should use the SMaterial flag for ZWriteEnable -just as other material types use this attribute. -Use it like this: -\code -SceneManager->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true); -\endcode -**/ -const c8 *const ALLOW_ZWRITE_ON_TRANSPARENT = "Allow_ZWrite_On_Transparent"; - -//! Flag to avoid loading group structures in .obj files -/** Use it like this: -\code -SceneManager->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_GROUPS, true); -\endcode -**/ -const c8 *const OBJ_LOADER_IGNORE_GROUPS = "OBJ_IgnoreGroups"; - -//! Flag to avoid loading material .mtl file for .obj files -/** Use it like this: -\code -SceneManager->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_MATERIAL_FILES, true); -\endcode -**/ -const c8 *const OBJ_LOADER_IGNORE_MATERIAL_FILES = "OBJ_IgnoreMaterialFiles"; - -} // end namespace scene -} // end namespace irr diff --git a/irr/include/exampleHelper.h b/irr/include/exampleHelper.h deleted file mode 100755 index 698430cb9..000000000 --- a/irr/include/exampleHelper.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2015 Patryk Nadrowski -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#pragma once - -#include "path.h" - -namespace irr -{ - -static io::path getExampleMediaPath() -{ -#ifdef IRR_MOBILE_PATHS - return io::path("media/"); -#else - return io::path("../../media/"); -#endif -} - -} // end namespace irr diff --git a/irr/include/irrlicht.h b/irr/include/irrlicht.h index 8bac30e3d..b23402729 100644 --- a/irr/include/irrlicht.h +++ b/irr/include/irrlicht.h @@ -34,7 +34,6 @@ #include "IEventReceiver.h" #include "irrTypes.h" #include "SIrrCreationParameters.h" -#include "IrrCompileConfig.h" // for IRRLICHT_API and IRRCALLCONV //! Everything in the Irrlicht Engine can be found in this namespace. namespace irr @@ -56,7 +55,7 @@ for the vertical retrace period, otherwise not. \return Returns pointer to the created IrrlichtDevice or null if the device could not be created. */ -extern "C" IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDevice( +extern "C" IrrlichtDevice *createDevice( video::E_DRIVER_TYPE driverType = video::EDT_OPENGL, // parentheses are necessary for some compilers const core::dimension2d &windowSize = (core::dimension2d(640, 480)), @@ -74,7 +73,7 @@ handle in which the device should be created. See irr::SIrrlichtCreationParameters for details. \return Returns pointer to the created IrrlichtDevice or null if the device could not be created. */ -extern "C" IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDeviceEx( +extern "C" IrrlichtDevice *createDeviceEx( const SIrrlichtCreationParameters ¶meters); // THE FOLLOWING IS AN EMPTY LIST OF ALL SUB NAMESPACES diff --git a/irr/include/matrix4.h b/irr/include/matrix4.h index 6fc8cf6f8..7d9a11ca5 100644 --- a/irr/include/matrix4.h +++ b/irr/include/matrix4.h @@ -11,7 +11,6 @@ #include "plane3d.h" #include "aabbox3d.h" #include "rect.h" -#include "IrrCompileConfig.h" // for IRRLICHT_API #include namespace irr @@ -1899,7 +1898,7 @@ inline CMatrix4 operator*(const T scalar, const CMatrix4 &mat) typedef CMatrix4 matrix4; //! global const identity matrix -IRRLICHT_API extern const matrix4 IdentityMatrix; +extern const matrix4 IdentityMatrix; } // end namespace core } // end namespace irr diff --git a/irr/include/mt_opengl.h b/irr/include/mt_opengl.h index 1a92cde56..9fd99c191 100755 --- a/irr/include/mt_opengl.h +++ b/irr/include/mt_opengl.h @@ -5,7 +5,6 @@ #include #include -#include "IrrCompileConfig.h" // for IRRLICHT_API #include "IContextManager.h" #include @@ -3199,4 +3198,4 @@ public: }; // Global GL procedures object. -IRRLICHT_API extern OpenGLProcedures GL; +extern OpenGLProcedures GL; diff --git a/irr/scripts/BindingGenerator.lua b/irr/scripts/BindingGenerator.lua index 1ca5b41d9..83c625b06 100755 --- a/irr/scripts/BindingGenerator.lua +++ b/irr/scripts/BindingGenerator.lua @@ -349,7 +349,6 @@ f:write[[ #include #include -#include "IrrCompileConfig.h" // for IRRLICHT_API #include "IContextManager.h" #include @@ -415,7 +414,7 @@ f:write[[ ]]; f:write( "};\n" ); f:write( "\n// Global GL procedures object.\n" ); -f:write( "IRRLICHT_API extern OpenGLProcedures GL;\n" ); +f:write( "extern OpenGLProcedures GL;\n" ); f:close(); -- Write loader implementation diff --git a/irr/src/CAttributeImpl.h b/irr/src/CAttributeImpl.h deleted file mode 100644 index e9436a407..000000000 --- a/irr/src/CAttributeImpl.h +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#include "CAttributes.h" - -namespace irr -{ -namespace io -{ - -/* - Basic types, check documentation in IAttribute.h to see how they generally work. -*/ - -// Attribute implemented for boolean values -class CBoolAttribute : public IAttribute -{ -public: - CBoolAttribute(const char *name, bool value) - { - Name = name; - setBool(value); - } - - s32 getInt() const override - { - return BoolValue ? 1 : 0; - } - - f32 getFloat() const override - { - return BoolValue ? 1.0f : 0.0f; - } - - bool getBool() const override - { - return BoolValue; - } - - void setInt(s32 intValue) override - { - BoolValue = (intValue != 0); - } - - void setFloat(f32 floatValue) override - { - BoolValue = (floatValue != 0); - } - - void setBool(bool boolValue) override - { - BoolValue = boolValue; - } - - E_ATTRIBUTE_TYPE getType() const override - { - return EAT_BOOL; - } - - bool BoolValue; -}; - -// Attribute implemented for integers -class CIntAttribute : public IAttribute -{ -public: - CIntAttribute(const char *name, s32 value) - { - Name = name; - setInt(value); - } - - s32 getInt() const override - { - return Value; - } - - f32 getFloat() const override - { - return (f32)Value; - } - - void setInt(s32 intValue) override - { - Value = intValue; - } - - void setFloat(f32 floatValue) override - { - Value = (s32)floatValue; - }; - - E_ATTRIBUTE_TYPE getType() const override - { - return EAT_INT; - } - - s32 Value; -}; - -// Attribute implemented for floats -class CFloatAttribute : public IAttribute -{ -public: - CFloatAttribute(const char *name, f32 value) - { - Name = name; - setFloat(value); - } - - s32 getInt() const override - { - return (s32)Value; - } - - f32 getFloat() const override - { - return Value; - } - - void setInt(s32 intValue) override - { - Value = (f32)intValue; - } - - void setFloat(f32 floatValue) override - { - Value = floatValue; - } - - E_ATTRIBUTE_TYPE getType() const override - { - return EAT_FLOAT; - } - - f32 Value; -}; - -} // end namespace io -} // end namespace irr diff --git a/irr/src/CAttributes.cpp b/irr/src/CAttributes.cpp deleted file mode 100644 index 924bd1a45..000000000 --- a/irr/src/CAttributes.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#include "CAttributes.h" -#include "CAttributeImpl.h" -#include "ITexture.h" -#include "IVideoDriver.h" - -namespace irr -{ -namespace io -{ - -CAttributes::CAttributes() {} - -CAttributes::~CAttributes() -{ - clear(); -} - -//! Removes all attributes -void CAttributes::clear() -{ - for (auto it : Attributes) - delete it.second; - Attributes.clear(); -} - -//! Sets a attribute as boolean value -void CAttributes::setAttribute(const c8 *attributeName, bool value) -{ - auto it = Attributes.find(attributeName); - if (it != Attributes.end()) { - it->second->setBool(value); - } else { - Attributes[attributeName] = new CBoolAttribute(attributeName, value); - } -} - -//! Gets a attribute as boolean value -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setAttribute() as bool -//! or 0 if attribute is not set. -bool CAttributes::getAttributeAsBool(const c8 *attributeName, bool defaultNotFound) const -{ - auto it = Attributes.find(attributeName); - if (it != Attributes.end()) - return it->second->getBool(); - else - return defaultNotFound; -} - -//! Sets a attribute as integer value -void CAttributes::setAttribute(const c8 *attributeName, s32 value) -{ - auto it = Attributes.find(attributeName); - if (it != Attributes.end()) { - it->second->setInt(value); - } else { - Attributes[attributeName] = new CIntAttribute(attributeName, value); - } -} - -//! Gets a attribute as integer value -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setAttribute() as integer -//! or 0 if attribute is not set. -s32 CAttributes::getAttributeAsInt(const c8 *attributeName, irr::s32 defaultNotFound) const -{ - auto it = Attributes.find(attributeName); - if (it != Attributes.end()) - return it->second->getInt(); - else - return defaultNotFound; -} - -//! Sets a attribute as float value -void CAttributes::setAttribute(const c8 *attributeName, f32 value) -{ - auto it = Attributes.find(attributeName); - if (it != Attributes.end()) { - it->second->setFloat(value); - } else { - Attributes[attributeName] = new CFloatAttribute(attributeName, value); - } -} - -//! Gets a attribute as integer value -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setAttribute() as float value -//! or 0 if attribute is not set. -f32 CAttributes::getAttributeAsFloat(const c8 *attributeName, irr::f32 defaultNotFound) const -{ - auto it = Attributes.find(attributeName); - if (it != Attributes.end()) - return it->second->getFloat(); - else - return defaultNotFound; -} - -//! Returns the type of an attribute -E_ATTRIBUTE_TYPE CAttributes::getAttributeType(const c8 *attributeName) const -{ - E_ATTRIBUTE_TYPE ret = EAT_UNKNOWN; - - auto it = Attributes.find(attributeName); - if (it != Attributes.end()) - ret = it->second->getType(); - - return ret; -} - -//! Returns if an attribute with a name exists -bool CAttributes::existsAttribute(const c8 *attributeName) const -{ - return Attributes.find(attributeName) != Attributes.end(); -} - -} // end namespace io -} // end namespace irr diff --git a/irr/src/CAttributes.h b/irr/src/CAttributes.h deleted file mode 100644 index 8ea3ecf19..000000000 --- a/irr/src/CAttributes.h +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#pragma once - -#include -#include -#include "IAttributes.h" -#include "IAttribute.h" - -namespace irr -{ - -namespace io -{ - -//! Implementation of the IAttributes interface -class CAttributes : public IAttributes -{ -public: - CAttributes(); - ~CAttributes(); - - //! Returns the type of an attribute - //! \param attributeName: Name for the attribute - E_ATTRIBUTE_TYPE getAttributeType(const c8 *attributeName) const override; - - //! Returns if an attribute with a name exists - bool existsAttribute(const c8 *attributeName) const override; - - //! Removes all attributes - void clear() override; - - /* - - Integer Attribute - - */ - - //! Adds an attribute as integer - void addInt(const c8 *attributeName, s32 value) override { - setAttribute(attributeName, value); - } - - //! Sets an attribute as integer value - void setAttribute(const c8 *attributeName, s32 value) override; - - //! Gets an attribute as integer value - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - s32 getAttributeAsInt(const c8 *attributeName, irr::s32 defaultNotFound = 0) const override; - - /* - - Float Attribute - - */ - - //! Adds an attribute as float - void addFloat(const c8 *attributeName, f32 value) override { - setAttribute(attributeName, value); - } - - //! Sets a attribute as float value - void setAttribute(const c8 *attributeName, f32 value) override; - - //! Gets an attribute as float value - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - f32 getAttributeAsFloat(const c8 *attributeName, irr::f32 defaultNotFound = 0.f) const override; - - /* - Bool Attribute - */ - - //! Adds an attribute as bool - void addBool(const c8 *attributeName, bool value) override { - setAttribute(attributeName, value); - } - - //! Sets an attribute as boolean value - void setAttribute(const c8 *attributeName, bool value) override; - - //! Gets an attribute as boolean value - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - bool getAttributeAsBool(const c8 *attributeName, bool defaultNotFound = false) const override; - -protected: - typedef std::basic_string string; - - // specify a comparator so we can directly look up in the map with const c8* - // (works since C++14) - std::map> Attributes; -}; - -} // end namespace io -} // end namespace irr diff --git a/irr/src/CGUISkin.cpp b/irr/src/CGUISkin.cpp index 3c130f7a1..b6439c840 100644 --- a/irr/src/CGUISkin.cpp +++ b/irr/src/CGUISkin.cpp @@ -10,7 +10,6 @@ #include "IGUISpriteBank.h" #include "IGUIElement.h" #include "IVideoDriver.h" -#include "IAttributes.h" namespace irr { diff --git a/irr/src/CIrrDeviceStub.cpp b/irr/src/CIrrDeviceStub.cpp index 2bd0fb1d0..ff1319164 100644 --- a/irr/src/CIrrDeviceStub.cpp +++ b/irr/src/CIrrDeviceStub.cpp @@ -13,7 +13,6 @@ #include "CTimer.h" #include "CLogger.h" #include "irrString.h" -#include "IrrCompileConfig.h" // for IRRLICHT_SDK_VERSION namespace irr { diff --git a/irr/src/CMakeLists.txt b/irr/src/CMakeLists.txt index e41457532..83da89c11 100644 --- a/irr/src/CMakeLists.txt +++ b/irr/src/CMakeLists.txt @@ -401,7 +401,6 @@ add_library(IRRIOOBJ OBJECT CReadFile.cpp CWriteFile.cpp CZipReader.cpp - CAttributes.cpp ) add_library(IRROTHEROBJ OBJECT diff --git a/irr/src/CNullDriver.cpp b/irr/src/CNullDriver.cpp index f54f7a418..246f414de 100644 --- a/irr/src/CNullDriver.cpp +++ b/irr/src/CNullDriver.cpp @@ -3,9 +3,10 @@ // For conditions of distribution and use, see copyright notice in irrlicht.h #include "CNullDriver.h" +#include "IVideoDriver.h" +#include "SMaterial.h" #include "os.h" #include "CImage.h" -#include "CAttributes.h" #include "IReadFile.h" #include "IWriteFile.h" #include "IImageLoader.h" @@ -55,20 +56,6 @@ CNullDriver::CNullDriver(io::IFileSystem *io, const core::dimension2d &scre ViewPort(0, 0, 0, 0), ScreenSize(screenSize), MinVertexCountForVBO(500), TextureCreationFlags(0), OverrideMaterial2DEnabled(false), AllowZWriteOnTransparent(false) { - DriverAttributes = new io::CAttributes(); - DriverAttributes->addInt("MaxTextures", MATERIAL_MAX_TEXTURES); - DriverAttributes->addInt("MaxSupportedTextures", MATERIAL_MAX_TEXTURES); - DriverAttributes->addInt("MaxAnisotropy", 1); - // DriverAttributes->addInt("MaxAuxBuffers", 0); - DriverAttributes->addInt("MaxMultipleRenderTargets", 1); - DriverAttributes->addInt("MaxIndices", -1); - DriverAttributes->addInt("MaxTextureSize", -1); - // DriverAttributes->addInt("MaxGeometryVerticesOut", 0); - // DriverAttributes->addFloat("MaxTextureLODBias", 0.f); - DriverAttributes->addInt("Version", 1); - // DriverAttributes->addInt("ShaderLanguageVersion", 0); - // DriverAttributes->addInt("AntiAlias", 0); - setFog(); setTextureCreationFlag(ETCF_ALWAYS_32_BIT, true); @@ -113,9 +100,6 @@ CNullDriver::CNullDriver(io::IFileSystem *io, const core::dimension2d &scre //! destructor CNullDriver::~CNullDriver() { - if (DriverAttributes) - DriverAttributes->drop(); - if (FileSystem) FileSystem->drop(); @@ -236,12 +220,6 @@ bool CNullDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const return false; } -//! Get attributes of the actual video driver -const io::IAttributes &CNullDriver::getDriverAttributes() const -{ - return *DriverAttributes; -} - //! sets transformation void CNullDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4 &mat) { diff --git a/irr/src/CNullDriver.h b/irr/src/CNullDriver.h index 3ef8c642d..cb6c5fba5 100644 --- a/irr/src/CNullDriver.h +++ b/irr/src/CNullDriver.h @@ -9,7 +9,6 @@ #include "IGPUProgrammingServices.h" #include "irrArray.h" #include "irrString.h" -#include "IAttributes.h" #include "IMesh.h" #include "IMeshBuffer.h" #include "IMeshSceneNode.h" @@ -50,9 +49,6 @@ public: //! queries the features of the driver, returns true if feature is available bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const override; - //! Get attributes of the actual video driver - const io::IAttributes &getDriverAttributes() const override; - //! sets transformation void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4 &mat) override; @@ -717,8 +713,6 @@ protected: SColor FogColor; SExposedVideoData ExposedData; - io::IAttributes *DriverAttributes; - SOverrideMaterial OverrideMaterial; SMaterial OverrideMaterial2D; SMaterial InitMaterial2D; diff --git a/irr/src/COBJMeshFileLoader.cpp b/irr/src/COBJMeshFileLoader.cpp index fdbcbd1d0..5c7f38950 100644 --- a/irr/src/COBJMeshFileLoader.cpp +++ b/irr/src/COBJMeshFileLoader.cpp @@ -9,7 +9,6 @@ #include "SMeshBuffer.h" #include "SAnimatedMesh.h" #include "IReadFile.h" -#include "IAttributes.h" #include "fast_atof.h" #include "coreutil.h" #include "os.h" @@ -74,8 +73,6 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file) const c8 *bufPtr = buf; core::stringc grpName, mtlName; bool mtlChanged = false; - bool useGroups = !SceneManager->getParameters()->getAttributeAsBool(OBJ_LOADER_IGNORE_GROUPS); - bool useMaterials = !SceneManager->getParameters()->getAttributeAsBool(OBJ_LOADER_IGNORE_MATERIAL_FILES); [[maybe_unused]] irr::u32 lineNr = 1; // only counts non-empty lines, still useful in debugging to locate errors core::array faceCorners; faceCorners.reallocate(32); // should be large enough @@ -85,15 +82,7 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file) while (bufPtr != bufEnd) { switch (bufPtr[0]) { case 'm': // mtllib (material) - { - if (useMaterials) { - c8 name[WORD_BUFFER_LENGTH]; - bufPtr = goAndCopyNextWord(name, bufPtr, WORD_BUFFER_LENGTH, bufEnd); -#ifdef _IRR_DEBUG_OBJ_LOADER_ - os::Printer::log("Ignoring material file", name); -#endif - } - } break; + break; // not supported case 'v': // v, vn, vt switch (bufPtr[1]) { @@ -127,12 +116,7 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file) #ifdef _IRR_DEBUG_OBJ_LOADER_ os::Printer::log("Loaded group start", grp, ELL_DEBUG); #endif - if (useGroups) { - if (0 != grp[0]) - grpName = grp; - else - grpName = "default"; - } + grpName = ('\0' != grp[0]) ? grp : "default"; mtlChanged = true; } break; diff --git a/irr/src/COpenGLDriver.cpp b/irr/src/COpenGLDriver.cpp index 9c37e2f79..7e7454673 100644 --- a/irr/src/COpenGLDriver.cpp +++ b/irr/src/COpenGLDriver.cpp @@ -116,18 +116,6 @@ bool COpenGLDriver::genericDriverInit() os::Printer::log("GLSL version", buf, ELL_INFORMATION); } else os::Printer::log("GLSL not available.", ELL_INFORMATION); - DriverAttributes->setAttribute("MaxTextures", (s32)Feature.MaxTextureUnits); - DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.MaxTextureUnits); - DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy); - DriverAttributes->setAttribute("MaxAuxBuffers", MaxAuxBuffers); - DriverAttributes->setAttribute("MaxMultipleRenderTargets", (s32)Feature.MultipleRenderTarget); - DriverAttributes->setAttribute("MaxIndices", (s32)MaxIndices); - DriverAttributes->setAttribute("MaxTextureSize", (s32)MaxTextureSize); - DriverAttributes->setAttribute("MaxGeometryVerticesOut", (s32)MaxGeometryVerticesOut); - DriverAttributes->setAttribute("MaxTextureLODBias", MaxTextureLODBias); - DriverAttributes->setAttribute("Version", Version); - DriverAttributes->setAttribute("ShaderLanguageVersion", ShaderLanguageVersion); - DriverAttributes->setAttribute("AntiAlias", AntiAlias); glPixelStorei(GL_PACK_ALIGNMENT, 1); diff --git a/irr/src/CSceneManager.cpp b/irr/src/CSceneManager.cpp index 41c59fe66..b5a310287 100644 --- a/irr/src/CSceneManager.cpp +++ b/irr/src/CSceneManager.cpp @@ -42,7 +42,7 @@ CSceneManager::CSceneManager(video::IVideoDriver *driver, ISceneNode(0, 0), Driver(driver), CursorControl(cursorControl), - ActiveCamera(0), Parameters(0), + ActiveCamera(0), MeshCache(cache), CurrentRenderPass(ESNRP_NONE) { // root node's scene manager @@ -60,9 +60,6 @@ CSceneManager::CSceneManager(video::IVideoDriver *driver, else MeshCache->grab(); - // set scene parameters - Parameters = new io::CAttributes(); - // create collision manager CollisionManager = new CSceneCollisionManager(this, Driver); @@ -105,9 +102,6 @@ CSceneManager::~CSceneManager() if (MeshCache) MeshCache->drop(); - if (Parameters) - Parameters->drop(); - // remove all nodes before dropping the driver // as render targets may be destroyed twice @@ -472,8 +466,7 @@ void CSceneManager::drawAll() Driver->setTransform(video::ETS_WORLD, core::IdentityMatrix); for (u32 i = video::ETS_COUNT - 1; i >= video::ETS_TEXTURE_0; --i) Driver->setTransform((video::E_TRANSFORMATION_STATE)i, core::IdentityMatrix); - // TODO: This should not use an attribute here but a real parameter when necessary (too slow!) - Driver->setAllowZWriteOnTransparent(Parameters->getAttributeAsBool(ALLOW_ZWRITE_ON_TRANSPARENT)); + Driver->setAllowZWriteOnTransparent(true); // do animations and other stuff. OnAnimate(os::Timer::getTime()); @@ -743,12 +736,6 @@ void CSceneManager::clear() removeAll(); } -//! Returns interface to the parameters set in this scene. -io::IAttributes *CSceneManager::getParameters() -{ - return Parameters; -} - //! Returns current render pass. E_SCENE_NODE_RENDER_PASS CSceneManager::getSceneNodeRenderPass() const { diff --git a/irr/src/CSceneManager.h b/irr/src/CSceneManager.h index 8f03a1fec..078044a2e 100644 --- a/irr/src/CSceneManager.h +++ b/irr/src/CSceneManager.h @@ -11,7 +11,6 @@ #include "irrString.h" #include "irrArray.h" #include "IMeshLoader.h" -#include "CAttributes.h" namespace irr { @@ -158,9 +157,6 @@ public: //! Removes all children of this scene node void removeAll() override; - //! Returns interface to the parameters set in this scene. - io::IAttributes *getParameters() override; - //! Returns current render pass. E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const override; @@ -266,10 +262,6 @@ private: ICameraSceneNode *ActiveCamera; core::vector3df camWorldPos; // Position of camera for transparent nodes. - //! String parameters - // NOTE: Attributes are slow and should only be used for debug-info and not in release - io::CAttributes *Parameters; - //! Mesh cache IMeshCache *MeshCache; diff --git a/irr/src/IAttribute.h b/irr/src/IAttribute.h deleted file mode 100644 index 23352a623..000000000 --- a/irr/src/IAttribute.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#pragma once - -#include "irrTypes.h" -#include "irrString.h" -#include "EAttributes.h" - -namespace irr -{ -namespace io -{ - -class IAttribute -{ -public: - virtual ~IAttribute(){}; - - virtual s32 getInt() const { return 0; } - virtual f32 getFloat() const { return 0; } - virtual bool getBool() const { return false; } - - virtual void setInt(s32 intValue){}; - virtual void setFloat(f32 floatValue){}; - virtual void setBool(bool boolValue){}; - - core::stringc Name; - - virtual E_ATTRIBUTE_TYPE getType() const = 0; -}; - -} // end namespace io -} // end namespace irr diff --git a/irr/src/Irrlicht.cpp b/irr/src/Irrlicht.cpp index 2e80088ab..cfe836754 100644 --- a/irr/src/Irrlicht.cpp +++ b/irr/src/Irrlicht.cpp @@ -27,7 +27,7 @@ static const char *const copyright = "Irrlicht Engine (c) 2002-2017 Nikolaus Geb namespace irr { //! stub for calling createDeviceEx -IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDevice(video::E_DRIVER_TYPE driverType, +IrrlichtDevice *createDevice(video::E_DRIVER_TYPE driverType, const core::dimension2d &windowSize, u32 bits, bool fullscreen, bool stencilbuffer, bool vsync, IEventReceiver *res) @@ -46,7 +46,7 @@ IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDevice(video::E_DRIVER_TYPE drive return createDeviceEx(p); } -extern "C" IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters ¶ms) +extern "C" IrrlichtDevice *createDeviceEx(const SIrrlichtCreationParameters ¶ms) { IrrlichtDevice *dev = 0; @@ -90,7 +90,7 @@ namespace video { const SMaterial IdentityMaterial; -extern "C" IRRLICHT_API bool IRRCALLCONV isDriverSupported(E_DRIVER_TYPE driver) +extern "C" bool isDriverSupported(E_DRIVER_TYPE driver) { switch (driver) { case EDT_NULL: diff --git a/irr/src/OpenGL/Driver.cpp b/irr/src/OpenGL/Driver.cpp index 6e30063aa..c1cae0294 100644 --- a/irr/src/OpenGL/Driver.cpp +++ b/irr/src/OpenGL/Driver.cpp @@ -261,16 +261,6 @@ bool COpenGL3DriverBase::genericDriverInit(const core::dimension2d &screenS StencilBuffer = stencilBuffer; - DriverAttributes->setAttribute("MaxTextures", (s32)Feature.MaxTextureUnits); - DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.MaxTextureUnits); - DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy); - DriverAttributes->setAttribute("MaxIndices", (s32)MaxIndices); - DriverAttributes->setAttribute("MaxTextureSize", (s32)MaxTextureSize); - DriverAttributes->setAttribute("MaxArrayTextureLayers", (s32)MaxArrayTextureLayers); - DriverAttributes->setAttribute("MaxTextureLODBias", MaxTextureLODBias); - DriverAttributes->setAttribute("Version", 100 * Version.Major + Version.Minor); - DriverAttributes->setAttribute("AntiAlias", AntiAlias); - GL.PixelStorei(GL_PACK_ALIGNMENT, 1); for (s32 i = 0; i < ETS_COUNT; ++i) diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index dc6a91831..d6522d4f8 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: LGPL-2.1-or-later // Copyright (C) 2010-2013 celeron55, Perttu Ahola -#include "IAttributes.h" #include "gui/mainmenumanager.h" #include "clouds.h" #include "gui/touchcontrols.h" @@ -111,9 +110,6 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args) init_input(); - m_rendering_engine->get_scene_manager()->getParameters()-> - setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true); - guienv = m_rendering_engine->get_gui_env(); config_guienv(); g_settings->registerChangedCallback("dpi_change_notifier", setting_changed_callback, this); diff --git a/src/client/game.cpp b/src/client/game.cpp index 42b605685..f340f98e4 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -5,7 +5,6 @@ #include "game.h" #include -#include "IAttributes.h" #include "client/renderingengine.h" #include "camera.h" #include "client.h" @@ -959,8 +958,6 @@ bool Game::startup(bool *kill, driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, g_settings->getBool("mip_map")); - smgr->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_MATERIAL_FILES, true); - // Reinit runData runData = GameRunData(); runData.time_from_last_punch = 10.0; diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index 720ddcb6f..cee066131 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -10,9 +10,11 @@ #include #include #include "guiFormSpecMenu.h" +#include "EGUIElementTypes.h" #include "constants.h" #include "gamedef.h" #include "client/keycode.h" +#include "gui/guiTable.h" #include "util/strfnd.h" #include #include @@ -198,7 +200,7 @@ void GUIFormSpecMenu::setInitialFocus() // 3. first table for (gui::IGUIElement *it : children) { - if (it->getTypeName() == std::string("GUITable")) { + if (it->getType() == gui::EGUIET_TABLE) { Environment->setFocus(it); return; } diff --git a/src/gui/guiScene.cpp b/src/gui/guiScene.cpp index 269bc1658..75e57210d 100644 --- a/src/gui/guiScene.cpp +++ b/src/gui/guiScene.cpp @@ -8,7 +8,6 @@ #include #include #include -#include "IAttributes.h" #include "porting.h" #include "client/mesh.h" @@ -21,8 +20,6 @@ GUIScene::GUIScene(gui::IGUIEnvironment *env, scene::ISceneManager *smgr, m_cam = m_smgr->addCameraSceneNode(0, v3f(0.f, 0.f, -100.f), v3f(0.f)); m_cam->setFOV(30.f * core::DEGTORAD); - - m_smgr->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true); } GUIScene::~GUIScene() diff --git a/src/gui/guiTable.cpp b/src/gui/guiTable.cpp index 0bc480da7..5c3a99057 100644 --- a/src/gui/guiTable.cpp +++ b/src/gui/guiTable.cpp @@ -635,11 +635,6 @@ void GUITable::setDynamicData(const DynamicData &dyndata) m_scrollbar->setPos(dyndata.scrollpos); } -const c8* GUITable::getTypeName() const -{ - return "GUITable"; -} - void GUITable::updateAbsolutePosition() { IGUIElement::updateAbsolutePosition(); diff --git a/src/gui/guiTable.h b/src/gui/guiTable.h index 63aeb0e8f..7dbf17a51 100644 --- a/src/gui/guiTable.h +++ b/src/gui/guiTable.h @@ -118,9 +118,6 @@ public: /* Set selection, scroll position and opened (sub)trees */ void setDynamicData(const DynamicData &dyndata); - /* Returns "GUITable" */ - virtual const c8* getTypeName() const; - /* Must be called when position or size changes */ virtual void updateAbsolutePosition(); diff --git a/src/util/string.cpp b/src/util/string.cpp index ea0f0c29a..52fc3ada9 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -1085,9 +1085,8 @@ std::optional my_string_to_double(const std::string &s) if (s.empty()) return std::nullopt; char *end = nullptr; - errno = 0; // Note: this also supports hexadecimal notation like "0x1.0p+1" - double number = std::strtod(s.data(), &end); + double number = std::strtod(s.c_str(), &end); if (end != &*s.end()) return std::nullopt; return number;