diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..2a377d08a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +*.png filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.ogg filter=lfs diff=lfs merge=lfs -text +*.binka filter=lfs diff=lfs merge=lfs -text +*.arc filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.ico filter=lfs diff=lfs merge=lfs -text diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index 13826da35..4b8f5f5ba 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -103,7 +103,7 @@ char SoundEngine::m_szRedistName[]={"redist"}; #endif -char *SoundEngine::m_szStreamFileA[eStream_Max]= +const char *SoundEngine::m_szStreamFileA[eStream_Max]= { "calm1", "calm2", diff --git a/Minecraft.Client/Common/Audio/SoundEngine.h b/Minecraft.Client/Common/Audio/SoundEngine.h index 5bd2fe4b9..5417dcec9 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.h +++ b/Minecraft.Client/Common/Audio/SoundEngine.h @@ -151,7 +151,7 @@ private: static char m_szSoundPath[]; static char m_szMusicPath[]; static char m_szRedistName[]; - static char *m_szStreamFileA[eStream_Max]; + static const char *m_szStreamFileA[eStream_Max]; AUDIO_LISTENER m_ListenerA[MAX_LOCAL_PLAYERS]; int m_validListenerCount; diff --git a/Minecraft.Client/Common/Colours/ColourTable.cpp b/Minecraft.Client/Common/Colours/ColourTable.cpp index e4bfe7327..fa1e9d691 100644 --- a/Minecraft.Client/Common/Colours/ColourTable.cpp +++ b/Minecraft.Client/Common/Colours/ColourTable.cpp @@ -4,7 +4,7 @@ unordered_map ColourTable::s_colourNamesMap; -wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] = +const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] = { L"NOTSET", diff --git a/Minecraft.Client/Common/Colours/ColourTable.h b/Minecraft.Client/Common/Colours/ColourTable.h index 8e0a348c0..af99a8ed5 100644 --- a/Minecraft.Client/Common/Colours/ColourTable.h +++ b/Minecraft.Client/Common/Colours/ColourTable.h @@ -5,7 +5,7 @@ class ColourTable private: unsigned int m_colourValues[eMinecraftColour_COUNT]; - static wchar_t *ColourTableElements[eMinecraftColour_COUNT]; + static const wchar_t *ColourTableElements[eMinecraftColour_COUNT]; static unordered_map s_colourNamesMap; public: diff --git a/Minecraft.Client/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Common/DLC/DLCAudioFile.cpp index 6faf0c3b3..7116f62d8 100644 --- a/Minecraft.Client/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCAudioFile.cpp @@ -26,7 +26,7 @@ PBYTE DLCAudioFile::getData(DWORD &dwBytes) return m_pbData; } -WCHAR *DLCAudioFile::wchTypeNamesA[]= +const WCHAR *DLCAudioFile::wchTypeNamesA[]= { L"CUENAME", L"CREDIT", diff --git a/Minecraft.Client/Common/DLC/DLCAudioFile.h b/Minecraft.Client/Common/DLC/DLCAudioFile.h index 728512d76..f1a356fe9 100644 --- a/Minecraft.Client/Common/DLC/DLCAudioFile.h +++ b/Minecraft.Client/Common/DLC/DLCAudioFile.h @@ -28,7 +28,7 @@ public: e_AudioParamType_Max, }; - static WCHAR *wchTypeNamesA[e_AudioParamType_Max]; + static const WCHAR *wchTypeNamesA[e_AudioParamType_Max]; DLCAudioFile(const wstring &path); diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index 36f4d7f7e..dd34e67f9 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -7,7 +7,7 @@ #include "..\..\Minecraft.h" #include "..\..\TexturePackRepository.h" -WCHAR *DLCManager::wchTypeNamesA[]= +const WCHAR *DLCManager::wchTypeNamesA[]= { L"DISPLAYNAME", L"THEMENAME", diff --git a/Minecraft.Client/Common/DLC/DLCManager.h b/Minecraft.Client/Common/DLC/DLCManager.h index 277652329..d4dd2508e 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.h +++ b/Minecraft.Client/Common/DLC/DLCManager.h @@ -48,7 +48,7 @@ public: e_DLCParamType_Max, }; - static WCHAR *wchTypeNamesA[e_DLCParamType_Max]; + static const WCHAR *wchTypeNamesA[e_DLCParamType_Max]; private: vector m_packs; diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp index 8f172443b..0606808cb 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp @@ -12,7 +12,7 @@ #include "ConsoleGameRules.h" #include "GameRuleManager.h" -WCHAR *GameRuleManager::wchTagNameA[] = +const WCHAR *GameRuleManager::wchTagNameA[] = { L"", // eGameRuleType_Root L"MapOptions", // eGameRuleType_LevelGenerationOptions @@ -34,7 +34,7 @@ WCHAR *GameRuleManager::wchTagNameA[] = L"UpdatePlayer", // eGameRuleType_UpdatePlayerRule }; -WCHAR *GameRuleManager::wchAttrNameA[] = +const WCHAR *GameRuleManager::wchAttrNameA[] = { L"descriptionName", // eGameRuleAttr_descriptionName L"promptName", // eGameRuleAttr_promptName diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.h b/Minecraft.Client/Common/GameRules/GameRuleManager.h index e9e983b85..3f446e842 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleManager.h +++ b/Minecraft.Client/Common/GameRules/GameRuleManager.h @@ -24,8 +24,8 @@ class WstringLookup; class GameRuleManager { public: - static WCHAR *wchTagNameA[ConsoleGameRules::eGameRuleType_Count]; - static WCHAR *wchAttrNameA[ConsoleGameRules::eGameRuleAttr_Count]; + static const WCHAR *wchTagNameA[ConsoleGameRules::eGameRuleType_Count]; + static const WCHAR *wchAttrNameA[ConsoleGameRules::eGameRuleAttr_Count]; static const short version_number = 2; diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index a2ab17a8c..00462a90c 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1051,7 +1051,8 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() m_pSaveDetails=StorageManager.ReturnSavesInfo(); if(m_pSaveDetails==NULL) { - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); + char savename[] = "save"; + C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo(m_iPad, NULL, this, savename); } #if TO_BE_IMPLEMENTED diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index d4f26ae71..9e0059f3b 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -13,7 +13,7 @@ //#define SKIN_SELECT_PACK_PLAYER_CUSTOM 1 #define SKIN_SELECT_MAX_DEFAULTS 2 -WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]= +const WCHAR *UIScene_SkinSelectMenu::wchDefaultNamesA[]= { L"USE LOCALISED VERSION", // Server selected L"Steve", diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h index e8d760967..60579ac60 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h @@ -6,7 +6,7 @@ class UIScene_SkinSelectMenu : public UIScene { private: - static WCHAR *wchDefaultNamesA[eDefaultSkins_Count]; + static const WCHAR *wchDefaultNamesA[eDefaultSkins_Count]; // 4J Stu - How many to show on each side of the main control static const BYTE sidePreviewControls = 4; diff --git a/Minecraft.Client/DirtyChunkSorter.h b/Minecraft.Client/DirtyChunkSorter.h index 1bf8b61f7..2c34d4bff 100644 --- a/Minecraft.Client/DirtyChunkSorter.h +++ b/Minecraft.Client/DirtyChunkSorter.h @@ -2,7 +2,7 @@ class Chunk; class Mob; -class DirtyChunkSorter : public std::binary_function +class DirtyChunkSorter { private: shared_ptr cameraEntity; diff --git a/Minecraft.Client/DistanceChunkSorter.h b/Minecraft.Client/DistanceChunkSorter.h index 4789070d0..224737ab6 100644 --- a/Minecraft.Client/DistanceChunkSorter.h +++ b/Minecraft.Client/DistanceChunkSorter.h @@ -2,7 +2,7 @@ class Entity; class Chunk; -class DistanceChunkSorter : public std::binary_function +class DistanceChunkSorter { private: double ix, iy, iz; diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index 9e693d1a0..da9fe12eb 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.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index cd6e0bae1..9a2e98a66 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -24,7 +24,7 @@ bool Textures::MIPMAP = true; C4JRender::eTextureFormat Textures::TEXTURE_FORMAT = C4JRender::TEXTURE_FORMAT_RxGyBzAw; int Textures::preLoadedIdx[TN_COUNT]; -wchar_t *Textures::preLoaded[TN_COUNT] = +const wchar_t *Textures::preLoaded[TN_COUNT] = { L"%blur%misc/pumpkinblur", // L"%blur%/misc/vignette", // Not currently used @@ -1520,7 +1520,7 @@ TEXTURE_NAME TUImages[] = }; // This is for any TU textures that aren't part of our enum indexed preload set -wchar_t *TUImagePaths[] = +const wchar_t *TUImagePaths[] = { L"font/Default", L"font/Mojangles_7", @@ -1579,7 +1579,7 @@ TEXTURE_NAME OriginalImages[] = TN_COUNT }; -wchar_t *OriginalImagesPaths[] = +const wchar_t *OriginalImagesPaths[] = { L"misc/watercolor.png", diff --git a/Minecraft.Client/Textures.h b/Minecraft.Client/Textures.h index eb3d2f6d2..1fca56106 100644 --- a/Minecraft.Client/Textures.h +++ b/Minecraft.Client/Textures.h @@ -243,7 +243,7 @@ public: static C4JRender::eTextureFormat TEXTURE_FORMAT; private: - static wchar_t *preLoaded[TN_COUNT]; + static const wchar_t *preLoaded[TN_COUNT]; static int preLoadedIdx[TN_COUNT]; unordered_map idMap; diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp index dea9e3155..9ebf6c5d9 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp @@ -56,7 +56,7 @@ typedef ID3D11DeviceContext ID3D1XContext; typedef F32 ViewCoord; typedef gdraw_d3d11_resourcetype gdraw_resourcetype; -static void report_d3d_error(HRESULT hr, char *call, char *context); +static void report_d3d_error(HRESULT hr, const char *call, const char *context); static void *map_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf, bool discard) { diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl index df42488c6..7e4db0380 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl @@ -200,7 +200,7 @@ static void safe_release(T *&p) } } -static void report_d3d_error(HRESULT hr, char *call, char *context) +static void report_d3d_error(HRESULT hr, const char *call, const char *context) { if (hr == E_OUTOFMEMORY) IggyGDrawSendWarning(NULL, "GDraw D3D out of memory in %s%s", call, context); @@ -478,7 +478,7 @@ static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingI D3D1X_(SUBRESOURCE_DATA) mipdata[24]; S32 i, w, h, nmips, bpp; HRESULT hr = S_OK; - char *failed_call; + const char *failed_call; U8 *ptr; // generate mip maps and set up descriptors for them @@ -700,7 +700,7 @@ static void RADLINK gdraw_DescribeVertexBuffer(GDrawVertexBuffer *vbuf, GDraw_Ve static GDrawHandle *get_color_rendertarget(GDrawStats *stats) { - char *failed_call; + const char *failed_call; // try to recycle LRU rendertarget GDrawHandle *t = gdraw_HandleCacheGetLRU(&gdraw->rendertargets); @@ -762,7 +762,7 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) static ID3D1X(DepthStencilView) *get_rendertarget_depthbuffer(GDrawStats *stats) { if (!gdraw->depth_buffer[1]) { - char *failed_call; + const char *failed_call; assert(!gdraw->rt_depth_buffer); D3D1X_(TEXTURE2D_DESC) desc = { static_cast(gdraw->frametex_width), static_cast(gdraw->frametex_height), 1U, 1U, DXGI_FORMAT_D24_UNORM_S8_UINT, { 1, 0 }, @@ -2384,7 +2384,7 @@ static S32 num_pixels(S32 w, S32 h, S32 mipmaps) GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, S32 /*len*/, IggyFileTextureRaw *texture) { - char *failed_call=""; + const char *failed_call=""; U8 *free_data = 0; GDrawTexture *t=0; S32 width, height, mipmaps, size, blk; @@ -2405,6 +2405,8 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, D3D1X_(TEXTURE2D_DESC) desc = { static_cast(width), static_cast(height), static_cast(mipmaps), 1U, DXGI_FORMAT_UNKNOWN, { 1, 0 }, D3D1X_(USAGE_IMMUTABLE), D3D1X_(BIND_SHADER_RESOURCE), 0U, 0U }; + bool done = false; + switch (texture->format) { case IFT_FORMAT_rgba_8888 : size= 4; d3dfmt = DXGI_FORMAT_R8G8B8A8_UNORM; break; case IFT_FORMAT_DXT1 : size= 8; d3dfmt = DXGI_FORMAT_BC1_UNORM; blk = 4; break; @@ -2412,60 +2414,62 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, case IFT_FORMAT_DXT5 : size=16; d3dfmt = DXGI_FORMAT_BC3_UNORM; blk = 4; break; default: { IggyGDrawSendWarning(NULL, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format); - goto done; + done = true; } } - desc.Format = d3dfmt; - - U8 *data = resource_file + texture->file_offset; - - if (texture->format == IFT_FORMAT_i_8 || texture->format == IFT_FORMAT_i_4) { - // convert from intensity to luma+alpha - S32 i; - S32 total_size = 2 * num_pixels(width,height,mipmaps); - - free_data = (U8 *) IggyGDrawMalloc(total_size); - if (!free_data) { - IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); - goto done; - } - - U8 *cur = free_data; - - for (k=0; k < mipmaps; ++k) { - S32 w = RR_MAX(width >> k, 1); - S32 h = RR_MAX(height >> k, 1); - for (i=0; i < w*h; ++i) { - cur[0] = cur[1] = *data++; - cur += 2; + if (!done) { + desc.Format = d3dfmt; + + U8 *data = resource_file + texture->file_offset; + + if (texture->format == IFT_FORMAT_i_8 || texture->format == IFT_FORMAT_i_4) { + // convert from intensity to luma+alpha + S32 i; + S32 total_size = 2 * num_pixels(width,height,mipmaps); + + free_data = (U8 *) IggyGDrawMalloc(total_size); + if (!free_data) { + IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); + done = true; + } else { + U8 *cur = free_data; + + for (k=0; k < mipmaps; ++k) { + S32 w = RR_MAX(width >> k, 1); + S32 h = RR_MAX(height >> k, 1); + for (i=0; i < w*h; ++i) { + cur[0] = cur[1] = *data++; + cur += 2; + } + } + data = free_data; + } + } + + if (!done) { + for (k=0; k < mipmaps; ++k) { + S32 w = RR_MAX(width >> k, 1); + S32 h = RR_MAX(height >> k, 1); + S32 blkw = (w + blk-1) / blk; + S32 blkh = (h + blk-1) / blk; + + mipdata[k].pSysMem = data; + mipdata[k].SysMemPitch = blkw * size; + data += blkw * blkh * size; + } + + failed_call = "CreateTexture2D"; + hr = gdraw->d3d_device->CreateTexture2D(&desc, mipdata, &tex); + if (!FAILED(hr)) { + failed_call = "CreateShaderResourceView for texture creation"; + hr = gdraw->d3d_device->CreateShaderResourceView(tex, NULL, &view); + if (!FAILED(hr)) + t = gdraw_D3D1X_(WrappedTextureCreate)(view); } } - data = free_data; } - for (k=0; k < mipmaps; ++k) { - S32 w = RR_MAX(width >> k, 1); - S32 h = RR_MAX(height >> k, 1); - S32 blkw = (w + blk-1) / blk; - S32 blkh = (h + blk-1) / blk; - - mipdata[k].pSysMem = data; - mipdata[k].SysMemPitch = blkw * size; - data += blkw * blkh * size; - } - - failed_call = "CreateTexture2D"; - hr = gdraw->d3d_device->CreateTexture2D(&desc, mipdata, &tex); - if (FAILED(hr)) goto done; - - failed_call = "CreateShaderResourceView for texture creation"; - hr = gdraw->d3d_device->CreateShaderResourceView(tex, NULL, &view); - if (FAILED(hr)) goto done; - - t = gdraw_D3D1X_(WrappedTextureCreate)(view); - -done: if (FAILED(hr)) { report_d3d_error(hr, failed_call, ""); } diff --git a/Minecraft.Client/stdafx.h b/Minecraft.Client/stdafx.h index 87a42bec8..04a18b13d 100644 --- a/Minecraft.Client/stdafx.h +++ b/Minecraft.Client/stdafx.h @@ -20,6 +20,23 @@ // #endif // #endif +#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 +#include +#include +#include +// TODO: reference additional headers your program requires here +#include +#include +using namespace DirectX; + +#define HRESULT_SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) + +#endif + #ifdef __PS3__ #include "Ps3Types.h" @@ -59,23 +76,6 @@ #include #endif -#ifdef _WINDOWS64 -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include -#include -#include -#include -// TODO: reference additional headers your program requires here -#include -#include -using namespace DirectX; - -#define HRESULT_SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) - -#endif - - #ifdef _DURANGO #include diff --git a/Minecraft.World/Achievement.cpp b/Minecraft.World/Achievement.cpp index a0dfd5332..2c0d85d4c 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 b39c44b31..08ec5df92 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 c2f681fa9..46d438685 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 b983ba7b2..30ded527d 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 ef2815ea9..b0c7c2363 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 ef2cd7fde..ce0263591 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 88d9640a4..9cbf5cacf 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 15ccca2de..ee737321d 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 56cae3fd7..c111b7c77 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 44bf6a54f..0fee321c1 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 5f7f60765..bb1dfcf7d 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 adc753608..aa988e029 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 dcd067220..cfb125aaa 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 f29012913..19303b0d0 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 2e170ad2b..37ec371f5 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 dc01f3b3b..798828008 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);