diff --git a/Minecraft.Client/Platform/Common/Audio/SoundEngine.h b/Minecraft.Client/Platform/Common/Audio/SoundEngine.h index e45572461..f75be95a3 100644 --- a/Minecraft.Client/Platform/Common/Audio/SoundEngine.h +++ b/Minecraft.Client/Platform/Common/Audio/SoundEngine.h @@ -153,7 +153,8 @@ private: C4JThread *m_openStreamThread; static int OpenStreamThreadProc( void* lpParameter ); char m_szStreamName[255]; - int CurrentSoundsPlaying[eSoundType_MAX+eSFX_MAX]; + int CurrentSoundsPlaying[static_cast(eSoundType_MAX) + + static_cast(eSFX_MAX)]; // streaming music files - will be different for mash-up packs int m_iStream_Overworld_Min,m_iStream_Overworld_Max; diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleGameRulesConstants.h b/Minecraft.Client/Platform/Common/GameRules/ConsoleGameRulesConstants.h index a7111f042..93c012ac2 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleGameRulesConstants.h +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleGameRulesConstants.h @@ -113,7 +113,8 @@ public: static void write(DataOutputStream *dos, ConsoleGameRules::EGameRuleAttr eAttr) { - dos->writeInt( eGameRuleType_Count + eAttr ); + dos->writeInt(static_cast(eGameRuleType_Count) + + static_cast(eAttr)); } -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp index bb64f0c1f..4f9134908 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp @@ -341,7 +341,8 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos) for (int i=0; i<8; i++) dos->writeBoolean(false); // Padding. // Write string lookup. - int numStrings = ConsoleGameRules::eGameRuleType_Count + ConsoleGameRules::eGameRuleAttr_Count; + int numStrings = static_cast(ConsoleGameRules::eGameRuleType_Count) + + static_cast(ConsoleGameRules::eGameRuleAttr_Count); dos->writeInt(numStrings); for (int i = 0; i < ConsoleGameRules::eGameRuleType_Count; i++) dos->writeUTF( wchTagNameA[i] ); for (int i = 0; i < ConsoleGameRules::eGameRuleAttr_Count; i++) dos->writeUTF( wchAttrNameA[i] ); diff --git a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXMath.h b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXMath.h index 0beb3a724..3ec021bd0 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXMath.h +++ b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXMath.h @@ -935,10 +935,10 @@ struct XMFLOAT3X3 { return m[Row][Column]; } -#if (__cplusplus >= 202002L) - bool operator==(const XMFLOAT3X3&) const = default; - auto operator<=>(const XMFLOAT3X3&) const = default; -#endif +#if (__cplusplus >= 202002L) + bool operator==(const XMFLOAT3X3&) const = delete; + auto operator<=>(const XMFLOAT3X3&) const = delete; +#endif }; //------------------------------------------------------------------------------ @@ -987,10 +987,10 @@ struct XMFLOAT4X3 { return m[Row][Column]; } -#if (__cplusplus >= 202002L) - bool operator==(const XMFLOAT4X3&) const = default; - auto operator<=>(const XMFLOAT4X3&) const = default; -#endif +#if (__cplusplus >= 202002L) + bool operator==(const XMFLOAT4X3&) const = delete; + auto operator<=>(const XMFLOAT4X3&) const = delete; +#endif }; // 4x3 Row-major Matrix: 32 bit floating point components aligned on a 16 byte @@ -1044,10 +1044,10 @@ struct XMFLOAT3X4 { return m[Row][Column]; } -#if (__cplusplus >= 202002L) - bool operator==(const XMFLOAT3X4&) const = default; - auto operator<=>(const XMFLOAT3X4&) const = default; -#endif +#if (__cplusplus >= 202002L) + bool operator==(const XMFLOAT3X4&) const = delete; + auto operator<=>(const XMFLOAT3X4&) const = delete; +#endif }; // 3x4 Column-major Matrix: 32 bit floating point components aligned on a 16 @@ -1106,10 +1106,10 @@ struct XMFLOAT4X4 { return m[Row][Column]; } -#if (__cplusplus >= 202002L) - bool operator==(const XMFLOAT4X4&) const = default; - auto operator<=>(const XMFLOAT4X4&) const = default; -#endif +#if (__cplusplus >= 202002L) + bool operator==(const XMFLOAT4X4&) const = delete; + auto operator<=>(const XMFLOAT4X4&) const = delete; +#endif }; // 4x4 Matrix: 32 bit floating point components aligned on a 16 byte boundary diff --git a/Minecraft.Client/UI/Screen.cpp b/Minecraft.Client/UI/Screen.cpp index 719e6c24c..1315feb9c 100644 --- a/Minecraft.Client/UI/Screen.cpp +++ b/Minecraft.Client/UI/Screen.cpp @@ -34,7 +34,7 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) { std::wstring Screen::getClipboard() { // 4J - removed - return NULL; + return std::wstring(); } void Screen::setClipboard(const std::wstring& str) { diff --git a/Minecraft.World/IO/Files/File.cpp b/Minecraft.World/IO/Files/File.cpp index 8f03fa15a..ac38e6f05 100644 --- a/Minecraft.World/IO/Files/File.cpp +++ b/Minecraft.World/IO/Files/File.cpp @@ -31,11 +31,11 @@ namespace fs = std::filesystem; fs::path ToFilesystemPath(const std::wstring& path) { const std::string nativePath = wstringtofilename(path); - return fs::u8path(nativePath); + return fs::path(nativePath); } std::wstring ToFilename(const fs::path& path) { - const std::string filename = path.filename().u8string(); + const std::string filename = path.filename().string(); return filenametowstring(filename.c_str()); } diff --git a/Minecraft.World/Recipes/ArmorDyeRecipe.cpp b/Minecraft.World/Recipes/ArmorDyeRecipe.cpp index 812e3faea..19dfdc61a 100644 --- a/Minecraft.World/Recipes/ArmorDyeRecipe.cpp +++ b/Minecraft.World/Recipes/ArmorDyeRecipe.cpp @@ -124,9 +124,9 @@ const ItemInstance* ArmorDyeRecipe::getResultItem() { return NULL; } const int ArmorDyeRecipe::getGroup() { return ShapedRecipy::eGroupType_Armour; } // 4J-PB -bool ArmorDyeRecipe::requires(int iRecipe) { return false; } +bool ArmorDyeRecipe::requiresRecipe(int iRecipe) { return false; } -void ArmorDyeRecipe::requires(INGREDIENTS_REQUIRED* pIngReq) { +void ArmorDyeRecipe::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) { // int iCount=0; // bool bFound; // int j; diff --git a/Minecraft.World/Recipes/ArmorDyeRecipe.h b/Minecraft.World/Recipes/ArmorDyeRecipe.h index 52fbbb591..52a2c06a6 100644 --- a/Minecraft.World/Recipes/ArmorDyeRecipe.h +++ b/Minecraft.World/Recipes/ArmorDyeRecipe.h @@ -20,7 +20,7 @@ public: // 4J-PB virtual bool - requires(int iRecipe); + requiresRecipe(int iRecipe); virtual void - requires(INGREDIENTS_REQUIRED* pIngReq); -}; \ No newline at end of file + collectRequirements(INGREDIENTS_REQUIRED* pIngReq); +}; diff --git a/Minecraft.World/Recipes/Recipes.cpp b/Minecraft.World/Recipes/Recipes.cpp index 2c053dee3..c20ae2d95 100644 --- a/Minecraft.World/Recipes/Recipes.cpp +++ b/Minecraft.World/Recipes/Recipes.cpp @@ -1092,7 +1092,7 @@ void Recipes::buildRecipeIngredientsArray(void) { Recipy* recipe = *it; // wprintf(L"RECIPE - [%d] is // %w\n",iCount,recipe->getResultItem()->getItem()->getName()); - recipe->requires(&m_pRecipeIngredientsRequired[iCount++]); + recipe->collectRequirements(&m_pRecipeIngredientsRequired[iCount++]); } // printf("Total recipes in buildRecipeIngredientsArray - %d",iCount); diff --git a/Minecraft.World/Recipes/Recipy.h b/Minecraft.World/Recipes/Recipy.h index 15b169db6..d1570b216 100644 --- a/Minecraft.World/Recipes/Recipy.h +++ b/Minecraft.World/Recipes/Recipy.h @@ -52,9 +52,9 @@ public: // 4J-PB virtual bool - requires(int iRecipe) + requiresRecipe(int iRecipe) = 0; virtual void - requires(INGREDIENTS_REQUIRED* pIngReq) + collectRequirements(INGREDIENTS_REQUIRED* pIngReq) = 0; }; diff --git a/Minecraft.World/Recipes/ShapedRecipy.cpp b/Minecraft.World/Recipes/ShapedRecipy.cpp index b2a87aeec..8cb828c7b 100644 --- a/Minecraft.World/Recipes/ShapedRecipy.cpp +++ b/Minecraft.World/Recipes/ShapedRecipy.cpp @@ -92,7 +92,7 @@ std::shared_ptr ShapedRecipy::assemble( int ShapedRecipy::size() { return width * height; } // 4J-PB -bool ShapedRecipy::requires(int iRecipe) { +bool ShapedRecipy::requiresRecipe(int iRecipe) { app.DebugPrintf("ShapedRecipy %d\n", iRecipe); int iCount = 0; for (int x = 0; x < 3; x++) { @@ -109,7 +109,7 @@ bool ShapedRecipy::requires(int iRecipe) { return false; } -void ShapedRecipy::requires(INGREDIENTS_REQUIRED* pIngReq) { +void ShapedRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) { // printf("ShapedRecipy %d\n",iRecipe); int iCount = 0; diff --git a/Minecraft.World/Recipes/ShapedRecipy.h b/Minecraft.World/Recipes/ShapedRecipy.h index 71a1351d2..47c175d8d 100644 --- a/Minecraft.World/Recipes/ShapedRecipy.h +++ b/Minecraft.World/Recipes/ShapedRecipy.h @@ -32,7 +32,7 @@ public: // 4J-PB - to return the items required to make a recipe virtual bool - requires(int iRecipe); + requiresRecipe(int iRecipe); virtual void - requires(INGREDIENTS_REQUIRED* pIngReq); + collectRequirements(INGREDIENTS_REQUIRED* pIngReq); }; diff --git a/Minecraft.World/Recipes/ShapelessRecipy.cpp b/Minecraft.World/Recipes/ShapelessRecipy.cpp index 0d8972346..68265a489 100644 --- a/Minecraft.World/Recipes/ShapelessRecipy.cpp +++ b/Minecraft.World/Recipes/ShapelessRecipy.cpp @@ -65,7 +65,7 @@ std::shared_ptr ShapelessRecipy::assemble( int ShapelessRecipy::size() { return (int)ingredients->size(); } // 4J-PB -bool ShapelessRecipy::requires(int iRecipe) { +bool ShapelessRecipy::requiresRecipe(int iRecipe) { std::vector* tempList = new std::vector; *tempList = *ingredients; @@ -87,7 +87,7 @@ bool ShapelessRecipy::requires(int iRecipe) { return false; } -void ShapelessRecipy::requires(INGREDIENTS_REQUIRED* pIngReq) { +void ShapelessRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) { int iCount = 0; bool bFound; int j; diff --git a/Minecraft.World/Recipes/ShapelessRecipy.h b/Minecraft.World/Recipes/ShapelessRecipy.h index 910c63ad2..671f730c4 100644 --- a/Minecraft.World/Recipes/ShapelessRecipy.h +++ b/Minecraft.World/Recipes/ShapelessRecipy.h @@ -21,7 +21,7 @@ public: // 4J-PB - to return the items required to make a recipe virtual bool - requires(int iRecipe); + requiresRecipe(int iRecipe); virtual void - requires(INGREDIENTS_REQUIRED* pIngReq); + collectRequirements(INGREDIENTS_REQUIRED* pIngReq); }; diff --git a/Minecraft.World/Stats/Achievement.cpp b/Minecraft.World/Stats/Achievement.cpp index 3b4171191..ba8a9814e 100644 --- a/Minecraft.World/Stats/Achievement.cpp +++ b/Minecraft.World/Stats/Achievement.cpp @@ -40,10 +40,10 @@ void Achievement::_init() { * @param x X position in the achievement tree * @param y Y position in the achievement tree * @param icon Item used as the achievement icon - * @param requires Achievement object that is required to unlock this one + * @param prerequisite Achievement object that is required to unlock this one */ Achievement::Achievement(int id, const std::wstring& name, int x, int y, - Item* icon, Achievement* requires) + Item* icon, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name))), desc(I18n::get( @@ -51,10 +51,10 @@ Achievement::Achievement(int id, const std::wstring& name, int x, int y, icon(new ItemInstance(icon)), x(x), y(y), - requires(requires) {} + prerequisite(prerequisite) {} Achievement::Achievement(int id, const std::wstring& name, int x, int y, - Tile* icon, Achievement* requires) + Tile* icon, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name))), desc(I18n::get( @@ -62,11 +62,11 @@ Achievement::Achievement(int id, const std::wstring& name, int x, int y, icon(new ItemInstance(icon)), x(x), y(y), - requires(requires) {} + prerequisite(prerequisite) {} Achievement::Achievement(int id, const std::wstring& name, int x, int y, std::shared_ptr icon, - Achievement* requires) + Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name))), desc(I18n::get( @@ -74,7 +74,7 @@ Achievement::Achievement(int id, const std::wstring& name, int x, int y, icon(icon), x(x), y(y), - requires(requires) {} + prerequisite(prerequisite) {} /** * @brief Sets the decription formatter (DescFormatter) diff --git a/Minecraft.World/Stats/Achievement.h b/Minecraft.World/Stats/Achievement.h index 444be24d4..a0708cde4 100644 --- a/Minecraft.World/Stats/Achievement.h +++ b/Minecraft.World/Stats/Achievement.h @@ -7,8 +7,7 @@ class DescFormatter; class Achievement : public Stat { public: const int x, y; - Achievement* - requires; + Achievement* prerequisite; private: const std::wstring desc; @@ -23,11 +22,12 @@ private: public: Achievement(int id, const std::wstring& name, int x, int y, Item* icon, - Achievement* requires); + Achievement* prerequisite); Achievement(int id, const std::wstring& name, int x, int y, Tile* icon, - Achievement* requires); + Achievement* prerequisite); Achievement(int id, const std::wstring& name, int x, int y, - std::shared_ptr icon, Achievement* requires); + std::shared_ptr icon, + Achievement* prerequisite); Achievement* setAwardLocallyOnly(); Achievement* setGolden(); diff --git a/meson.build b/meson.build index 0ad3c83a9..7295092e7 100644 --- a/meson.build +++ b/meson.build @@ -2,6 +2,7 @@ project('4jcraft-chucklegrounds', ['cpp', 'c'], version : '0.1.0', meson_version: '>= 1.1', default_options : [ + 'cpp_std=c++26', 'warning_level=0', 'buildtype=debug', # for now 'unity=on', # merge source files per target