From 6dfdd9032892f933a2cd23470ccd03149d114811 Mon Sep 17 00:00:00 2001 From: VivyaCC <21315274+enginelesscc@users.noreply.github.com> Date: Fri, 6 Mar 2026 23:13:30 +0100 Subject: [PATCH] win cpp23 compat: Minecraft.World --- Minecraft.Client/Extrax64Stubs.cpp | 6 +++--- Minecraft.World/Achievement.cpp | 12 ++++++------ Minecraft.World/Achievement.h | 8 ++++---- Minecraft.World/ArmorDyeRecipe.cpp | 4 ++-- Minecraft.World/ArmorDyeRecipe.h | 4 ++-- Minecraft.World/FireworksRecipe.h | 4 ++-- Minecraft.World/Recipes.cpp | 2 +- Minecraft.World/Recipy.h | 4 ++-- Minecraft.World/ShapedRecipy.cpp | 4 ++-- Minecraft.World/ShapedRecipy.h | 4 ++-- Minecraft.World/ShapelessRecipy.cpp | 4 ++-- Minecraft.World/ShapelessRecipy.h | 4 ++-- Minecraft.World/Tag.cpp | 2 +- Minecraft.World/Tag.h | 2 +- Minecraft.World/Villager.cpp | 2 +- Minecraft.World/stdafx.h | 5 +++-- Minecraft.World/x64headers/extraX64.h | 6 +++--- 17 files changed, 39 insertions(+), 38 deletions(-) diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index 9e693d1a..da9fe12e 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -69,10 +69,10 @@ void XShowAchievementsUI(int i) {} DWORD XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; } #ifndef _DURANGO -void PIXAddNamedCounter(int a, char* b, ...) {} +void PIXAddNamedCounter(int a, const char* b, ...) {} //#define PS3_USE_PIX_EVENTS //#define PS4_USE_PIX_EVENTS -void PIXBeginNamedEvent(int a, char* b, ...) +void PIXBeginNamedEvent(int a, const char* b, ...) { #ifdef PS4_USE_PIX_EVENTS char buf[512]; @@ -125,7 +125,7 @@ void PIXEndNamedEvent() PixDepth -= 1; #endif } -void PIXSetMarkerDeprecated(int a, char* b, ...) {} +void PIXSetMarkerDeprecated(int a, const char* b, ...) {} #else // 4J Stu - Removed this implementation in favour of a macro that will convert our string format // conversion at compile time rather than at runtime diff --git a/Minecraft.World/Achievement.cpp b/Minecraft.World/Achievement.cpp index a0dfd533..2c0d85d4 100644 --- a/Minecraft.World/Achievement.cpp +++ b/Minecraft.World/Achievement.cpp @@ -15,18 +15,18 @@ void Achievement::_init() if (y > Achievements::yMax) Achievements::yMax = y; } -Achievement::Achievement(int id, const wstring& name, int x, int y, Item *icon, Achievement *requires) - : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), requires(requires) +Achievement::Achievement(int id, const wstring& name, int x, int y, Item *icon, Achievement *reqs) + : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), reqs(reqs) { } -Achievement::Achievement(int id, const wstring& name, int x, int y, Tile *icon, Achievement *requires) - : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), requires(requires) +Achievement::Achievement(int id, const wstring& name, int x, int y, Tile *icon, Achievement *reqs) + : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon( new ItemInstance(icon) ), x(x), y(y), reqs(reqs) { } -Achievement::Achievement(int id, const wstring& name, int x, int y, shared_ptr icon, Achievement *requires) - : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon(icon), x(x), y(y), requires(requires) +Achievement::Achievement(int id, const wstring& name, int x, int y, shared_ptr icon, Achievement *reqs) + : Stat( Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(wstring(L"achievement.").append(name)) ), desc( I18n::get(wstring(L"achievement.").append(name).append(L".desc"))), icon(icon), x(x), y(y), reqs(reqs) { } diff --git a/Minecraft.World/Achievement.h b/Minecraft.World/Achievement.h index b39c44b3..08ec5df9 100644 --- a/Minecraft.World/Achievement.h +++ b/Minecraft.World/Achievement.h @@ -9,7 +9,7 @@ class Achievement : public Stat { public: const int x, y; - Achievement *requires; + Achievement *reqs; private: const wstring desc; @@ -23,9 +23,9 @@ private: void _init(); public: - Achievement(int id, const wstring& name, int x, int y, Item *icon, Achievement *requires); - Achievement(int id, const wstring& name, int x, int y, Tile *icon, Achievement *requires); - Achievement(int id, const wstring& name, int x, int y, shared_ptr icon, Achievement *requires); + Achievement(int id, const wstring& name, int x, int y, Item *icon, Achievement *reqs); + Achievement(int id, const wstring& name, int x, int y, Tile *icon, Achievement *reqs); + Achievement(int id, const wstring& name, int x, int y, shared_ptr icon, Achievement *reqs); Achievement *setAwardLocallyOnly(); Achievement *setGolden(); diff --git a/Minecraft.World/ArmorDyeRecipe.cpp b/Minecraft.World/ArmorDyeRecipe.cpp index c2f681fa..46d43868 100644 --- a/Minecraft.World/ArmorDyeRecipe.cpp +++ b/Minecraft.World/ArmorDyeRecipe.cpp @@ -147,12 +147,12 @@ const int ArmorDyeRecipe::getGroup() } // 4J-PB -bool ArmorDyeRecipe::requires(int iRecipe) +bool ArmorDyeRecipe::reqs(int iRecipe) { return false; } -void ArmorDyeRecipe::requires(INGREDIENTS_REQUIRED *pIngReq) +void ArmorDyeRecipe::reqs(INGREDIENTS_REQUIRED *pIngReq) { //int iCount=0; //bool bFound; diff --git a/Minecraft.World/ArmorDyeRecipe.h b/Minecraft.World/ArmorDyeRecipe.h index b983ba7b..30ded527 100644 --- a/Minecraft.World/ArmorDyeRecipe.h +++ b/Minecraft.World/ArmorDyeRecipe.h @@ -18,6 +18,6 @@ public: virtual const int getGroup(); // 4J-PB - virtual bool requires(int iRecipe); - virtual void requires(INGREDIENTS_REQUIRED *pIngReq); + virtual bool reqs(int iRecipe); + virtual void reqs(INGREDIENTS_REQUIRED *pIngReq); }; \ No newline at end of file diff --git a/Minecraft.World/FireworksRecipe.h b/Minecraft.World/FireworksRecipe.h index ef2815ea..b0c7c236 100644 --- a/Minecraft.World/FireworksRecipe.h +++ b/Minecraft.World/FireworksRecipe.h @@ -37,8 +37,8 @@ public: virtual const int getGroup() { return 0; } // 4J-PB - virtual bool requires(int iRecipe) { return false; }; - virtual void requires(INGREDIENTS_REQUIRED *pIngReq) {}; + virtual bool reqs(int iRecipe) { return false; }; + virtual void reqs(INGREDIENTS_REQUIRED *pIngReq) {}; // 4J Added static void updatePossibleRecipes(shared_ptr craftSlots, bool *firework, bool *charge, bool *fade); diff --git a/Minecraft.World/Recipes.cpp b/Minecraft.World/Recipes.cpp index ef2cd7fd..ce026359 100644 --- a/Minecraft.World/Recipes.cpp +++ b/Minecraft.World/Recipes.cpp @@ -1312,7 +1312,7 @@ void Recipes::buildRecipeIngredientsArray(void) int iCount=0; for (auto& recipe : *recipies) { - recipe->requires(&m_pRecipeIngredientsRequired[iCount++]); + recipe->reqs(&m_pRecipeIngredientsRequired[iCount++]); } //printf("Total recipes in buildRecipeIngredientsArray - %d",iCount); diff --git a/Minecraft.World/Recipy.h b/Minecraft.World/Recipy.h index 88d9640a..9cbf5cac 100644 --- a/Minecraft.World/Recipy.h +++ b/Minecraft.World/Recipy.h @@ -49,7 +49,7 @@ public: virtual const int getGroup() = 0; // 4J-PB - virtual bool requires(int iRecipe) = 0; - virtual void requires(INGREDIENTS_REQUIRED *pIngReq) = 0; + virtual bool reqs(int iRecipe) = 0; + virtual void reqs(INGREDIENTS_REQUIRED *pIngReq) = 0; }; diff --git a/Minecraft.World/ShapedRecipy.cpp b/Minecraft.World/ShapedRecipy.cpp index 15ccca2d..ee737321 100644 --- a/Minecraft.World/ShapedRecipy.cpp +++ b/Minecraft.World/ShapedRecipy.cpp @@ -106,7 +106,7 @@ int ShapedRecipy::size() } // 4J-PB -bool ShapedRecipy::requires(int iRecipe) +bool ShapedRecipy::reqs(int iRecipe) { app.DebugPrintf("ShapedRecipy %d\n",iRecipe); int iCount=0; @@ -130,7 +130,7 @@ bool ShapedRecipy::requires(int iRecipe) return false; } -void ShapedRecipy::requires(INGREDIENTS_REQUIRED *pIngReq) +void ShapedRecipy::reqs(INGREDIENTS_REQUIRED *pIngReq) { //printf("ShapedRecipy %d\n",iRecipe); diff --git a/Minecraft.World/ShapedRecipy.h b/Minecraft.World/ShapedRecipy.h index 56cae3fd..c111b7c7 100644 --- a/Minecraft.World/ShapedRecipy.h +++ b/Minecraft.World/ShapedRecipy.h @@ -26,7 +26,7 @@ public: ShapedRecipy *keepTag(); // 4J-PB - to return the items required to make a recipe - virtual bool requires(int iRecipe); - virtual void requires(INGREDIENTS_REQUIRED *pIngReq); + virtual bool reqs(int iRecipe); + virtual void reqs(INGREDIENTS_REQUIRED *pIngReq); }; diff --git a/Minecraft.World/ShapelessRecipy.cpp b/Minecraft.World/ShapelessRecipy.cpp index 44bf6a54..0fee321c 100644 --- a/Minecraft.World/ShapelessRecipy.cpp +++ b/Minecraft.World/ShapelessRecipy.cpp @@ -77,7 +77,7 @@ int ShapelessRecipy::size() } // 4J-PB -bool ShapelessRecipy::requires(int iRecipe) +bool ShapelessRecipy::reqs(int iRecipe) { vector *tempList = new vector; @@ -97,7 +97,7 @@ bool ShapelessRecipy::requires(int iRecipe) return false; } -void ShapelessRecipy::requires(INGREDIENTS_REQUIRED *pIngReq) +void ShapelessRecipy::reqs(INGREDIENTS_REQUIRED *pIngReq) { int iCount=0; bool bFound; diff --git a/Minecraft.World/ShapelessRecipy.h b/Minecraft.World/ShapelessRecipy.h index 5f7f6076..bb1dfcf7 100644 --- a/Minecraft.World/ShapelessRecipy.h +++ b/Minecraft.World/ShapelessRecipy.h @@ -17,7 +17,7 @@ public: virtual int size(); // 4J-PB - to return the items required to make a recipe - virtual bool requires(int iRecipe); - virtual void requires(INGREDIENTS_REQUIRED *pIngReq); + virtual bool reqs(int iRecipe); + virtual void reqs(INGREDIENTS_REQUIRED *pIngReq); }; diff --git a/Minecraft.World/Tag.cpp b/Minecraft.World/Tag.cpp index adc75360..aa988e02 100644 --- a/Minecraft.World/Tag.cpp +++ b/Minecraft.World/Tag.cpp @@ -153,7 +153,7 @@ Tag *Tag::newTag(byte type, const wstring &name) return NULL; } -wchar_t *Tag::getTagName(byte type) +const wchar_t *Tag::getTagName(byte type) { switch (type) { diff --git a/Minecraft.World/Tag.h b/Minecraft.World/Tag.h index dcd06722..cfb125aa 100644 --- a/Minecraft.World/Tag.h +++ b/Minecraft.World/Tag.h @@ -39,7 +39,7 @@ public: static Tag *readNamedTag(DataInput *dis, int tagDepth); static void writeNamedTag(Tag *tag, DataOutput *dos); static Tag *newTag(byte type, const wstring &name); - static wchar_t *getTagName(byte type); + static const wchar_t *getTagName(byte type); virtual ~Tag() {} virtual bool equals(Tag *obj); // 4J Brought forward from 1.2 virtual Tag *copy() = 0; // 4J Brought foward from 1.2 diff --git a/Minecraft.World/Villager.cpp b/Minecraft.World/Villager.cpp index f2901291..19303b0d 100644 --- a/Minecraft.World/Villager.cpp +++ b/Minecraft.World/Villager.cpp @@ -513,7 +513,7 @@ void Villager::addOffers(int addCount) } // shuffle the list to make it more interesting - std::random_shuffle(newOffers->begin(), newOffers->end()); + std::shuffle(newOffers->begin(), newOffers->end(), std::mt19937{std::random_device{}()}); if (offers == NULL) { diff --git a/Minecraft.World/stdafx.h b/Minecraft.World/stdafx.h index 2e170ad2..37ec371f 100644 --- a/Minecraft.World/stdafx.h +++ b/Minecraft.World/stdafx.h @@ -4,9 +4,8 @@ // #pragma once -#include - #ifdef _WINDOWS64 +#define _HAS_STD_BYTE 0 // solve (std::)'byte' ambiguity with windows headers #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: #include @@ -16,6 +15,8 @@ #include #endif +#include + #ifdef _DURANGO #include #include diff --git a/Minecraft.World/x64headers/extraX64.h b/Minecraft.World/x64headers/extraX64.h index dc01f3b3..79882800 100644 --- a/Minecraft.World/x64headers/extraX64.h +++ b/Minecraft.World/x64headers/extraX64.h @@ -332,10 +332,10 @@ public: #define PIXSetMarkerDeprecated(a, b, ...) PIXSetMarker(a, L ## b, __VA_ARGS__) #define PIXAddNamedCounter(a, b) PIXReportCounter( L ## b, a) #else -void PIXAddNamedCounter(int a, char *b, ...); -void PIXBeginNamedEvent(int a, char *b, ...); +void PIXAddNamedCounter(int a, const char *b, ...); +void PIXBeginNamedEvent(int a, const char *b, ...); void PIXEndNamedEvent(); -void PIXSetMarkerDeprecated(int a, char *b, ...); +void PIXSetMarkerDeprecated(int a, const char *b, ...); #endif void XSetThreadProcessor(HANDLE a, int b);