diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index a70351355..4a8aa44e0 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp @@ -4,7 +4,7 @@ #include "../../../Minecraft.World/IO/Streams/InputOutputStream.h" #include "../../../Minecraft.World/Util/StringHelpers.h" -AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const std::wstring &name, TexturePack *fallback) : id(id), name(name) +AbstractTexturePack::AbstractTexturePack(std::uint32_t id, File *file, const std::wstring &name, TexturePack *fallback) : id(id), name(name) { // 4J init textureId = -1; @@ -152,7 +152,7 @@ bool AbstractTexturePack::hasFile(const std::wstring &name, bool allowFallback) return !hasFile && (allowFallback && fallback != NULL) ? fallback->hasFile(name, allowFallback) : hasFile; } -DWORD AbstractTexturePack::getId() +std::uint32_t AbstractTexturePack::getId() { return id; } diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h index 7f6e23f2b..3c2176622 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h @@ -8,7 +8,7 @@ class BufferedImage; class AbstractTexturePack : public TexturePack { private: - const DWORD id; + const std::uint32_t id; const std::wstring name; protected: @@ -36,7 +36,7 @@ private: int textureId; protected: - AbstractTexturePack(DWORD id, File *file, const std::wstring &name, TexturePack *fallback); + AbstractTexturePack(std::uint32_t id, File *file, const std::wstring &name, TexturePack *fallback); private: static std::wstring trim(std::wstring line); @@ -61,7 +61,7 @@ public: virtual void load(Textures *textures); virtual bool hasFile(const std::wstring &name, bool allowFallback); virtual bool hasFile(const std::wstring &name) = 0; - virtual DWORD getId(); + virtual std::uint32_t getId(); virtual std::wstring getName(); virtual std::wstring getDesc1(); virtual std::wstring getDesc2(); diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index 1c1160d7f..06880099b 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -50,7 +50,7 @@ namespace } } -DLCTexturePack::DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback) : AbstractTexturePack(id, NULL, pack->getName(), fallback) +DLCTexturePack::DLCTexturePack(std::uint32_t id, DLCPack *pack, TexturePack *fallback) : AbstractTexturePack(id, NULL, pack->getName(), fallback) { m_dlcInfoPack = pack; m_dlcDataPack = NULL; @@ -305,7 +305,7 @@ void DLCTexturePack::loadData() -std::wstring DLCTexturePack::getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder) +std::wstring DLCTexturePack::getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder) { return app.getFilePath(packId,filename,bAddDataFolder); } diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.h b/Minecraft.Client/Textures/Packs/DLCTexturePack.h index 375c8cafe..ef6e5154b 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.h +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.h @@ -22,7 +22,7 @@ private: public: using AbstractTexturePack::getResource; - DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback); + DLCTexturePack(std::uint32_t id, DLCPack *pack, TexturePack *fallback); ~DLCTexturePack(); virtual std::wstring getResource(const std::wstring& name); @@ -54,8 +54,8 @@ public: virtual bool isLoadingData() { return m_bLoadingData; } private: - static std::wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder); - static std::wstring getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder=true); + static std::wstring getRootPath(std::uint32_t packId, bool allowOverride, bool bAddDataFolder); + static std::wstring getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder=true); public: static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask); diff --git a/Minecraft.Client/Textures/Packs/FileTexturePack.cpp b/Minecraft.Client/Textures/Packs/FileTexturePack.cpp index 4cbf392ed..c70b462d6 100644 --- a/Minecraft.Client/Textures/Packs/FileTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FileTexturePack.cpp @@ -1,7 +1,7 @@ #include "../../Platform/stdafx.h" #include "FileTexturePack.h" -FileTexturePack::FileTexturePack(DWORD id, File *file, TexturePack *fallback) : AbstractTexturePack(id, file, file->getName(), fallback) +FileTexturePack::FileTexturePack(std::uint32_t id, File *file, TexturePack *fallback) : AbstractTexturePack(id, file, file->getName(), fallback) { // 4J Stu - These calls need to be in the most derived version of the class loadIcon(); @@ -83,4 +83,4 @@ bool FileTexturePack::isTerrainUpdateCompatible() return !hasOldFiles; #endif return false; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Textures/Packs/FileTexturePack.h b/Minecraft.Client/Textures/Packs/FileTexturePack.h index 6a7be75fe..3643d6f74 100644 --- a/Minecraft.Client/Textures/Packs/FileTexturePack.h +++ b/Minecraft.Client/Textures/Packs/FileTexturePack.h @@ -12,7 +12,7 @@ private: //ZipFile *zipFile; public: - FileTexturePack(DWORD id, File *file, TexturePack *fallback); + FileTexturePack(std::uint32_t id, File *file, TexturePack *fallback); //@Override void unload(Textures *textures); diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp index 51e5a669c..39bdd88ec 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp @@ -1,7 +1,7 @@ #include "../../Platform/stdafx.h" #include "FolderTexturePack.h" -FolderTexturePack::FolderTexturePack(DWORD id, const std::wstring &name, File *folder, TexturePack *fallback) : AbstractTexturePack(id, folder, name, fallback) +FolderTexturePack::FolderTexturePack(std::uint32_t id, const std::wstring &name, File *folder, TexturePack *fallback) : AbstractTexturePack(id, folder, name, fallback) { // 4J Stu - These calls need to be in the most derived version of the class loadIcon(); @@ -107,4 +107,4 @@ void FolderTexturePack::unloadUI() } AbstractTexturePack::unloadUI(); #endif -} \ No newline at end of file +} diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.h b/Minecraft.Client/Textures/Packs/FolderTexturePack.h index c57d2576e..3cd30859e 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.h +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.h @@ -8,7 +8,7 @@ private: bool bUILoaded; public: - FolderTexturePack(DWORD id, const std::wstring &name, File *folder, TexturePack *fallback); + FolderTexturePack(std::uint32_t id, const std::wstring &name, File *folder, TexturePack *fallback); protected: //@Override @@ -23,4 +23,4 @@ public: virtual std::wstring getPath(bool bTitleUpdateTexture = false); virtual void loadUI(); virtual void unloadUI(); -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Textures/Packs/TexturePack.h b/Minecraft.Client/Textures/Packs/TexturePack.h index a5954c77e..ed36f63dd 100644 --- a/Minecraft.Client/Textures/Packs/TexturePack.h +++ b/Minecraft.Client/Textures/Packs/TexturePack.h @@ -22,7 +22,7 @@ public: virtual void load(Textures *textures) = 0; virtual InputStream *getResource(const std::wstring &name, bool allowFallback) = 0;// throws IOException; //virtual InputStream *getResource(const std::wstring &name) = 0;// throws IOException; - virtual DWORD getId() = 0; + virtual std::uint32_t getId() = 0; virtual std::wstring getName() = 0; virtual std::wstring getDesc1() = 0; virtual std::wstring getDesc2() = 0; diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp index 2b10c3a4a..b20bf8f57 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp @@ -291,19 +291,19 @@ bool TexturePackRepository::canUseWebSkin() return false; } -std::vector< std::pair > *TexturePackRepository::getTexturePackIdNames() +std::vector< std::pair > *TexturePackRepository::getTexturePackIdNames() { - std::vector< std::pair > *packList = new std::vector< std::pair >(); + std::vector< std::pair > *packList = new std::vector< std::pair >(); for(AUTO_VAR(it,texturePacks->begin()); it != texturePacks->end(); ++it) { TexturePack *pack = *it; - packList->push_back( std::pair(pack->getId(),pack->getName()) ); + packList->push_back( std::pair(pack->getId(),pack->getName()) ); } return packList; } -bool TexturePackRepository::selectTexturePackById(DWORD id) +bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { bool bDidSelect = false; @@ -352,7 +352,7 @@ bool TexturePackRepository::selectTexturePackById(DWORD id) return bDidSelect; } -TexturePack *TexturePackRepository::getTexturePackById(DWORD id) +TexturePack *TexturePackRepository::getTexturePackById(std::uint32_t id) { AUTO_VAR(it, cacheById.find(id)); if(it != cacheById.end()) @@ -363,27 +363,27 @@ TexturePack *TexturePackRepository::getTexturePackById(DWORD id) return NULL; } -TexturePack *TexturePackRepository::addTexturePackFromDLC(DLCPack *dlcPack, DWORD id) +TexturePack *TexturePackRepository::addTexturePackFromDLC(DLCPack *dlcPack, std::uint32_t id) { TexturePack *newPack = NULL; // 4J-PB - The City texture pack went out with a child id for the texture pack of 1 instead of zero // we need to mask off the child id here to deal with this - DWORD dwParentID=id&0xFFFFFF; // child id is <<24 and Or'd with parent + const std::uint32_t parentId = id & 0xFFFFFFu; // child id is <<24 and Or'd with parent if(dlcPack != NULL) { - newPack = new DLCTexturePack(dwParentID, dlcPack, DEFAULT_TEXTURE_PACK); + newPack = new DLCTexturePack(parentId, dlcPack, DEFAULT_TEXTURE_PACK); texturePacks->push_back(newPack); - cacheById[dwParentID] = newPack; + cacheById[parentId] = newPack; #ifndef _CONTENT_PACKAGE if(dlcPack->hasPurchasedFile(DLCManager::e_DLCType_TexturePack,L"")) { - wprintf(L"Added new FULL DLCTexturePack: %ls - id=%d\n", dlcPack->getName().c_str(),dwParentID ); + wprintf(L"Added new FULL DLCTexturePack: %ls - id=%u\n", dlcPack->getName().c_str(), parentId ); } else { - wprintf(L"Added new TRIAL DLCTexturePack: %ls - id=%d\n", dlcPack->getName().c_str(),dwParentID ); + wprintf(L"Added new TRIAL DLCTexturePack: %ls - id=%u\n", dlcPack->getName().c_str(), parentId ); } #endif } @@ -398,7 +398,7 @@ void TexturePackRepository::clearInvalidTexturePacks() } } -void TexturePackRepository::removeTexturePackById(DWORD id) +void TexturePackRepository::removeTexturePackById(std::uint32_t id) { AUTO_VAR(it, cacheById.find(id)); if(it != cacheById.end()) @@ -450,7 +450,7 @@ TexturePack *TexturePackRepository::getTexturePackByIndex(unsigned int index) return pack; } -unsigned int TexturePackRepository::getTexturePackIndex(unsigned int id) +unsigned int TexturePackRepository::getTexturePackIndex(std::uint32_t id) { int currentIndex = 0; for(AUTO_VAR(it,texturePacks->begin()); it != texturePacks->end(); ++it) @@ -461,4 +461,4 @@ unsigned int TexturePackRepository::getTexturePackIndex(unsigned int id) } if(currentIndex >= texturePacks->size()) currentIndex = 0; return currentIndex; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.h b/Minecraft.Client/Textures/Packs/TexturePackRepository.h index 1f8e66b8c..a93e1f7c6 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.h +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.h @@ -7,9 +7,9 @@ class Minecraft; class TexturePackRepository { public: - static const DWORD DEFAULT_TEXTURE_PACK_ID = 0; - static const DWORD FOLDER_TEST_TEXTURE_PACK_ID = 1; - static const DWORD DLC_TEST_TEXTURE_PACK_ID = 2; + static constexpr std::uint32_t DEFAULT_TEXTURE_PACK_ID = 0; + static constexpr std::uint32_t FOLDER_TEST_TEXTURE_PACK_ID = 1; + static constexpr std::uint32_t DLC_TEST_TEXTURE_PACK_ID = 2; private: static TexturePack *DEFAULT_TEXTURE_PACK; TexturePack *m_dummyTexturePack; @@ -21,7 +21,7 @@ private: std::vector *texturePacks; std::vector m_texturePacksToDelete; - std::unordered_map cacheById; + std::unordered_map cacheById; TexturePack *selected; TexturePack *lastSelected; @@ -60,18 +60,18 @@ public: bool isUsingDefaultSkin() { return selected == DEFAULT_TEXTURE_PACK; } // 4J Added TexturePack *getDefault() { return DEFAULT_TEXTURE_PACK; } // 4J Added - std::vector< std::pair > *getTexturePackIdNames(); - bool selectTexturePackById(DWORD id); // 4J Added - TexturePack *getTexturePackById(DWORD id); // 4J Added + std::vector< std::pair > *getTexturePackIdNames(); + bool selectTexturePackById(std::uint32_t id); // 4J Added + TexturePack *getTexturePackById(std::uint32_t id); // 4J Added - TexturePack *addTexturePackFromDLC(DLCPack *dlcPack, DWORD id); + TexturePack *addTexturePackFromDLC(DLCPack *dlcPack, std::uint32_t id); void clearInvalidTexturePacks(); void updateUI(); bool needsUIUpdate(); private: - void removeTexturePackById(DWORD id); + void removeTexturePackById(std::uint32_t id); public: unsigned int getTexturePackCount(); TexturePack *getTexturePackByIndex(unsigned int index); - unsigned int getTexturePackIndex(unsigned int id); + unsigned int getTexturePackIndex(std::uint32_t id); };