diff --git a/4J.Profile/4J_Profile.cpp b/4J.Profile/4J_Profile.cpp index 3776dec6d..33b88d143 100644 --- a/4J.Profile/4J_Profile.cpp +++ b/4J.Profile/4J_Profile.cpp @@ -51,7 +51,7 @@ void C_4JProfile::SetPrimaryPad(int iPad) {} static char s_gamertag[64] = "Player"; char* C_4JProfile::GetGamertag(int iPad) { return s_gamertag; } -wstring C_4JProfile::GetDisplayName(int iPad) { return L"Player"; } +std::wstring C_4JProfile::GetDisplayName(int iPad) { return L"Player"; } bool C_4JProfile::IsFullVersion() { return true; } void C_4JProfile::SetSignInChangeCallback(void(*Func)(LPVOID, bool, unsigned int), LPVOID lpParam) {} void C_4JProfile::SetNotificationsCallback(void(*Func)(LPVOID, DWORD, unsigned int), LPVOID lpParam) {} diff --git a/4J.Profile/4J_Profile.h b/4J.Profile/4J_Profile.h index f1bd85bbe..4e6fc606c 100644 --- a/4J.Profile/4J_Profile.h +++ b/4J.Profile/4J_Profile.h @@ -76,7 +76,7 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); char* GetGamertag(int iPad); - wstring GetDisplayName(int iPad); + std::wstring GetDisplayName(int iPad); bool IsFullVersion(); void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); void SetNotificationsCallback(void ( *Func)(LPVOID, DWORD, unsigned int),LPVOID lpParam); diff --git a/4J.Storage/4J_Storage.h b/4J.Storage/4J_Storage.h index 7fa3f0745..aa1d74522 100644 --- a/4J.Storage/4J_Storage.h +++ b/4J.Storage/4J_Storage.h @@ -322,7 +322,7 @@ public: C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,LPVOID lpParam=NULL, int iUserData=0); // C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0); // C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0); - // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); + // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::wstring &Filename); // unsigned int CRC(unsigned char *buf, int len); // enum eXBLWS diff --git a/Minecraft.Client/Build/Common/App_structs.h b/Minecraft.Client/Build/Common/App_structs.h index ed321b5fd..47cc5167c 100644 --- a/Minecraft.Client/Build/Common/App_structs.h +++ b/Minecraft.Client/Build/Common/App_structs.h @@ -164,8 +164,8 @@ typedef struct #ifdef _XBOX_ONE - wstring wsProductId; - wstring wsDisplayName; + std::wstring wsProductId; + std::wstring wsDisplayName; // add a store for the local DLC image PBYTE pbImageData; @@ -224,4 +224,4 @@ typedef struct _TMSPPRequest } TMSPPRequest; -typedef pair SceneStackPair; +typedef std::pair SceneStackPair; diff --git a/Minecraft.Client/Build/Common/Audio/Consoles_SoundEngine.h b/Minecraft.Client/Build/Common/Audio/Consoles_SoundEngine.h index 0c0b0ff96..8a7124afb 100644 --- a/Minecraft.Client/Build/Common/Audio/Consoles_SoundEngine.h +++ b/Minecraft.Client/Build/Common/Audio/Consoles_SoundEngine.h @@ -46,19 +46,19 @@ class ConsoleSoundEngine public: ConsoleSoundEngine() : m_bIsPlayingStreamingCDMusic(false),m_bIsPlayingStreamingGameMusic(false), m_bIsPlayingEndMusic(false),m_bIsPlayingNetherMusic(false){}; - virtual void tick(shared_ptr *players, float a) =0; + virtual void tick(std::shared_ptr *players, float a) =0; virtual void destroy()=0; virtual void play(int iSound, float x, float y, float z, float volume, float pitch) =0; - virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) =0; + virtual void playStreaming(const std::wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) =0; virtual void playUI(int iSound, float volume, float pitch) =0; virtual void updateMusicVolume(float fVal) =0; virtual void updateSystemMusicPlaying(bool isPlaying) = 0; virtual void updateSoundEffectVolume(float fVal) =0; virtual void init(Options *) =0 ; - virtual void add(const wstring& name, File *file) =0; - virtual void addMusic(const wstring& name, File *file) =0; - virtual void addStreaming(const wstring& name, File *file) =0; - virtual char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) =0; + virtual void add(const std::wstring& name, File *file) =0; + virtual void addMusic(const std::wstring& name, File *file) =0; + virtual void addStreaming(const std::wstring& name, File *file) =0; + virtual char *ConvertSoundPathToName(const std::wstring& name, bool bConvertSpaces) =0; virtual void playMusicTick() =0; virtual bool GetIsPlayingStreamingCDMusic() ; diff --git a/Minecraft.Client/Build/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Build/Common/Audio/SoundEngine.cpp index 45ccd8a38..b4cd9f7a9 100644 --- a/Minecraft.Client/Build/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Build/Common/Audio/SoundEngine.cpp @@ -32,7 +32,7 @@ void SoundEngine::init(Options *pOptions) { } -void SoundEngine::tick(shared_ptr *players, float a) +void SoundEngine::tick(std::shared_ptr *players, float a) { } void SoundEngine::destroy() {} @@ -40,16 +40,16 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa { app.DebugPrintf("PlaySound - %d\n",iSound); } -void SoundEngine::playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay) {} +void SoundEngine::playStreaming(const std::wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay) {} void SoundEngine::playUI(int iSound, float volume, float pitch) {} void SoundEngine::updateMusicVolume(float fVal) {} void SoundEngine::updateSoundEffectVolume(float fVal) {} -void SoundEngine::add(const wstring& name, File *file) {} -void SoundEngine::addMusic(const wstring& name, File *file) {} -void SoundEngine::addStreaming(const wstring& name, File *file) {} -char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return NULL; } +void SoundEngine::add(const std::wstring& name, File *file) {} +void SoundEngine::addMusic(const std::wstring& name, File *file) {} +void SoundEngine::addStreaming(const std::wstring& name, File *file) {} +char *SoundEngine::ConvertSoundPathToName(const std::wstring& name, bool bConvertSpaces) { return NULL; } bool SoundEngine::isStreamingWavebankReady() { return true; } void SoundEngine::playMusicTick() {}; void SoundEngine::SetStreamingSounds(int, int, int, int, int, int, int) {} @@ -631,7 +631,7 @@ static float fVal=0.0f; static S32 running = AIL_ms_count(); #endif -void SoundEngine::tick(shared_ptr *players, float a) +void SoundEngine::tick(std::shared_ptr *players, float a) { #ifdef __DISABLE_MILES__ return; @@ -749,7 +749,7 @@ void SoundEngine::destroy() {} void SoundEngine::GetSoundName(char *szSoundName,int iSound) { strcpy((char *)szSoundName,"Minecraft/"); - wstring name = wchSoundNames[iSound]; + std::wstring name = wchSoundNames[iSound]; char *SoundName = (char *)ConvertSoundPathToName(name); strcat((char *)szSoundName,SoundName); } @@ -774,7 +774,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa /* // if we are already playing loads of this sounds ignore this one if(CurrentSoundsPlaying[iSound+eSFX_MAX]>MAX_SAME_SOUNDS_PLAYING) { - // wstring name = wchSoundNames[iSound]; + // std::wstring name = wchSoundNames[iSound]; // char *SoundName = (char *)ConvertSoundPathToName(name); // app.DebugPrintf("Too many %s sounds playing!\n",SoundName); return; @@ -786,9 +786,9 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa strcpy((char *)szSoundName,"Minecraft/"); #ifdef DISTORTION_TEST - wstring name = wchSoundNames[eSoundType_MOB_ENDERDRAGON_GROWL]; + std::wstring name = wchSoundNames[eSoundType_MOB_ENDERDRAGON_GROWL]; #else - wstring name = wchSoundNames[iSound]; + std::wstring name = wchSoundNames[iSound]; #endif char *SoundName = (char *)ConvertSoundPathToName(name); @@ -822,7 +822,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa void SoundEngine::playUI(int iSound, float volume, float pitch) { U8 szSoundName[256]; - wstring name; + std::wstring name; // we have some game sounds played as UI sounds... // Not the best way to do this, but it seems to only be the portal sounds @@ -881,7 +881,7 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) // playStreaming // ///////////////////////////////////////////// -void SoundEngine::playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay) +void SoundEngine::playStreaming(const std::wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay) { // This function doesn't actually play a streaming sound, just sets states and an id for the music tick to play it // Level audio will be played when a play with an empty name comes in @@ -1059,7 +1059,7 @@ int SoundEngine::getMusicID(int iDomain) // ///////////////////////////////////////////// // check what the CD is -int SoundEngine::getMusicID(const wstring& name) +int SoundEngine::getMusicID(const std::wstring& name) { int iCD=0; char *SoundName = (char *)ConvertSoundPathToName(name,true); @@ -1126,9 +1126,9 @@ void SoundEngine::updateSoundEffectVolume(float fVal) //AIL_set_variable_float(0,"UserEffectVol",fVal); } -void SoundEngine::add(const wstring& name, File *file) {} -void SoundEngine::addMusic(const wstring& name, File *file) {} -void SoundEngine::addStreaming(const wstring& name, File *file) {} +void SoundEngine::add(const std::wstring& name, File *file) {} +void SoundEngine::addMusic(const std::wstring& name, File *file) {} +void SoundEngine::addStreaming(const std::wstring& name, File *file) {} bool SoundEngine::isStreamingWavebankReady() { return true; } int SoundEngine::OpenStreamThreadProc( void* lpParameter ) @@ -1225,16 +1225,16 @@ void SoundEngine::playMusicUpdate() m_StreamingAudioInfo.bIs3D=false; #ifdef _XBOX_ONE - wstring &wstrSoundName=dlcAudioFile->GetSoundName(m_musicID); - wstring wstrFile=L"TPACK:\\Data\\" + wstrSoundName +L".binka"; + std::wstring &wstrSoundName=dlcAudioFile->GetSoundName(m_musicID); + std::wstring wstrFile=L"TPACK:\\Data\\" + wstrSoundName +L".binka"; std::wstring mountedPath = StorageManager.GetMountedPath(wstrFile); wcstombs(m_szStreamName,mountedPath.c_str(),255); #else - wstring &wstrSoundName=dlcAudioFile->GetSoundName(m_musicID); + std::wstring &wstrSoundName=dlcAudioFile->GetSoundName(m_musicID); char szName[255]; wcstombs(szName,wstrSoundName.c_str(),255); - string strFile="TPACK:\\Data\\" + string(szName) + ".binka"; + std::string strFile="TPACK:\\Data\\" + string(szName) + ".binka"; std::string mountedPath = StorageManager.GetMountedPath(strFile); strcpy(m_szStreamName,mountedPath.c_str()); #endif @@ -1323,7 +1323,7 @@ void SoundEngine::playMusicUpdate() #endif } - // wstring name = m_szStreamFileA[m_musicID]; + // std::wstring name = m_szStreamFileA[m_musicID]; // char *SoundName = (char *)ConvertSoundPathToName(name); // strcat((char *)szStreamName,SoundName); @@ -1632,7 +1632,7 @@ void SoundEngine::playMusicUpdate() // ConvertSoundPathToName // ///////////////////////////////////////////// -char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) +char *SoundEngine::ConvertSoundPathToName(const std::wstring& name, bool bConvertSpaces) { static char buf[256]; assert(name.length()<256); diff --git a/Minecraft.Client/Build/Common/Audio/SoundEngine.h b/Minecraft.Client/Build/Common/Audio/SoundEngine.h index 4f6ea511d..487c04e53 100644 --- a/Minecraft.Client/Build/Common/Audio/SoundEngine.h +++ b/Minecraft.Client/Build/Common/Audio/SoundEngine.h @@ -1,7 +1,7 @@ #pragma once class Mob; class Options; -using namespace std; +//using namespace std; #include "../../../../Minecraft.World/Util/SoundTypes.h" enum eMUSICFILES @@ -96,21 +96,21 @@ public: void GetSoundName(char *szSoundName,int iSound); #endif virtual void play(int iSound, float x, float y, float z, float volume, float pitch); - virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true); + virtual void playStreaming(const std::wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true); virtual void playUI(int iSound, float volume, float pitch); virtual void playMusicTick(); virtual void updateMusicVolume(float fVal); virtual void updateSystemMusicPlaying(bool isPlaying); virtual void updateSoundEffectVolume(float fVal); virtual void init(Options *); - virtual void tick(shared_ptr *players, float a); // 4J - updated to take array of local players rather than single one - virtual void add(const wstring& name, File *file); - virtual void addMusic(const wstring& name, File *file); - virtual void addStreaming(const wstring& name, File *file); - virtual char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false); + virtual void tick(std::shared_ptr *players, float a); // 4J - updated to take array of local players rather than single one + virtual void add(const std::wstring& name, File *file); + virtual void addMusic(const std::wstring& name, File *file); + virtual void addStreaming(const std::wstring& name, File *file); + virtual char *ConvertSoundPathToName(const std::wstring& name, bool bConvertSpaces=false); bool isStreamingWavebankReady(); // 4J Added int getMusicID(int iDomain); - int getMusicID(const wstring& name); + int getMusicID(const std::wstring& name); void SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1); void updateMiles(); // AP added so Vita can update all the Miles functions during the mixer callback void playMusicUpdate(); @@ -145,7 +145,7 @@ private: int m_StreamState; int m_MusicType; AUDIO_INFO m_StreamingAudioInfo; - wstring m_CDMusic; + std::wstring m_CDMusic; BOOL m_bSystemMusicPlaying; float m_MasterMusicVolume; float m_MasterEffectsVolume; diff --git a/Minecraft.Client/Build/Common/Audio/SoundNames.cpp b/Minecraft.Client/Build/Common/Audio/SoundNames.cpp index fe1228098..06535e369 100644 --- a/Minecraft.Client/Build/Common/Audio/SoundNames.cpp +++ b/Minecraft.Client/Build/Common/Audio/SoundNames.cpp @@ -91,7 +91,7 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]= L"ambient.cave.cave2", // eSoundType_CAVE_CAVE2 - removed the two sounds that were at 192k in the first ambient cave event #endif L"portal.portal", // eSoundType_PORTAL_PORTAL, - // 4J-PB - added a couple that were still using wstring + // 4J-PB - added a couple that were still using std::wstring L"portal.trigger", // eSoundType_PORTAL_TRIGGER L"portal.travel", // eSoundType_PORTAL_TRAVEL diff --git a/Minecraft.Client/Build/Common/Colours/ColourTable.cpp b/Minecraft.Client/Build/Common/Colours/ColourTable.cpp index c6a9c4953..b8dc1e249 100644 --- a/Minecraft.Client/Build/Common/Colours/ColourTable.cpp +++ b/Minecraft.Client/Build/Common/Colours/ColourTable.cpp @@ -2,7 +2,7 @@ #include "ColourTable.h" #include "../../../../Minecraft.World/Util/StringHelpers.h" -unordered_map ColourTable::s_colourNamesMap; +std::unordered_map ColourTable::s_colourNamesMap; const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] = { @@ -310,7 +310,7 @@ void ColourTable::staticCtor() { for(unsigned int i = eMinecraftColour_NOT_SET; i < eMinecraftColour_COUNT; ++i) { - s_colourNamesMap.insert( unordered_map::value_type( ColourTableElements[i], (eMinecraftColour)i) ); + s_colourNamesMap.insert( std::unordered_map::value_type( ColourTableElements[i], (eMinecraftColour)i) ); } } @@ -337,7 +337,7 @@ void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength) for(int i = 0; i < coloursCount; ++i) { - wstring colourId = dis.readUTF(); + std::wstring colourId = dis.readUTF(); int colourValue = dis.readInt(); setColour(colourId, colourValue); AUTO_VAR(it,s_colourNamesMap.find(colourId)); @@ -346,7 +346,7 @@ void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength) bais.reset(); } -void ColourTable::setColour(const wstring &colourName, int value) +void ColourTable::setColour(const std::wstring &colourName, int value) { AUTO_VAR(it,s_colourNamesMap.find(colourName)); if(it != s_colourNamesMap.end()) @@ -355,7 +355,7 @@ void ColourTable::setColour(const wstring &colourName, int value) } } -void ColourTable::setColour(const wstring &colourName, const wstring &value) +void ColourTable::setColour(const std::wstring &colourName, const std::wstring &value) { setColour(colourName, _fromHEXString(value)); } diff --git a/Minecraft.Client/Build/Common/Colours/ColourTable.h b/Minecraft.Client/Build/Common/Colours/ColourTable.h index af99a8ed5..5b3e6ee03 100644 --- a/Minecraft.Client/Build/Common/Colours/ColourTable.h +++ b/Minecraft.Client/Build/Common/Colours/ColourTable.h @@ -6,7 +6,7 @@ private: unsigned int m_colourValues[eMinecraftColour_COUNT]; static const wchar_t *ColourTableElements[eMinecraftColour_COUNT]; - static unordered_map s_colourNamesMap; + static std::unordered_map s_colourNamesMap; public: static void staticCtor(); @@ -18,6 +18,6 @@ public: unsigned int getColor(eMinecraftColour id) { return getColour(id); } void loadColoursFromData(PBYTE pbData, DWORD dwLength); - void setColour(const wstring &colourName, int value); - void setColour(const wstring &colourName, const wstring &value); + void setColour(const std::wstring &colourName, int value); + void setColour(const std::wstring &colourName, const std::wstring &value); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/Consoles_App.cpp b/Minecraft.Client/Build/Common/Consoles_App.cpp index aeb8b66a4..c59324a3f 100644 --- a/Minecraft.Client/Build/Common/Consoles_App.cpp +++ b/Minecraft.Client/Build/Common/Consoles_App.cpp @@ -213,7 +213,7 @@ CMinecraftApp::CMinecraftApp() for(int i=0;i; + m_vBannedListA[i] = new std::vector; } LocaleAndLanguageInit(); @@ -316,7 +316,7 @@ void CMinecraftApp::HandleButtonPresses(int iPad) // ProfileManager.WriteToProfile(iPad,true); } -bool CMinecraftApp::LoadInventoryMenu(int iPad,shared_ptr player,bool bNavigateBack) +bool CMinecraftApp::LoadInventoryMenu(int iPad,std::shared_ptr player,bool bNavigateBack) { bool success = true; @@ -339,7 +339,7 @@ bool CMinecraftApp::LoadInventoryMenu(int iPad,shared_ptr player,bo return success; } -bool CMinecraftApp::LoadCreativeMenu(int iPad,shared_ptr player,bool bNavigateBack) +bool CMinecraftApp::LoadCreativeMenu(int iPad,std::shared_ptr player,bool bNavigateBack) { bool success = true; @@ -362,7 +362,7 @@ bool CMinecraftApp::LoadCreativeMenu(int iPad,shared_ptr player,boo return success; } -bool CMinecraftApp::LoadCrafting2x2Menu(int iPad,shared_ptr player) +bool CMinecraftApp::LoadCrafting2x2Menu(int iPad,std::shared_ptr player) { bool success = true; @@ -388,7 +388,7 @@ bool CMinecraftApp::LoadCrafting2x2Menu(int iPad,shared_ptr player) return success; } -bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,shared_ptr player, int x, int y, int z) +bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,std::shared_ptr player, int x, int y, int z) { bool success = true; @@ -414,7 +414,7 @@ bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,shared_ptr player, return success; } -bool CMinecraftApp::LoadEnchantingMenu(int iPad,shared_ptr inventory, int x, int y, int z, Level *level) +bool CMinecraftApp::LoadEnchantingMenu(int iPad,std::shared_ptr inventory, int x, int y, int z, Level *level) { bool success = true; @@ -440,7 +440,7 @@ bool CMinecraftApp::LoadEnchantingMenu(int iPad,shared_ptr inventory, return success; } -bool CMinecraftApp::LoadFurnaceMenu(int iPad,shared_ptr inventory, shared_ptr furnace) +bool CMinecraftApp::LoadFurnaceMenu(int iPad,std::shared_ptr inventory, std::shared_ptr furnace) { bool success = true; @@ -465,7 +465,7 @@ bool CMinecraftApp::LoadFurnaceMenu(int iPad,shared_ptr inventory, sh return success; } -bool CMinecraftApp::LoadBrewingStandMenu(int iPad,shared_ptr inventory, shared_ptr brewingStand) +bool CMinecraftApp::LoadBrewingStandMenu(int iPad,std::shared_ptr inventory, std::shared_ptr brewingStand) { bool success = true; @@ -491,7 +491,7 @@ bool CMinecraftApp::LoadBrewingStandMenu(int iPad,shared_ptr inventor } -bool CMinecraftApp::LoadContainerMenu(int iPad,shared_ptr inventory, shared_ptr container) +bool CMinecraftApp::LoadContainerMenu(int iPad,std::shared_ptr inventory, std::shared_ptr container) { bool success = true; @@ -525,7 +525,7 @@ bool CMinecraftApp::LoadContainerMenu(int iPad,shared_ptr inventory, return success; } -bool CMinecraftApp::LoadTrapMenu(int iPad,shared_ptr inventory, shared_ptr trap) +bool CMinecraftApp::LoadTrapMenu(int iPad,std::shared_ptr inventory, std::shared_ptr trap) { bool success = true; @@ -550,7 +550,7 @@ bool CMinecraftApp::LoadTrapMenu(int iPad,shared_ptr inventory, share return success; } -bool CMinecraftApp::LoadSignEntryMenu(int iPad,shared_ptr sign) +bool CMinecraftApp::LoadSignEntryMenu(int iPad,std::shared_ptr sign) { bool success = true; @@ -566,7 +566,7 @@ bool CMinecraftApp::LoadSignEntryMenu(int iPad,shared_ptr sign) return success; } -bool CMinecraftApp::LoadRepairingMenu(int iPad,shared_ptr inventory, Level *level, int x, int y, int z) +bool CMinecraftApp::LoadRepairingMenu(int iPad,std::shared_ptr inventory, Level *level, int x, int y, int z) { bool success = true; @@ -585,7 +585,7 @@ bool CMinecraftApp::LoadRepairingMenu(int iPad,shared_ptr inventory, return success; } -bool CMinecraftApp::LoadTradingMenu(int iPad, shared_ptr inventory, shared_ptr trader, Level *level) +bool CMinecraftApp::LoadTradingMenu(int iPad, std::shared_ptr inventory, std::shared_ptr trader, Level *level) { bool success = true; @@ -1223,7 +1223,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) PlayerList *players = MinecraftServer::getInstance()->getPlayerList(); for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3) { - shared_ptr decorationPlayer = *it3; + std::shared_ptr decorationPlayer = *it3; decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false); } } @@ -1328,7 +1328,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) } } -void CMinecraftApp::SetPlayerSkin(int iPad,const wstring &name) +void CMinecraftApp::SetPlayerSkin(int iPad,const std::wstring &name) { DWORD skinId = app.getSkinIdFromPath(name); @@ -1348,7 +1348,7 @@ void CMinecraftApp::SetPlayerSkin(int iPad,DWORD dwSkinId) } -wstring CMinecraftApp::GetPlayerSkinName(int iPad) +std::wstring CMinecraftApp::GetPlayerSkinName(int iPad) { return app.getSkinPathFromId(GameSettingsA[iPad]->dwSelectedSkin); } @@ -1396,7 +1396,7 @@ DWORD CMinecraftApp::GetPlayerSkinId(int iPad) } -void CMinecraftApp::SetPlayerCape(int iPad,const wstring &name) +void CMinecraftApp::SetPlayerCape(int iPad,const std::wstring &name) { DWORD capeId = Player::getCapeIdFromPath(name); @@ -1415,7 +1415,7 @@ void CMinecraftApp::SetPlayerCape(int iPad,DWORD dwCapeId) if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(dwCapeId); } -wstring CMinecraftApp::GetPlayerCapeName(int iPad) +std::wstring CMinecraftApp::GetPlayerCapeName(int iPad) { return Player::getCapePathFromId(GameSettingsA[iPad]->dwSelectedCape); } @@ -2191,7 +2191,7 @@ unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlay } if(iPad < 0) iPad = 0; - shared_ptr player = Minecraft::GetInstance()->localplayers[iPad]; + std::shared_ptr player = Minecraft::GetInstance()->localplayers[iPad]; if(bOverridePlayer || player==NULL) { @@ -2211,7 +2211,7 @@ void CMinecraftApp::SetGameSettingsDebugMask(int iPad, unsigned int uiVal) GameSettingsA[iPad]->uiDebugBitmask=uiVal; // update the value so the network server can use it - shared_ptr player = Minecraft::GetInstance()->localplayers[iPad]; + std::shared_ptr player = Minecraft::GetInstance()->localplayers[iPad]; if(player) { @@ -2378,7 +2378,7 @@ void CMinecraftApp::HandleXuiActions(void) eTMSAction eTMS; LPVOID param; Minecraft *pMinecraft=Minecraft::GetInstance(); - shared_ptr player; + std::shared_ptr player; // are there any global actions to deal with? eAction = app.GetGlobalXuiAction(); @@ -4032,7 +4032,7 @@ int CMinecraftApp::BannedLevelDialogReturned(void *pParam,int iPad,const C4JStor void CMinecraftApp::loadMediaArchive() { - wstring mediapath = L""; + std::wstring mediapath = L""; #ifdef __PS3__ mediapath = L"Common\\Media\\MediaPS3.arc"; @@ -4053,7 +4053,7 @@ void CMinecraftApp::loadMediaArchive() m_mediaArchive = new ArchiveFile( File(mediapath) ); } #if 0 - string path = "Common\\media.arc"; + std::string path = "Common\\media.arc"; HANDLE hFile = CreateFile( path.c_str(), GENERIC_READ, FILE_SHARE_READ, @@ -4102,7 +4102,7 @@ void CMinecraftApp::loadStringTable() // we need to unload the current string table, this is a reload delete m_stringTable; } - wstring localisationFile = L"languages.loc"; + std::wstring localisationFile = L"languages.loc"; if (m_mediaArchive->hasFile(localisationFile)) { byteArray locFile = m_mediaArchive->getFile(localisationFile); @@ -5146,7 +5146,7 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d // // we only attempt to install the cape once per launch of the game // m_bDefaultCapeInstallAttempted=true; // -// wstring wTemp=L"Default_Cape.png"; +// std::wstring wTemp=L"Default_Cape.png"; // bool bRes=app.IsFileInMemoryTextures(wTemp); // // if the file is not already in the memory textures, then read it from TMS // if(!bRes) @@ -5210,7 +5210,7 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d DWORD dwPackID=m_dlcManager.retrievePackIDFromDLCDataFile(szFullFilename,pack); // Do we need to override the TexturePack.pck with an updated version in a TU? - wstring wsTemp=getFilePath(dwPackID, wstring(L"TexturePack.pck"),false ); + std::wstring wsTemp=getFilePath(dwPackID, std::wstring(L"TexturePack.pck"),false ); File texturePCKPath(wsTemp ); if(texturePCKPath.exists()) { @@ -5314,7 +5314,7 @@ bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid) return false; } -void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD dwBytes) +void CMinecraftApp::AddMemoryTextureFile(const std::wstring &wName,PBYTE pbData,DWORD dwBytes) { EnterCriticalSection(&csMemFilesLock); // check it's not already in @@ -5360,7 +5360,7 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD LeaveCriticalSection(&csMemFilesLock); } -void CMinecraftApp::RemoveMemoryTextureFile(const wstring &wName) +void CMinecraftApp::RemoveMemoryTextureFile(const std::wstring &wName) { EnterCriticalSection(&csMemFilesLock); @@ -5386,7 +5386,7 @@ void CMinecraftApp::RemoveMemoryTextureFile(const wstring &wName) bool CMinecraftApp::DefaultCapeExists() { - wstring wTex=L"Special_Cape.png"; + std::wstring wTex=L"Special_Cape.png"; bool val = false; EnterCriticalSection(&csMemFilesLock); @@ -5397,7 +5397,7 @@ bool CMinecraftApp::DefaultCapeExists() return val; } -bool CMinecraftApp::IsFileInMemoryTextures(const wstring &wName) +bool CMinecraftApp::IsFileInMemoryTextures(const std::wstring &wName) { bool val = false; @@ -5409,7 +5409,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const wstring &wName) return val; } -void CMinecraftApp::GetMemFileDetails(const wstring &wName,PBYTE *ppbData,DWORD *pdwBytes) +void CMinecraftApp::GetMemFileDetails(const std::wstring &wName,PBYTE *ppbData,DWORD *pdwBytes) { EnterCriticalSection(&csMemFilesLock); AUTO_VAR(it, m_MEM_Files.find(wName)); @@ -5525,7 +5525,7 @@ void CMinecraftApp::GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes) } -// bool CMinecraftApp::UploadFileToGlobalStorage(int iQuadrant, C4JStorage::eGlobalStorage eStorageFacility, wstring *wsFile ) +// bool CMinecraftApp::UploadFileToGlobalStorage(int iQuadrant, C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ) // { // bool bRes=false; // #ifndef _CONTENT_PACKAGE @@ -5971,9 +5971,9 @@ int CMinecraftApp::GetHTMLFontSize(EHTMLFontSize size) return s_iHTMLFontSizesA[size]; } -wstring CMinecraftApp::FormatHTMLString(int iPad, const wstring &desc, int shadowColour /*= 0xFFFFFFFF*/) +std::wstring CMinecraftApp::FormatHTMLString(int iPad, const std::wstring &desc, int shadowColour /*= 0xFFFFFFFF*/) { - wstring text(desc); + std::wstring text(desc); wchar_t replacements[64]; // We will also insert line breaks here as couldn't figure out how to get them to come through from strings.resx ! @@ -6071,7 +6071,7 @@ wstring CMinecraftApp::FormatHTMLString(int iPad, const wstring &desc, int shado #endif #ifdef _XBOX - wstring imageRoot = L""; + std::wstring imageRoot = L""; Minecraft *pMinecraft = Minecraft::GetInstance(); imageRoot = pMinecraft->skins->getSelected()->getXuiRootPath(); @@ -6093,7 +6093,7 @@ wstring CMinecraftApp::FormatHTMLString(int iPad, const wstring &desc, int shado return text; } -wstring CMinecraftApp::GetActionReplacement(int iPad, unsigned char ucAction) +std::wstring CMinecraftApp::GetActionReplacement(int iPad, unsigned char ucAction) { unsigned int input = InputManager.GetGameJoypadMaps(InputManager.GetJoypadMapVal(iPad) ,ucAction); @@ -6145,7 +6145,7 @@ wstring CMinecraftApp::GetActionReplacement(int iPad, unsigned char ucAction) }; return L""; #else - wstring replacement = L""; + std::wstring replacement = L""; // 4J Stu - Some of our actions can be mapped to multiple physical buttons, so replaces the switch that was here if (input & _360_JOY_BUTTON_A) replacement = L"ButtonA"; @@ -6200,7 +6200,7 @@ wstring CMinecraftApp::GetActionReplacement(int iPad, unsigned char ucAction) #endif } -wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey) +std::wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey) { #ifdef _XBOX switch(uiVKey) @@ -6244,7 +6244,7 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey) } return NULL; #else - wstring replacement = L""; + std::wstring replacement = L""; switch(uiVKey) { case VK_PAD_A: @@ -6329,7 +6329,7 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey) #endif } -wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) +std::wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) { #ifdef _XBOX switch(uiIcon) @@ -6355,7 +6355,7 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) #endif swprintf(string,128,L"", size, size); - wstring result = L""; + std::wstring result = L""; switch(uiIcon) { case XZP_ICON_SHANK_01: @@ -6372,22 +6372,22 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) } #if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) -unordered_map CMinecraftApp::MojangData; -unordered_map CMinecraftApp::DLCTextures_PackID; -unordered_map CMinecraftApp::DLCInfo; -unordered_map CMinecraftApp::DLCInfo_SkinName; +std::unordered_map CMinecraftApp::MojangData; +std::unordered_map CMinecraftApp::DLCTextures_PackID; +std::unordered_map CMinecraftApp::DLCInfo; +std::unordered_map CMinecraftApp::DLCInfo_SkinName; #elif defined(_DURANGO) -unordered_map CMinecraftApp::MojangData; -unordered_map CMinecraftApp::DLCTextures_PackID; // for mash-up packs & texture packs -//unordered_map CMinecraftApp::DLCInfo_Trial; // full offerid, dlc_info -unordered_map CMinecraftApp::DLCInfo_Full; // full offerid, dlc_info -unordered_map CMinecraftApp::DLCInfo_SkinName; // skin name, full offer id +std::unordered_map CMinecraftApp::MojangData; +std::unordered_map CMinecraftApp::DLCTextures_PackID; // for mash-up packs & texture packs +//std::unordered_map CMinecraftApp::DLCInfo_Trial; // full offerid, dlc_info +std::unordered_map CMinecraftApp::DLCInfo_Full; // full offerid, dlc_info +std::unordered_map CMinecraftApp::DLCInfo_SkinName; // skin name, full offer id #else -unordered_map CMinecraftApp::MojangData; -unordered_map CMinecraftApp::DLCTextures_PackID; -unordered_map CMinecraftApp::DLCInfo_Trial; -unordered_map CMinecraftApp::DLCInfo_Full; -unordered_map CMinecraftApp::DLCInfo_SkinName; +std::unordered_map CMinecraftApp::MojangData; +std::unordered_map CMinecraftApp::DLCTextures_PackID; +std::unordered_map CMinecraftApp::DLCInfo_Trial; +std::unordered_map CMinecraftApp::DLCInfo_Full; +std::unordered_map CMinecraftApp::DLCInfo_SkinName; #endif @@ -6530,7 +6530,7 @@ HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGe } #elif defined _XBOX_ONE -unordered_map *CMinecraftApp::GetDLCInfo() +std::unordered_map *CMinecraftApp::GetDLCInfo() { return &DLCInfo_Full; } @@ -6549,7 +6549,7 @@ HRESULT CMinecraftApp::RegisterDLCData(eDLCContentType eType, WCHAR *pwchBannerN } // check if we already have this info from the local DLC file - wstring wsTemp=wchUppercaseProductID; + std::wstring wsTemp=wchUppercaseProductID; AUTO_VAR(it, DLCInfo_Full.find(wsTemp)); if( it == DLCInfo_Full.end() ) @@ -6662,7 +6662,7 @@ HRESULT CMinecraftApp::RegisterDLCData(char *pchDLCName, unsigned int uiSortInde #if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__) -bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal) +bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,ULONGLONG *pullVal) { AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); if( it == DLCInfo_SkinName.end() ) @@ -6691,7 +6691,7 @@ bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID) } DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName) { - string tempString=pchDLCName; + std::string tempString=pchDLCName; if(DLCInfo.size()>0) { @@ -6712,7 +6712,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName) DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID) { - unordered_map::iterator it= DLCInfo.begin(); + std::unordered_map::iterator it= DLCInfo.begin(); for(int i=0;i::iterator it= DLCInfo.begin(); + std::unordered_map::iterator it= DLCInfo.begin(); for(int i=0;i::iterator it= DLCTextures_PackID.begin(); + std::unordered_map::iterator it= DLCTextures_PackID.begin(); for(int i=0;i::iterator it= DLCInfo_Full.begin(); + std::unordered_map::iterator it= DLCInfo_Full.begin(); for(int i=0;isecond; } -wstring CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) +std::wstring CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) { - unordered_map::iterator it= DLCTextures_PackID.begin(); + std::unordered_map::iterator it= DLCTextures_PackID.begin(); for(int i=0;isecond; } #else -bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal) +bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,ULONGLONG *pullVal) { AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); if( it == DLCInfo_SkinName.end() ) @@ -6857,7 +6857,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial) DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) { - unordered_map::iterator it= DLCInfo_Trial.begin(); + std::unordered_map::iterator it= DLCInfo_Trial.begin(); for(int i=0;i::iterator it= DLCInfo_Full.begin(); + std::unordered_map::iterator it= DLCInfo_Full.begin(); for(int i=0;i::iterator it= DLCTextures_PackID.begin(); + std::unordered_map::iterator it= DLCTextures_PackID.begin(); for(int i=0;i0) { AUTO_VAR(it, DLCInfo_Full.find(wsTemp)); @@ -6913,8 +6913,8 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR *pwchProductID) } DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName) { - unordered_map::iterator it= DLCInfo_Full.begin(); - wstring wsProductName=pwchProductName; + std::unordered_map::iterator it= DLCInfo_Full.begin(); + std::wstring wsProductName=pwchProductName; for(int i=0;igetRenderer(eTYPE_PLAYER); Model *pModel = renderer->getModel(); - vector *pvModelPart = new vector; - vector *pvSkinBoxes = new vector; + std::vector *pvModelPart = new std::vector; + std::vector *pvSkinBoxes = new std::vector; EnterCriticalSection( &csAdditionalModelParts ); EnterCriticalSection( &csAdditionalSkinBoxes ); @@ -8618,19 +8618,19 @@ void CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, D } - m_AdditionalModelParts.insert( std::pair *>(dwSkinID, pvModelPart) ); - m_AdditionalSkinBoxes.insert( std::pair *>(dwSkinID, pvSkinBoxes) ); + m_AdditionalModelParts.insert( std::pair *>(dwSkinID, pvModelPart) ); + m_AdditionalSkinBoxes.insert( std::pair *>(dwSkinID, pvSkinBoxes) ); LeaveCriticalSection( &csAdditionalSkinBoxes ); LeaveCriticalSection( &csAdditionalModelParts ); } -vector * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vector *pvSkinBoxA) +std::vector * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, std::vector *pvSkinBoxA) { EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); Model *pModel = renderer->getModel(); - vector *pvModelPart = new vector; + std::vector *pvModelPart = new std::vector; EnterCriticalSection( &csAdditionalModelParts ); EnterCriticalSection( &csAdditionalSkinBoxes ); @@ -8646,8 +8646,8 @@ vector * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect } } - m_AdditionalModelParts.insert( std::pair *>(dwSkinID, pvModelPart) ); - m_AdditionalSkinBoxes.insert( std::pair *>(dwSkinID, pvSkinBoxA) ); + m_AdditionalModelParts.insert( std::pair *>(dwSkinID, pvModelPart) ); + m_AdditionalSkinBoxes.insert( std::pair *>(dwSkinID, pvSkinBoxA) ); LeaveCriticalSection( &csAdditionalSkinBoxes ); LeaveCriticalSection( &csAdditionalModelParts ); @@ -8655,10 +8655,10 @@ vector * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect } -vector *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) +std::vector *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) { EnterCriticalSection( &csAdditionalModelParts ); - vector *pvModelParts=NULL; + std::vector *pvModelParts=NULL; if(m_AdditionalModelParts.size()>0) { AUTO_VAR(it, m_AdditionalModelParts.find(dwSkinID)); @@ -8672,10 +8672,10 @@ vector *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) return pvModelParts; } -vector *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID) +std::vector *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID) { EnterCriticalSection( &csAdditionalSkinBoxes ); - vector *pvSkinBoxes=NULL; + std::vector *pvSkinBoxes=NULL; if(m_AdditionalSkinBoxes.size()>0) { AUTO_VAR(it,m_AdditionalSkinBoxes.find(dwSkinID)); @@ -8725,7 +8725,7 @@ void CMinecraftApp::SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOve LeaveCriticalSection( &csAnimOverrideBitmask ); } -DWORD CMinecraftApp::getSkinIdFromPath(const wstring &skin) +DWORD CMinecraftApp::getSkinIdFromPath(const std::wstring &skin) { bool dlcSkin = false; unsigned int skinId = 0; @@ -8734,7 +8734,7 @@ DWORD CMinecraftApp::getSkinIdFromPath(const wstring &skin) { dlcSkin = skin.substr(0,3).compare(L"dlc") == 0; - wstring skinValue = skin.substr(7,skin.size()); + std::wstring skinValue = skin.substr(7,skin.size()); skinValue = skinValue.substr(0,skinValue.find_first_of(L'.')); std::wstringstream ss; @@ -8751,7 +8751,7 @@ DWORD CMinecraftApp::getSkinIdFromPath(const wstring &skin) return skinId; } -wstring CMinecraftApp::getSkinPathFromId(DWORD skinId) +std::wstring CMinecraftApp::getSkinPathFromId(DWORD skinId) { // 4J Stu - This function maps the encoded DWORD we store in the player profile // to a filename that is stored as a memory texture and shared between systems in game @@ -8810,7 +8810,7 @@ int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::E return 0; } -int CMinecraftApp::getArchiveFileSize(const wstring &filename) +int CMinecraftApp::getArchiveFileSize(const std::wstring &filename) { TexturePack *tPack = NULL; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -8822,7 +8822,7 @@ int CMinecraftApp::getArchiveFileSize(const wstring &filename) else return m_mediaArchive->getFileSize(filename); } -bool CMinecraftApp::hasArchiveFile(const wstring &filename) +bool CMinecraftApp::hasArchiveFile(const std::wstring &filename) { TexturePack *tPack = NULL; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -8831,7 +8831,7 @@ bool CMinecraftApp::hasArchiveFile(const wstring &filename) else return m_mediaArchive->hasFile(filename); } -byteArray CMinecraftApp::getArchiveFile(const wstring &filename) +byteArray CMinecraftApp::getArchiveFile(const std::wstring &filename) { TexturePack *tPack = NULL; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -8945,9 +8945,9 @@ bool CMinecraftApp::IsLocalMultiplayerAvailable() // 4J-PB - language and locale function -void CMinecraftApp::getLocale(vector &vecWstrLocales) +void CMinecraftApp::getLocale(std::vector &vecWstrLocales) { - vector locales; + std::vector locales; DWORD dwSystemLanguage = XGetLanguage( ); @@ -9391,10 +9391,10 @@ void CMinecraftApp::SetTickTMSDLCFiles(bool bVal) m_bTickTMSDLCFiles=bVal; } -wstring CMinecraftApp::getFilePath(DWORD packId, wstring filename, bool bAddDataFolder) +std::wstring CMinecraftApp::getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder) { #ifdef _XBOX - wstring path = getRootPath(packId, true, bAddDataFolder) + filename; + std::wstring path = getRootPath(packId, true, bAddDataFolder) + filename; File f(path); if(f.exists()) { @@ -9421,15 +9421,15 @@ enum ETitleUpdateTexturePacks }; #ifdef _TU_BUILD -wstring titleUpdateTexturePackRoot = L"UPDATE:\\res\\DLC\\"; +std::wstring titleUpdateTexturePackRoot = L"UPDATE:\\res\\DLC\\"; #else -wstring titleUpdateTexturePackRoot = L"GAME:\\res\\TitleUpdate\\DLC\\"; +std::wstring titleUpdateTexturePackRoot = L"GAME:\\res\\TitleUpdate\\DLC\\"; #endif #endif -wstring CMinecraftApp::getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder) +std::wstring CMinecraftApp::getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder) { - wstring path = L"TPACK:"; + std::wstring path = L"TPACK:"; #ifdef _XBOX if(allowOverride) { diff --git a/Minecraft.Client/Build/Common/Consoles_App.h b/Minecraft.Client/Build/Common/Consoles_App.h index a0e22d924..7adfd5448 100644 --- a/Minecraft.Client/Build/Common/Consoles_App.h +++ b/Minecraft.Client/Build/Common/Consoles_App.h @@ -1,6 +1,6 @@ #pragma once -using namespace std; +//using namespace std; #include "Audio/Consoles_SoundEngine.h" #ifndef __linux__ @@ -73,11 +73,11 @@ public: typedef std::vector VNOTIFICATIONS; // storing skin files - std::vector vSkinNames; + std::vector vSkinNames; DLCManager m_dlcManager; // storing credits text from the DLC - std::vector m_vCreditText; // hold the credit text lines so we can avoid duplicating them + std::vector m_vCreditText; // hold the credit text lines so we can avoid duplicating them // In builds prior to TU5, the size of the GAME_SETTINGS struct was 204 bytes. We added a few new values to the internal struct in TU5, and even though we @@ -128,18 +128,18 @@ public: bool GetGameStarted() {return m_bGameStarted;} void SetGameStarted(bool bVal) { if(bVal) DebugPrintf("SetGameStarted - true\n"); else DebugPrintf("SetGameStarted - false\n"); m_bGameStarted = bVal; m_bIsAppPaused = !bVal;} int GetLocalPlayerCount(void); - bool LoadInventoryMenu(int iPad,shared_ptr player, bool bNavigateBack=false); - bool LoadCreativeMenu(int iPad,shared_ptr player,bool bNavigateBack=false); - bool LoadEnchantingMenu(int iPad,shared_ptr inventory, int x, int y, int z, Level *level); - bool LoadFurnaceMenu(int iPad,shared_ptr inventory, shared_ptr furnace); - bool LoadBrewingStandMenu(int iPad,shared_ptr inventory, shared_ptr brewingStand); - bool LoadContainerMenu(int iPad,shared_ptr inventory, shared_ptr container); - bool LoadTrapMenu(int iPad,shared_ptr inventory, shared_ptr trap); - bool LoadCrafting2x2Menu(int iPad,shared_ptr player); - bool LoadCrafting3x3Menu(int iPad,shared_ptr player, int x, int y, int z); - bool LoadSignEntryMenu(int iPad,shared_ptr sign); - bool LoadRepairingMenu(int iPad,shared_ptr inventory, Level *level, int x, int y, int z); - bool LoadTradingMenu(int iPad, shared_ptr inventory, shared_ptr trader, Level *level); + bool LoadInventoryMenu(int iPad,std::shared_ptr player, bool bNavigateBack=false); + bool LoadCreativeMenu(int iPad,std::shared_ptr player,bool bNavigateBack=false); + bool LoadEnchantingMenu(int iPad,std::shared_ptr inventory, int x, int y, int z, Level *level); + bool LoadFurnaceMenu(int iPad,std::shared_ptr inventory, std::shared_ptr furnace); + bool LoadBrewingStandMenu(int iPad,std::shared_ptr inventory, std::shared_ptr brewingStand); + bool LoadContainerMenu(int iPad,std::shared_ptr inventory, std::shared_ptr container); + bool LoadTrapMenu(int iPad,std::shared_ptr inventory, std::shared_ptr trap); + bool LoadCrafting2x2Menu(int iPad,std::shared_ptr player); + bool LoadCrafting3x3Menu(int iPad,std::shared_ptr player, int x, int y, int z); + bool LoadSignEntryMenu(int iPad,std::shared_ptr sign); + bool LoadRepairingMenu(int iPad,std::shared_ptr inventory, Level *level, int x, int y, int z); + bool LoadTradingMenu(int iPad, std::shared_ptr inventory, std::shared_ptr trader, Level *level); bool GetTutorialMode() { return m_bTutorialMode;} void SetTutorialMode(bool bSet) {m_bTutorialMode=bSet;} @@ -231,9 +231,9 @@ public: void SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucVal); unsigned char GetGameSettings(int iPad,eGameSetting eVal); unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad - void SetPlayerSkin(int iPad,const wstring &name); + void SetPlayerSkin(int iPad,const std::wstring &name); void SetPlayerSkin(int iPad,DWORD dwSkinId); - void SetPlayerCape(int iPad,const wstring &name); + void SetPlayerCape(int iPad,const std::wstring &name); void SetPlayerCape(int iPad,DWORD dwCapeId); void SetPlayerFavoriteSkin(int iPad, int iIndex,unsigned int uiSkinID); unsigned int GetPlayerFavoriteSkin(int iPad,int iIndex); @@ -258,9 +258,9 @@ public: void TickOpacityTimer(int iPad) { if(m_uiOpacityCountDown[iPad]>0) m_uiOpacityCountDown[iPad]--;} public: - wstring GetPlayerSkinName(int iPad); + std::wstring GetPlayerSkinName(int iPad); DWORD GetPlayerSkinId(int iPad); - wstring GetPlayerCapeName(int iPad); + std::wstring GetPlayerCapeName(int iPad); DWORD GetPlayerCapeId(int iPad); DWORD GetAdditionalModelParts(int iPad); void CheckGameSettingsChanged(bool bOverride5MinuteTimer=false, int iPad=XUSER_INDEX_ANY); @@ -310,7 +310,7 @@ public: #endif void SetDebugSequence(const char *pchSeq); static int DebugInputCallback(LPVOID pParam); - //bool UploadFileToGlobalStorage(int iQuadrant, C4JStorage::eGlobalStorage eStorageFacility, wstring *wsFile ); + //bool UploadFileToGlobalStorage(int iQuadrant, C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ); // Installed DLC bool StartInstallDLCProcess(int iPad); @@ -325,7 +325,7 @@ public: void ClearDLCInstalled() { m_bDLCInstallProcessCompleted=false;} static int MarketplaceCountsCallback(LPVOID pParam,C4JStorage::DLC_TMS_DETAILS *,int iPad); - bool AlreadySeenCreditText(const wstring &wstemp); + bool AlreadySeenCreditText(const std::wstring &wstemp); void ClearNewDLCAvailable(void) { m_bNewDLCAvailable=false; m_bSeenNewDLCTip=true;} bool GetNewDLCAvailable() { return m_bNewDLCAvailable;} @@ -339,10 +339,10 @@ public: bool isXuidNotch(PlayerUID xuid); bool isXuidDeadmau5(PlayerUID xuid); - void AddMemoryTextureFile(const wstring &wName, PBYTE pbData, DWORD dwBytes); - void RemoveMemoryTextureFile(const wstring &wName); - void GetMemFileDetails(const wstring &wName,PBYTE *ppbData,DWORD *pdwBytes); - bool IsFileInMemoryTextures(const wstring &wName); + void AddMemoryTextureFile(const std::wstring &wName, PBYTE pbData, DWORD dwBytes); + void RemoveMemoryTextureFile(const std::wstring &wName); + void GetMemFileDetails(const std::wstring &wName,PBYTE *ppbData,DWORD *pdwBytes); + bool IsFileInMemoryTextures(const std::wstring &wName); // Texture Pack Data files (icon, banner, comparison shot & text) void AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes); @@ -367,15 +367,15 @@ public: private: PlayerUID m_xuidNotch; #ifdef _DURANGO - unordered_map m_GTS_Files; + std::unordered_map m_GTS_Files; #else - unordered_map m_GTS_Files; + std::unordered_map m_GTS_Files; #endif // for storing memory textures - player skin - unordered_map m_MEM_Files; + std::unordered_map m_MEM_Files; // for storing texture pack data files - unordered_map m_MEM_TPD; + std::unordered_map m_MEM_TPD; CRITICAL_SECTION csMemFilesLock; // For locking access to the above map CRITICAL_SECTION csMemTPDLock; // For locking access to the above map @@ -422,9 +422,9 @@ protected: StringTable *m_stringTable; public: - int getArchiveFileSize(const wstring &filename); - bool hasArchiveFile(const wstring &filename); - byteArray getArchiveFile(const wstring &filename); + int getArchiveFileSize(const std::wstring &filename); + bool hasArchiveFile(const std::wstring &filename); + byteArray getArchiveFile(const std::wstring &filename); private: @@ -551,10 +551,10 @@ public: int GetHTMLColour(eMinecraftColour colour); int GetHTMLColor(eMinecraftColour colour) { return GetHTMLColour(colour); } int GetHTMLFontSize(EHTMLFontSize size); - wstring FormatHTMLString(int iPad, const wstring &desc, int shadowColour = 0xFFFFFFFF); - wstring GetActionReplacement(int iPad, unsigned char ucAction); - wstring GetVKReplacement(unsigned int uiVKey); - wstring GetIconReplacement(unsigned int uiIcon); + std::wstring FormatHTMLString(int iPad, const std::wstring &desc, int shadowColour = 0xFFFFFFFF); + std::wstring GetActionReplacement(int iPad, unsigned char ucAction); + std::wstring GetVKReplacement(unsigned int uiVKey); + std::wstring GetIconReplacement(unsigned int uiIcon); float getAppTime() { return m_Time.fAppTime; } void UpdateTrialPausedTimer() { mfTrialPausedTime+= m_Time.fElapsedTime;} @@ -583,18 +583,18 @@ public: #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) HRESULT RegisterDLCData(char *pchDLCName, unsigned int uiSortIndex, char *pchImageURL); - bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal); + bool GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,ULONGLONG *pullVal); DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial); DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full); #elif defined(_XBOX_ONE) static HRESULT RegisterDLCData(eDLCContentType, WCHAR *, WCHAR *, WCHAR *, WCHAR *, int, unsigned int); - //bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,WCHAR *pwchProductId); - bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring &wsProductId); + //bool GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,WCHAR *pwchProductId); + bool GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,std::wstring &wsProductId); DLC_INFO *GetDLCInfoForFullOfferID(WCHAR *pwchProductId); DLC_INFO *GetDLCInfoForProductName(WCHAR *pwchProductName); #else static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, __uint64, __uint64, WCHAR *, unsigned int, int, WCHAR *pDataFile); - bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal); + bool GetDLCFullOfferIDForSkinID(const std::wstring &FirstSkin,ULONGLONG *pullVal); DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial); DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full); #endif @@ -619,22 +619,22 @@ private: std::vector vDLCCredits; #if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - static unordered_map MojangData; - static unordered_map DLCTextures_PackID; // for mash-up packs & texture packs - static unordered_map DLCInfo; - static unordered_map DLCInfo_SkinName; // skin name, full offer id + static std::unordered_map MojangData; + static std::unordered_map DLCTextures_PackID; // for mash-up packs & texture packs + static std::unordered_map DLCInfo; + static std::unordered_map DLCInfo_SkinName; // skin name, full offer id #elif defined(_DURANGO) - static unordered_map MojangData; - static unordered_map DLCTextures_PackID; // for mash-up packs & texture packs - //static unordered_map DLCInfo_Trial; // full offerid, dlc_info - static unordered_map DLCInfo_Full; // full offerid, dlc_info - static unordered_map DLCInfo_SkinName; // skin name, full offer id + static std::unordered_map MojangData; + static std::unordered_map DLCTextures_PackID; // for mash-up packs & texture packs + //static std::unordered_map DLCInfo_Trial; // full offerid, dlc_info + static std::unordered_map DLCInfo_Full; // full offerid, dlc_info + static std::unordered_map DLCInfo_SkinName; // skin name, full offer id #else - static unordered_map MojangData; - static unordered_map DLCTextures_PackID; // for mash-up packs & texture packs - static unordered_map DLCInfo_Trial; // full offerid, dlc_info - static unordered_map DLCInfo_Full; // full offerid, dlc_info - static unordered_map DLCInfo_SkinName; // skin name, full offer id + static std::unordered_map MojangData; + static std::unordered_map DLCTextures_PackID; // for mash-up packs & texture packs + static std::unordered_map DLCInfo_Trial; // full offerid, dlc_info + static std::unordered_map DLCInfo_Full; // full offerid, dlc_info + static std::unordered_map DLCInfo_SkinName; // skin name, full offer id #endif // bool m_bRead_TMS_XUIDS_XML; // track whether we have already read the TMS xuids.xml file // bool m_bRead_TMS_DLCINFO_XML; // track whether we have already read the TMS DLC.xml file @@ -713,11 +713,11 @@ public: void processSchematics(LevelChunk *levelChunk); void processSchematicsLighting(LevelChunk *levelChunk); void loadDefaultGameRules(); - vector *getLevelGenerators() { return m_gameRules.getLevelGenerators(); } + std::vector *getLevelGenerators() { return m_gameRules.getLevelGenerators(); } void setLevelGenerationOptions(LevelGenerationOptions *levelGen); LevelRuleset *getGameRuleDefinitions() { return m_gameRules.getGameRuleDefinitions(); } LevelGenerationOptions *getLevelGenerationOptions() { return m_gameRules.getLevelGenerationOptions(); } - LPCWSTR GetGameRulesString(const wstring &key); + LPCWSTR GetGameRulesString(const std::wstring &key); private: BYTE m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's @@ -728,7 +728,7 @@ public: short GetPlayerColour(BYTE networkSmallId); unsigned int GetPlayerPrivileges(BYTE networkSmallId); - wstring getEntityName(eINSTANCEOF type); + std::wstring getEntityName(eINSTANCEOF type); @@ -758,7 +758,7 @@ public: #ifdef _XBOX_ONE static int TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,LPVOID, WCHAR *wchFilename); - unordered_map *GetDLCInfo(); + std::unordered_map *GetDLCInfo(); #else static int TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename); #endif @@ -768,8 +768,8 @@ public: int GetDLCInfoTrialOffersCount(); int GetDLCInfoFullOffersCount(); #ifdef _XBOX_ONE - bool GetDLCFullOfferIDForPackID(const int iPackID,wstring &wsProductId); - wstring GetDLCInfoTexturesFullOffer(int iIndex); + bool GetDLCFullOfferIDForPackID(const int iPackID,std::wstring &wsProductId); + std::wstring GetDLCInfoTexturesFullOffer(int iIndex); #else bool GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pullVal); @@ -788,8 +788,8 @@ private: // Download Status //Request current_download; - vector m_DLCDownloadQueue; - vector m_TMSPPDownloadQueue; + std::vector m_DLCDownloadQueue; + std::vector m_TMSPPDownloadQueue; static DWORD m_dwContentTypeA[e_Marketplace_MAX]; int m_iDLCOfferC; bool m_bAllDLCContentRetrieved; @@ -817,14 +817,14 @@ public: // Storing additional model parts per skin texture void SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, DWORD dwSkinBoxC); - vector * SetAdditionalSkinBoxes(DWORD dwSkinID, vector *pvSkinBoxA); - vector *GetAdditionalModelParts(DWORD dwSkinID); - vector *GetAdditionalSkinBoxes(DWORD dwSkinID); + std::vector * SetAdditionalSkinBoxes(DWORD dwSkinID, std::vector *pvSkinBoxA); + std::vector *GetAdditionalModelParts(DWORD dwSkinID); + std::vector *GetAdditionalSkinBoxes(DWORD dwSkinID); void SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOverrideBitmask); unsigned int GetAnimOverrideBitmask(DWORD dwSkinID); - static DWORD getSkinIdFromPath(const wstring &skin); - static wstring getSkinPathFromId(DWORD skinId); + static DWORD getSkinIdFromPath(const std::wstring &skin); + static std::wstring getSkinPathFromId(DWORD skinId); virtual int LoadLocalTMSFile(WCHAR *wchTMSFile)=0; virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt)=0; @@ -848,15 +848,15 @@ public: private: // vector of additional skin model parts, indexed by the skin texture id - unordered_map *> m_AdditionalModelParts; - unordered_map *> m_AdditionalSkinBoxes; - unordered_map m_AnimOverrides; + std::unordered_map *> m_AdditionalModelParts; + std::unordered_map *> m_AdditionalSkinBoxes; + std::unordered_map m_AnimOverrides; bool m_bResetNether; DWORD m_dwRequiredTexturePackID; #ifdef _XBOX_ONE - vector m_vTMSPPData; + std::vector m_vTMSPPData; #endif #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) @@ -872,19 +872,19 @@ private: public: void LocaleAndLanguageInit(); - void getLocale(vector &vecWstrLocales); + void getLocale(std::vector &vecWstrLocales); DWORD get_eMCLang(WCHAR *pwchLocale); DWORD get_xcLang(WCHAR *pwchLocale); void SetTickTMSDLCFiles(bool bVal); - wstring getFilePath(DWORD packId, wstring filename, bool bAddDataFolder); + std::wstring getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder); private: - unordered_mapm_localeA; - unordered_mapm_eMCLangA; - unordered_mapm_xcLangA; - wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder); + std::unordered_mapm_localeA; + std::unordered_mapm_eMCLangA; + std::unordered_mapm_xcLangA; + std::wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder); public: #ifdef _XBOX diff --git a/Minecraft.Client/Build/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Build/Common/DLC/DLCAudioFile.cpp index 74a35ecff..2c312fd99 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCAudioFile.cpp @@ -6,7 +6,7 @@ #include "../../../Platform/Xbox/XML/xmlFilesCallback.h" #endif -DLCAudioFile::DLCAudioFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path) +DLCAudioFile::DLCAudioFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path) { m_pbData = NULL; m_dwBytes = 0; @@ -32,7 +32,7 @@ const WCHAR *DLCAudioFile::wchTypeNamesA[]= L"CREDIT", }; -DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const wstring ¶mName) +DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const std::wstring ¶mName) { EAudioParameterType type = e_AudioParamType_Invalid; @@ -48,7 +48,7 @@ DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const wstring & return type; } -void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, const wstring &value) +void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, const std::wstring &value) { switch(ptype) { @@ -79,7 +79,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons maximumChars = 35; break; } - wstring creditValue = value; + std::wstring creditValue = value; while (creditValue.length() > maximumChars) { unsigned int i = 1; @@ -122,7 +122,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) { - unordered_map parameterMapping; + std::unordered_map parameterMapping; unsigned int uiCurrentByte=0; // File format defined in the AudioPacker @@ -145,7 +145,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) for(unsigned int i=0;iwchData); + std::wstring parameterName((WCHAR *)pParams->wchData); EAudioParameterType type = getParameterType(parameterName); if( type != e_AudioParamType_Invalid ) { @@ -204,7 +204,7 @@ int DLCAudioFile::GetCountofType(DLCAudioFile::EAudioType eType) } -wstring &DLCAudioFile::GetSoundName(int iIndex) +std::wstring &DLCAudioFile::GetSoundName(int iIndex) { int iWorldType=e_AudioType_Overworld; while(iIndex>=m_parameters[iWorldType].size()) diff --git a/Minecraft.Client/Build/Common/DLC/DLCAudioFile.h b/Minecraft.Client/Build/Common/DLC/DLCAudioFile.h index f1a356fe9..f71f89130 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCAudioFile.h +++ b/Minecraft.Client/Build/Common/DLC/DLCAudioFile.h @@ -30,14 +30,14 @@ public: }; static const WCHAR *wchTypeNamesA[e_AudioParamType_Max]; - DLCAudioFile(const wstring &path); + DLCAudioFile(const std::wstring &path); virtual void addData(PBYTE pbData, DWORD dwBytes); virtual PBYTE getData(DWORD &dwBytes); bool processDLCDataFile(PBYTE pbData, DWORD dwLength); int GetCountofType(DLCAudioFile::EAudioType ptype); - wstring &GetSoundName(int iIndex); + std::wstring &GetSoundName(int iIndex); private: using DLCFile::addParameter; @@ -45,10 +45,10 @@ private: PBYTE m_pbData; DWORD m_dwBytes; static const int CURRENT_AUDIO_VERSION_NUM=1; - //unordered_map m_parameters; - vector m_parameters[e_AudioType_Max]; + //std::unordered_map m_parameters; + std::vector m_parameters[e_AudioType_Max]; // use the EAudioType to order these - void addParameter(DLCAudioFile::EAudioType type, DLCAudioFile::EAudioParameterType ptype, const wstring &value); - DLCAudioFile::EAudioParameterType getParameterType(const wstring ¶mName); + void addParameter(DLCAudioFile::EAudioType type, DLCAudioFile::EAudioParameterType ptype, const std::wstring &value); + DLCAudioFile::EAudioParameterType getParameterType(const std::wstring ¶mName); }; diff --git a/Minecraft.Client/Build/Common/DLC/DLCCapeFile.cpp b/Minecraft.Client/Build/Common/DLC/DLCCapeFile.cpp index 0be1e8067..fc6c4077f 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCCapeFile.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCCapeFile.cpp @@ -2,7 +2,7 @@ #include "DLCManager.h" #include "DLCCapeFile.h" -DLCCapeFile::DLCCapeFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Cape,path) +DLCCapeFile::DLCCapeFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Cape,path) { } diff --git a/Minecraft.Client/Build/Common/DLC/DLCCapeFile.h b/Minecraft.Client/Build/Common/DLC/DLCCapeFile.h index 8373d340a..6626387a8 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCCapeFile.h +++ b/Minecraft.Client/Build/Common/DLC/DLCCapeFile.h @@ -4,7 +4,7 @@ class DLCCapeFile : public DLCFile { public: - DLCCapeFile(const wstring &path); + DLCCapeFile(const std::wstring &path); virtual void addData(PBYTE pbData, DWORD dwBytes); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/DLC/DLCColourTableFile.cpp b/Minecraft.Client/Build/Common/DLC/DLCColourTableFile.cpp index 59a75c53a..5910ac322 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCColourTableFile.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCColourTableFile.cpp @@ -5,7 +5,7 @@ #include "../../../Textures/Packs/TexturePackRepository.h" #include "../../../Textures/Packs/TexturePack.h" -DLCColourTableFile::DLCColourTableFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_ColourTable,path) +DLCColourTableFile::DLCColourTableFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_ColourTable,path) { m_colourTable = NULL; } diff --git a/Minecraft.Client/Build/Common/DLC/DLCColourTableFile.h b/Minecraft.Client/Build/Common/DLC/DLCColourTableFile.h index 842697391..cb7a8cf5a 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCColourTableFile.h +++ b/Minecraft.Client/Build/Common/DLC/DLCColourTableFile.h @@ -9,7 +9,7 @@ private: ColourTable *m_colourTable; public: - DLCColourTableFile(const wstring &path); + DLCColourTableFile(const std::wstring &path); ~DLCColourTableFile(); virtual void addData(PBYTE pbData, DWORD dwBytes); diff --git a/Minecraft.Client/Build/Common/DLC/DLCFile.cpp b/Minecraft.Client/Build/Common/DLC/DLCFile.cpp index fb98db81a..7a1f21e8b 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCFile.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCFile.cpp @@ -1,7 +1,7 @@ #include "../../../../Minecraft.World/Build/stdafx.h" #include "DLCFile.h" -DLCFile::DLCFile(DLCManager::EDLCType type, const wstring &path) +DLCFile::DLCFile(DLCManager::EDLCType type, const std::wstring &path) { m_type = type; m_path = path; @@ -11,7 +11,7 @@ DLCFile::DLCFile(DLCManager::EDLCType type, const wstring &path) if(dlcSkin) { - wstring skinValue = path.substr(7,path.size()); + std::wstring skinValue = path.substr(7,path.size()); skinValue = skinValue.substr(0,skinValue.find_first_of(L'.')); std::wstringstream ss; ss << std::dec << skinValue.c_str(); diff --git a/Minecraft.Client/Build/Common/DLC/DLCFile.h b/Minecraft.Client/Build/Common/DLC/DLCFile.h index 3a40dbc76..0f652f849 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCFile.h +++ b/Minecraft.Client/Build/Common/DLC/DLCFile.h @@ -5,21 +5,21 @@ class DLCFile { protected: DLCManager::EDLCType m_type; - wstring m_path; + std::wstring m_path; DWORD m_dwSkinId; public: - DLCFile(DLCManager::EDLCType type, const wstring &path); + DLCFile(DLCManager::EDLCType type, const std::wstring &path); virtual ~DLCFile() {} DLCManager::EDLCType getType() { return m_type; } - wstring getPath() { return m_path; } + std::wstring getPath() { return m_path; } DWORD getSkinID() { return m_dwSkinId; } virtual void addData(PBYTE pbData, DWORD dwBytes) {} virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; } - virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value) {} + virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {} - virtual wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; } + virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; } virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) { return false;} }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/DLC/DLCGameRules.h b/Minecraft.Client/Build/Common/DLC/DLCGameRules.h index a1998b1dd..4b1fe01f8 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCGameRules.h +++ b/Minecraft.Client/Build/Common/DLC/DLCGameRules.h @@ -6,5 +6,5 @@ class DLCGameRules : public DLCFile { public: - DLCGameRules(DLCManager::EDLCType type, const wstring &path) : DLCFile(type,path) {} + DLCGameRules(DLCManager::EDLCType type, const std::wstring &path) : DLCFile(type,path) {} }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/DLC/DLCGameRulesFile.cpp b/Minecraft.Client/Build/Common/DLC/DLCGameRulesFile.cpp index dd549f902..6623c676b 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCGameRulesFile.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCGameRulesFile.cpp @@ -2,7 +2,7 @@ #include "DLCManager.h" #include "DLCGameRulesFile.h" -DLCGameRulesFile::DLCGameRulesFile(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path) +DLCGameRulesFile::DLCGameRulesFile(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path) { m_pbData = NULL; m_dwBytes = 0; diff --git a/Minecraft.Client/Build/Common/DLC/DLCGameRulesFile.h b/Minecraft.Client/Build/Common/DLC/DLCGameRulesFile.h index e6456d73a..9924ca849 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCGameRulesFile.h +++ b/Minecraft.Client/Build/Common/DLC/DLCGameRulesFile.h @@ -8,7 +8,7 @@ private: DWORD m_dwBytes; public: - DLCGameRulesFile(const wstring &path); + DLCGameRulesFile(const std::wstring &path); virtual void addData(PBYTE pbData, DWORD dwBytes); virtual PBYTE getData(DWORD &dwBytes); diff --git a/Minecraft.Client/Build/Common/DLC/DLCGameRulesHeader.cpp b/Minecraft.Client/Build/Common/DLC/DLCGameRulesHeader.cpp index a8d8509ed..ef644da56 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCGameRulesHeader.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCGameRulesHeader.cpp @@ -9,7 +9,7 @@ #include "DLCManager.h" #include "DLCGameRulesHeader.h" -DLCGameRulesHeader::DLCGameRulesHeader(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path) +DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path) { m_pbData = NULL; m_dwBytes = 0; @@ -35,7 +35,7 @@ void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes) // Init values. int version_number; byte compression_type; - wstring texturepackid; + std::wstring texturepackid; // Read Datastream. version_number = dis.readInt(); diff --git a/Minecraft.Client/Build/Common/DLC/DLCGameRulesHeader.h b/Minecraft.Client/Build/Common/DLC/DLCGameRulesHeader.h index f73b817b8..fddc7318c 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCGameRulesHeader.h +++ b/Minecraft.Client/Build/Common/DLC/DLCGameRulesHeader.h @@ -16,22 +16,22 @@ private: public: virtual bool requiresTexturePack() {return m_bRequiresTexturePack;} virtual UINT getRequiredTexturePackId() {return m_requiredTexturePackId;} - virtual wstring getDefaultSaveName() {return m_defaultSaveName;} + virtual std::wstring getDefaultSaveName() {return m_defaultSaveName;} virtual LPCWSTR getWorldName() {return m_worldName.c_str();} virtual LPCWSTR getDisplayName() {return m_displayName.c_str();} - virtual wstring getGrfPath() {return L"GameRules.grf";} + virtual std::wstring getGrfPath() {return L"GameRules.grf";} virtual void setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;} virtual void setRequiredTexturePackId(UINT x) {m_requiredTexturePackId = x;} - virtual void setDefaultSaveName(const wstring &x) {m_defaultSaveName = x;} - virtual void setWorldName(const wstring & x) {m_worldName = x;} - virtual void setDisplayName(const wstring & x) {m_displayName = x;} - virtual void setGrfPath(const wstring & x) {m_grfPath = x;} + virtual void setDefaultSaveName(const std::wstring &x) {m_defaultSaveName = x;} + virtual void setWorldName(const std::wstring & x) {m_worldName = x;} + virtual void setDisplayName(const std::wstring & x) {m_displayName = x;} + virtual void setGrfPath(const std::wstring & x) {m_grfPath = x;} LevelGenerationOptions *lgo; public: - DLCGameRulesHeader(const wstring &path); + DLCGameRulesHeader(const std::wstring &path); virtual void addData(PBYTE pbData, DWORD dwBytes); virtual PBYTE getData(DWORD &dwBytes); diff --git a/Minecraft.Client/Build/Common/DLC/DLCLocalisationFile.cpp b/Minecraft.Client/Build/Common/DLC/DLCLocalisationFile.cpp index c54475a11..82c5549e1 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCLocalisationFile.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCLocalisationFile.cpp @@ -3,7 +3,7 @@ #include "DLCLocalisationFile.h" #include "../../../Utils/StringTable.h" -DLCLocalisationFile::DLCLocalisationFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_LocalisationData,path) +DLCLocalisationFile::DLCLocalisationFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_LocalisationData,path) { m_strings = NULL; } diff --git a/Minecraft.Client/Build/Common/DLC/DLCLocalisationFile.h b/Minecraft.Client/Build/Common/DLC/DLCLocalisationFile.h index 083e60d8b..db4211667 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCLocalisationFile.h +++ b/Minecraft.Client/Build/Common/DLC/DLCLocalisationFile.h @@ -9,7 +9,7 @@ private: StringTable *m_strings; public: - DLCLocalisationFile(const wstring &path); + DLCLocalisationFile(const std::wstring &path); DLCLocalisationFile(PBYTE pbData, DWORD dwBytes); // when we load in a texture pack details file from TMS++ virtual void addData(PBYTE pbData, DWORD dwBytes); diff --git a/Minecraft.Client/Build/Common/DLC/DLCManager.cpp b/Minecraft.Client/Build/Common/DLC/DLCManager.cpp index c30eab3ca..929853f66 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCManager.cpp @@ -10,10 +10,10 @@ #ifdef __linux__ #include static const size_t DLC_WCHAR_BINARY = 2; -static wstring dlc_read_wstring(const void *data) +static std::wstring dlc_read_wstring(const void *data) { const uint16_t *p = (const uint16_t *)data; - wstring s; + std::wstring s; while (*p) s += (wchar_t)*p++; return s; } @@ -21,7 +21,7 @@ static wstring dlc_read_wstring(const void *data) #define DLC_PARAM_ADV(n) (sizeof(C4JStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BINARY) #define DLC_DETAIL_ADV(n) (sizeof(C4JStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BINARY) #else -#define DLC_WSTRING(ptr) wstring((WCHAR *)(ptr)) +#define DLC_WSTRING(ptr) std::wstring((WCHAR *)(ptr)) #define DLC_PARAM_ADV(n) (sizeof(C4JStorage::DLC_FILE_PARAM) + sizeof(WCHAR) * (n)) #define DLC_DETAIL_ADV(n) (sizeof(C4JStorage::DLC_FILE_DETAILS) + sizeof(WCHAR) * (n)) #endif @@ -58,7 +58,7 @@ DLCManager::~DLCManager() } } -DLCManager::EDLCParameterType DLCManager::getParameterType(const wstring ¶mName) +DLCManager::EDLCParameterType DLCManager::getParameterType(const std::wstring ¶mName) { EDLCParameterType type = e_DLCParamType_Invalid; @@ -110,7 +110,7 @@ void DLCManager::removePack(DLCPack *pack) } } -DLCPack *DLCManager::getPack(const wstring &name) +DLCPack *DLCManager::getPack(const std::wstring &name) { DLCPack *pack = NULL; //DWORD currentIndex = 0; @@ -118,7 +118,7 @@ DLCPack *DLCManager::getPack(const wstring &name) for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { currentPack = *it; - wstring wsName=currentPack->getName(); + std::wstring wsName=currentPack->getName(); if(wsName.compare(name) == 0) { @@ -130,7 +130,7 @@ DLCPack *DLCManager::getPack(const wstring &name) } #ifdef _XBOX_ONE -DLCPack *DLCManager::getPackFromProductID(const wstring &productID) +DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID) { DLCPack *pack = NULL; //DWORD currentIndex = 0; @@ -138,7 +138,7 @@ DLCPack *DLCManager::getPackFromProductID(const wstring &productID) for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { currentPack = *it; - wstring wsName=currentPack->getPurchaseOfferId(); + std::wstring wsName=currentPack->getPurchaseOfferId(); if(wsName.compare(productID) == 0) { @@ -230,7 +230,7 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D return foundIndex; } -DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found) +DWORD DLCManager::getPackIndexContainingSkin(const std::wstring &path, bool &found) { DWORD foundIndex = 0; found = false; @@ -252,7 +252,7 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found) return foundIndex; } -DLCPack *DLCManager::getPackContainingSkin(const wstring &path) +DLCPack *DLCManager::getPackContainingSkin(const std::wstring &path) { DLCPack *foundPack = NULL; for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) @@ -270,7 +270,7 @@ DLCPack *DLCManager::getPackContainingSkin(const wstring &path) return foundPack; } -DLCSkinFile *DLCManager::getSkinFile(const wstring &path) +DLCSkinFile *DLCManager::getSkinFile(const std::wstring &path) { DLCSkinFile *foundSkinfile = NULL; for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) @@ -326,15 +326,15 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) return corruptDLCCount; } -bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const wstring &path, DLCPack *pack, bool fromArchive) +bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive) { return readDLCDataFile( dwFilesProcessed, wstringtofilename(path), pack, fromArchive); } -bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DLCPack *pack, bool fromArchive) +bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive) { - wstring wPath = convStringToWstring(path); + std::wstring wPath = convStringToWstring(path); if (fromArchive && app.getArchiveFileSize(wPath) >= 0) { byteArray bytes = app.getArchiveFile(wPath); @@ -343,11 +343,11 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL else if (fromArchive) return false; #ifdef _WINDOWS64 - string finalPath = StorageManager.GetMountedPath(path.c_str()); + std::string finalPath = StorageManager.GetMountedPath(path.c_str()); if(finalPath.size() == 0) finalPath = path; HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #elif defined(_DURANGO) - wstring finalPath = StorageManager.GetMountedPath(wPath.c_str()); + std::wstring finalPath = StorageManager.GetMountedPath(wPath.c_str()); if(finalPath.size() == 0) finalPath = wPath; HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #else @@ -387,7 +387,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack) { - unordered_map parameterMapping; + std::unordered_map parameterMapping; unsigned int uiCurrentByte=0; // File format defined in the DLC_Creator @@ -418,7 +418,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD for(unsigned int i=0;iwchData); + std::wstring parameterName = DLC_WSTRING(pParams->wchData); DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName); if( type != DLCManager::e_DLCParamType_Invalid ) { @@ -544,17 +544,17 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD return true; } -DWORD DLCManager::retrievePackIDFromDLCDataFile(const string &path, DLCPack *pack) +DWORD DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack) { DWORD packId = 0; - wstring wPath = convStringToWstring(path); + std::wstring wPath = convStringToWstring(path); #ifdef _WINDOWS64 - string finalPath = StorageManager.GetMountedPath(path.c_str()); + std::string finalPath = StorageManager.GetMountedPath(path.c_str()); if(finalPath.size() == 0) finalPath = path; HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #elif defined(_DURANGO) - wstring finalPath = StorageManager.GetMountedPath(wPath.c_str()); + std::wstring finalPath = StorageManager.GetMountedPath(wPath.c_str()); if(finalPath.size() == 0) finalPath = wPath; HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #else @@ -594,7 +594,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) { DWORD packId=0; bool bPackIDSet=false; - unordered_map parameterMapping; + std::unordered_map parameterMapping; unsigned int uiCurrentByte=0; // File format defined in the DLC_Creator @@ -623,7 +623,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) for(unsigned int i=0;iwchData); + std::wstring parameterName = DLC_WSTRING(pParams->wchData); DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName); if( type != DLCManager::e_DLCParamType_Invalid ) { @@ -664,7 +664,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) { if(it->second==e_DLCParamType_PackId) { - wstring wsTemp = DLC_WSTRING(pParams->wchData); + std::wstring wsTemp = DLC_WSTRING(pParams->wchData); std::wstringstream ss; // 4J Stu - numbered using decimal to make it easier for artists/people to number manually ss << std::dec << wsTemp.c_str(); diff --git a/Minecraft.Client/Build/Common/DLC/DLCManager.h b/Minecraft.Client/Build/Common/DLC/DLCManager.h index 1021b6641..41ffb3646 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCManager.h +++ b/Minecraft.Client/Build/Common/DLC/DLCManager.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include class DLCPack; class DLCSkinFile; @@ -51,7 +51,7 @@ public: const static WCHAR *wchTypeNamesA[e_DLCParamType_Max]; private: - vector m_packs; + std::vector m_packs; //bool m_bNeedsUpdated; bool m_bNeedsCorruptCheck; DWORD m_dwUnnamedCorruptDLCCount; @@ -59,7 +59,7 @@ public: DLCManager(); ~DLCManager(); - static EDLCParameterType getParameterType(const wstring ¶mName); + static EDLCParameterType getParameterType(const std::wstring ¶mName); DWORD getPackCount(EDLCType type = e_DLCType_All); @@ -75,22 +75,22 @@ public: void addPack(DLCPack *pack); void removePack(DLCPack *pack); - DLCPack *getPack(const wstring &name); + DLCPack *getPack(const std::wstring &name); #ifdef _XBOX_ONE - DLCPack *DLCManager::getPackFromProductID(const wstring &productID); + DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID); #endif DLCPack *getPack(DWORD index, EDLCType type = e_DLCType_All); DWORD getPackIndex(DLCPack *pack, bool &found, EDLCType type = e_DLCType_All); - DLCSkinFile *getSkinFile(const wstring &path); // Will hunt all packs of type skin to find the right skinfile + DLCSkinFile *getSkinFile(const std::wstring &path); // Will hunt all packs of type skin to find the right skinfile - DLCPack *getPackContainingSkin(const wstring &path); - DWORD getPackIndexContainingSkin(const wstring &path, bool &found); + DLCPack *getPackContainingSkin(const std::wstring &path); + DWORD getPackIndexContainingSkin(const std::wstring &path, bool &found); DWORD checkForCorruptDLCAndAlert(bool showMessage = true); - bool readDLCDataFile(DWORD &dwFilesProcessed, const wstring &path, DLCPack *pack, bool fromArchive = false); - bool readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DLCPack *pack, bool fromArchive = false); - DWORD retrievePackIDFromDLCDataFile(const string &path, DLCPack *pack); + bool readDLCDataFile(DWORD &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive = false); + bool readDLCDataFile(DWORD &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false); + DWORD retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack); private: bool processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack); diff --git a/Minecraft.Client/Build/Common/DLC/DLCPack.cpp b/Minecraft.Client/Build/Common/DLC/DLCPack.cpp index f2878045b..bf6be031b 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCPack.cpp @@ -11,7 +11,7 @@ #include "DLCColourTableFile.h" #include "../../../../Minecraft.World/Util/StringHelpers.h" -DLCPack::DLCPack(const wstring &name,DWORD dwLicenseMask) +DLCPack::DLCPack(const std::wstring &name,DWORD dwLicenseMask) { m_dataPath = L""; m_packName = name; @@ -35,7 +35,7 @@ DLCPack::DLCPack(const wstring &name,DWORD dwLicenseMask) } #ifdef _XBOX_ONE -DLCPack::DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMask) +DLCPack::DLCPack(const std::wstring &name,const std::wstring &productID,DWORD dwLicenseMask) { m_dataPath = L""; m_packName = name; @@ -119,7 +119,7 @@ void DLCPack::setParentPack(DLCPack *parentPack) m_parentPack = parentPack; } -void DLCPack::addParameter(DLCManager::EDLCParameterType type, const wstring &value) +void DLCPack::addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) { switch(type) { @@ -183,7 +183,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned in return false; } -DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path) +DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const std::wstring &path) { DLCFile *newFile = NULL; @@ -192,7 +192,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path) case DLCManager::e_DLCType_Skin: { std::vector splitPath = stringSplit(path,L'/'); - wstring strippedPath = splitPath.back(); + std::wstring strippedPath = splitPath.back(); newFile = new DLCSkinFile(strippedPath); @@ -212,7 +212,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path) case DLCManager::e_DLCType_Cape: { std::vector splitPath = stringSplit(path,L'/'); - wstring strippedPath = splitPath.back(); + std::wstring strippedPath = splitPath.back(); newFile = new DLCCapeFile(strippedPath); } break; @@ -248,13 +248,13 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path) } // MGH - added this comp func, as the embedded func in find_if was confusing the PS3 compiler -static const wstring *g_pathCmpString = NULL; +static const std::wstring *g_pathCmpString = NULL; static bool pathCmp(DLCFile *val) { return (g_pathCmpString->compare(val->getPath()) == 0); } -bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path) +bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const std::wstring &path) { bool hasFile = false; if(type == DLCManager::e_DLCType_All) @@ -268,7 +268,7 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path else { g_pathCmpString = &path; - AUTO_VAR(it, find_if( m_files[type].begin(), m_files[type].end(), pathCmp )); + AUTO_VAR(it, std::find_if( m_files[type].begin(), m_files[type].end(), pathCmp )); hasFile = it != m_files[type].end(); if(!hasFile && m_parentPack ) { @@ -300,7 +300,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index) return file; } -DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path) +DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const std::wstring &path) { DLCFile *file = NULL; if(type == DLCManager::e_DLCType_All) @@ -314,7 +314,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path) else { g_pathCmpString = &path; - AUTO_VAR(it, find_if( m_files[type].begin(), m_files[type].end(), pathCmp )); + AUTO_VAR(it, std::find_if( m_files[type].begin(), m_files[type].end(), pathCmp )); if(it == m_files[type].end()) { @@ -352,7 +352,7 @@ DWORD DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCT return count; }; -DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const wstring &path, bool &found) +DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found) { if(type == DLCManager::e_DLCType_All) { @@ -380,7 +380,7 @@ DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const wstring &path, bo return foundIndex; } -bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type, const wstring &path) +bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type, const std::wstring &path) { if(type == DLCManager::e_DLCType_All) { diff --git a/Minecraft.Client/Build/Common/DLC/DLCPack.h b/Minecraft.Client/Build/Common/DLC/DLCPack.h index 856744c27..7a0ba2bac 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCPack.h +++ b/Minecraft.Client/Build/Common/DLC/DLCPack.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "DLCManager.h" class DLCFile; @@ -8,19 +8,19 @@ class DLCSkinFile; class DLCPack { private: - vector m_files[DLCManager::e_DLCType_Max]; - vector m_childPacks; + std::vector m_files[DLCManager::e_DLCType_Max]; + std::vector m_childPacks; DLCPack *m_parentPack; - unordered_map m_parameters; + std::unordered_map m_parameters; - wstring m_packName; - wstring m_dataPath; + std::wstring m_packName; + std::wstring m_dataPath; DWORD m_dwLicenseMask; int m_dlcMountIndex; XCONTENTDEVICEID m_dlcDeviceID; #ifdef _XBOX_ONE - wstring m_wsProductId; + std::wstring m_wsProductId; #else ULONGLONG m_ullFullOfferId; #endif @@ -31,13 +31,13 @@ private: PBYTE m_data; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. public: - DLCPack(const wstring &name,DWORD dwLicenseMask); + DLCPack(const std::wstring &name,DWORD dwLicenseMask); #ifdef _XBOX_ONE - DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMask); + DLCPack(const std::wstring &name,const std::wstring &productID,DWORD dwLicenseMask); #endif ~DLCPack(); - wstring getFullDataPath() { return m_dataPath; } + std::wstring getFullDataPath() { return m_dataPath; } void SetDataPointer(PBYTE pbData) { m_data = pbData; } @@ -61,33 +61,33 @@ public: void addChildPack(DLCPack *childPack); void setParentPack(DLCPack *parentPack); - void addParameter(DLCManager::EDLCParameterType type, const wstring &value); + void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); bool getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int ¶m); void updateLicenseMask( DWORD dwLicenseMask ) { m_dwLicenseMask = dwLicenseMask; } DWORD getLicenseMask( ) { return m_dwLicenseMask; } - wstring getName() { return m_packName; } + std::wstring getName() { return m_packName; } #ifdef _XBOX_ONE - wstring getPurchaseOfferId() { return m_wsProductId; } + std::wstring getPurchaseOfferId() { return m_wsProductId; } #else ULONGLONG getPurchaseOfferId() { return m_ullFullOfferId; } #endif - DLCFile *addFile(DLCManager::EDLCType type, const wstring &path); + DLCFile *addFile(DLCManager::EDLCType type, const std::wstring &path); DLCFile *getFile(DLCManager::EDLCType type, DWORD index); - DLCFile *getFile(DLCManager::EDLCType type, const wstring &path); + DLCFile *getFile(DLCManager::EDLCType type, const std::wstring &path); DWORD getDLCItemsCount(DLCManager::EDLCType type = DLCManager::e_DLCType_All); - DWORD getFileIndexAt(DLCManager::EDLCType type, const wstring &path, bool &found); - bool doesPackContainFile(DLCManager::EDLCType type, const wstring &path); + DWORD getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found); + bool doesPackContainFile(DLCManager::EDLCType type, const std::wstring &path); DWORD GetPackID() {return m_packId;} DWORD getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); } - DWORD getSkinIndexAt(const wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); } - DLCSkinFile *getSkinFile(const wstring &path) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, path); } + DWORD getSkinIndexAt(const std::wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); } + DLCSkinFile *getSkinFile(const std::wstring &path) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, path); } DLCSkinFile *getSkinFile(DWORD index) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, index); } - bool doesPackContainSkin(const wstring &path) { return doesPackContainFile(DLCManager::e_DLCType_Skin, path); } + bool doesPackContainSkin(const std::wstring &path) { return doesPackContainFile(DLCManager::e_DLCType_Skin, path); } - bool hasPurchasedFile(DLCManager::EDLCType type, const wstring &path); + bool hasPurchasedFile(DLCManager::EDLCType type, const std::wstring &path); }; diff --git a/Minecraft.Client/Build/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Build/Common/DLC/DLCSkinFile.cpp index fd366ba37..91bcdb563 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCSkinFile.cpp @@ -7,7 +7,7 @@ #include "../../../../Minecraft.World/Player/Player.h" #include "../../../../Minecraft.World/Util/StringHelpers.h" -DLCSkinFile::DLCSkinFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Skin,path) +DLCSkinFile::DLCSkinFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Skin,path) { m_displayName = L""; m_themeName = L""; @@ -21,7 +21,7 @@ void DLCSkinFile::addData(PBYTE pbData, DWORD dwBytes) app.AddMemoryTextureFile(m_path,pbData,dwBytes); } -void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring &value) +void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) { switch(type) { @@ -71,7 +71,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring maximumChars = 35; break; } - wstring creditValue = value; + std::wstring creditValue = value; while (creditValue.length() > maximumChars) { unsigned int i = 1; @@ -163,7 +163,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring } } -// vector *DLCSkinFile::getAdditionalModelParts() +// std::vector *DLCSkinFile::getAdditionalModelParts() // { // return &m_AdditionalModelParts; // } @@ -172,12 +172,12 @@ int DLCSkinFile::getAdditionalBoxesCount() { return (int)m_AdditionalBoxes.size(); } -vector *DLCSkinFile::getAdditionalBoxes() +std::vector *DLCSkinFile::getAdditionalBoxes() { return &m_AdditionalBoxes; } -wstring DLCSkinFile::getParameterAsString(DLCManager::EDLCParameterType type) +std::wstring DLCSkinFile::getParameterAsString(DLCManager::EDLCParameterType type) { switch(type) { diff --git a/Minecraft.Client/Build/Common/DLC/DLCSkinFile.h b/Minecraft.Client/Build/Common/DLC/DLCSkinFile.h index 0e6d75308..b39583e1b 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCSkinFile.h +++ b/Minecraft.Client/Build/Common/DLC/DLCSkinFile.h @@ -6,23 +6,23 @@ class DLCSkinFile : public DLCFile { private: - wstring m_displayName; - wstring m_themeName; - wstring m_cape; + std::wstring m_displayName; + std::wstring m_themeName; + std::wstring m_cape; unsigned int m_uiAnimOverrideBitmask; bool m_bIsFree; - vector m_AdditionalBoxes; + std::vector m_AdditionalBoxes; public: - DLCSkinFile(const wstring &path); + DLCSkinFile(const std::wstring &path); virtual void addData(PBYTE pbData, DWORD dwBytes); - virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value); + virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); - virtual wstring getParameterAsString(DLCManager::EDLCParameterType type); + virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); - vector *getAdditionalBoxes(); + std::vector *getAdditionalBoxes(); int getAdditionalBoxesCount(); unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask;} bool isFree() {return m_bIsFree;} diff --git a/Minecraft.Client/Build/Common/DLC/DLCTextureFile.cpp b/Minecraft.Client/Build/Common/DLC/DLCTextureFile.cpp index 2593f3d72..1b4681d7e 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCTextureFile.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCTextureFile.cpp @@ -2,7 +2,7 @@ #include "DLCManager.h" #include "DLCTextureFile.h" -DLCTextureFile::DLCTextureFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Texture,path) +DLCTextureFile::DLCTextureFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Texture,path) { m_bIsAnim = false; m_animString = L""; @@ -24,7 +24,7 @@ PBYTE DLCTextureFile::getData(DWORD &dwBytes) return m_pbData; } -void DLCTextureFile::addParameter(DLCManager::EDLCParameterType type, const wstring &value) +void DLCTextureFile::addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) { switch(type) { @@ -36,7 +36,7 @@ void DLCTextureFile::addParameter(DLCManager::EDLCParameterType type, const wstr } } -wstring DLCTextureFile::getParameterAsString(DLCManager::EDLCParameterType type) +std::wstring DLCTextureFile::getParameterAsString(DLCManager::EDLCParameterType type) { switch(type) { diff --git a/Minecraft.Client/Build/Common/DLC/DLCTextureFile.h b/Minecraft.Client/Build/Common/DLC/DLCTextureFile.h index bc7916867..831740601 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCTextureFile.h +++ b/Minecraft.Client/Build/Common/DLC/DLCTextureFile.h @@ -6,19 +6,19 @@ class DLCTextureFile : public DLCFile private: bool m_bIsAnim; - wstring m_animString; + std::wstring m_animString; PBYTE m_pbData; DWORD m_dwBytes; public: - DLCTextureFile(const wstring &path); + DLCTextureFile(const std::wstring &path); virtual void addData(PBYTE pbData, DWORD dwBytes); virtual PBYTE getData(DWORD &dwBytes); - virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value); + virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); - virtual wstring getParameterAsString(DLCManager::EDLCParameterType type); + virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/DLC/DLCUIDataFile.cpp b/Minecraft.Client/Build/Common/DLC/DLCUIDataFile.cpp index 438338aae..6bb5da7d1 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCUIDataFile.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCUIDataFile.cpp @@ -2,7 +2,7 @@ #include "DLCManager.h" #include "DLCUIDataFile.h" -DLCUIDataFile::DLCUIDataFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path) +DLCUIDataFile::DLCUIDataFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path) { m_pbData = NULL; m_dwBytes = 0; diff --git a/Minecraft.Client/Build/Common/DLC/DLCUIDataFile.h b/Minecraft.Client/Build/Common/DLC/DLCUIDataFile.h index 105ad0dfd..a9ffa6c1f 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCUIDataFile.h +++ b/Minecraft.Client/Build/Common/DLC/DLCUIDataFile.h @@ -9,7 +9,7 @@ private: bool m_canDeleteData; public: - DLCUIDataFile(const wstring &path); + DLCUIDataFile(const std::wstring &path); ~DLCUIDataFile(); using DLCFile::addData; diff --git a/Minecraft.Client/Build/Common/GameRules/AddEnchantmentRuleDefinition.cpp b/Minecraft.Client/Build/Common/GameRules/AddEnchantmentRuleDefinition.cpp index 6bb11ff4c..d4b581598 100644 --- a/Minecraft.Client/Build/Common/GameRules/AddEnchantmentRuleDefinition.cpp +++ b/Minecraft.Client/Build/Common/GameRules/AddEnchantmentRuleDefinition.cpp @@ -20,7 +20,7 @@ void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n dos->writeUTF( _toString( m_enchantmentLevel ) ); } -void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void AddEnchantmentRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"enchantmentId") == 0) { @@ -43,7 +43,7 @@ void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, co } } -bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr item) +bool AddEnchantmentRuleDefinition::enchantItem(std::shared_ptr item) { bool enchanted = false; if (item != NULL) @@ -60,7 +60,7 @@ bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr item) if(e != NULL && e->category->canEnchant(item->getItem())) { - int level = min(e->getMaxLevel(), m_enchantmentLevel); + int level = std::min(e->getMaxLevel(), m_enchantmentLevel); item->enchant(e, m_enchantmentLevel); enchanted = true; } diff --git a/Minecraft.Client/Build/Common/GameRules/AddEnchantmentRuleDefinition.h b/Minecraft.Client/Build/Common/GameRules/AddEnchantmentRuleDefinition.h index 3beece109..bb6f48ae3 100644 --- a/Minecraft.Client/Build/Common/GameRules/AddEnchantmentRuleDefinition.h +++ b/Minecraft.Client/Build/Common/GameRules/AddEnchantmentRuleDefinition.h @@ -17,7 +17,7 @@ public: virtual void writeAttributes(DataOutputStream *, UINT numAttrs); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); - bool enchantItem(shared_ptr item); + bool enchantItem(std::shared_ptr item); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/AddItemRuleDefinition.cpp b/Minecraft.Client/Build/Common/GameRules/AddItemRuleDefinition.cpp index d3eb1b0d6..cda647351 100644 --- a/Minecraft.Client/Build/Common/GameRules/AddItemRuleDefinition.cpp +++ b/Minecraft.Client/Build/Common/GameRules/AddItemRuleDefinition.cpp @@ -32,7 +32,7 @@ void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs dos->writeUTF( _toString( m_slot ) ); } -void AddItemRuleDefinition::getChildren(vector *children) +void AddItemRuleDefinition::getChildren(std::vector *children) { GameRuleDefinition::getChildren( children ); for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); it++) @@ -56,7 +56,7 @@ GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleT return rule; } -void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void AddItemRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"itemId") == 0) { @@ -94,13 +94,13 @@ void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wst } } -bool AddItemRuleDefinition::addItemToContainer(shared_ptr container, int slotId) +bool AddItemRuleDefinition::addItemToContainer(std::shared_ptr container, int slotId) { bool added = false; if(Item::items[m_itemId] != NULL) { - int quantity = min(m_quantity, Item::items[m_itemId]->getMaxStackSize()); - shared_ptr newItem = shared_ptr(new ItemInstance(m_itemId,quantity,m_auxValue) ); + int quantity = std::min(m_quantity, Item::items[m_itemId]->getMaxStackSize()); + std::shared_ptr newItem = std::shared_ptr(new ItemInstance(m_itemId,quantity,m_auxValue) ); newItem->set4JData(m_dataTag); for(AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it) @@ -118,9 +118,9 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr container, container->setItem( slotId, newItem ); added = true; } - else if(dynamic_pointer_cast(container) != NULL) + else if(std::dynamic_pointer_cast(container) != NULL) { - added = dynamic_pointer_cast(container)->add(newItem); + added = std::dynamic_pointer_cast(container)->add(newItem); } } return added; diff --git a/Minecraft.Client/Build/Common/GameRules/AddItemRuleDefinition.h b/Minecraft.Client/Build/Common/GameRules/AddItemRuleDefinition.h index 602f2d824..01ac84eef 100644 --- a/Minecraft.Client/Build/Common/GameRules/AddItemRuleDefinition.h +++ b/Minecraft.Client/Build/Common/GameRules/AddItemRuleDefinition.h @@ -13,18 +13,18 @@ private: int m_auxValue; int m_dataTag; int m_slot; - vector m_enchantments; + std::vector m_enchantments; public: AddItemRuleDefinition(); virtual void writeAttributes(DataOutputStream *, UINT numAttributes); - virtual void getChildren(vector *children); + virtual void getChildren(std::vector *children); virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddItem; } virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); - bool addItemToContainer(shared_ptr container, int slotId); + bool addItemToContainer(std::shared_ptr container, int slotId); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/ApplySchematicRuleDefinition.cpp b/Minecraft.Client/Build/Common/GameRules/ApplySchematicRuleDefinition.cpp index 03fc1b5c8..1e88b0d51 100644 --- a/Minecraft.Client/Build/Common/GameRules/ApplySchematicRuleDefinition.cpp +++ b/Minecraft.Client/Build/Common/GameRules/ApplySchematicRuleDefinition.cpp @@ -53,7 +53,7 @@ void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n } } -void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void ApplySchematicRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"filename") == 0) { @@ -167,7 +167,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk * if(m_locationBox == NULL) updateLocationBox(); if(chunkBox->intersects( m_locationBox )) { - m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 ); + m_locationBox->y1 = std::min((double)Level::maxBuildHeight, m_locationBox->y1 ); #ifdef _DEBUG app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",m_schematicName.c_str(),chunk->x, chunk->z); @@ -206,7 +206,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve if(m_locationBox == NULL) updateLocationBox(); if(chunkBox->intersects( m_locationBox )) { - m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 ); + m_locationBox->y1 = std::min((double)Level::maxBuildHeight, m_locationBox->y1 ); #ifdef _DEBUG app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",m_schematicName.c_str(),chunk->x, chunk->z); diff --git a/Minecraft.Client/Build/Common/GameRules/ApplySchematicRuleDefinition.h b/Minecraft.Client/Build/Common/GameRules/ApplySchematicRuleDefinition.h index 21c42dead..7cf307ae1 100644 --- a/Minecraft.Client/Build/Common/GameRules/ApplySchematicRuleDefinition.h +++ b/Minecraft.Client/Build/Common/GameRules/ApplySchematicRuleDefinition.h @@ -12,7 +12,7 @@ class ApplySchematicRuleDefinition : public GameRuleDefinition { private: LevelGenerationOptions *m_levelGenOptions; - wstring m_schematicName; + std::wstring m_schematicName; ConsoleSchematicFile *m_schematic; Vec3 *m_location; AABB *m_locationBox; @@ -31,7 +31,7 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; } virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); void processSchematic(AABB *chunkBox, LevelChunk *chunk); void processSchematicLighting(AABB *chunkBox, LevelChunk *chunk); @@ -41,7 +41,7 @@ public: bool isComplete() { return m_completed; } - wstring getSchematicName() { return m_schematicName; } + std::wstring getSchematicName() { return m_schematicName; } /** 4J-JEV: * This GameRuleDefinition contains limited game state. diff --git a/Minecraft.Client/Build/Common/GameRules/BiomeOverride.cpp b/Minecraft.Client/Build/Common/GameRules/BiomeOverride.cpp index ef624bcb8..fb6256d70 100644 --- a/Minecraft.Client/Build/Common/GameRules/BiomeOverride.cpp +++ b/Minecraft.Client/Build/Common/GameRules/BiomeOverride.cpp @@ -21,7 +21,7 @@ void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs) dos->writeUTF(_toString(m_topTile)); } -void BiomeOverride::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void BiomeOverride::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"tileId") == 0) { diff --git a/Minecraft.Client/Build/Common/GameRules/BiomeOverride.h b/Minecraft.Client/Build/Common/GameRules/BiomeOverride.h index 5ad9263cf..6ce91bbd1 100644 --- a/Minecraft.Client/Build/Common/GameRules/BiomeOverride.h +++ b/Minecraft.Client/Build/Common/GameRules/BiomeOverride.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "GameRuleDefinition.h" @@ -16,7 +16,7 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_BiomeOverride; } virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool isBiome(int id); void getTileValues(BYTE &tile, BYTE &topTile); diff --git a/Minecraft.Client/Build/Common/GameRules/CollectItemRuleDefinition.cpp b/Minecraft.Client/Build/Common/GameRules/CollectItemRuleDefinition.cpp index 4e118e68e..d4a7f2839 100644 --- a/Minecraft.Client/Build/Common/GameRules/CollectItemRuleDefinition.cpp +++ b/Minecraft.Client/Build/Common/GameRules/CollectItemRuleDefinition.cpp @@ -31,7 +31,7 @@ void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numA dos->writeUTF( _toString( m_quantity ) ); } -void CollectItemRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void CollectItemRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"itemId") == 0) { @@ -74,7 +74,7 @@ void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesIn GameRuleDefinition::populateGameRule(type, rule); } -bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr item) +bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr item) { bool statusChanged = false; if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue) @@ -94,7 +94,7 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptrgetConnection() != NULL) { - rule->getConnection()->send( shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0))); + rule->getConnection()->send( std::shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0))); } } } @@ -102,10 +102,10 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr item) +std::wstring CollectItemRuleDefinition::generateXml(std::shared_ptr item) { // 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd - wstring xml = L""; + std::wstring xml = L""; if(item != NULL) { xml = L"(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\""; diff --git a/Minecraft.Client/Build/Common/GameRules/CollectItemRuleDefinition.h b/Minecraft.Client/Build/Common/GameRules/CollectItemRuleDefinition.h index 5ee6f4c57..3a6b981c9 100644 --- a/Minecraft.Client/Build/Common/GameRules/CollectItemRuleDefinition.h +++ b/Minecraft.Client/Build/Common/GameRules/CollectItemRuleDefinition.h @@ -21,7 +21,7 @@ public: ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_CollectItemRule; } virtual void writeAttributes(DataOutputStream *, UINT numAttributes); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); virtual int getGoal(); virtual int getProgress(GameRule *rule); @@ -31,10 +31,10 @@ public: void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule); - bool onCollectItem(GameRule *rule, shared_ptr item); + bool onCollectItem(GameRule *rule, std::shared_ptr item); - static wstring generateXml(shared_ptr item); + static std::wstring generateXml(std::shared_ptr item); private: - //static wstring generateXml(CollectItemRuleDefinition *ruleDef); + //static std::wstring generateXml(CollectItemRuleDefinition *ruleDef); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/CompleteAllRuleDefinition.cpp b/Minecraft.Client/Build/Common/GameRules/CompleteAllRuleDefinition.cpp index 477264b36..69467b6e8 100644 --- a/Minecraft.Client/Build/Common/GameRules/CompleteAllRuleDefinition.cpp +++ b/Minecraft.Client/Build/Common/GameRules/CompleteAllRuleDefinition.cpp @@ -5,7 +5,7 @@ #include "../../../../Minecraft.World/Network/Connection.h" #include "../../../../Minecraft.World/Headers/net.minecraft.network.packet.h" -void CompleteAllRuleDefinition::getChildren(vector *children) +void CompleteAllRuleDefinition::getChildren(std::vector *children) { CompoundGameRuleDefinition::getChildren(children); } @@ -17,7 +17,7 @@ bool CompleteAllRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int return statusChanged; } -bool CompleteAllRuleDefinition::onCollectItem(GameRule *rule, shared_ptr item) +bool CompleteAllRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr item) { bool statusChanged = CompoundGameRuleDefinition::onCollectItem(rule,item); if(statusChanged) updateStatus(rule); @@ -51,15 +51,15 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule) auxValue = m_lastRuleStatusChanged->getAuxValue(); m_lastRuleStatusChanged = NULL; } - rule->getConnection()->send( shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData)))); + rule->getConnection()->send( std::shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData)))); } app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal); } -wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &description, void *data, int dataLength) +std::wstring CompleteAllRuleDefinition::generateDescriptionString(const std::wstring &description, void *data, int dataLength) { PacketData *values = (PacketData *)data; - wstring newDesc = description; + std::wstring newDesc = description; newDesc = replaceAll(newDesc,L"{*progress*}",_toString(values->progress)); newDesc = replaceAll(newDesc,L"{*goal*}",_toString(values->goal)); return newDesc; diff --git a/Minecraft.Client/Build/Common/GameRules/CompleteAllRuleDefinition.h b/Minecraft.Client/Build/Common/GameRules/CompleteAllRuleDefinition.h index b2cb8847f..dbf9365b8 100644 --- a/Minecraft.Client/Build/Common/GameRules/CompleteAllRuleDefinition.h +++ b/Minecraft.Client/Build/Common/GameRules/CompleteAllRuleDefinition.h @@ -14,12 +14,12 @@ private: public: ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_CompleteAllRule; } - virtual void getChildren(vector *children); + virtual void getChildren(std::vector *children); virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z); - virtual bool onCollectItem(GameRule *rule, shared_ptr item); + virtual bool onCollectItem(GameRule *rule, std::shared_ptr item); - static wstring generateDescriptionString(const wstring &description, void *data, int dataLength); + static std::wstring generateDescriptionString(const std::wstring &description, void *data, int dataLength); private: void updateStatus(GameRule *rule); diff --git a/Minecraft.Client/Build/Common/GameRules/CompoundGameRuleDefinition.cpp b/Minecraft.Client/Build/Common/GameRules/CompoundGameRuleDefinition.cpp index 87eaf27f1..b7e7c67ad 100644 --- a/Minecraft.Client/Build/Common/GameRules/CompoundGameRuleDefinition.cpp +++ b/Minecraft.Client/Build/Common/GameRules/CompoundGameRuleDefinition.cpp @@ -17,7 +17,7 @@ CompoundGameRuleDefinition::~CompoundGameRuleDefinition() } } -void CompoundGameRuleDefinition::getChildren(vector *children) +void CompoundGameRuleDefinition::getChildren(std::vector *children) { GameRuleDefinition::getChildren(children); for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); it++) @@ -91,7 +91,7 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, in return statusChanged; } -bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr item) +bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr item) { bool statusChanged = false; for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it) @@ -109,7 +109,7 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr player) +void CompoundGameRuleDefinition::postProcessPlayer(std::shared_ptr player) { for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) { diff --git a/Minecraft.Client/Build/Common/GameRules/CompoundGameRuleDefinition.h b/Minecraft.Client/Build/Common/GameRules/CompoundGameRuleDefinition.h index bfedfd092..ad13f67b9 100644 --- a/Minecraft.Client/Build/Common/GameRules/CompoundGameRuleDefinition.h +++ b/Minecraft.Client/Build/Common/GameRules/CompoundGameRuleDefinition.h @@ -5,19 +5,19 @@ class CompoundGameRuleDefinition : public GameRuleDefinition { protected: - vector m_children; + std::vector m_children; protected: GameRuleDefinition *m_lastRuleStatusChanged; public: CompoundGameRuleDefinition(); virtual ~CompoundGameRuleDefinition(); - virtual void getChildren(vector *children); + virtual void getChildren(std::vector *children); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule); virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z); - virtual bool onCollectItem(GameRule *rule, shared_ptr item); - virtual void postProcessPlayer(shared_ptr player); + virtual bool onCollectItem(GameRule *rule, std::shared_ptr item); + virtual void postProcessPlayer(std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/ConsoleGenerateStructure.cpp b/Minecraft.Client/Build/Common/GameRules/ConsoleGenerateStructure.cpp index 6fdeb397d..a1ebd5873 100644 --- a/Minecraft.Client/Build/Common/GameRules/ConsoleGenerateStructure.cpp +++ b/Minecraft.Client/Build/Common/GameRules/ConsoleGenerateStructure.cpp @@ -15,7 +15,7 @@ ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) m_dimension = 0; } -void ConsoleGenerateStructure::getChildren(vector *children) +void ConsoleGenerateStructure::getChildren(std::vector *children) { GameRuleDefinition::getChildren(children); @@ -72,7 +72,7 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, UINT numAt dos->writeUTF(_toString(m_dimension)); } -void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void ConsoleGenerateStructure::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"x") == 0) { @@ -120,9 +120,9 @@ BoundingBox* ConsoleGenerateStructure::getBoundingBox() for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it) { ConsoleGenerateStructureAction *action = *it; - maxX = max(maxX,action->getEndX()); - maxY = max(maxY,action->getEndY()); - maxZ = max(maxZ,action->getEndZ()); + maxX = std::max(maxX,action->getEndX()); + maxY = std::max(maxY,action->getEndY()); + maxZ = std::max(maxZ,action->getEndZ()); } boundingBox = new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ); diff --git a/Minecraft.Client/Build/Common/GameRules/ConsoleGenerateStructure.h b/Minecraft.Client/Build/Common/GameRules/ConsoleGenerateStructure.h index f88fcb42b..717be3324 100644 --- a/Minecraft.Client/Build/Common/GameRules/ConsoleGenerateStructure.h +++ b/Minecraft.Client/Build/Common/GameRules/ConsoleGenerateStructure.h @@ -13,18 +13,18 @@ class ConsoleGenerateStructure : public GameRuleDefinition, public StructurePiec { private: int m_x, m_y, m_z; - vector m_actions; + std::vector m_actions; int m_dimension; public: ConsoleGenerateStructure(); virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_GenerateStructure; } - virtual void getChildren(vector *children); + virtual void getChildren(std::vector *children); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); // StructurePiece virtual BoundingBox *getBoundingBox(); diff --git a/Minecraft.Client/Build/Common/GameRules/ConsoleSchematicFile.cpp b/Minecraft.Client/Build/Common/GameRules/ConsoleSchematicFile.cpp index e9604f97b..179555771 100644 --- a/Minecraft.Client/Build/Common/GameRules/ConsoleSchematicFile.cpp +++ b/Minecraft.Client/Build/Common/GameRules/ConsoleSchematicFile.cpp @@ -116,7 +116,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis) for (int i = 0; i < tileEntityTags->size(); i++) { CompoundTag *teTag = tileEntityTags->get(i); - shared_ptr te = TileEntity::loadStatic(teTag); + std::shared_ptr te = TileEntity::loadStatic(teTag); if(te == NULL) { @@ -153,7 +153,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis) #ifdef _DEBUG //app.DebugPrintf(1,"Loaded entity type %d at (%f,%f,%f)\n",(int)type,x,y,z); #endif - m_entities.push_back( pair(Vec3::newPermanent(x,y,z),(CompoundTag *)eTag->copy())); + m_entities.push_back( std::pair(Vec3::newPermanent(x,y,z),(CompoundTag *)eTag->copy())); } } delete tag; @@ -186,15 +186,15 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos) __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot) { - int xStart = max(destinationBox->x0, (double)chunk->x*16); - int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16); + int xStart = std::max(destinationBox->x0, (double)chunk->x*16); + int xEnd = std::min(destinationBox->x1, (double)((xStart>>4)<<4) + 16); int yStart = destinationBox->y0; int yEnd = destinationBox->y1; if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight; - int zStart = max(destinationBox->z0, (double)chunk->z*16); - int zEnd = min(destinationBox->z1, (double)((zStart>>4)<<4) + 16); + int zStart = std::max(destinationBox->z0, (double)chunk->z*16); + int zEnd = std::min(destinationBox->z1, (double)((zStart>>4)<<4) + 16); #ifdef _DEBUG app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1); @@ -325,15 +325,15 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB // we can do the sort of lighting that might propagate out of the chunk. __int64 ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot) { - int xStart = max(destinationBox->x0, (double)chunk->x*16); - int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16); + int xStart = std::max(destinationBox->x0, (double)chunk->x*16); + int xEnd = std::min(destinationBox->x1, (double)((xStart>>4)<<4) + 16); int yStart = destinationBox->y0; int yEnd = destinationBox->y1; if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight; - int zStart = max(destinationBox->z0, (double)chunk->z*16); - int zEnd = min(destinationBox->z1, (double)((zStart>>4)<<4) + 16); + int zStart = std::max(destinationBox->z0, (double)chunk->z*16); + int zEnd = std::min(destinationBox->z1, (double)((zStart>>4)<<4) + 16); int rowBlocksIncluded = (yEnd-yStart)*(zEnd-zStart); int blocksIncluded = (xEnd-xStart)*rowBlocksIncluded; @@ -433,7 +433,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, { for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it) { - shared_ptr te = *it; + std::shared_ptr te = *it; double targetX = te->x; double targetY = te->y + destinationBox->y0; @@ -444,7 +444,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ); if( chunkBox->containsIncludingLowerBound(pos) ) { - shared_ptr teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 ); + std::shared_ptr teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 ); if ( teCopy != NULL ) { @@ -495,11 +495,11 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, } CompoundTag *eTag = it->second; - shared_ptr e = EntityIO::loadStatic(eTag, NULL); + std::shared_ptr e = EntityIO::loadStatic(eTag, NULL); if( e->GetType() == eTYPE_PAINTING ) { - shared_ptr painting = dynamic_pointer_cast(e); + std::shared_ptr painting = std::dynamic_pointer_cast(e); double tileX = painting->xTile; double tileZ = painting->zTile; @@ -512,7 +512,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, } else if( e->GetType() == eTYPE_ITEM_FRAME ) { - shared_ptr frame = dynamic_pointer_cast(e); + std::shared_ptr frame = std::dynamic_pointer_cast(e); double tileX = frame->xTile; double tileZ = frame->zTile; @@ -678,12 +678,12 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l { for (int zc = zc0; zc <= zc1; zc++) { - vector > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize); + std::vector > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize); for(AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it) { - shared_ptr te = *it; + std::shared_ptr te = *it; CompoundTag *teTag = new CompoundTag(); - shared_ptr teCopy = te->clone(); + std::shared_ptr teCopy = te->clone(); // Adjust the tileEntity position to schematic coords from world co-ords teCopy->x -= xStart; @@ -698,12 +698,12 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l tag.put(L"TileEntities", tileEntitiesTag); AABB *bb = AABB::newTemp(xStart,yStart,zStart,xEnd,yEnd,zEnd); - vector > *entities = level->getEntities(nullptr, bb); + std::vector > *entities = level->getEntities(nullptr, bb); ListTag *entitiesTag = new ListTag(L"entities"); for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { - shared_ptr e = *it; + std::shared_ptr e = *it; bool mobCanBeSaved = false; if(bSaveMobs) @@ -778,12 +778,12 @@ void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data, if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { lowerY0 = y0; - lowerY1 = min(y1, compressedHeight); + lowerY1 = std::min(y1, compressedHeight); bHasLower = true; } if(y1 >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { - upperY0 = max(y0, compressedHeight) - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; + upperY0 = std::max(y0, compressedHeight) - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; upperY1 = y1 - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; bHasUpper = true; } @@ -900,12 +900,12 @@ void ConsoleSchematicFile::setBlocksAndData(LevelChunk *chunk, byteArray blockDa if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { lowerY0 = y0; - lowerY1 = min(y1, compressedHeight); + lowerY1 = std::min(y1, compressedHeight); bHasLower = true; } if(y1 >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { - upperY0 = max(y0, compressedHeight) - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; + upperY0 = std::max(y0, compressedHeight) - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; upperY1 = y1 - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; bHasUpper = true; } @@ -1005,12 +1005,12 @@ void ConsoleSchematicFile::setBlocksAndData(LevelChunk *chunk, byteArray blockDa } } -vector > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1) +std::vector > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1) { - vector > *result = new vector >; + std::vector > *result = new std::vector >; for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1) { result->push_back(te); diff --git a/Minecraft.Client/Build/Common/GameRules/ConsoleSchematicFile.h b/Minecraft.Client/Build/Common/GameRules/ConsoleSchematicFile.h index c91a41cd3..759233f83 100644 --- a/Minecraft.Client/Build/Common/GameRules/ConsoleSchematicFile.h +++ b/Minecraft.Client/Build/Common/GameRules/ConsoleSchematicFile.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #define XBOX_SCHEMATIC_ORIGINAL_VERSION 1 #define XBOX_SCHEMATIC_CURRENT_VERSION 2 @@ -55,8 +55,8 @@ public: } XboxSchematicInitParam; private: int m_xSize, m_ySize, m_zSize; - vector > m_tileEntities; - vector< pair > m_entities; + std::vector > m_tileEntities; + std::vector< std::pair > m_entities; public: byteArray m_data; @@ -83,7 +83,7 @@ private: void load_tags(DataInputStream *dis); static void getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP); - static vector > *getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1); + static std::vector > *getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1); void chunkCoordToSchematicCoord(AABB *destinationBox, int chunkX, int chunkZ, ESchematicRotation rot, int &schematicX, int &schematicZ); void schematicCoordToChunkCoord(AABB *destinationBox, double schematicX, double schematicZ, ESchematicRotation rot, double &chunkX, double &chunkZ); diff --git a/Minecraft.Client/Build/Common/GameRules/GameRule.cpp b/Minecraft.Client/Build/Common/GameRules/GameRule.cpp index 8e42aa5eb..d3c9a30a1 100644 --- a/Minecraft.Client/Build/Common/GameRules/GameRule.cpp +++ b/Minecraft.Client/Build/Common/GameRules/GameRule.cpp @@ -18,7 +18,7 @@ GameRule::~GameRule() } } -GameRule::ValueType GameRule::getParameter(const wstring ¶meterName) +GameRule::ValueType GameRule::getParameter(const std::wstring ¶meterName) { if(m_parameters.find(parameterName) == m_parameters.end()) { @@ -30,7 +30,7 @@ GameRule::ValueType GameRule::getParameter(const wstring ¶meterName) return m_parameters[parameterName]; } -void GameRule::setParameter(const wstring ¶meterName,ValueType value) +void GameRule::setParameter(const std::wstring ¶meterName,ValueType value) { if(m_parameters.find(parameterName) == m_parameters.end()) { @@ -53,7 +53,7 @@ GameRuleDefinition *GameRule::getGameRuleDefinition() } void GameRule::onUseTile(int tileId, int x, int y, int z) { m_definition->onUseTile(this,tileId,x,y,z); } -void GameRule::onCollectItem(shared_ptr item) { m_definition->onCollectItem(this,item); } +void GameRule::onCollectItem(std::shared_ptr item) { m_definition->onCollectItem(this,item); } void GameRule::write(DataOutputStream *dos) { @@ -61,7 +61,7 @@ void GameRule::write(DataOutputStream *dos) dos->writeInt(m_parameters.size()); for (AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); it++) { - wstring pName = (*it).first; + std::wstring pName = (*it).first; ValueType vType = (*it).second; dos->writeUTF( (*it).first ); @@ -79,7 +79,7 @@ void GameRule::read(DataInputStream *dis) int savedParams = dis->readInt(); for (int i = 0; i < savedParams; i++) { - wstring pNames = dis->readUTF(); + std::wstring pNames = dis->readUTF(); ValueType vType = getParameter(pNames); diff --git a/Minecraft.Client/Build/Common/GameRules/GameRule.h b/Minecraft.Client/Build/Common/GameRules/GameRule.h index bdc2ceff5..33eb1348d 100644 --- a/Minecraft.Client/Build/Common/GameRules/GameRule.h +++ b/Minecraft.Client/Build/Common/GameRules/GameRule.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include @@ -36,7 +36,7 @@ private: Connection *m_connection; public: - typedef unordered_map stringValueMapType; + typedef std::unordered_map stringValueMapType; stringValueMapType m_parameters; // These are the members of this rule that maintain it's state public: @@ -45,17 +45,17 @@ public: Connection *getConnection() { return m_connection; } - ValueType getParameter(const wstring ¶meterName); - void setParameter(const wstring ¶meterName,ValueType value); + ValueType getParameter(const std::wstring ¶meterName); + void setParameter(const std::wstring ¶meterName,ValueType value); GameRuleDefinition *getGameRuleDefinition(); // All the hooks go here void onUseTile(int tileId, int x, int y, int z); - void onCollectItem(shared_ptr item); + void onCollectItem(std::shared_ptr item); // 4J-JEV: For saving. - //CompoundTag *toTags(unordered_map *map); - //static GameRule *fromTags(Connection *c, CompoundTag *cTag, vector *grds); + //CompoundTag *toTags(std::unordered_map *map); + //static GameRule *fromTags(Connection *c, CompoundTag *cTag, std::vector *grds); void write(DataOutputStream *dos); void read(DataInputStream *dos); diff --git a/Minecraft.Client/Build/Common/GameRules/GameRuleDefinition.cpp b/Minecraft.Client/Build/Common/GameRules/GameRuleDefinition.cpp index bc20a7263..9288fdacf 100644 --- a/Minecraft.Client/Build/Common/GameRules/GameRuleDefinition.cpp +++ b/Minecraft.Client/Build/Common/GameRules/GameRuleDefinition.cpp @@ -20,7 +20,7 @@ void GameRuleDefinition::write(DataOutputStream *dos) writeAttributes(dos, 0); // 4J-JEV: Get children. - vector *children = new vector(); + std::vector *children = new std::vector(); getChildren( children ); // Write children. @@ -43,7 +43,7 @@ void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttribut dos->writeUTF(_toString(m_4JDataValue)); } -void GameRuleDefinition::getChildren(vector *children) {} +void GameRuleDefinition::getChildren(std::vector *children) {} GameRuleDefinition *GameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) { @@ -53,7 +53,7 @@ GameRuleDefinition *GameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType return NULL; } -void GameRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void GameRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"descriptionName") == 0) { @@ -104,25 +104,25 @@ void GameRuleDefinition::setComplete(GameRule *rule, bool val) rule->setParameter(L"bComplete",value); } -vector *GameRuleDefinition::enumerate() +std::vector *GameRuleDefinition::enumerate() { // Get Vector. - vector *gRules; - gRules = new vector(); + std::vector *gRules; + gRules = new std::vector(); gRules->push_back(this); getChildren(gRules); return gRules; } -unordered_map *GameRuleDefinition::enumerateMap() +std::unordered_map *GameRuleDefinition::enumerateMap() { - unordered_map *out - = new unordered_map(); + std::unordered_map *out + = new std::unordered_map(); int i = 0; - vector *gRules = enumerate(); + std::vector *gRules = enumerate(); for (AUTO_VAR(it, gRules->begin()); it != gRules->end(); it++) - out->insert( pair( *it, i++ ) ); + out->insert( std::pair( *it, i++ ) ); return out; } @@ -136,9 +136,9 @@ GameRulesInstance *GameRuleDefinition::generateNewGameRulesInstance(GameRulesIns return manager; } -wstring GameRuleDefinition::generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data, int dataLength) +std::wstring GameRuleDefinition::generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const std::wstring &description, void *data, int dataLength) { - wstring formatted = description; + std::wstring formatted = description; switch(defType) { case ConsoleGameRules::eGameRuleType_CompleteAllRule: diff --git a/Minecraft.Client/Build/Common/GameRules/GameRuleDefinition.h b/Minecraft.Client/Build/Common/GameRules/GameRuleDefinition.h index fb93248d8..05d567db0 100644 --- a/Minecraft.Client/Build/Common/GameRules/GameRuleDefinition.h +++ b/Minecraft.Client/Build/Common/GameRules/GameRuleDefinition.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include #include @@ -21,8 +21,8 @@ private: protected: // These attributes should map to those in the XSD GameRuleType - wstring m_descriptionId; - wstring m_promptId; + std::wstring m_descriptionId; + std::wstring m_promptId; int m_4JDataValue; public: @@ -35,10 +35,10 @@ public: virtual void write(DataOutputStream *); virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); - virtual void getChildren(vector *); + virtual void getChildren(std::vector *); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule); @@ -53,14 +53,14 @@ public: // Here we should have functions for all the hooks, with a GameRule* as the first parameter virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z) { return false; } - virtual bool onCollectItem(GameRule *rule, shared_ptr item) { return false; } - virtual void postProcessPlayer(shared_ptr player) { } + virtual bool onCollectItem(GameRule *rule, std::shared_ptr item) { return false; } + virtual void postProcessPlayer(std::shared_ptr player) { } - vector *enumerate(); - unordered_map *enumerateMap(); + std::vector *enumerate(); + std::unordered_map *enumerateMap(); // Static functions static GameRulesInstance *generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection); - static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = NULL, int dataLength = 0); + static std::wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const std::wstring &description, void *data = NULL, int dataLength = 0); }; diff --git a/Minecraft.Client/Build/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Build/Common/GameRules/GameRuleManager.cpp index 86f2f0851..30493a22f 100644 --- a/Minecraft.Client/Build/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Build/Common/GameRules/GameRuleManager.cpp @@ -347,12 +347,12 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos) for (int i = 0; i < ConsoleGameRules::eGameRuleAttr_Count; i++) dos->writeUTF( wchAttrNameA[i] ); // Write schematic files. - unordered_map *files; + std::unordered_map *files; files = getLevelGenerationOptions()->getUnfinishedSchematicFiles(); dos->writeInt( files->size() ); for (AUTO_VAR(it, files->begin()); it != files->end(); it++) { - wstring filename = it->first; + std::wstring filename = it->first; ConsoleSchematicFile *file = it->second; ByteArrayOutputStream fileBaos; @@ -470,18 +470,18 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI // string lookup. UINT numStrings = contentDis->readInt(); - vector tagsAndAtts; + std::vector tagsAndAtts; for (UINT i = 0; i < numStrings; i++) tagsAndAtts.push_back( contentDis->readUTF() ); - unordered_map tagIdMap; + std::unordered_map tagIdMap; for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (int)ConsoleGameRules::eGameRuleType_Count; ++type) { for(UINT i = 0; i < numStrings; ++i) { if(tagsAndAtts[i].compare(wchTagNameA[type]) == 0) { - tagIdMap.insert( unordered_map::value_type(i, (ConsoleGameRules::EGameRuleType)type) ); + tagIdMap.insert( std::unordered_map::value_type(i, (ConsoleGameRules::EGameRuleType)type) ); break; } } @@ -489,14 +489,14 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI // 4J-JEV: TODO: As yet unused. /* - unordered_map attrIdMap; + std::unordered_map attrIdMap; for(int attr = (int)ConsoleGameRules::eGameRuleAttr_descriptionName; attr < (int)ConsoleGameRules::eGameRuleAttr_Count; ++attr) { for (UINT i = 0; i < numStrings; i++) { if (tagsAndAtts[i].compare(wchAttrNameA[attr]) == 0) { - tagIdMap.insert( unordered_map::value_type(i , (ConsoleGameRules::EGameRuleAttr)attr) ); + tagIdMap.insert( std::unordered_map::value_type(i , (ConsoleGameRules::EGameRuleAttr)attr) ); break; } } @@ -506,7 +506,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI UINT numFiles = contentDis->readInt(); for (UINT i = 0; i < numFiles; i++) { - wstring sFilename = contentDis->readUTF(); + std::wstring sFilename = contentDis->readUTF(); int length = contentDis->readInt(); byteArray ba( length ); @@ -581,19 +581,19 @@ LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh) return out; } -void GameRuleManager::readAttributes(DataInputStream *dis, vector *tagsAndAtts, GameRuleDefinition *rule) +void GameRuleManager::readAttributes(DataInputStream *dis, std::vector *tagsAndAtts, GameRuleDefinition *rule) { int numAttrs = dis->readInt(); for (UINT att = 0; att < numAttrs; ++att) { int attID = dis->readInt(); - wstring value = dis->readUTF(); + std::wstring value = dis->readUTF(); if(rule != NULL) rule->addAttribute(tagsAndAtts->at(attID),value); } } -void GameRuleManager::readChildren(DataInputStream *dis, vector *tagsAndAtts, unordered_map *tagIdMap, GameRuleDefinition *rule) +void GameRuleManager::readChildren(DataInputStream *dis, std::vector *tagsAndAtts, std::unordered_map *tagIdMap, GameRuleDefinition *rule) { int numChildren = dis->readInt(); for(UINT child = 0; child < numChildren; ++child) @@ -633,9 +633,9 @@ void GameRuleManager::loadDefaultGameRules() { #ifdef _XBOX #ifdef _TU_BUILD - wstring fileRoot = L"UPDATE:\\res\\GameRules\\Tutorial.pck"; + std::wstring fileRoot = L"UPDATE:\\res\\GameRules\\Tutorial.pck"; #else - wstring fileRoot = L"GAME:\\res\\TitleUpdate\\GameRules\\Tutorial.pck"; + std::wstring fileRoot = L"GAME:\\res\\TitleUpdate\\GameRules\\Tutorial.pck"; #endif File packedTutorialFile(fileRoot); if(loadGameRulesPack(&packedTutorialFile)) @@ -648,7 +648,7 @@ void GameRuleManager::loadDefaultGameRules() #ifndef _CONTENT_PACKAGE // 4J Stu - Remove these just now //File testRulesPath(L"GAME:\\GameRules"); - //vector *packFiles = testRulesPath.listFiles(); + //std::vector *packFiles = testRulesPath.listFiles(); //for(AUTO_VAR(it,packFiles->begin()); it != packFiles->end(); ++it) //{ @@ -659,7 +659,7 @@ void GameRuleManager::loadDefaultGameRules() #else // _XBOX - wstring fpTutorial = L"Tutorial.pck"; + std::wstring fpTutorial = L"Tutorial.pck"; if(app.getArchiveFileSize(fpTutorial) >= 0) { DLCPack *pack = new DLCPack(L"",0xffffffff); @@ -749,7 +749,7 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen m_currentLevelGenerationOptions->reset_start(); } -LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key) +LPCWSTR GameRuleManager::GetGameRulesString(const std::wstring &key) { if(m_currentGameRuleDefinitions != NULL && !key.empty() ) { @@ -763,7 +763,7 @@ LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key) LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *lgo) { - vector *lgs = m_levelGenerators.getLevelGenerators(); + std::vector *lgs = m_levelGenerators.getLevelGenerators(); for (int i = 0; isize(); i++) if (lgs->at(i) == lgo) diff --git a/Minecraft.Client/Build/Common/GameRules/GameRuleManager.h b/Minecraft.Client/Build/Common/GameRules/GameRuleManager.h index 481fc723d..8d55510af 100644 --- a/Minecraft.Client/Build/Common/GameRules/GameRuleManager.h +++ b/Minecraft.Client/Build/Common/GameRules/GameRuleManager.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +////using namespace std; #include "LevelGenerators.h" #include "LevelRules.h" @@ -54,8 +54,8 @@ public: bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings); private: - void readAttributes(DataInputStream *dis, vector *tagsAndAtts, GameRuleDefinition *rule); - void readChildren(DataInputStream *dis, vector *tagsAndAtts, unordered_map *tagIdMap, GameRuleDefinition *rule); + void readAttributes(DataInputStream *dis, std::vector *tagsAndAtts, GameRuleDefinition *rule); + void readChildren(DataInputStream *dis, std::vector *tagsAndAtts, std::unordered_map *tagIdMap, GameRuleDefinition *rule); public: void processSchematics(LevelChunk *levelChunk); @@ -68,11 +68,11 @@ private: LEVEL_GEN_ID addLevelGenerationOptions(LevelGenerationOptions *); public: - vector *getLevelGenerators() { return m_levelGenerators.getLevelGenerators(); } + std::vector *getLevelGenerators() { return m_levelGenerators.getLevelGenerators(); } void setLevelGenerationOptions(LevelGenerationOptions *levelGen); LevelRuleset *getGameRuleDefinitions() { return m_currentGameRuleDefinitions; } LevelGenerationOptions *getLevelGenerationOptions() { return m_currentLevelGenerationOptions; } - LPCWSTR GetGameRulesString(const wstring &key); + LPCWSTR GetGameRulesString(const std::wstring &key); // 4J-JEV: // Properly cleans-up and unloads the current set of gameRules. diff --git a/Minecraft.Client/Build/Common/GameRules/GameRulesInstance.h b/Minecraft.Client/Build/Common/GameRules/GameRulesInstance.h index 064e086d8..c2c79547c 100644 --- a/Minecraft.Client/Build/Common/GameRules/GameRulesInstance.h +++ b/Minecraft.Client/Build/Common/GameRules/GameRulesInstance.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include #include "GameRule.h" diff --git a/Minecraft.Client/Build/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Build/Common/GameRules/LevelGenerationOptions.cpp index e84cd292f..31ceed6b7 100644 --- a/Minecraft.Client/Build/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Build/Common/GameRules/LevelGenerationOptions.cpp @@ -24,20 +24,20 @@ JustGrSource::JustGrSource() bool JustGrSource::requiresTexturePack() {return m_bRequiresTexturePack;} UINT JustGrSource::getRequiredTexturePackId() {return m_requiredTexturePackId;} -wstring JustGrSource::getDefaultSaveName() {return m_defaultSaveName;} +std::wstring JustGrSource::getDefaultSaveName() {return m_defaultSaveName;} LPCWSTR JustGrSource::getWorldName() {return m_worldName.c_str();} LPCWSTR JustGrSource::getDisplayName() {return m_displayName.c_str();} -wstring JustGrSource::getGrfPath() {return m_grfPath;} +std::wstring JustGrSource::getGrfPath() {return m_grfPath;} bool JustGrSource::requiresBaseSave() { return m_bRequiresBaseSave; }; -wstring JustGrSource::getBaseSavePath() { return m_baseSavePath; }; +std::wstring JustGrSource::getBaseSavePath() { return m_baseSavePath; }; void JustGrSource::setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;} void JustGrSource::setRequiredTexturePackId(UINT x) {m_requiredTexturePackId = x;} -void JustGrSource::setDefaultSaveName(const wstring &x) {m_defaultSaveName = x;} -void JustGrSource::setWorldName(const wstring &x) {m_worldName = x;} -void JustGrSource::setDisplayName(const wstring &x) {m_displayName = x;} -void JustGrSource::setGrfPath(const wstring &x) {m_grfPath = x;} -void JustGrSource::setBaseSavePath(const wstring &x) { m_baseSavePath = x; m_bRequiresBaseSave = true; } +void JustGrSource::setDefaultSaveName(const std::wstring &x) {m_defaultSaveName = x;} +void JustGrSource::setWorldName(const std::wstring &x) {m_worldName = x;} +void JustGrSource::setDisplayName(const std::wstring &x) {m_displayName = x;} +void JustGrSource::setGrfPath(const std::wstring &x) {m_grfPath = x;} +void JustGrSource::setBaseSavePath(const std::wstring &x) { m_baseSavePath = x; m_bRequiresBaseSave = true; } bool JustGrSource::ready() { return true; } @@ -107,11 +107,11 @@ void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttr dos->writeUTF(_toString(m_useFlatWorld)); } -void LevelGenerationOptions::getChildren(vector *children) +void LevelGenerationOptions::getChildren(std::vector *children) { GameRuleDefinition::getChildren(children); - vector used_schematics; + std::vector used_schematics; for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); it++) if ( !(*it)->isComplete() ) used_schematics.push_back( *it ); @@ -158,7 +158,7 @@ GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRule return rule; } -void LevelGenerationOptions::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void LevelGenerationOptions::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"seed") == 0) { @@ -193,21 +193,21 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws } else if(attributeName.compare(L"saveName") == 0) { - wstring string(getString(attributeValue)); + std::wstring string(getString(attributeValue)); if(!string.empty()) setDefaultSaveName( string ); else setDefaultSaveName( attributeValue ); app.DebugPrintf("LevelGenerationOptions: Adding parameter saveName=%ls\n", getDefaultSaveName().c_str()); } else if(attributeName.compare(L"worldName") == 0) { - wstring string(getString(attributeValue)); + std::wstring string(getString(attributeValue)); if(!string.empty()) setWorldName( string ); else setWorldName( attributeValue ); app.DebugPrintf("LevelGenerationOptions: Adding parameter worldName=%ls\n", getWorldName()); } else if(attributeName.compare(L"displayName") == 0) { - wstring string(getString(attributeValue)); + std::wstring string(getString(attributeValue)); if(!string.empty()) setDisplayName( string ); else setDisplayName( attributeValue ); app.DebugPrintf("LevelGenerationOptions: Adding parameter displayName=%ls\n", getDisplayName()); @@ -331,7 +331,7 @@ void LevelGenerationOptions::clearSchematics() m_schematics.clear(); } -ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen) +ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const std::wstring &filename, PBYTE pbData, DWORD dwLen) { // If we have already loaded this, just return AUTO_VAR(it, m_schematics.find(filename)); @@ -355,7 +355,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f return schematic; } -ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &filename) +ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const std::wstring &filename) { ConsoleSchematicFile *schematic = NULL; // If we have already loaded this, just return @@ -367,7 +367,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi return schematic; } -void LevelGenerationOptions::releaseSchematicFile(const wstring &filename) +void LevelGenerationOptions::releaseSchematicFile(const std::wstring &filename) { // 4J Stu - We don't want to delete them when done, but probably want to keep a set of active schematics for the current world //AUTO_VAR(it, m_schematics.find(filename)); @@ -388,7 +388,7 @@ void LevelGenerationOptions::loadStringTable(StringTable *table) m_stringTable = table; } -LPCWSTR LevelGenerationOptions::getString(const wstring &key) +LPCWSTR LevelGenerationOptions::getString(const std::wstring &key) { if(m_stringTable == NULL) { @@ -429,19 +429,19 @@ bool LevelGenerationOptions::isFeatureChunk(int chunkX, int chunkZ, StructureFea return isFeature; } -unordered_map *LevelGenerationOptions::getUnfinishedSchematicFiles() +std::unordered_map *LevelGenerationOptions::getUnfinishedSchematicFiles() { // Clean schematic rules. - unordered_set usedFiles = unordered_set(); + std::unordered_set usedFiles = std::unordered_set(); for (AUTO_VAR(it, m_schematicRules.begin()); it!=m_schematicRules.end(); it++) if ( !(*it)->isComplete() ) usedFiles.insert( (*it)->getSchematicName() ); // Clean schematic files. - unordered_map *out - = new unordered_map(); + std::unordered_map *out + = new std::unordered_map(); for (AUTO_VAR(it, usedFiles.begin()); it!=usedFiles.end(); it++) - out->insert( pair(*it, getSchematicFile(*it)) ); + out->insert( std::pair(*it, getSchematicFile(*it)) ); return out; } @@ -478,22 +478,22 @@ bool LevelGenerationOptions::isFromDLC() { return getSrc() == eSrc_fromDLC; } bool LevelGenerationOptions::requiresTexturePack() { return info()->requiresTexturePack(); } UINT LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); } -wstring LevelGenerationOptions::getDefaultSaveName() { return info()->getDefaultSaveName(); } +std::wstring LevelGenerationOptions::getDefaultSaveName() { return info()->getDefaultSaveName(); } LPCWSTR LevelGenerationOptions::getWorldName() { return info()->getWorldName(); } LPCWSTR LevelGenerationOptions::getDisplayName() { return info()->getDisplayName(); } -wstring LevelGenerationOptions::getGrfPath() { return info()->getGrfPath(); } +std::wstring LevelGenerationOptions::getGrfPath() { return info()->getGrfPath(); } bool LevelGenerationOptions::requiresBaseSave() { return info()->requiresBaseSave(); } -wstring LevelGenerationOptions::getBaseSavePath() { return info()->getBaseSavePath(); } +std::wstring LevelGenerationOptions::getBaseSavePath() { return info()->getBaseSavePath(); } void LevelGenerationOptions::setGrSource(GrSource *grs) { m_pSrc = grs; } void LevelGenerationOptions::setRequiresTexturePack(bool x) { info()->setRequiresTexturePack(x); } void LevelGenerationOptions::setRequiredTexturePackId(UINT x) { info()->setRequiredTexturePackId(x); } -void LevelGenerationOptions::setDefaultSaveName(const wstring &x) { info()->setDefaultSaveName(x); } -void LevelGenerationOptions::setWorldName(const wstring &x) { info()->setWorldName(x); } -void LevelGenerationOptions::setDisplayName(const wstring &x) { info()->setDisplayName(x); } -void LevelGenerationOptions::setGrfPath(const wstring &x) { info()->setGrfPath(x); } -void LevelGenerationOptions::setBaseSavePath(const wstring &x) { info()->setBaseSavePath(x); } +void LevelGenerationOptions::setDefaultSaveName(const std::wstring &x) { info()->setDefaultSaveName(x); } +void LevelGenerationOptions::setWorldName(const std::wstring &x) { info()->setWorldName(x); } +void LevelGenerationOptions::setDisplayName(const std::wstring &x) { info()->setDisplayName(x); } +void LevelGenerationOptions::setGrfPath(const std::wstring &x) { info()->setGrfPath(x); } +void LevelGenerationOptions::setBaseSavePath(const std::wstring &x) { info()->setBaseSavePath(x); } bool LevelGenerationOptions::ready() { return info()->ready(); } diff --git a/Minecraft.Client/Build/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Build/Common/GameRules/LevelGenerationOptions.h index b75c2119f..c64409845 100644 --- a/Minecraft.Client/Build/Common/GameRules/LevelGenerationOptions.h +++ b/Minecraft.Client/Build/Common/GameRules/LevelGenerationOptions.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; // #pragma message("LevelGenerationOptions.h ") @@ -24,20 +24,20 @@ public: virtual bool requiresTexturePack()=0; virtual UINT getRequiredTexturePackId()=0; - virtual wstring getDefaultSaveName()=0; + virtual std::wstring getDefaultSaveName()=0; virtual LPCWSTR getWorldName()=0; virtual LPCWSTR getDisplayName()=0; - virtual wstring getGrfPath()=0; + virtual std::wstring getGrfPath()=0; virtual bool requiresBaseSave() = 0; - virtual wstring getBaseSavePath() = 0; + virtual std::wstring getBaseSavePath() = 0; virtual void setRequiresTexturePack(bool)=0; virtual void setRequiredTexturePackId(UINT)=0; - virtual void setDefaultSaveName(const wstring &)=0; - virtual void setWorldName(const wstring &)=0; - virtual void setDisplayName(const wstring &)=0; - virtual void setGrfPath(const wstring &)=0; - virtual void setBaseSavePath(const wstring &)=0; + virtual void setDefaultSaveName(const std::wstring &)=0; + virtual void setWorldName(const std::wstring &)=0; + virtual void setDisplayName(const std::wstring &)=0; + virtual void setGrfPath(const std::wstring &)=0; + virtual void setBaseSavePath(const std::wstring &)=0; virtual bool ready()=0; @@ -47,32 +47,32 @@ public: class JustGrSource : public GrSource { protected: - wstring m_worldName; - wstring m_displayName; - wstring m_defaultSaveName; + std::wstring m_worldName; + std::wstring m_displayName; + std::wstring m_defaultSaveName; bool m_bRequiresTexturePack; int m_requiredTexturePackId; - wstring m_grfPath; - wstring m_baseSavePath; + std::wstring m_grfPath; + std::wstring m_baseSavePath; bool m_bRequiresBaseSave; public: virtual bool requiresTexturePack(); virtual UINT getRequiredTexturePackId(); - virtual wstring getDefaultSaveName(); + virtual std::wstring getDefaultSaveName(); virtual LPCWSTR getWorldName(); virtual LPCWSTR getDisplayName(); - virtual wstring getGrfPath(); + virtual std::wstring getGrfPath(); virtual bool requiresBaseSave(); - virtual wstring getBaseSavePath(); + virtual std::wstring getBaseSavePath(); virtual void setRequiresTexturePack(bool x); virtual void setRequiredTexturePackId(UINT x); - virtual void setDefaultSaveName(const wstring &x); - virtual void setWorldName(const wstring &x); - virtual void setDisplayName(const wstring &x); - virtual void setGrfPath(const wstring &x); - virtual void setBaseSavePath(const wstring &x); + virtual void setDefaultSaveName(const std::wstring &x); + virtual void setWorldName(const std::wstring &x); + virtual void setDisplayName(const std::wstring &x); + virtual void setGrfPath(const std::wstring &x); + virtual void setBaseSavePath(const std::wstring &x); virtual bool ready(); @@ -117,22 +117,22 @@ public: bool requiresTexturePack(); UINT getRequiredTexturePackId(); - wstring getDefaultSaveName(); + std::wstring getDefaultSaveName(); LPCWSTR getWorldName(); LPCWSTR getDisplayName(); - wstring getGrfPath(); + std::wstring getGrfPath(); bool requiresBaseSave(); - wstring getBaseSavePath(); + std::wstring getBaseSavePath(); void setGrSource(GrSource *grs); void setRequiresTexturePack(bool x); void setRequiredTexturePackId(UINT x); - void setDefaultSaveName(const wstring &x); - void setWorldName(const wstring &x); - void setDisplayName(const wstring &x); - void setGrfPath(const wstring &x); - void setBaseSavePath(const wstring &x); + void setDefaultSaveName(const std::wstring &x); + void setWorldName(const std::wstring &x); + void setDisplayName(const std::wstring &x); + void setGrfPath(const std::wstring &x); + void setBaseSavePath(const std::wstring &x); bool ready(); @@ -149,13 +149,13 @@ private: __int64 m_seed; bool m_useFlatWorld; Pos *m_spawnPos; - vector m_schematicRules; - vector m_structureRules; + std::vector m_schematicRules; + std::vector m_structureRules; bool m_bHaveMinY; int m_minY; - unordered_map m_schematics; - vector m_biomeOverrides; - vector m_features; + std::unordered_map m_schematics; + std::vector m_biomeOverrides; + std::vector m_features; bool m_bRequiresGameRules; LevelRuleset *m_requiredGameRules; @@ -169,9 +169,9 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType(); virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); - virtual void getChildren(vector *children); + virtual void getChildren(std::vector *children); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); __int64 getLevelSeed(); Pos *getSpawnPos(); @@ -186,11 +186,11 @@ private: void clearSchematics(); public: - ConsoleSchematicFile *loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen); + ConsoleSchematicFile *loadSchematicFile(const std::wstring &filename, PBYTE pbData, DWORD dwLen); public: - ConsoleSchematicFile *getSchematicFile(const wstring &filename); - void releaseSchematicFile(const wstring &filename); + ConsoleSchematicFile *getSchematicFile(const std::wstring &filename); + void releaseSchematicFile(const std::wstring &filename); bool requiresGameRules(); void setRequiredGameRules(LevelRuleset *rules); @@ -200,9 +200,9 @@ public: bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature); void loadStringTable(StringTable *table); - LPCWSTR getString(const wstring &key); + LPCWSTR getString(const std::wstring &key); - unordered_map *getUnfinishedSchematicFiles(); + std::unordered_map *getUnfinishedSchematicFiles(); // 4J-JEV: // ApplySchematicRules contain limited state diff --git a/Minecraft.Client/Build/Common/GameRules/LevelGenerators.cpp b/Minecraft.Client/Build/Common/GameRules/LevelGenerators.cpp index 362383f92..a92a208e6 100644 --- a/Minecraft.Client/Build/Common/GameRules/LevelGenerators.cpp +++ b/Minecraft.Client/Build/Common/GameRules/LevelGenerators.cpp @@ -7,7 +7,7 @@ LevelGenerators::LevelGenerators() { } -void LevelGenerators::addLevelGenerator(const wstring &displayName, LevelGenerationOptions *generator) +void LevelGenerators::addLevelGenerator(const std::wstring &displayName, LevelGenerationOptions *generator) { if(!displayName.empty()) generator->setDisplayName(displayName); m_levelGenerators.push_back(generator); @@ -15,7 +15,7 @@ void LevelGenerators::addLevelGenerator(const wstring &displayName, LevelGenerat void LevelGenerators::removeLevelGenerator(LevelGenerationOptions *generator) { - vector::iterator it; + std::vector::iterator it; while ( (it = find( m_levelGenerators.begin(), m_levelGenerators.end(), generator ) ) diff --git a/Minecraft.Client/Build/Common/GameRules/LevelGenerators.h b/Minecraft.Client/Build/Common/GameRules/LevelGenerators.h index 824b83875..ac05ee857 100644 --- a/Minecraft.Client/Build/Common/GameRules/LevelGenerators.h +++ b/Minecraft.Client/Build/Common/GameRules/LevelGenerators.h @@ -1,19 +1,19 @@ #pragma once -using namespace std; +//using namespace std; class LevelGenerationOptions; class LevelGenerators { private: - vector m_levelGenerators; + std::vector m_levelGenerators; public: LevelGenerators(); - void addLevelGenerator(const wstring &displayName, LevelGenerationOptions *generator); + void addLevelGenerator(const std::wstring &displayName, LevelGenerationOptions *generator); void removeLevelGenerator(LevelGenerationOptions *generator); - vector *getLevelGenerators() { return &m_levelGenerators; } + std::vector *getLevelGenerators() { return &m_levelGenerators; } }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/LevelRules.cpp b/Minecraft.Client/Build/Common/GameRules/LevelRules.cpp index 9520cf996..141edd11c 100644 --- a/Minecraft.Client/Build/Common/GameRules/LevelRules.cpp +++ b/Minecraft.Client/Build/Common/GameRules/LevelRules.cpp @@ -6,11 +6,11 @@ LevelRules::LevelRules() { } -void LevelRules::addLevelRule(const wstring &displayName, PBYTE pbData, DWORD dwLen) +void LevelRules::addLevelRule(const std::wstring &displayName, PBYTE pbData, DWORD dwLen) { } -void LevelRules::addLevelRule(const wstring &displayName, LevelRuleset *rootRule) +void LevelRules::addLevelRule(const std::wstring &displayName, LevelRuleset *rootRule) { } diff --git a/Minecraft.Client/Build/Common/GameRules/LevelRules.h b/Minecraft.Client/Build/Common/GameRules/LevelRules.h index a94a2123b..e88cd5dac 100644 --- a/Minecraft.Client/Build/Common/GameRules/LevelRules.h +++ b/Minecraft.Client/Build/Common/GameRules/LevelRules.h @@ -7,8 +7,8 @@ class LevelRules public: LevelRules(); - void addLevelRule(const wstring &displayName, PBYTE pbData, DWORD dwLen); - void addLevelRule(const wstring &displayName, LevelRuleset *rootRule); + void addLevelRule(const std::wstring &displayName, PBYTE pbData, DWORD dwLen); + void addLevelRule(const std::wstring &displayName, LevelRuleset *rootRule); void removeLevelRule(LevelRuleset *removing); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/LevelRuleset.cpp b/Minecraft.Client/Build/Common/GameRules/LevelRuleset.cpp index 555db7a4b..debe610ff 100644 --- a/Minecraft.Client/Build/Common/GameRules/LevelRuleset.cpp +++ b/Minecraft.Client/Build/Common/GameRules/LevelRuleset.cpp @@ -17,7 +17,7 @@ LevelRuleset::~LevelRuleset() } } -void LevelRuleset::getChildren(vector *children) +void LevelRuleset::getChildren(std::vector *children) { CompoundGameRuleDefinition::getChildren(children); for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); it++) @@ -44,7 +44,7 @@ void LevelRuleset::loadStringTable(StringTable *table) m_stringTable = table; } -LPCWSTR LevelRuleset::getString(const wstring &key) +LPCWSTR LevelRuleset::getString(const std::wstring &key) { if(m_stringTable == NULL) { @@ -56,7 +56,7 @@ LPCWSTR LevelRuleset::getString(const wstring &key) } } -AABB *LevelRuleset::getNamedArea(const wstring &areaName) +AABB *LevelRuleset::getNamedArea(const std::wstring &areaName) { AABB *area = NULL; for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it) diff --git a/Minecraft.Client/Build/Common/GameRules/LevelRuleset.h b/Minecraft.Client/Build/Common/GameRules/LevelRuleset.h index bbb17c437..93802450c 100644 --- a/Minecraft.Client/Build/Common/GameRules/LevelRuleset.h +++ b/Minecraft.Client/Build/Common/GameRules/LevelRuleset.h @@ -7,21 +7,21 @@ class NamedAreaRuleDefinition; class LevelRuleset : public CompoundGameRuleDefinition { private: - vector m_areas; + std::vector m_areas; StringTable *m_stringTable; public: LevelRuleset(); ~LevelRuleset(); - virtual void getChildren(vector *children); + virtual void getChildren(std::vector *children); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_LevelRules; } void loadStringTable(StringTable *table); - LPCWSTR getString(const wstring &key); + LPCWSTR getString(const std::wstring &key); - AABB *getNamedArea(const wstring &areaName); + AABB *getNamedArea(const std::wstring &areaName); StringTable *getStringTable() { return m_stringTable; } }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/NamedAreaRuleDefinition.cpp b/Minecraft.Client/Build/Common/GameRules/NamedAreaRuleDefinition.cpp index 1e656af01..43f438609 100644 --- a/Minecraft.Client/Build/Common/GameRules/NamedAreaRuleDefinition.cpp +++ b/Minecraft.Client/Build/Common/GameRules/NamedAreaRuleDefinition.cpp @@ -36,7 +36,7 @@ void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAtt dos->writeUTF(_toString(m_area->z1)); } -void NamedAreaRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void NamedAreaRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"name") == 0) { diff --git a/Minecraft.Client/Build/Common/GameRules/NamedAreaRuleDefinition.h b/Minecraft.Client/Build/Common/GameRules/NamedAreaRuleDefinition.h index 7cf7db193..8386b3fd4 100644 --- a/Minecraft.Client/Build/Common/GameRules/NamedAreaRuleDefinition.h +++ b/Minecraft.Client/Build/Common/GameRules/NamedAreaRuleDefinition.h @@ -5,7 +5,7 @@ class NamedAreaRuleDefinition : public GameRuleDefinition { private: - wstring m_name; + std::wstring m_name; AABB *m_area; public: @@ -16,8 +16,8 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_NamedArea; } - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); AABB *getArea() { return m_area; } - wstring getName() { return m_name; } + std::wstring getName() { return m_name; } }; diff --git a/Minecraft.Client/Build/Common/GameRules/StartFeature.cpp b/Minecraft.Client/Build/Common/GameRules/StartFeature.cpp index da0505a89..f9262df3e 100644 --- a/Minecraft.Client/Build/Common/GameRules/StartFeature.cpp +++ b/Minecraft.Client/Build/Common/GameRules/StartFeature.cpp @@ -21,7 +21,7 @@ void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs) dos->writeUTF(_toString((int)m_feature)); } -void StartFeature::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void StartFeature::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"chunkX") == 0) { diff --git a/Minecraft.Client/Build/Common/GameRules/StartFeature.h b/Minecraft.Client/Build/Common/GameRules/StartFeature.h index 4980ac9ab..51edc99f1 100644 --- a/Minecraft.Client/Build/Common/GameRules/StartFeature.h +++ b/Minecraft.Client/Build/Common/GameRules/StartFeature.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "GameRuleDefinition.h" #include "../../../../Minecraft.World/WorldGen/Features/StructureFeature.h" @@ -16,7 +16,7 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_StartFeature; } virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature); }; diff --git a/Minecraft.Client/Build/Common/GameRules/UpdatePlayerRuleDefinition.cpp b/Minecraft.Client/Build/Common/GameRules/UpdatePlayerRuleDefinition.cpp index 329330abd..77cb68f93 100644 --- a/Minecraft.Client/Build/Common/GameRules/UpdatePlayerRuleDefinition.cpp +++ b/Minecraft.Client/Build/Common/GameRules/UpdatePlayerRuleDefinition.cpp @@ -56,7 +56,7 @@ void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, UINT num } } -void UpdatePlayerRuleDefinition::getChildren(vector *children) +void UpdatePlayerRuleDefinition::getChildren(std::vector *children) { GameRuleDefinition::getChildren(children); for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++) @@ -80,7 +80,7 @@ GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGame return rule; } -void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void UpdatePlayerRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"spawnX") == 0) { @@ -130,7 +130,7 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons } } -void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr player) +void UpdatePlayerRuleDefinition::postProcessPlayer(std::shared_ptr player) { if(m_bUpdateHealth) { diff --git a/Minecraft.Client/Build/Common/GameRules/UpdatePlayerRuleDefinition.h b/Minecraft.Client/Build/Common/GameRules/UpdatePlayerRuleDefinition.h index 538aefa1c..2b14dd508 100644 --- a/Minecraft.Client/Build/Common/GameRules/UpdatePlayerRuleDefinition.h +++ b/Minecraft.Client/Build/Common/GameRules/UpdatePlayerRuleDefinition.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "GameRuleDefinition.h" @@ -9,7 +9,7 @@ class Pos; class UpdatePlayerRuleDefinition : public GameRuleDefinition { private: - vector m_items; + std::vector m_items; bool m_bUpdateHealth, m_bUpdateFood, m_bUpdateYRot, m_bUpdateInventory; int m_health; @@ -23,11 +23,11 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_UpdatePlayerRule; } - virtual void getChildren(vector *children); + virtual void getChildren(std::vector *children); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); - virtual void postProcessPlayer(shared_ptr player); + virtual void postProcessPlayer(std::shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/UseTileRuleDefinition.cpp b/Minecraft.Client/Build/Common/GameRules/UseTileRuleDefinition.cpp index 7817df153..5e3b98cff 100644 --- a/Minecraft.Client/Build/Common/GameRules/UseTileRuleDefinition.cpp +++ b/Minecraft.Client/Build/Common/GameRules/UseTileRuleDefinition.cpp @@ -28,7 +28,7 @@ void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttri dos->writeUTF(_toString(m_coordinates.z)); } -void UseTileRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void UseTileRuleDefinition::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"tileId") == 0) { diff --git a/Minecraft.Client/Build/Common/GameRules/UseTileRuleDefinition.h b/Minecraft.Client/Build/Common/GameRules/UseTileRuleDefinition.h index 6b95d47a2..6df664288 100644 --- a/Minecraft.Client/Build/Common/GameRules/UseTileRuleDefinition.h +++ b/Minecraft.Client/Build/Common/GameRules/UseTileRuleDefinition.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "GameRuleDefinition.h" #include "../../../../Minecraft.World/Util/Pos.h" @@ -18,7 +18,7 @@ public: ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_UseTileRule; } virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z); }; diff --git a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionGenerateBox.cpp b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionGenerateBox.cpp index a748358b7..14efc4c72 100644 --- a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionGenerateBox.cpp +++ b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionGenerateBox.cpp @@ -35,7 +35,7 @@ void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, UINT dos->writeUTF(_toString(m_skipAir)); } -void XboxStructureActionGenerateBox::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void XboxStructureActionGenerateBox::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"x0") == 0) { diff --git a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionGenerateBox.h b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionGenerateBox.h index 78664d421..3570b5a3f 100644 --- a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionGenerateBox.h +++ b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionGenerateBox.h @@ -20,7 +20,7 @@ public: virtual int getEndZ() { return m_z1; } virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool generateBoxInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceBlock.cpp b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceBlock.cpp index b4c9d28b9..d0c469cf4 100644 --- a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceBlock.cpp +++ b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceBlock.cpp @@ -26,7 +26,7 @@ void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, UINT } -void XboxStructureActionPlaceBlock::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void XboxStructureActionPlaceBlock::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"x") == 0) { diff --git a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceBlock.h b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceBlock.h index 3ee377b99..75648965c 100644 --- a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceBlock.h +++ b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceBlock.h @@ -19,7 +19,7 @@ public: virtual int getEndZ() { return m_z; } virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool placeBlockInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceContainer.cpp b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceContainer.cpp index abaaae744..a3c74f0c3 100644 --- a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceContainer.cpp +++ b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceContainer.cpp @@ -24,7 +24,7 @@ XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer() //void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, UINT numAttrs) -void XboxStructureActionPlaceContainer::getChildren(vector *children) +void XboxStructureActionPlaceContainer::getChildren(std::vector *children) { XboxStructureActionPlaceBlock::getChildren(children); for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++) @@ -48,7 +48,7 @@ GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules return rule; } -void XboxStructureActionPlaceContainer::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void XboxStructureActionPlaceContainer::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"facing") == 0) { @@ -78,7 +78,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st } level->setTile( worldX, worldY, worldZ, m_tile ); - shared_ptr container = dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); + std::shared_ptr container = std::dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ); if ( container != NULL ) diff --git a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceContainer.h b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceContainer.h index 6355ca116..bef68bbb9 100644 --- a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceContainer.h +++ b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceContainer.h @@ -10,20 +10,20 @@ class BoundingBox; class XboxStructureActionPlaceContainer : public XboxStructureActionPlaceBlock { private: - vector m_items; + std::vector m_items; public: XboxStructureActionPlaceContainer(); ~XboxStructureActionPlaceContainer(); virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_PlaceContainer; } - virtual void getChildren(vector *children); + virtual void getChildren(std::vector *children); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); // 4J-JEV: Super class handles attr-facing fine. //virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool placeContainerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceSpawner.cpp b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceSpawner.cpp index d51865f49..8b06606e4 100644 --- a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceSpawner.cpp +++ b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceSpawner.cpp @@ -23,7 +23,7 @@ void XboxStructureActionPlaceSpawner::writeAttributes(DataOutputStream *dos, UIN dos->writeUTF(m_entityId); } -void XboxStructureActionPlaceSpawner::addAttribute(const wstring &attributeName, const wstring &attributeValue) +void XboxStructureActionPlaceSpawner::addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue) { if(attributeName.compare(L"entity") == 0) { @@ -54,7 +54,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct } level->setTile( worldX, worldY, worldZ, m_tile ); - shared_ptr entity = dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); + std::shared_ptr entity = std::dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); #ifndef _CONTENT_PACKAGE wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ); diff --git a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceSpawner.h b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceSpawner.h index 160009807..92899b93e 100644 --- a/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceSpawner.h +++ b/Minecraft.Client/Build/Common/GameRules/XboxStructureActionPlaceSpawner.h @@ -10,7 +10,7 @@ class GRFObject; class XboxStructureActionPlaceSpawner : public XboxStructureActionPlaceBlock { private: - wstring m_entityId; + std::wstring m_entityId; public: XboxStructureActionPlaceSpawner(); ~XboxStructureActionPlaceSpawner(); @@ -18,7 +18,7 @@ public: virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_PlaceSpawner; } virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); - virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); + virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); bool placeSpawnerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.cpp b/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.cpp index 753dd3411..e500ad156 100644 --- a/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.cpp +++ b/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.cpp @@ -4,7 +4,7 @@ #include "LeaderboardManager.h" -const wstring LeaderboardManager::filterNames[eNumFilterModes] = +const std::wstring LeaderboardManager::filterNames[eNumFilterModes] = { L"Friends", L"MyScore", L"TopRank" }; @@ -85,7 +85,7 @@ void LeaderboardManager::printStats(ReadView &view) { ReadScore score = view.m_queries[i]; - app.DebugPrintf( "\tname='%s'\n", wstringtofilename(wstring(score.m_name)) ); + app.DebugPrintf( "\tname='%s'\n", wstringtofilename(std::wstring(score.m_name)) ); app.DebugPrintf( "\trank='%i'\n", score.m_rank ); app.DebugPrintf( "\tstatsData=[" ); diff --git a/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.h b/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.h index b8b81c807..5dde22f38 100644 --- a/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.h +++ b/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.h @@ -84,7 +84,7 @@ public: eFM_UNDEFINED }; - static const wstring filterNames[eNumFilterModes]; + static const std::wstring filterNames[eNumFilterModes]; typedef struct KillsRecord { @@ -167,7 +167,7 @@ public: PlayerUID m_uid; // Player's unique identifier. unsigned long m_rank; // Rank of the player on this scoreboard. - wstring m_name; // Player's display name. + std::wstring m_name; // Player's display name. unsigned long m_totalScore; // Sum of all the player's scores on this leaderboard. diff --git a/Minecraft.Client/Build/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Build/Common/Network/GameNetworkManager.cpp index 72785e7e1..42ee07ff4 100644 --- a/Minecraft.Client/Build/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Build/Common/Network/GameNetworkManager.cpp @@ -284,7 +284,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // PRIMARY PLAYER app.DebugPrintf("[NET] Creating ClientConnection (IsHost=%d)...\n", g_NetworkManager.IsHost()); - vector createdConnections; + std::vector createdConnections; ClientConnection *connection; if( g_NetworkManager.IsHost() ) @@ -327,7 +327,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame } app.DebugPrintf("[NET] Sending PreLoginPacket...\n"); - connection->send( shared_ptr( new PreLoginPacket(minecraft->user->name) ) ); + connection->send( std::shared_ptr( new PreLoginPacket(minecraft->user->name) ) ); app.DebugPrintf("[NET] PreLoginPacket sent. Entering connection tick loop...\n"); // Tick connection until we're ready to go. The stages involved in this are: @@ -415,7 +415,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // Open the socket on the server end to accept incoming data Socket::addIncomingSocket(socket); - connection->send( shared_ptr( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) ); + connection->send( std::shared_ptr( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) ); createdConnections.push_back( connection ); @@ -540,7 +540,7 @@ INetworkPlayer *CGameNetworkManager::GetPlayerBySmallId(unsigned char smallId) } #ifdef _DURANGO -wstring CGameNetworkManager::GetDisplayNameByGamertag(wstring gamertag) +std::wstring CGameNetworkManager::GetDisplayNameByGamertag(std::wstring gamertag) { return s_pPlatformNetworkManager->GetDisplayNameByGamertag(gamertag); } @@ -634,7 +634,7 @@ bool CGameNetworkManager::SessionHasSpace(unsigned int spaceRequired) return s_pPlatformNetworkManager->SessionHasSpace( spaceRequired ); } -vector *CGameNetworkManager::GetSessionList(int iPad, int localPlayers, bool partyOnly) +std::vector *CGameNetworkManager::GetSessionList(int iPad, int localPlayers, bool partyOnly) { return s_pPlatformNetworkManager->GetSessionList( iPad, localPlayers, partyOnly ); } @@ -1146,7 +1146,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) PlayerList *players = pServer->getPlayers(); for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it) { - shared_ptr servPlayer = *it; + std::shared_ptr servPlayer = *it; if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() ) { servPlayer->connection->connection->getSocket()->setPlayer(NULL); @@ -1214,7 +1214,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) PlayerList *players = pServer->getPlayers(); for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it) { - shared_ptr servPlayer = *it; + std::shared_ptr servPlayer = *it; if( servPlayer->getXuid() == localPlayerXuid ) { servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) ); @@ -1271,7 +1271,7 @@ bool CGameNetworkManager::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int inde return s_pPlatformNetworkManager->SystemFlagGet( pNetworkPlayer, index ); } -wstring CGameNetworkManager::GatherStats() +std::wstring CGameNetworkManager::GatherStats() { return s_pPlatformNetworkManager->GatherStats(); } @@ -1289,7 +1289,7 @@ void CGameNetworkManager::renderQueueMeter() #endif } -wstring CGameNetworkManager::GatherRTTStats() +std::wstring CGameNetworkManager::GatherRTTStats() { return s_pPlatformNetworkManager->GatherRTTStats(); } @@ -1403,7 +1403,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc Minecraft *pMinecraft = Minecraft::GetInstance(); Socket *socket = NULL; - shared_ptr mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()]; + std::shared_ptr mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()]; if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL) { // If we already have a MultiplayerLocalPlayer here then we are doing a session type change @@ -1440,7 +1440,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc if( connection->createdOk ) { - connection->send( shared_ptr( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) ); + connection->send( std::shared_ptr( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) ); pMinecraft->addPendingLocalConnection(idx, connection); } else diff --git a/Minecraft.Client/Build/Common/Network/GameNetworkManager.h b/Minecraft.Client/Build/Common/Network/GameNetworkManager.h index 479c2f51f..9512e7eb8 100644 --- a/Minecraft.Client/Build/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Build/Common/Network/GameNetworkManager.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include #ifndef __linux__ #include @@ -69,7 +69,7 @@ public: INetworkPlayer *GetPlayerByIndex(int playerIndex); INetworkPlayer *GetPlayerByXuid(PlayerUID xuid); INetworkPlayer *GetPlayerBySmallId(unsigned char smallId); - wstring GetDisplayNameByGamertag(wstring gamertag); + std::wstring GetDisplayNameByGamertag(std::wstring gamertag); INetworkPlayer *GetHostPlayer(); void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam); void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam); @@ -96,7 +96,7 @@ public: // Client session discovery bool SessionHasSpace(unsigned int spaceRequired = 1); - vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); + std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); @@ -157,9 +157,9 @@ public: #endif // Debug output - wstring GatherStats(); + std::wstring GatherStats(); void renderQueueMeter(); - wstring GatherRTTStats(); + std::wstring GatherRTTStats(); // GUI debug output diff --git a/Minecraft.Client/Build/Common/Network/NetworkPlayerInterface.h b/Minecraft.Client/Build/Common/Network/NetworkPlayerInterface.h index 501b08ff1..28db131e9 100644 --- a/Minecraft.Client/Build/Common/Network/NetworkPlayerInterface.h +++ b/Minecraft.Client/Build/Common/Network/NetworkPlayerInterface.h @@ -26,6 +26,6 @@ public: virtual void SetSocket(Socket *pSocket) = 0; virtual Socket *GetSocket() = 0; virtual const wchar_t *GetOnlineName() = 0; - virtual wstring GetDisplayName() = 0; + virtual std::wstring GetDisplayName() = 0; virtual PlayerUID GetUID() = 0; }; diff --git a/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerInterface.h b/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerInterface.h index fe7580bb5e..7cbc26394 100644 --- a/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerInterface.h +++ b/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerInterface.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include #ifndef __linux__ #include @@ -103,8 +103,8 @@ public: virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) = 0; virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) = 0; - virtual wstring GatherStats() = 0; - virtual wstring GatherRTTStats() = 0; + virtual std::wstring GatherStats() = 0; + virtual std::wstring GatherRTTStats() = 0; private: virtual void SetSessionTexturePackParentId( int id ) = 0; @@ -112,7 +112,7 @@ private: virtual void Notify(int ID, ULONG_PTR Param) = 0; public: - virtual vector *GetSessionList(int iPad, int localPlayers, bool partyOnly) = 0; + virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly) = 0; virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession) = 0; virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ) = 0; virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) = 0; @@ -123,6 +123,6 @@ public: #endif #ifdef _DURANGO - virtual wstring GetDisplayNameByGamertag(wstring gamertag) = 0; + virtual std::wstring GetDisplayNameByGamertag(std::wstring gamertag) = 0; #endif }; diff --git a/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerStub.cpp index 1fb3d3059..df7f32531 100644 --- a/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerStub.cpp @@ -476,14 +476,14 @@ bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer *pNetworkPlayer, return false; } -wstring CPlatformNetworkManagerStub::GatherStats() +std::wstring CPlatformNetworkManagerStub::GatherStats() { return L""; } -wstring CPlatformNetworkManagerStub::GatherRTTStats() +std::wstring CPlatformNetworkManagerStub::GatherRTTStats() { - wstring stats(L"Rtt: "); + std::wstring stats(L"Rtt: "); wchar_t stat[32]; @@ -520,9 +520,9 @@ void CPlatformNetworkManagerStub::SetSearchResultsReady(int resultCount) m_searchResultsCount[m_lastSearchPad] = resultCount; } -vector *CPlatformNetworkManagerStub::GetSessionList(int iPad, int localPlayers, bool partyOnly) +std::vector *CPlatformNetworkManagerStub::GetSessionList(int iPad, int localPlayers, bool partyOnly) { - vector *filteredList = new vector();; + std::vector *filteredList = new std::vector();; return filteredList; } diff --git a/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerStub.h b/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerStub.h index 8a9dc797a..3ca2b8489 100644 --- a/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerStub.h +++ b/Minecraft.Client/Build/Common/Network/PlatformNetworkManagerStub.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include #include "../../../../Minecraft.World/Util/C4JThread.h" #include "NetworkPlayerInterface.h" @@ -66,7 +66,7 @@ private: HANDLE m_notificationListener; - vector m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system + std::vector m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system bool m_bLeavingGame; bool m_bLeaveGameOnTick; @@ -101,7 +101,7 @@ private: PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count); ~PlayerFlags(); }; - vector m_playerFlags; + std::vector m_playerFlags; void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagReset(); @@ -114,11 +114,11 @@ private: float m_lastPlayerEventTimeStart; public: - wstring GatherStats(); - wstring GatherRTTStats(); + std::wstring GatherStats(); + std::wstring GatherRTTStats(); private: - vector friendsSessions[XUSER_MAX_COUNT]; + std::vector friendsSessions[XUSER_MAX_COUNT]; int m_searchResultsCount[XUSER_MAX_COUNT]; int m_lastSearchStartTime[XUSER_MAX_COUNT]; @@ -145,7 +145,7 @@ private: void SetSearchResultsReady(int resultCount = 0); - vectorcurrentNetworkPlayers; + std::vectorcurrentNetworkPlayers; INetworkPlayer *addNetworkPlayer(IQNetPlayer *pQNetPlayer); void removeNetworkPlayer(IQNetPlayer *pQNetPlayer); static INetworkPlayer *getNetworkPlayer(IQNetPlayer *pQNetPlayer); @@ -155,7 +155,7 @@ private: virtual void Notify(int ID, ULONG_PTR Param); public: - virtual vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); + virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); diff --git a/Minecraft.Client/Build/Common/Network/Sony/NetworkPlayerSony.cpp b/Minecraft.Client/Build/Common/Network/Sony/NetworkPlayerSony.cpp index a09235635..5359dfbaa 100644 --- a/Minecraft.Client/Build/Common/Network/Sony/NetworkPlayerSony.cpp +++ b/Minecraft.Client/Build/Common/Network/Sony/NetworkPlayerSony.cpp @@ -98,7 +98,7 @@ const wchar_t *NetworkPlayerSony::GetOnlineName() return m_sqrPlayer->GetName(); } -wstring NetworkPlayerSony::GetDisplayName() +std::wstring NetworkPlayerSony::GetDisplayName() { return m_sqrPlayer->GetName(); } diff --git a/Minecraft.Client/Build/Common/Network/Sony/NetworkPlayerSony.h b/Minecraft.Client/Build/Common/Network/Sony/NetworkPlayerSony.h index bc4c97a9e..c71b343b6 100644 --- a/Minecraft.Client/Build/Common/Network/Sony/NetworkPlayerSony.h +++ b/Minecraft.Client/Build/Common/Network/Sony/NetworkPlayerSony.h @@ -28,7 +28,7 @@ public: virtual void SetSocket(Socket *pSocket); virtual Socket *GetSocket(); virtual const wchar_t *GetOnlineName(); - virtual wstring GetDisplayName(); + virtual std::wstring GetDisplayName(); virtual PlayerUID GetUID(); void SetUID(PlayerUID UID); diff --git a/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.cpp b/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.cpp index 0a19a99de..48e51a666 100644 --- a/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.cpp +++ b/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.cpp @@ -1064,7 +1064,7 @@ bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer, return false; } -wstring CPlatformNetworkManagerSony::GatherStats() +std::wstring CPlatformNetworkManagerSony::GatherStats() { #if 0 return L"Queue messages: " + _toString(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) @@ -1074,10 +1074,10 @@ wstring CPlatformNetworkManagerSony::GatherStats() #endif } -wstring CPlatformNetworkManagerSony::GatherRTTStats() +std::wstring CPlatformNetworkManagerSony::GatherRTTStats() { #if 0 - wstring stats(L"Rtt: "); + std::wstring stats(L"Rtt: "); wchar_t stat[32]; @@ -1141,9 +1141,9 @@ void CPlatformNetworkManagerSony::TickSearch() } } -vector *CPlatformNetworkManagerSony::GetSessionList(int iPad, int localPlayers, bool partyOnly) +std::vector *CPlatformNetworkManagerSony::GetSessionList(int iPad, int localPlayers, bool partyOnly) { - vector *filteredList = new vector(); + std::vector *filteredList = new std::vector(); for( int i = 0; i < m_searchResultsCount; i++ ) { if( m_pSearchResults[i].m_extData ) @@ -1219,7 +1219,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session { sessionInfo->data = *(GameSessionData *)pxnqi->pbData; - wstring gamerName = convStringToWstring(sessionInfo->data.hostName); + std::wstring gamerName = convStringToWstring(sessionInfo->data.hostName); swprintf(sessionInfo->displayLabel,app.GetString(IDS_GAME_HOST_NAME),L"MWWWWWWWWWWWWWWM");// gamerName.c_str() ); } else diff --git a/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.h b/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.h index 4746296d4..b36de5e07 100644 --- a/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.h +++ b/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include #include "../../../../../Minecraft.World/Util/C4JThread.h" #include "../NetworkPlayerInterface.h" @@ -86,7 +86,7 @@ private: HANDLE m_notificationListener; - vector m_machineSQRPrimaryPlayers; // collection of players that we deem to be the main one for that system + std::vector m_machineSQRPrimaryPlayers; // collection of players that we deem to be the main one for that system bool m_bLeavingGame; bool m_bLeaveGameOnTick; @@ -122,7 +122,7 @@ private: PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count); ~PlayerFlags(); }; - vector m_playerFlags; + std::vector m_playerFlags; void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagReset(); @@ -135,11 +135,11 @@ private: float m_lastPlayerEventTimeStart; public: - wstring GatherStats(); - wstring GatherRTTStats(); + std::wstring GatherStats(); + std::wstring GatherRTTStats(); private: - vector friendsSessions; + std::vector friendsSessions; int m_lastSearchStartTime; @@ -156,7 +156,7 @@ private: void TickSearch(); - vectorcurrentNetworkPlayers; + std::vectorcurrentNetworkPlayers; INetworkPlayer *addNetworkPlayer(SQRNetworkPlayer *pSQRPlayer); void removeNetworkPlayer(SQRNetworkPlayer *pSQRPlayer); static INetworkPlayer *getNetworkPlayer(SQRNetworkPlayer *pSQRPlayer); @@ -166,7 +166,7 @@ private: virtual void Notify(int ID, ULONG_PTR Param); public: - virtual vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); + virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); diff --git a/Minecraft.Client/Build/Common/Tutorial/AreaTask.cpp b/Minecraft.Client/Build/Common/Tutorial/AreaTask.cpp index aae2ec281..0706d858d 100644 --- a/Minecraft.Client/Build/Common/Tutorial/AreaTask.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/AreaTask.cpp @@ -2,7 +2,7 @@ #include "Tutorial.h" #include "AreaTask.h" -AreaTask::AreaTask(eTutorial_State state, Tutorial *tutorial, vector *inConstraints, int descriptionId, EAreaTaskCompletionStates completionState) +AreaTask::AreaTask(eTutorial_State state, Tutorial *tutorial, std::vector *inConstraints, int descriptionId, EAreaTaskCompletionStates completionState) : TutorialTask( tutorial, descriptionId, false, inConstraints, false, false, false ) { m_tutorialState = state; diff --git a/Minecraft.Client/Build/Common/Tutorial/AreaTask.h b/Minecraft.Client/Build/Common/Tutorial/AreaTask.h index 0d20bd7ab..2480d398b 100644 --- a/Minecraft.Client/Build/Common/Tutorial/AreaTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/AreaTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" @@ -16,7 +16,7 @@ private: EAreaTaskCompletionStates m_completionState; eTutorial_State m_tutorialState; public: - AreaTask(eTutorial_State state, Tutorial *tutorial, vector *inConstraints, int descriptionId = -1, EAreaTaskCompletionStates completionState = eAreaTaskCompletion_CompleteOnActivation); + AreaTask(eTutorial_State state, Tutorial *tutorial, std::vector *inConstraints, int descriptionId = -1, EAreaTaskCompletionStates completionState = eAreaTaskCompletion_CompleteOnActivation); virtual bool isCompleted(); virtual void setAsCurrentTask(bool active = true); virtual void onStateChange(eTutorial_State newState); diff --git a/Minecraft.Client/Build/Common/Tutorial/ChangeStateConstraint.cpp b/Minecraft.Client/Build/Common/Tutorial/ChangeStateConstraint.cpp index a5b23869c..545c0d35f 100644 --- a/Minecraft.Client/Build/Common/Tutorial/ChangeStateConstraint.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/ChangeStateConstraint.cpp @@ -60,10 +60,10 @@ void ChangeStateConstraint::tick(int iPad) { // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr player = minecraft->localplayers[iPad]; + std::shared_ptr player = minecraft->localplayers[iPad]; if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) { - player->connection->send( shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); + player->connection->send( std::shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); } } } @@ -101,10 +101,10 @@ void ChangeStateConstraint::tick(int iPad) { // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr player = minecraft->localplayers[iPad]; + std::shared_ptr player = minecraft->localplayers[iPad]; if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) { - player->connection->send( shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); + player->connection->send( std::shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); } } } @@ -125,10 +125,10 @@ void ChangeStateConstraint::tick(int iPad) { // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr player = minecraft->localplayers[iPad]; + std::shared_ptr player = minecraft->localplayers[iPad]; if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) { - player->connection->send( shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); + player->connection->send( std::shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); } } } diff --git a/Minecraft.Client/Build/Common/Tutorial/ChoiceTask.h b/Minecraft.Client/Build/Common/Tutorial/ChoiceTask.h index 79c2ba429..f10168b19 100644 --- a/Minecraft.Client/Build/Common/Tutorial/ChoiceTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/ChoiceTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" diff --git a/Minecraft.Client/Build/Common/Tutorial/CompleteUsingItemTask.cpp b/Minecraft.Client/Build/Common/Tutorial/CompleteUsingItemTask.cpp index 2e4d12b1e..c47850043 100644 --- a/Minecraft.Client/Build/Common/Tutorial/CompleteUsingItemTask.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/CompleteUsingItemTask.cpp @@ -23,7 +23,7 @@ bool CompleteUsingItemTask::isCompleted() return bIsCompleted; } -void CompleteUsingItemTask::completeUsingItem(shared_ptr item) +void CompleteUsingItemTask::completeUsingItem(std::shared_ptr item) { if(!hasBeenActivated() && !isPreCompletionEnabled()) return; for(int i=0;i item); + virtual void completeUsingItem(std::shared_ptr item); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/Tutorial/ControllerTask.h b/Minecraft.Client/Build/Common/Tutorial/ControllerTask.h index 1ee6746fd..90e0c4478 100644 --- a/Minecraft.Client/Build/Common/Tutorial/ControllerTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/ControllerTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" @@ -7,8 +7,8 @@ using namespace std; class ControllerTask : public TutorialTask { private: - unordered_map completedMappings; - unordered_map southpawCompletedMappings; + std::unordered_map completedMappings; + std::unordered_map southpawCompletedMappings; bool m_bHasSouthpaw; unsigned int m_uiCompletionMask; int *m_iCompletionMaskA; diff --git a/Minecraft.Client/Build/Common/Tutorial/CraftTask.cpp b/Minecraft.Client/Build/Common/Tutorial/CraftTask.cpp index ee9292d14..ac543862b 100644 --- a/Minecraft.Client/Build/Common/Tutorial/CraftTask.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/CraftTask.cpp @@ -3,7 +3,7 @@ #include "../../../../Minecraft.World/Headers/net.minecraft.world.item.h" CraftTask::CraftTask( int itemId, int auxValue, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector *inConstraints /*= NULL*/, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, std::vector *inConstraints /*= NULL*/, bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_quantity( quantity ), @@ -17,7 +17,7 @@ CraftTask::CraftTask( int itemId, int auxValue, int quantity, } CraftTask::CraftTask( int *items, int *auxValues, int numItems, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector *inConstraints /*= NULL*/, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, std::vector *inConstraints /*= NULL*/, bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_quantity( quantity ), @@ -40,7 +40,7 @@ CraftTask::~CraftTask() delete[] m_auxValues; } -void CraftTask::onCrafted(shared_ptr item) +void CraftTask::onCrafted(std::shared_ptr item) { #ifndef _CONTENT_PACKAGE wprintf(L"CraftTask::onCrafted - %ls\n", item->toString().c_str() ); diff --git a/Minecraft.Client/Build/Common/Tutorial/CraftTask.h b/Minecraft.Client/Build/Common/Tutorial/CraftTask.h index 1496f07a4..1a26b9264 100644 --- a/Minecraft.Client/Build/Common/Tutorial/CraftTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/CraftTask.h @@ -5,16 +5,16 @@ class CraftTask : public TutorialTask { public: CraftTask( int itemId, int auxValue, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = NULL, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, std::vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); CraftTask( int *items, int *auxValues, int numItems, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = NULL, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, std::vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); ~CraftTask(); virtual bool isCompleted() { return bIsCompleted; } - virtual void onCrafted(shared_ptr item); + virtual void onCrafted(std::shared_ptr item); private: int *m_items; diff --git a/Minecraft.Client/Build/Common/Tutorial/DiggerItemHint.cpp b/Minecraft.Client/Build/Common/Tutorial/DiggerItemHint.cpp index 078c5f4d4..87b29ef10 100644 --- a/Minecraft.Client/Build/Common/Tutorial/DiggerItemHint.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/DiggerItemHint.cpp @@ -20,7 +20,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descri tutorial->addMessage(IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL, true); } -int DiggerItemHint::startDestroyBlock(shared_ptr item, Tile *tile) +int DiggerItemHint::startDestroyBlock(std::shared_ptr item, Tile *tile) { if(item != NULL) { @@ -46,7 +46,7 @@ int DiggerItemHint::startDestroyBlock(shared_ptr item, Tile *tile) return -1; } -int DiggerItemHint::attack(shared_ptr item, shared_ptr entity) +int DiggerItemHint::attack(std::shared_ptr item, std::shared_ptr entity) { if(item != NULL) { @@ -62,7 +62,7 @@ int DiggerItemHint::attack(shared_ptr item, shared_ptr ent if(itemFound) { // It's also possible that we could hit TileEntities (eg falling sand) so don't want to give this hint then - if( dynamic_pointer_cast( entity ) != NULL ) + if( std::dynamic_pointer_cast( entity ) != NULL ) { return IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL; } diff --git a/Minecraft.Client/Build/Common/Tutorial/DiggerItemHint.h b/Minecraft.Client/Build/Common/Tutorial/DiggerItemHint.h index cb71742e7..b23a8be3d 100644 --- a/Minecraft.Client/Build/Common/Tutorial/DiggerItemHint.h +++ b/Minecraft.Client/Build/Common/Tutorial/DiggerItemHint.h @@ -13,6 +13,6 @@ private: public: DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int items[], unsigned int itemsLength); - virtual int startDestroyBlock(shared_ptr item, Tile *tile); - virtual int attack(shared_ptr item, shared_ptr entity); + virtual int startDestroyBlock(std::shared_ptr item, Tile *tile); + virtual int attack(std::shared_ptr item, std::shared_ptr entity); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/Tutorial/EffectChangedTask.h b/Minecraft.Client/Build/Common/Tutorial/EffectChangedTask.h index 23563f397..796653200 100644 --- a/Minecraft.Client/Build/Common/Tutorial/EffectChangedTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/EffectChangedTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" diff --git a/Minecraft.Client/Build/Common/Tutorial/FullTutorial.cpp b/Minecraft.Client/Build/Common/Tutorial/FullTutorial.cpp index e64e68514..5ccbf067e 100644 --- a/Minecraft.Client/Build/Common/Tutorial/FullTutorial.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/FullTutorial.cpp @@ -159,7 +159,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea"); if(area != NULL) { - vector *areaConstraints = new vector(); + std::vector *areaConstraints = new std::vector(); areaConstraints->push_back( new AreaConstraint( IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); addTask(e_Tutorial_State_Gameplay, new AreaTask(e_Tutorial_State_Gameplay,this, areaConstraints) ); } @@ -413,12 +413,12 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) AABB *exitArea = app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea"); if(exitArea != NULL) { - vector *creativeExitAreaConstraints = new vector(); + std::vector *creativeExitAreaConstraints = new std::vector(); creativeExitAreaConstraints->push_back( new AreaConstraint( -1, exitArea->x0,exitArea->y0,exitArea->z0,exitArea->x1,exitArea->y1,exitArea->z1,true,false) ); creativeFinalTask->AddTask( new AreaTask(e_Tutorial_State_CreativeMode, this, creativeExitAreaConstraints,IDS_TUTORIAL_TASK_CREATIVE_EXIT,AreaTask::eAreaTaskCompletion_CompleteOnConstraintsSatisfied) ); } - vector *creativeAreaConstraints = new vector(); + std::vector *creativeAreaConstraints = new std::vector(); creativeAreaConstraints->push_back( new AreaConstraint( IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); creativeFinalTask->AddTask( new AreaTask(e_Tutorial_State_CreativeMode, this, creativeAreaConstraints) ); diff --git a/Minecraft.Client/Build/Common/Tutorial/FullTutorialActiveTask.h b/Minecraft.Client/Build/Common/Tutorial/FullTutorialActiveTask.h index 5aa056103..8f827d593 100644 --- a/Minecraft.Client/Build/Common/Tutorial/FullTutorialActiveTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/FullTutorialActiveTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" diff --git a/Minecraft.Client/Build/Common/Tutorial/InfoTask.h b/Minecraft.Client/Build/Common/Tutorial/InfoTask.h index e072038b7..1362ad52c 100644 --- a/Minecraft.Client/Build/Common/Tutorial/InfoTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/InfoTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" @@ -7,7 +7,7 @@ using namespace std; class InfoTask : public TutorialTask { private: - unordered_map completedMappings; + std::unordered_map completedMappings; ETelemetryChallenges m_eTelemetryEvent; diff --git a/Minecraft.Client/Build/Common/Tutorial/LookAtEntityHint.h b/Minecraft.Client/Build/Common/Tutorial/LookAtEntityHint.h index 1c4629a89..beb5f1e1f 100644 --- a/Minecraft.Client/Build/Common/Tutorial/LookAtEntityHint.h +++ b/Minecraft.Client/Build/Common/Tutorial/LookAtEntityHint.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../../../../Minecraft.World/Util/Class.h" #include "TutorialHint.h" diff --git a/Minecraft.Client/Build/Common/Tutorial/LookAtTileHint.h b/Minecraft.Client/Build/Common/Tutorial/LookAtTileHint.h index 34ec1b957..856dbb63f 100644 --- a/Minecraft.Client/Build/Common/Tutorial/LookAtTileHint.h +++ b/Minecraft.Client/Build/Common/Tutorial/LookAtTileHint.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialHint.h" diff --git a/Minecraft.Client/Build/Common/Tutorial/PickupTask.cpp b/Minecraft.Client/Build/Common/Tutorial/PickupTask.cpp index 10268a13a..a1648e430 100644 --- a/Minecraft.Client/Build/Common/Tutorial/PickupTask.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/PickupTask.cpp @@ -1,7 +1,7 @@ #include "../../../../Minecraft.World/Build/stdafx.h" #include "PickupTask.h" -void PickupTask::onTake(shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) +void PickupTask::onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { if(item->id == m_itemId) { diff --git a/Minecraft.Client/Build/Common/Tutorial/PickupTask.h b/Minecraft.Client/Build/Common/Tutorial/PickupTask.h index 68e1d4793..91b800212 100644 --- a/Minecraft.Client/Build/Common/Tutorial/PickupTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/PickupTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" class ItemInstance; @@ -8,7 +8,7 @@ class PickupTask : public TutorialTask { public: PickupTask( int itemId, unsigned int quantity, int auxValue, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = NULL, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, std::vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_itemId( itemId), @@ -17,7 +17,7 @@ public: {} virtual bool isCompleted() { return bIsCompleted; } - virtual void onTake(shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); + virtual void onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); private: int m_itemId; diff --git a/Minecraft.Client/Build/Common/Tutorial/ProcedureCompoundTask.cpp b/Minecraft.Client/Build/Common/Tutorial/ProcedureCompoundTask.cpp index 88f906dce..a5fad5497 100644 --- a/Minecraft.Client/Build/Common/Tutorial/ProcedureCompoundTask.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/ProcedureCompoundTask.cpp @@ -111,7 +111,7 @@ bool ProcedureCompoundTask::isCompleted() return allCompleted; } -void ProcedureCompoundTask::onCrafted(shared_ptr item) +void ProcedureCompoundTask::onCrafted(std::shared_ptr item) { AUTO_VAR(itEnd, m_taskSequence.end()); for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) @@ -222,7 +222,7 @@ bool ProcedureCompoundTask::AllowFade() return allowFade; } -void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr item, int x, int y, int z,bool bTestUseOnly) +void ProcedureCompoundTask::useItemOn(Level *level, std::shared_ptr item, int x, int y, int z,bool bTestUseOnly) { AUTO_VAR(itEnd, m_taskSequence.end()); for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) @@ -232,7 +232,7 @@ void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr ite } } -void ProcedureCompoundTask::useItem(shared_ptr item, bool bTestUseOnly) +void ProcedureCompoundTask::useItem(std::shared_ptr item, bool bTestUseOnly) { AUTO_VAR(itEnd, m_taskSequence.end()); for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) @@ -242,7 +242,7 @@ void ProcedureCompoundTask::useItem(shared_ptr item, bool bTestUse } } -void ProcedureCompoundTask::onTake(shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) +void ProcedureCompoundTask::onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { AUTO_VAR(itEnd, m_taskSequence.end()); for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) diff --git a/Minecraft.Client/Build/Common/Tutorial/ProcedureCompoundTask.h b/Minecraft.Client/Build/Common/Tutorial/ProcedureCompoundTask.h index 36b327984..9be159aad 100644 --- a/Minecraft.Client/Build/Common/Tutorial/ProcedureCompoundTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/ProcedureCompoundTask.h @@ -18,7 +18,7 @@ public: virtual int getDescriptionId(); virtual int getPromptId(); virtual bool isCompleted(); - virtual void onCrafted(shared_ptr item); + virtual void onCrafted(std::shared_ptr item); virtual void handleUIInput(int iAction); virtual void setAsCurrentTask(bool active = true); virtual bool ShowMinimumTime(); @@ -26,11 +26,11 @@ public: virtual void setShownForMinimumTime(); virtual bool AllowFade(); - virtual void useItemOn(Level *level, shared_ptr item, int x, int y, int z, bool bTestUseOnly=false); - virtual void useItem(shared_ptr item, bool bTestUseOnly=false); - virtual void onTake(shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); + virtual void useItemOn(Level *level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly=false); + virtual void useItem(std::shared_ptr item, bool bTestUseOnly=false); + virtual void onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); virtual void onStateChange(eTutorial_State newState); private: - vector m_taskSequence; + std::vector m_taskSequence; }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/Tutorial/ProgressFlagTask.h b/Minecraft.Client/Build/Common/Tutorial/ProgressFlagTask.h index b96e1bc01..1d51c1751 100644 --- a/Minecraft.Client/Build/Common/Tutorial/ProgressFlagTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/ProgressFlagTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "Tutorial.h" #include "TutorialTask.h" diff --git a/Minecraft.Client/Build/Common/Tutorial/StatTask.h b/Minecraft.Client/Build/Common/Tutorial/StatTask.h index ba38f00a4..95af208a8 100644 --- a/Minecraft.Client/Build/Common/Tutorial/StatTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/StatTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" diff --git a/Minecraft.Client/Build/Common/Tutorial/StateChangeTask.h b/Minecraft.Client/Build/Common/Tutorial/StateChangeTask.h index fb9e63966..89602bf1a 100644 --- a/Minecraft.Client/Build/Common/Tutorial/StateChangeTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/StateChangeTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "Tutorial.h" #include "TutorialTask.h" @@ -9,7 +9,7 @@ private: eTutorial_State m_state; public: StateChangeTask(eTutorial_State state, - Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, vector *inConstraints = NULL, + Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, std::vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_state( state ) diff --git a/Minecraft.Client/Build/Common/Tutorial/TakeItemHint.cpp b/Minecraft.Client/Build/Common/Tutorial/TakeItemHint.cpp index c39f783a2..618eab631 100644 --- a/Minecraft.Client/Build/Common/Tutorial/TakeItemHint.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/TakeItemHint.cpp @@ -17,7 +17,7 @@ TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], u } } -bool TakeItemHint::onTake(shared_ptr item) +bool TakeItemHint::onTake(std::shared_ptr item) { if(item != NULL) { diff --git a/Minecraft.Client/Build/Common/Tutorial/TakeItemHint.h b/Minecraft.Client/Build/Common/Tutorial/TakeItemHint.h index f001d4c7a..a7641f64b 100644 --- a/Minecraft.Client/Build/Common/Tutorial/TakeItemHint.h +++ b/Minecraft.Client/Build/Common/Tutorial/TakeItemHint.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialHint.h" @@ -15,5 +15,5 @@ public: TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], unsigned int itemsLength); ~TakeItemHint(); - virtual bool onTake( shared_ptr item ); + virtual bool onTake( std::shared_ptr item ); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/Tutorial/Tutorial.cpp b/Minecraft.Client/Build/Common/Tutorial/Tutorial.cpp index 8f9e09935..d6e529a95 100644 --- a/Minecraft.Client/Build/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/Tutorial.cpp @@ -18,7 +18,7 @@ #include "TutorialConstraints.h" #include "TutorialHints.h" -vector Tutorial::s_completableTasks; +std::vector Tutorial::s_completableTasks; int Tutorial::m_iTutorialHintDelayTime = 14000; @@ -1003,7 +1003,7 @@ Tutorial::~Tutorial() { delete (*it); } - for(unordered_map::iterator it = messages.begin(); it != messages.end(); ++it) + for(std::unordered_map::iterator it = messages.begin(); it != messages.end(); ++it) { delete (*it).second; } @@ -1380,7 +1380,7 @@ void Tutorial::tick() while(itCon != constraintsToRemove[m_CurrentState].end() ) { constraints[e_Tutorial_State_Gameplay].push_back(itCon->first); - constraintsToRemove[e_Tutorial_State_Gameplay].push_back( pair(itCon->first, itCon->second) ); + constraintsToRemove[e_Tutorial_State_Gameplay].push_back( std::pair(itCon->first, itCon->second) ); constraints[m_CurrentState].erase( find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), itCon->first) ); itCon = constraintsToRemove[m_CurrentState].erase(itCon); @@ -1557,7 +1557,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) if(!message->m_replaceCurrent) lastMessageTime = GetTickCount(); - wstring text; + std::wstring text; if(!message->m_messageString.empty()) { text = message->m_messageString; @@ -1568,11 +1568,11 @@ bool Tutorial::setMessage(PopupMessageDetails *message) if( it != messages.end() && it->second != NULL ) { TutorialMessage *messageString = it->second; - text = wstring( messageString->getMessageForDisplay() ); + text = std::wstring( messageString->getMessageForDisplay() ); } else { - text = wstring( app.GetString(message->m_messageId) ); + text = std::wstring( app.GetString(message->m_messageId) ); } } @@ -1590,7 +1590,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) } } - wstring title; + std::wstring title; TutorialPopupInfo popupInfo; popupInfo.interactScene = m_UIScene; popupInfo.desc = text.c_str(); @@ -1601,7 +1601,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) popupInfo.tutorial = this; if( !message->m_titleString.empty() || message->m_titleId > 0 ) { - if(message->m_titleString.empty()) title = wstring( app.GetString(message->m_titleId) ); + if(message->m_titleString.empty()) title = std::wstring( app.GetString(message->m_titleId) ); else title = message->m_titleString; popupInfo.title = title.c_str(); @@ -1656,7 +1656,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message) return messageShown; } -bool Tutorial::setMessage(const wstring &messageString, int icon, int auxValue) +bool Tutorial::setMessage(const std::wstring &messageString, int icon, int auxValue) { PopupMessageDetails *message = new PopupMessageDetails(); message->m_messageString = messageString; @@ -1681,7 +1681,7 @@ void Tutorial::showTutorialPopup(bool show) } } -void Tutorial::useItemOn(Level *level, shared_ptr item, int x, int y, int z, bool bTestUseOnly) +void Tutorial::useItemOn(Level *level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly) { for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) { @@ -1690,7 +1690,7 @@ void Tutorial::useItemOn(Level *level, shared_ptr item, int x, int } } -void Tutorial::useItemOn(shared_ptr item, bool bTestUseOnly) +void Tutorial::useItemOn(std::shared_ptr item, bool bTestUseOnly) { for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) { @@ -1699,7 +1699,7 @@ void Tutorial::useItemOn(shared_ptr item, bool bTestUseOnly) } } -void Tutorial::completeUsingItem(shared_ptr item) +void Tutorial::completeUsingItem(std::shared_ptr item) { for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) { @@ -1718,7 +1718,7 @@ void Tutorial::completeUsingItem(shared_ptr item) } } -void Tutorial::startDestroyBlock(shared_ptr item, Tile *tile) +void Tutorial::startDestroyBlock(std::shared_ptr item, Tile *tile) { int hintNeeded = -1; for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) @@ -1754,7 +1754,7 @@ void Tutorial::destroyBlock(Tile *tile) } } -void Tutorial::attack(shared_ptr player, shared_ptr entity) +void Tutorial::attack(std::shared_ptr player, std::shared_ptr entity) { int hintNeeded = -1; for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) @@ -1772,7 +1772,7 @@ void Tutorial::attack(shared_ptr player, shared_ptr entity) } } -void Tutorial::itemDamaged(shared_ptr item) +void Tutorial::itemDamaged(std::shared_ptr item) { int hintNeeded = -1; for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) @@ -1803,7 +1803,7 @@ void Tutorial::handleUIInput(int iAction) currentTask[m_CurrentState]->handleUIInput(iAction); } -void Tutorial::createItemSelected(shared_ptr item, bool canMake) +void Tutorial::createItemSelected(std::shared_ptr item, bool canMake) { int hintNeeded = -1; for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) @@ -1821,7 +1821,7 @@ void Tutorial::createItemSelected(shared_ptr item, bool canMake) } } -void Tutorial::onCrafted(shared_ptr item) +void Tutorial::onCrafted(std::shared_ptr item) { for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state) { @@ -1833,7 +1833,7 @@ void Tutorial::onCrafted(shared_ptr item) } } -void Tutorial::onTake(shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) +void Tutorial::onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { if( !m_hintDisplayed ) { @@ -1860,7 +1860,7 @@ void Tutorial::onTake(shared_ptr item, unsigned int invItemCountAn } } -void Tutorial::onSelectedItemChanged(shared_ptr item) +void Tutorial::onSelectedItemChanged(std::shared_ptr item) { // We only handle this if we are in a state that allows changing based on the selected item // Menus and states like riding in a minecart will NOT allow this @@ -1976,7 +1976,7 @@ bool Tutorial::isInputAllowed(int mapping) return allowed; } -vector *Tutorial::getTasks() +std::vector *Tutorial::getTasks() { return &tasks; } @@ -2024,7 +2024,7 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa else if(delayedRemove) { c->setQueuedForRemoval(true); - constraintsToRemove[m_CurrentState].push_back( pair(c, 0) ); + constraintsToRemove[m_CurrentState].push_back( std::pair(c, 0) ); } else { diff --git a/Minecraft.Client/Build/Common/Tutorial/Tutorial.h b/Minecraft.Client/Build/Common/Tutorial/Tutorial.h index aaaaba0a7..3f06df12f 100644 --- a/Minecraft.Client/Build/Common/Tutorial/Tutorial.h +++ b/Minecraft.Client/Build/Common/Tutorial/Tutorial.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" #include "TutorialConstraint.h" #include "TutorialHint.h" @@ -27,9 +27,9 @@ public: int m_messageId; int m_promptId; int m_titleId; - wstring m_messageString; - wstring m_promptString; - wstring m_titleString; + std::wstring m_messageString; + std::wstring m_promptString; + std::wstring m_titleString; int m_icon; int m_iAuxVal; bool m_allowFade; @@ -78,13 +78,13 @@ private: int m_firstTickTime; protected: - unordered_map messages; - vector m_globalConstraints; - vector constraints[e_Tutorial_State_Max]; - vector< pair > constraintsToRemove[e_Tutorial_State_Max]; - vector tasks; // We store a copy of the tasks for the main gameplay tutorial so that we could display an overview menu - vector activeTasks[e_Tutorial_State_Max]; - vector hints[e_Tutorial_State_Max]; + std::unordered_map messages; + std::vector m_globalConstraints; + std::vector constraints[e_Tutorial_State_Max]; + std::vector< std::pair > constraintsToRemove[e_Tutorial_State_Max]; + std::vector tasks; // We store a copy of the tasks for the main gameplay tutorial so that we could display an overview menu + std::vector activeTasks[e_Tutorial_State_Max]; + std::vector hints[e_Tutorial_State_Max]; TutorialTask *currentTask[e_Tutorial_State_Max]; TutorialConstraint *currentFailedConstraint[e_Tutorial_State_Max]; @@ -147,23 +147,23 @@ public: bool setMessage(PopupMessageDetails *message); bool setMessage(TutorialHint *hint, PopupMessageDetails *message); - bool setMessage(const wstring &message, int icon, int auxValue); + bool setMessage(const std::wstring &message, int icon, int auxValue); void showTutorialPopup(bool show); - void useItemOn(Level *level, shared_ptr item, int x, int y, int z,bool bTestUseOnly=false); - void useItemOn(shared_ptr item, bool bTestUseOnly=false); - void completeUsingItem(shared_ptr item); - void startDestroyBlock(shared_ptr item, Tile *tile); + void useItemOn(Level *level, std::shared_ptr item, int x, int y, int z,bool bTestUseOnly=false); + void useItemOn(std::shared_ptr item, bool bTestUseOnly=false); + void completeUsingItem(std::shared_ptr item); + void startDestroyBlock(std::shared_ptr item, Tile *tile); void destroyBlock(Tile *tile); - void attack(shared_ptr player, shared_ptr entity); - void itemDamaged(shared_ptr item); + void attack(std::shared_ptr player, std::shared_ptr entity); + void itemDamaged(std::shared_ptr item); void handleUIInput(int iAction); - void createItemSelected(shared_ptr item, bool canMake); - void onCrafted(shared_ptr item); - void onTake(shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); - void onSelectedItemChanged(shared_ptr item); + void createItemSelected(std::shared_ptr item, bool canMake); + void onCrafted(std::shared_ptr item); + void onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux); + void onSelectedItemChanged(std::shared_ptr item); void onLookAt(int id, int iData=0); void onLookAtEntity(eINSTANCEOF type); void onEffectChanged(MobEffect *effect, bool bRemoved=false); @@ -181,7 +181,7 @@ public: int GetTutorialDisplayMessageTime() {return m_iTutorialDisplayMessageTime;} // Only for the main gameplay tutorial - vector *getTasks(); + std::vector *getTasks(); unsigned int getCurrentTaskIndex(); #ifdef _XBOX @@ -193,7 +193,7 @@ public: // These are required so that we have a consistent mapping of the completion bits stored in the profile data static void staticCtor(); - static vector s_completableTasks; + static std::vector s_completableTasks; static void debugResetPlayerSavedProgress(int iPad); }; diff --git a/Minecraft.Client/Build/Common/Tutorial/TutorialHint.cpp b/Minecraft.Client/Build/Common/Tutorial/TutorialHint.cpp index cd4f98f39..22a9ad555 100644 --- a/Minecraft.Client/Build/Common/Tutorial/TutorialHint.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/TutorialHint.cpp @@ -14,7 +14,7 @@ TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptio tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients); } -int TutorialHint::startDestroyBlock(shared_ptr item, Tile *tile) +int TutorialHint::startDestroyBlock(std::shared_ptr item, Tile *tile) { int returnVal = -1; switch(m_type) @@ -59,7 +59,7 @@ int TutorialHint::destroyBlock(Tile *tile) return returnVal; } -int TutorialHint::attack(shared_ptr item, shared_ptr entity) +int TutorialHint::attack(std::shared_ptr item, std::shared_ptr entity) { /* switch(m_type) @@ -71,7 +71,7 @@ int TutorialHint::attack(shared_ptr item, shared_ptr entit return -1; } -int TutorialHint::createItemSelected(shared_ptr item, bool canMake) +int TutorialHint::createItemSelected(std::shared_ptr item, bool canMake) { int returnVal = -1; switch(m_type) @@ -86,7 +86,7 @@ int TutorialHint::createItemSelected(shared_ptr item, bool canMake return returnVal; } -int TutorialHint::itemDamaged(shared_ptr item) +int TutorialHint::itemDamaged(std::shared_ptr item) { int returnVal = -1; switch(m_type) @@ -100,7 +100,7 @@ int TutorialHint::itemDamaged(shared_ptr item) return returnVal; } -bool TutorialHint::onTake( shared_ptr item ) +bool TutorialHint::onTake( std::shared_ptr item ) { return false; } diff --git a/Minecraft.Client/Build/Common/Tutorial/TutorialHint.h b/Minecraft.Client/Build/Common/Tutorial/TutorialHint.h index 8ca543cc7..191b021f3 100644 --- a/Minecraft.Client/Build/Common/Tutorial/TutorialHint.h +++ b/Minecraft.Client/Build/Common/Tutorial/TutorialHint.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialEnum.h" @@ -40,12 +40,12 @@ public: eTutorial_Hint getId() { return m_id; } - virtual int startDestroyBlock(shared_ptr item, Tile *tile); + virtual int startDestroyBlock(std::shared_ptr item, Tile *tile); virtual int destroyBlock(Tile *tile); - virtual int attack(shared_ptr item, shared_ptr entity); - virtual int createItemSelected(shared_ptr item, bool canMake); - virtual int itemDamaged(shared_ptr item); - virtual bool onTake( shared_ptr item ); + virtual int attack(std::shared_ptr item, std::shared_ptr entity); + virtual int createItemSelected(std::shared_ptr item, bool canMake); + virtual int itemDamaged(std::shared_ptr item); + virtual bool onTake( std::shared_ptr item ); virtual bool onLookAt(int id, int iData=0); virtual bool onLookAtEntity(eINSTANCEOF type); virtual int tick(); diff --git a/Minecraft.Client/Build/Common/Tutorial/TutorialMode.cpp b/Minecraft.Client/Build/Common/Tutorial/TutorialMode.cpp index 26b43de7b..014ff6554 100644 --- a/Minecraft.Client/Build/Common/Tutorial/TutorialMode.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/TutorialMode.cpp @@ -36,7 +36,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face) int t = minecraft->level->getTile(x, y, z); tutorial->destroyBlock(Tile::tiles[t]); } - shared_ptr item = minecraft->player->getSelectedItem(); + std::shared_ptr item = minecraft->player->getSelectedItem(); int damageBefore; if(item != NULL) { @@ -78,7 +78,7 @@ void TutorialMode::tick() */ } -bool TutorialMode::useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem) +bool TutorialMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem) { bool haveItem = false; int itemCount = 0; @@ -110,7 +110,7 @@ bool TutorialMode::useItemOn(shared_ptr player, Level *level, shared_ptr return result; } -void TutorialMode::attack(shared_ptr player, shared_ptr entity) +void TutorialMode::attack(std::shared_ptr player, std::shared_ptr entity) { if(!tutorial->m_allTutorialsComplete) tutorial->attack(player, entity); diff --git a/Minecraft.Client/Build/Common/Tutorial/TutorialMode.h b/Minecraft.Client/Build/Common/Tutorial/TutorialMode.h index 1a13252c6..b7694d267 100644 --- a/Minecraft.Client/Build/Common/Tutorial/TutorialMode.h +++ b/Minecraft.Client/Build/Common/Tutorial/TutorialMode.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../../../Player/MultiPlayerGameMode.h" #include "Tutorial.h" @@ -19,8 +19,8 @@ public: virtual void startDestroyBlock(int x, int y, int z, int face); virtual bool destroyBlock(int x, int y, int z, int face); virtual void tick(); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); - virtual void attack(shared_ptr player, shared_ptr entity); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); + virtual void attack(std::shared_ptr player, std::shared_ptr entity); virtual bool isInputAllowed(int mapping); diff --git a/Minecraft.Client/Build/Common/Tutorial/TutorialTask.cpp b/Minecraft.Client/Build/Common/Tutorial/TutorialTask.cpp index eba9cdb72..4507dc25e 100644 --- a/Minecraft.Client/Build/Common/Tutorial/TutorialTask.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/TutorialTask.cpp @@ -3,7 +3,7 @@ #include "TutorialConstraints.h" #include "TutorialTask.h" -TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, vector *inConstraints, +TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, std::vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) : tutorial( tutorial ), descriptionId( descriptionId ), m_promptId( -1 ), enablePreCompletion( enablePreCompletion ), areConstraintsEnabled( false ), bIsCompleted( false ), bHasBeenActivated( false ), diff --git a/Minecraft.Client/Build/Common/Tutorial/TutorialTask.h b/Minecraft.Client/Build/Common/Tutorial/TutorialTask.h index 92cb59990..c3074b9dc 100644 --- a/Minecraft.Client/Build/Common/Tutorial/TutorialTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/TutorialTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialEnum.h" class Level; @@ -30,10 +30,10 @@ protected: protected: bool bIsCompleted; bool m_bShownForMinimumTime; - vector constraints; + std::vector constraints; bool areConstraintsEnabled; public: - TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, vector *inConstraints, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); + TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, std::vector *inConstraints, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); virtual ~TutorialTask(); virtual int getDescriptionId() { return descriptionId; } @@ -52,12 +52,12 @@ public: bool TaskReminders() { return m_bTaskReminders;} virtual bool ShowMinimumTime() { return m_bShowMinimumTime;} - virtual void useItemOn(Level *level, shared_ptr item, int x, int y, int z, bool bTestUseOnly=false) { } - virtual void useItem(shared_ptr item,bool bTestUseOnly=false) { } - virtual void completeUsingItem(shared_ptr item) { } + virtual void useItemOn(Level *level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly=false) { } + virtual void useItem(std::shared_ptr item,bool bTestUseOnly=false) { } + virtual void completeUsingItem(std::shared_ptr item) { } virtual void handleUIInput(int iAction) { } - virtual void onCrafted(shared_ptr item) { } - virtual void onTake(shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { } + virtual void onCrafted(std::shared_ptr item) { } + virtual void onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { } virtual void onStateChange(eTutorial_State newState) { } virtual void onEffectChanged(MobEffect *effect, bool bRemoved=false) { } }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/Tutorial/UseItemTask.cpp b/Minecraft.Client/Build/Common/Tutorial/UseItemTask.cpp index 2cbb1f18d..b9b0d4e33 100644 --- a/Minecraft.Client/Build/Common/Tutorial/UseItemTask.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/UseItemTask.cpp @@ -5,7 +5,7 @@ #include "UseItemTask.h" UseItemTask::UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion, vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) + bool enablePreCompletion, std::vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) : TutorialTask( tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, bTaskReminders ), itemId( itemId ) { @@ -16,7 +16,7 @@ bool UseItemTask::isCompleted() return bIsCompleted; } -void UseItemTask::useItem(shared_ptr item,bool bTestUseOnly) +void UseItemTask::useItem(std::shared_ptr item,bool bTestUseOnly) { if(bTestUseOnly) return; diff --git a/Minecraft.Client/Build/Common/Tutorial/UseItemTask.h b/Minecraft.Client/Build/Common/Tutorial/UseItemTask.h index 46d71be47..d86cd45e5 100644 --- a/Minecraft.Client/Build/Common/Tutorial/UseItemTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/UseItemTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" @@ -14,7 +14,7 @@ private: public: UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); + bool enablePreCompletion = false, std::vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); virtual bool isCompleted(); - virtual void useItem(shared_ptr item, bool bTestUseOnly=false); + virtual void useItem(std::shared_ptr item, bool bTestUseOnly=false); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/Tutorial/UseTileTask.cpp b/Minecraft.Client/Build/Common/Tutorial/UseTileTask.cpp index 191c37e07..0e21de012 100644 --- a/Minecraft.Client/Build/Common/Tutorial/UseTileTask.cpp +++ b/Minecraft.Client/Build/Common/Tutorial/UseTileTask.cpp @@ -5,7 +5,7 @@ #include "UseTileTask.h" UseTileTask::UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion, vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) + bool enablePreCompletion, std::vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) : TutorialTask( tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, bTaskReminders ), x( x ), y( y ), z( z ), tileId( tileId ) { @@ -13,7 +13,7 @@ UseTileTask::UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutori } UseTileTask::UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion, vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) + bool enablePreCompletion, std::vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) : TutorialTask( tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, bTaskReminders ), tileId( tileId ) { @@ -25,7 +25,7 @@ bool UseTileTask::isCompleted() return bIsCompleted; } -void UseTileTask::useItemOn(Level *level, shared_ptr item, int x, int y, int z,bool bTestUseOnly) +void UseTileTask::useItemOn(Level *level, std::shared_ptr item, int x, int y, int z,bool bTestUseOnly) { if(bTestUseOnly) return; diff --git a/Minecraft.Client/Build/Common/Tutorial/UseTileTask.h b/Minecraft.Client/Build/Common/Tutorial/UseTileTask.h index 74b3a40cc..7d2467086 100644 --- a/Minecraft.Client/Build/Common/Tutorial/UseTileTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/UseTileTask.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "TutorialTask.h" @@ -16,9 +16,9 @@ private: public: UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); + bool enablePreCompletion = false, std::vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true); + bool enablePreCompletion = false, std::vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true); virtual bool isCompleted(); - virtual void useItemOn(Level *level, shared_ptr item, int x, int y, int z, bool bTestUseOnly=false); + virtual void useItemOn(Level *level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly=false); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/Tutorial/XuiCraftingTask.h b/Minecraft.Client/Build/Common/Tutorial/XuiCraftingTask.h index fff91c833..eae78a54c 100644 --- a/Minecraft.Client/Build/Common/Tutorial/XuiCraftingTask.h +++ b/Minecraft.Client/Build/Common/Tutorial/XuiCraftingTask.h @@ -12,7 +12,7 @@ public: }; // Select group - XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, vector *inConstraints = NULL, + XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, std::vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_group(groupToSelect), @@ -20,7 +20,7 @@ public: {} // Select Item - XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, vector *inConstraints = NULL, + XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, std::vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_item(itemId), diff --git a/Minecraft.Client/Build/Common/UI/IUIController.h b/Minecraft.Client/Build/Common/UI/IUIController.h index 319185d83..b6ecc91f2 100644 --- a/Minecraft.Client/Build/Common/UI/IUIController.h +++ b/Minecraft.Client/Build/Common/UI/IUIController.h @@ -39,7 +39,7 @@ public: virtual void ShowUIDebugMarketingGuide(bool show) {} virtual void DisplayGamertag(unsigned int iPad, bool show) = 0; - virtual void SetSelectedItem(unsigned int iPad, const wstring &name) = 0; + virtual void SetSelectedItem(unsigned int iPad, const std::wstring &name) = 0; virtual void UpdateSelectedItemPos(unsigned int iPad) = 0; virtual void HandleDLCMountingComplete() = 0; diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Build/Common/UI/IUIScene_AbstractContainerMenu.cpp index acb96a88e..1faba8d2c 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -703,11 +703,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick() // Determine appropriate context sensitive tool tips, based on what is carried on the pointer and what is under the pointer. // What are we carrying on pointer. - shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; - shared_ptr carriedItem = nullptr; + std::shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; + std::shared_ptr carriedItem = nullptr; if(player != NULL) carriedItem = player->inventory->getCarried(); - shared_ptr slotItem = nullptr; + std::shared_ptr slotItem = nullptr; Slot *slot = NULL; int slotIndex = 0; if(bPointerIsOverSlot) @@ -767,14 +767,14 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if( bPointerIsOverSlot && bSlotHasItem ) { - vector unformattedStrings; - wstring desc = GetItemDescription( slot, unformattedStrings ); + std::vector unformattedStrings; + std::wstring desc = GetItemDescription( slot, unformattedStrings ); SetPointerText(desc, unformattedStrings, slot != m_lastPointerLabelSlot); m_lastPointerLabelSlot = slot; } else { - vector unformattedStrings; + std::vector unformattedStrings; SetPointerText(L"", unformattedStrings, false); m_lastPointerLabelSlot = NULL; } @@ -888,7 +888,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if((eSectionUnderPointer==eSectionInventoryUsing)||(eSectionUnderPointer==eSectionInventoryInventory)) { - shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); + std::shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); ArmorRecipes::_eArmorType eArmourType=ArmorRecipes::GetArmorType(item->id); if(eArmourType==ArmorRecipes::eArmorType_None) @@ -951,7 +951,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() else if((eSectionUnderPointer==eSectionFurnaceUsing)||(eSectionUnderPointer==eSectionFurnaceInventory)) { // Get the info on this item. - shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); + std::shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); bool bValidFuel = FurnaceTileEntity::isFuel(item); bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL; @@ -961,7 +961,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if(!isSlotEmpty(eSectionFurnaceIngredient,0)) { // is it the same as this item - shared_ptr IngredientItem = getSlotItem(eSectionFurnaceIngredient,0); + std::shared_ptr IngredientItem = getSlotItem(eSectionFurnaceIngredient,0); if(IngredientItem->id == item->id) { buttonY = eToolTipQuickMoveIngredient; @@ -990,7 +990,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if(!isSlotEmpty(eSectionFurnaceFuel,0)) { // is it the same as this item - shared_ptr fuelItem = getSlotItem(eSectionFurnaceFuel,0); + std::shared_ptr fuelItem = getSlotItem(eSectionFurnaceFuel,0); if(fuelItem->id == item->id) { buttonY = eToolTipQuickMoveFuel; @@ -1001,7 +1001,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if(!isSlotEmpty(eSectionFurnaceIngredient,0)) { // is it the same as this item - shared_ptr IngredientItem = getSlotItem(eSectionFurnaceIngredient,0); + std::shared_ptr IngredientItem = getSlotItem(eSectionFurnaceIngredient,0); if(IngredientItem->id == item->id) { buttonY = eToolTipQuickMoveIngredient; @@ -1043,7 +1043,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() else if((eSectionUnderPointer==eSectionBrewingUsing)||(eSectionUnderPointer==eSectionBrewingInventory)) { // Get the info on this item. - shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); + std::shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); int iId=item->id; // valid ingredient? @@ -1061,7 +1061,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if(!isSlotEmpty(eSectionBrewingIngredient,0)) { // is it the same as this item - shared_ptr IngredientItem = getSlotItem(eSectionBrewingIngredient,0); + std::shared_ptr IngredientItem = getSlotItem(eSectionBrewingIngredient,0); if(IngredientItem->id == item->id) { buttonY = eToolTipQuickMoveIngredient; @@ -1103,7 +1103,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() else if((eSectionUnderPointer==eSectionEnchantUsing)||(eSectionUnderPointer==eSectionEnchantInventory)) { // Get the info on this item. - shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); + std::shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); int iId=item->id; // valid enchantable tool? @@ -1198,7 +1198,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() SetPointerOutsideMenu( false ); } - shared_ptr item = nullptr; + std::shared_ptr item = nullptr; if(bPointerIsOverSlot && bSlotHasItem) item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem, bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA, buttonX, buttonY, buttonRT); @@ -1409,7 +1409,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex); if ( bSlotHasItem ) { - shared_ptr item = getSlotItem(m_eCurrSection, currentIndex); + std::shared_ptr item = getSlotItem(m_eCurrSection, currentIndex); if( Minecraft::GetInstance()->localgameModes[iPad] != NULL ) { Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails; @@ -1568,7 +1568,7 @@ int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection) return currentIndex + getSectionStartOffset(eSection); } -bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr itemA, shared_ptr itemB) +bool IUIScene_AbstractContainerMenu::IsSameItemAs(std::shared_ptr itemA, std::shared_ptr itemB) { if(itemA == NULL || itemB == NULL) return false; @@ -1582,11 +1582,11 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot) if(slot != NULL && slot->hasItem()) { - shared_ptr item = slot->getItem(); + std::shared_ptr item = slot->getItem(); if ( item->isStackable() ) { int iCount = item->GetCount(); - int iMaxStackSize = min(item->getMaxStackSize(), slot->getMaxStackSize() ); + int iMaxStackSize = std::min(item->getMaxStackSize(), slot->getMaxStackSize() ); iResult = iMaxStackSize - iCount; @@ -1597,16 +1597,16 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot) return iResult; } -wstring IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot, vector &unformattedStrings) +std::wstring IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot, std::vector &unformattedStrings) { if(slot == NULL) return L""; - wstring desc = L""; - vector *strings = slot->getItem()->getHoverText(nullptr, false, unformattedStrings); + std::wstring desc = L""; + std::vector *strings = slot->getItem()->getHoverText(nullptr, false, unformattedStrings); bool firstLine = true; for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it) { - wstring thisString = *it; + std::wstring thisString = *it; if(!firstLine) { desc.append( L"
" ); diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_AbstractContainerMenu.h b/Minecraft.Client/Build/Common/UI/IUIScene_AbstractContainerMenu.h index bdb8bb4c8..33c49f689 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Build/Common/UI/IUIScene_AbstractContainerMenu.h @@ -200,18 +200,18 @@ protected: virtual void setSectionFocus(ESceneSection eSection, int iPad) = 0; virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y) = 0; virtual void setFocusToPointer(int iPad) = 0; - virtual void SetPointerText(const wstring &description, vector &unformattedStrings, bool newSlot) = 0; - virtual shared_ptr getSlotItem(ESceneSection eSection, int iSlot) = 0; + virtual void SetPointerText(const std::wstring &description, std::vector &unformattedStrings, bool newSlot) = 0; + virtual std::shared_ptr getSlotItem(ESceneSection eSection, int iSlot) = 0; virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0; virtual void adjustPointerForSafeZone() = 0; - virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, + virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { return false; } private: - bool IsSameItemAs(shared_ptr itemA, shared_ptr itemB); + bool IsSameItemAs(std::shared_ptr itemA, std::shared_ptr itemB); int GetEmptyStackSpace(Slot *slot); - wstring GetItemDescription(Slot *slot, vector &unformattedStrings); + std::wstring GetItemDescription(Slot *slot, std::vector &unformattedStrings); protected: diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_AnvilMenu.cpp b/Minecraft.Client/Build/Common/UI/IUIScene_AnvilMenu.cpp index 1f5c43ae7..b4d6726bc 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/IUIScene_AnvilMenu.cpp @@ -197,7 +197,7 @@ void IUIScene_AnvilMenu::handleTick() { Minecraft *pMinecraft = Minecraft::GetInstance(); bool canAfford = true; - wstring m_costString = L""; + std::wstring m_costString = L""; if(m_repairMenu->cost > 0) { @@ -216,7 +216,7 @@ void IUIScene_AnvilMenu::handleTick() wchar_t temp[256]; swprintf(temp, 256, costString, m_repairMenu->cost); m_costString = temp; - if(!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->mayPickup(dynamic_pointer_cast(m_inventory->player->shared_from_this()))) + if(!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->mayPickup(std::dynamic_pointer_cast(m_inventory->player->shared_from_this()))) { canAfford = false; } @@ -245,15 +245,15 @@ void IUIScene_AnvilMenu::updateItemName() ByteArrayOutputStream baos; DataOutputStream dos(&baos); dos.writeUTF(m_itemName); - Minecraft::GetInstance()->localplayers[getPad()]->connection->send(shared_ptr(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray()))); + Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::shared_ptr(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray()))); } -void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector > *items) +void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, std::vector > *items) { slotChanged(container, RepairMenu::INPUT_SLOT, container->getSlot(0)->getItem()); } -void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr item) +void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr item) { if (slotIndex == RepairMenu::INPUT_SLOT) { diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_AnvilMenu.h b/Minecraft.Client/Build/Common/UI/IUIScene_AnvilMenu.h index e4178d83e..a21210cfc 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_AnvilMenu.h +++ b/Minecraft.Client/Build/Common/UI/IUIScene_AnvilMenu.h @@ -16,9 +16,9 @@ class RepairMenu; class IUIScene_AnvilMenu : public virtual IUIScene_AbstractContainerMenu, public net_minecraft_world_inventory::ContainerListener { protected: - shared_ptr m_inventory; + std::shared_ptr m_inventory; RepairMenu *m_repairMenu; - wstring m_itemName; + std::wstring m_itemName; protected: IUIScene_AnvilMenu(); @@ -32,14 +32,14 @@ protected: // Anvil only virtual void handleEditNamePressed() = 0; - virtual void setEditNameValue(const wstring &name) = 0; + virtual void setEditNameValue(const std::wstring &name) = 0; virtual void setEditNameEditable(bool enabled) = 0; - virtual void setCostLabel(const wstring &label, bool canAfford) = 0; + virtual void setCostLabel(const std::wstring &label, bool canAfford) = 0; virtual void showCross(bool show) = 0; void updateItemName(); // ContainerListenr - void refreshContainer(AbstractContainerMenu *container, vector > *items); - void slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr item); + void refreshContainer(AbstractContainerMenu *container, std::vector > *items); + void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr item); void setContainerData(AbstractContainerMenu *container, int id, int value); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Build/Common/UI/IUIScene_CraftingMenu.cpp index d0421ad87..88b08751a 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/IUIScene_CraftingMenu.cpp @@ -208,7 +208,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) int iSlot=iVSlotIndexA[m_iCurrentSlotVIndex]; int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; - shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); + std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); if( pMinecraft->localgameModes[iPad] != NULL) @@ -244,7 +244,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) iSlot=0; } int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; - shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); + std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); if( pMinecraft->localgameModes[iPad] != NULL ) @@ -258,7 +258,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) if(pRecipeIngredientsRequired[iRecipe].bCanMake[iPad]) { - pTempItemInst->onCraftedBy(m_pPlayer->level, dynamic_pointer_cast( m_pPlayer->shared_from_this() ), pTempItemInst->count ); + pTempItemInst->onCraftedBy(m_pPlayer->level, std::dynamic_pointer_cast( m_pPlayer->shared_from_this() ), pTempItemInst->count ); // TODO 4J Stu - handleCraftItem should do a lot more than what it does, loads of the "can we craft" code should also probably be // shifted to the GameMode pMinecraft->localgameModes[iPad]->handleCraftItem(iRecipe,m_pPlayer); @@ -272,7 +272,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { for(int j=0;j ingItemInst = nullptr; + std::shared_ptr ingItemInst = nullptr; // do we need to remove a specific aux value? if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE) { @@ -291,7 +291,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) if (ingItemInst->getItem()->hasCraftingRemainingItem()) { // replace item with remaining result - m_pPlayer->inventory->add( shared_ptr( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) ); + m_pPlayer->inventory->add( std::shared_ptr( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) ); } } @@ -607,7 +607,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() { if (m_pPlayer->inventory->items[k] != NULL) { - wstring itemstring=m_pPlayer->inventory->items[k]->toString(); + std::wstring itemstring=m_pPlayer->inventory->items[k]->toString(); //printf("--- Player has "); OutputDebugStringW(itemstring.c_str()); @@ -624,10 +624,10 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() // for (int i = 0; i < iRecipeC; i++) // { - // shared_ptr pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL); + // std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL); // if (pTempItemInst != NULL) // { - // wstring itemstring=pTempItemInst->toString(); + // std::wstring itemstring=pTempItemInst->toString(); // // printf("Recipe [%d] = ",i); // OutputDebugStringW(itemstring.c_str()); @@ -761,7 +761,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() if(iHSlotBrushControl<=m_iCraftablesMaxHSlotC) { bool bFound=false; - shared_ptr pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr); + std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr); //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); int iID=pTempItemInst->getItem()->id; int iBaseType; @@ -835,7 +835,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() while((iIndex pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr); + std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr); assert(pTempItemInst->id!=0); unsigned int uiAlpha; @@ -903,7 +903,7 @@ void IUIScene_CraftingMenu::UpdateHighlight() { iSlot=0; } - shared_ptr pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr); + std::shared_ptr pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr); // special case for the torch coal/charcoal int id=pTempItemInstAdditional->getDescriptionId(); @@ -991,7 +991,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots() { if(i!=1) continue; } - shared_ptr pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr); + std::shared_ptr pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr); assert(pTempItemInstAdditional->id!=0); unsigned int uiAlpha; @@ -1057,7 +1057,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() int iBoxWidth=(m_iContainerType==RECIPE_TYPE_2x2)?2:3; int iRecipe=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]; bool bCanMakeRecipe = pRecipeIngredientsRequired[iRecipe].bCanMake[getPad()]; - shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); + std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); m_iIngredientsC=pRecipeIngredientsRequired[iRecipe].iIngC; @@ -1077,7 +1077,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() iAuxVal = 0xFF; } - shared_ptr itemInst= shared_ptr(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal)); + std::shared_ptr itemInst= std::shared_ptr(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal)); setIngredientDescriptionItem(getPad(),i,itemInst); setIngredientDescriptionRedBox(i,false); @@ -1141,7 +1141,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() { iAuxVal = 0xFF; } - shared_ptr itemInst= shared_ptr(new ItemInstance(id,1,iAuxVal)); + std::shared_ptr itemInst= std::shared_ptr(new ItemInstance(id,1,iAuxVal)); setIngredientSlotItem(getPad(),index,itemInst); // show the ingredients we don't have if we can't make the recipe if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L< pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr); + std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr); int iID=pTempItemInst->getItem()->id; int iAuxVal=pTempItemInst->getAuxValue(); int iBaseType; @@ -1257,8 +1257,8 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade) if(iIDSString>=0) { // this is an html control now, so set the font size and colour - //wstring wsText=app.GetString(iIDSString); - wstring wsText=app.FormatHTMLString(getPad(),app.GetString(iIDSString)); + //std::wstring wsText=app.GetString(iIDSString); + std::wstring wsText=app.FormatHTMLString(getPad(),app.GetString(iIDSString)); // 12 for splitscreen, 14 for normal EHTMLFontSize size = eHTMLSize_Normal; diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_CraftingMenu.h b/Minecraft.Client/Build/Common/UI/IUIScene_CraftingMenu.h index 98b952752..ca2fa20c3 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_CraftingMenu.h +++ b/Minecraft.Client/Build/Common/UI/IUIScene_CraftingMenu.h @@ -49,7 +49,7 @@ protected: int m_iCurrentSlotVIndex; int m_iRecipeC; int m_iContainerType; // 2x2 or 3x3 - shared_ptr m_pPlayer; + std::shared_ptr m_pPlayer; int m_iGroupIndex; int iVSlotIndexA[3]; // index of the v slots currently displayed @@ -96,13 +96,13 @@ protected: virtual void hideAllHSlots() = 0; virtual void hideAllVSlots() = 0; virtual void hideAllIngredientsSlots() = 0; - virtual void setCraftHSlotItem(int iPad, int iIndex, shared_ptr item, unsigned int uiAlpha) = 0; - virtual void setCraftVSlotItem(int iPad, int iIndex, shared_ptr item, unsigned int uiAlpha) = 0; - virtual void setCraftingOutputSlotItem(int iPad, shared_ptr item) = 0; + virtual void setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr item, unsigned int uiAlpha) = 0; + virtual void setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr item, unsigned int uiAlpha) = 0; + virtual void setCraftingOutputSlotItem(int iPad, std::shared_ptr item) = 0; virtual void setCraftingOutputSlotRedBox(bool show) = 0; - virtual void setIngredientSlotItem(int iPad, int index, shared_ptr item) = 0; + virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr item) = 0; virtual void setIngredientSlotRedBox(int index, bool show) = 0; - virtual void setIngredientDescriptionItem(int iPad, int index, shared_ptr item) = 0; + virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr item) = 0; virtual void setIngredientDescriptionRedBox(int index, bool show) = 0; virtual void setIngredientDescriptionText(int index, LPCWSTR text) = 0; virtual void setShowCraftHSlot(int iIndex, bool show) = 0; diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Build/Common/UI/IUIScene_CreativeMenu.cpp index a3fbfe7f5..0f43e4c88 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/IUIScene_CreativeMenu.cpp @@ -12,16 +12,16 @@ // 4J JEV - Images for each tab. IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = NULL; -vector< shared_ptr > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount]; +std::vector< std::shared_ptr > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount]; -#define ITEM(id) list->push_back( shared_ptr(new ItemInstance(id, 1, 0)) ); -#define ITEM_AUX(id, aux) list->push_back( shared_ptr(new ItemInstance(id, 1, aux)) ); +#define ITEM(id) list->push_back( std::shared_ptr(new ItemInstance(id, 1, 0)) ); +#define ITEM_AUX(id, aux) list->push_back( std::shared_ptr(new ItemInstance(id, 1, aux)) ); #define DEF(index) list = &categoryGroups[index]; void IUIScene_CreativeMenu::staticCtor() { - vector< shared_ptr > *list; + std::vector< std::shared_ptr > *list; // Building Blocks @@ -708,7 +708,7 @@ unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount() // 4J JEV - Item Picker Menu -IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr smp, shared_ptr inv ) : AbstractContainerMenu() +IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( std::shared_ptr smp, std::shared_ptr inv ) : AbstractContainerMenu() { inventory = inv; creativeContainer = smp; @@ -734,7 +734,7 @@ IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr player) +bool IUIScene_CreativeMenu::ItemPickerMenu::stillValid(std::shared_ptr player) { return true; } @@ -794,7 +794,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL qu Minecraft *pMinecraft = Minecraft::GetInstance(); for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i) { - shared_ptr newItem = m_menu->getSlot(i)->getItem(); + std::shared_ptr newItem = m_menu->getSlot(i)->getItem(); if(newItem != NULL) { @@ -813,7 +813,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q // Drop items. Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr playerInventory = pMinecraft->localplayers[iPad]->inventory; + std::shared_ptr playerInventory = pMinecraft->localplayers[iPad]->inventory; if (playerInventory->getCarried() != NULL) { if (buttonNum == 0) @@ -823,7 +823,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q } if (buttonNum == 1) { - shared_ptr removedItem = playerInventory->getCarried()->remove(1); + std::shared_ptr removedItem = playerInventory->getCarried()->remove(1); pMinecraft->localgameModes[iPad]->handleCreativeModeItemDrop(removedItem); if (playerInventory->getCarried()->count == 0) playerInventory->setCarried(nullptr); } @@ -894,9 +894,9 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu if (buttonNum == 0) { - shared_ptr playerInventory = pMinecraft->localplayers[getPad()]->inventory; - shared_ptr carried = playerInventory->getCarried(); - shared_ptr clicked = m_menu->getSlot(currentIndex)->getItem(); + std::shared_ptr playerInventory = pMinecraft->localplayers[getPad()]->inventory; + std::shared_ptr carried = playerInventory->getCarried(); + std::shared_ptr clicked = m_menu->getSlot(currentIndex)->getItem(); if (clicked != NULL) { playerInventory->setCarried(ItemInstance::clone(clicked)); @@ -928,7 +928,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu quickKeyHeld = FALSE; } m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]); - shared_ptr newItem = m_menu->getSlot(currentIndex)->getItem(); + std::shared_ptr newItem = m_menu->getSlot(currentIndex)->getItem(); // call this function to synchronize multiplayer item bar pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - (int)m_menu->slots->size() + 9 + InventoryMenu::USE_ROW_SLOT_START); @@ -941,7 +941,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu m_iCurrSlotX = m_creativeSlotX; m_iCurrSlotY = m_creativeSlotY; - shared_ptr playerInventory = pMinecraft->localplayers[getPad()]->inventory; + std::shared_ptr playerInventory = pMinecraft->localplayers[getPad()]->inventory; playerInventory->setCarried(nullptr); m_bCarryingCreativeItem = false; } @@ -970,14 +970,14 @@ bool IUIScene_CreativeMenu::CanHaveFocus( ESceneSection eSection ) return false; } -bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr item, int &slotX) +bool IUIScene_CreativeMenu::getEmptyInventorySlot(std::shared_ptr item, int &slotX) { bool sameItemFound = false; bool emptySlotFound = false; // Jump to the slot with this item already on it, if we can stack more for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i) { - shared_ptr slotItem = m_menu->getSlot(i)->getItem(); + std::shared_ptr slotItem = m_menu->getSlot(i)->getItem(); if( slotItem != NULL && slotItem->sameItem(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() )) { sameItemFound = true; @@ -1020,7 +1020,7 @@ int IUIScene_CreativeMenu::getSectionStartOffset(ESceneSection eSection) return offset; } -bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, +bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { bool _override = false; diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_CreativeMenu.h b/Minecraft.Client/Build/Common/UI/IUIScene_CreativeMenu.h index c844d9d89..0c738e7f7 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_CreativeMenu.h +++ b/Minecraft.Client/Build/Common/UI/IUIScene_CreativeMenu.h @@ -74,21 +74,21 @@ public: class ItemPickerMenu : public AbstractContainerMenu { protected: - shared_ptr creativeContainer; - shared_ptr inventory; + std::shared_ptr creativeContainer; + std::shared_ptr inventory; public: - ItemPickerMenu( shared_ptr creativeContainer, shared_ptr inventory ); + ItemPickerMenu( std::shared_ptr creativeContainer, std::shared_ptr inventory ); - virtual bool stillValid(shared_ptr player); + virtual bool stillValid(std::shared_ptr player); bool isOverrideResultClick(int slotNum, int buttonNum); protected: // 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative - virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr player) { } // do nothing + virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr player) { } // do nothing } *itemPickerMenu; protected: - static vector< shared_ptr > categoryGroups[eCreativeInventoryGroupsCount]; + static std::vector< std::shared_ptr > categoryGroups[eCreativeInventoryGroupsCount]; // 4J JEV - Tabs static TabSpec **specs; @@ -112,11 +112,11 @@ protected: virtual void handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld); virtual void handleAdditionalKeyPress(int iAction); virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld); - bool getEmptyInventorySlot(shared_ptr item, int &slotX); + bool getEmptyInventorySlot(std::shared_ptr item, int &slotX); int getSectionStartOffset(ESceneSection eSection); virtual bool IsSectionSlotList( ESceneSection eSection ); virtual bool CanHaveFocus( ESceneSection eSection ); - virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, + virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining, EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_EnchantingMenu.cpp b/Minecraft.Client/Build/Common/UI/IUIScene_EnchantingMenu.cpp index b50e28548..d868496db 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_EnchantingMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/IUIScene_EnchantingMenu.cpp @@ -140,7 +140,7 @@ void IUIScene_EnchantingMenu::handleOtherClicked(int iPad, ESceneSection eSectio break; }; Minecraft *pMinecraft = Minecraft::GetInstance(); - if (index >= 0 && m_menu->clickMenuButton(dynamic_pointer_cast(pMinecraft->localplayers[iPad]), index)) + if (index >= 0 && m_menu->clickMenuButton(std::dynamic_pointer_cast(pMinecraft->localplayers[iPad]), index)) { pMinecraft->localgameModes[iPad]->handleInventoryButtonClick(m_menu->containerId, index); } diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Build/Common/UI/IUIScene_StartGame.cpp index d6dfad931..fe0410249 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Build/Common/UI/IUIScene_StartGame.cpp @@ -356,7 +356,7 @@ int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStora { if (ProfileManager.IsSignedInLive(iPad)) { - wstring ProductId; + std::wstring ProductId; app.GetDLCFullOfferIDForPackID(pClass->m_MoreOptionsParams.dwTexturePack,ProductId); diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_TradingMenu.cpp b/Minecraft.Client/Build/Common/UI/IUIScene_TradingMenu.cpp index 2e853d212..6db5cb6ea 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_TradingMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/IUIScene_TradingMenu.cpp @@ -16,7 +16,7 @@ IUIScene_TradingMenu::IUIScene_TradingMenu() m_bHasUpdatedOnce = false; } -shared_ptr IUIScene_TradingMenu::getMerchant() +std::shared_ptr IUIScene_TradingMenu::getMerchant() { return m_merchant; } @@ -70,9 +70,9 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) if(!activeRecipe->isDeprecated()) { // Do we have the ingredients? - shared_ptr buyAItem = activeRecipe->getBuyAItem(); - shared_ptr buyBItem = activeRecipe->getBuyBItem(); - shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; + std::shared_ptr buyAItem = activeRecipe->getBuyAItem(); + std::shared_ptr buyBItem = activeRecipe->getBuyBItem(); + std::shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; int buyAMatches = player->inventory->countMatches(buyAItem); int buyBMatches = player->inventory->countMatches(buyBItem); if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) ) @@ -84,7 +84,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) player->inventory->removeResources(buyBItem); // Add the item we have purchased - shared_ptr result = activeRecipe->getSellItem()->copy(); + std::shared_ptr result = activeRecipe->getSellItem()->copy(); if(!player->inventory->add( result ) ) { player->drop(result); @@ -92,7 +92,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) // Send a packet to the server int actualShopItem = m_activeOffers.at(selectedShopItem).second; - player->connection->send( shared_ptr( new TradeItemPacket(m_menu->containerId, actualShopItem) ) ); + player->connection->send( std::shared_ptr( new TradeItemPacket(m_menu->containerId, actualShopItem) ) ); updateDisplay(); } @@ -149,7 +149,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) ByteArrayOutputStream rawOutput; DataOutputStream output(&rawOutput); output.writeInt(actualShopItem); - Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray()))); + Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray()))); } } return handled; @@ -188,8 +188,8 @@ void IUIScene_TradingMenu::updateDisplay() MerchantRecipe *recipe = *it; if(!recipe->isDeprecated()) { - m_activeOffers.push_back( pair(recipe,unfilteredIndex)); - firstValidTrade = min(firstValidTrade,unfilteredIndex); + m_activeOffers.push_back( std::pair(recipe,unfilteredIndex)); + firstValidTrade = std::min(firstValidTrade,unfilteredIndex); } ++unfilteredIndex; } @@ -203,7 +203,7 @@ void IUIScene_TradingMenu::updateDisplay() ByteArrayOutputStream rawOutput; DataOutputStream output(&rawOutput); output.writeInt(firstValidTrade); - Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray()))); + Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray()))); } } @@ -234,7 +234,7 @@ void IUIScene_TradingMenu::updateDisplay() { MerchantRecipe *activeRecipe = m_activeOffers.at(selectedShopItem).first; - wstring wsTemp; + std::wstring wsTemp; // 4J-PB - need to get the villager type here wsTemp = app.GetString(IDS_VILLAGER_OFFERS_ITEM); @@ -244,12 +244,12 @@ void IUIScene_TradingMenu::updateDisplay() setTitle(wsTemp.c_str()); - vector unformattedStrings; - wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings); + std::vector unformattedStrings; + std::wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings); setOfferDescription(offerDescription, unformattedStrings); - shared_ptr buyAItem = activeRecipe->getBuyAItem(); - shared_ptr buyBItem = activeRecipe->getBuyBItem(); + std::shared_ptr buyAItem = activeRecipe->getBuyAItem(); + std::shared_ptr buyBItem = activeRecipe->getBuyBItem(); setRequest1Item(buyAItem); setRequest2Item(buyBItem); @@ -262,7 +262,7 @@ void IUIScene_TradingMenu::updateDisplay() bool canMake = true; - shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; + std::shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; int buyAMatches = player->inventory->countMatches(buyAItem); if(buyAMatches > 0) { @@ -321,10 +321,10 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe) { if(recipe->isDeprecated()) return false; - shared_ptr buyAItem = recipe->getBuyAItem(); - shared_ptr buyBItem = recipe->getBuyBItem(); + std::shared_ptr buyAItem = recipe->getBuyAItem(); + std::shared_ptr buyBItem = recipe->getBuyBItem(); - shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; + std::shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; int buyAMatches = player->inventory->countMatches(buyAItem); if(buyAMatches > 0) { @@ -349,28 +349,28 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe) } -void IUIScene_TradingMenu::setRequest1Item(shared_ptr item) +void IUIScene_TradingMenu::setRequest1Item(std::shared_ptr item) { } -void IUIScene_TradingMenu::setRequest2Item(shared_ptr item) +void IUIScene_TradingMenu::setRequest2Item(std::shared_ptr item) { } -void IUIScene_TradingMenu::setTradeItem(int index, shared_ptr item) +void IUIScene_TradingMenu::setTradeItem(int index, std::shared_ptr item) { } -wstring IUIScene_TradingMenu::GetItemDescription(shared_ptr item, vector &unformattedStrings) +std::wstring IUIScene_TradingMenu::GetItemDescription(std::shared_ptr item, std::vector &unformattedStrings) { if(item == NULL) return L""; - wstring desc = L""; - vector *strings = item->getHoverTextOnly(nullptr, false, unformattedStrings); + std::wstring desc = L""; + std::vector *strings = item->getHoverTextOnly(nullptr, false, unformattedStrings); bool firstLine = true; for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it) { - wstring thisString = *it; + std::wstring thisString = *it; if(!firstLine) { desc.append( L"
" ); diff --git a/Minecraft.Client/Build/Common/UI/IUIScene_TradingMenu.h b/Minecraft.Client/Build/Common/UI/IUIScene_TradingMenu.h index 8dfd6aa33..db342b071 100644 --- a/Minecraft.Client/Build/Common/UI/IUIScene_TradingMenu.h +++ b/Minecraft.Client/Build/Common/UI/IUIScene_TradingMenu.h @@ -7,8 +7,8 @@ class IUIScene_TradingMenu { protected: MerchantMenu *m_menu; - shared_ptr m_merchant; - vector< pair > m_activeOffers; + std::shared_ptr m_merchant; + std::vector< std::pair > m_activeOffers; int m_validOffersCount; int m_selectedSlot; @@ -32,27 +32,27 @@ protected: virtual void showScrollRightArrow(bool show) = 0; virtual void showScrollLeftArrow(bool show) = 0; virtual void moveSelector(bool right) = 0; - virtual void setRequest1Name(const wstring &name) = 0; - virtual void setRequest2Name(const wstring &name) = 0; - virtual void setTitle(const wstring &name) = 0; + virtual void setRequest1Name(const std::wstring &name) = 0; + virtual void setRequest2Name(const std::wstring &name) = 0; + virtual void setTitle(const std::wstring &name) = 0; virtual void setRequest1RedBox(bool show) = 0; virtual void setRequest2RedBox(bool show) = 0; virtual void setTradeRedBox(int index, bool show) = 0; - virtual void setOfferDescription(const wstring &name, vector &unformattedStrings) = 0; + virtual void setOfferDescription(const std::wstring &name, std::vector &unformattedStrings) = 0; - virtual void setRequest1Item(shared_ptr item); - virtual void setRequest2Item(shared_ptr item); - virtual void setTradeItem(int index, shared_ptr item); + virtual void setRequest1Item(std::shared_ptr item); + virtual void setRequest2Item(std::shared_ptr item); + virtual void setTradeItem(int index, std::shared_ptr item); private: void updateDisplay(); bool canMake(MerchantRecipe *recipe); - wstring GetItemDescription(shared_ptr item, vector &unformattedStrings); + std::wstring GetItemDescription(std::shared_ptr item, std::vector &unformattedStrings); public: - shared_ptr getMerchant(); + std::shared_ptr getMerchant(); virtual int getPad() = 0; }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIBitmapFont.cpp b/Minecraft.Client/Build/Common/UI/UIBitmapFont.cpp index c6b791b8e..e20b6f19b 100644 --- a/Minecraft.Client/Build/Common/UI/UIBitmapFont.cpp +++ b/Minecraft.Client/Build/Common/UI/UIBitmapFont.cpp @@ -19,7 +19,7 @@ UIAbstractBitmapFont::~UIAbstractBitmapFont() } -UIAbstractBitmapFont::UIAbstractBitmapFont(const string &fontname) +UIAbstractBitmapFont::UIAbstractBitmapFont(const std::string &fontname) { m_fontname = fontname; @@ -272,7 +272,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacte struct DebugData { - string name; + std::string name; long scale; long mul; @@ -286,7 +286,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacte }; static long long lastPrint = System::currentTimeMillis(); - static unordered_set debug_fontSizesRequested; + static std::unordered_set debug_fontSizesRequested; { DebugData dData = { m_cFontData->getFontName(), (long) pixel_scale, (long) glyphScale }; @@ -296,7 +296,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacte { app.DebugPrintf(" Requested font/sizes:\n"); - unordered_set::iterator itr; + std::unordered_set::iterator itr; for ( itr = debug_fontSizesRequested.begin(); itr != debug_fontSizesRequested.end(); itr++ diff --git a/Minecraft.Client/Build/Common/UI/UIBitmapFont.h b/Minecraft.Client/Build/Common/UI/UIBitmapFont.h index 62b708fbb..5d4e266e9 100644 --- a/Minecraft.Client/Build/Common/UI/UIBitmapFont.h +++ b/Minecraft.Client/Build/Common/UI/UIBitmapFont.h @@ -13,12 +13,12 @@ class CFontData; // | XC_LANGUAGE_PORTUGUESE // | XC_LANGUAGE_BRAZILIAN; -using namespace std; +//using namespace std; class UIAbstractBitmapFont { protected: - string m_fontname; + std::string m_fontname; IggyBitmapFontProvider *m_bitmapFontProvider; @@ -27,7 +27,7 @@ protected: unsigned int m_numGlyphs; public: - UIAbstractBitmapFont(const string &fontname); + UIAbstractBitmapFont(const std::string &fontname); ~UIAbstractBitmapFont(); void registerFont(); diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_Chat.cpp b/Minecraft.Client/Build/Common/UI/UIComponent_Chat.cpp index e3e041e3e..e1f1f1a81 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_Chat.cpp +++ b/Minecraft.Client/Build/Common/UI/UIComponent_Chat.cpp @@ -18,7 +18,7 @@ UIComponent_Chat::UIComponent_Chat(int iPad, void *initData, UILayer *parentLaye addTimer(0, 100); } -wstring UIComponent_Chat::getMoviePath() +std::wstring UIComponent_Chat::getMoviePath() { switch( m_parentLayer->getViewport() ) { @@ -49,7 +49,7 @@ void UIComponent_Chat::handleTimerComplete(int id) if(pMinecraft->localplayers[m_iPad]!= NULL) { Gui *pGui = pMinecraft->gui; - //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); + //DWORD messagesToDisplay = std::min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); for( unsigned int i = 0; i < CHAT_LINES_COUNT; ++i ) { float opacity = pGui->getOpacity(m_iPad, i); diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_Chat.h b/Minecraft.Client/Build/Common/UI/UIComponent_Chat.h index d18352ccd..a96fe8a06 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_Chat.h +++ b/Minecraft.Client/Build/Common/UI/UIComponent_Chat.h @@ -44,7 +44,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual EUIScene getSceneType() { return eUIComponent_Chat;} diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIConsole.cpp b/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIConsole.cpp index 7bdc0fc57..35ffb8434 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIConsole.cpp +++ b/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIConsole.cpp @@ -10,7 +10,7 @@ UIComponent_DebugUIConsole::UIComponent_DebugUIConsole(int iPad, void *initData, m_bTextChanged = false; } -wstring UIComponent_DebugUIConsole::getMoviePath() +std::wstring UIComponent_DebugUIConsole::getMoviePath() { return L"DebugUIConsoleComponent"; } @@ -28,7 +28,7 @@ void UIComponent_DebugUIConsole::tick() } } -void UIComponent_DebugUIConsole::addText(const string &text) +void UIComponent_DebugUIConsole::addText(const std::string &text) { if(!text.empty() && text.compare("\n") != 0) { diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIConsole.h b/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIConsole.h index 177754f55..31b21db2c 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIConsole.h +++ b/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIConsole.h @@ -20,7 +20,7 @@ private: UI_MAP_ELEMENT( m_labels[9], "consoleLine10") UI_END_MAP_ELEMENTS_AND_NAMES() - deque m_textList; + std::deque m_textList; bool m_bTextChanged; @@ -31,7 +31,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual EUIScene getSceneType() { return eUIComponent_DebugUIConsole;} @@ -45,5 +45,5 @@ public: // Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden virtual bool hidesLowerScenes() { return false; } - void addText(const string &text); + void addText(const std::string &text); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIMarketingGuide.cpp b/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIMarketingGuide.cpp index eb9db0be5..5001d9198 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIMarketingGuide.cpp +++ b/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIMarketingGuide.cpp @@ -27,7 +27,7 @@ UIComponent_DebugUIMarketingGuide::UIComponent_DebugUIMarketingGuide(int iPad, v IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetPlatform , 1 , value ); } -wstring UIComponent_DebugUIMarketingGuide::getMoviePath() +std::wstring UIComponent_DebugUIMarketingGuide::getMoviePath() { return L"DebugUIMarketingGuide"; } \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIMarketingGuide.h b/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIMarketingGuide.h index 2c6511734..f7847e846 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIMarketingGuide.h +++ b/Minecraft.Client/Build/Common/UI/UIComponent_DebugUIMarketingGuide.h @@ -18,7 +18,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual EUIScene getSceneType() { return eUIComponent_DebugUIMarketingGuide;} diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_Logo.cpp b/Minecraft.Client/Build/Common/UI/UIComponent_Logo.cpp index 6cbbeee8e..8c30c787a 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_Logo.cpp +++ b/Minecraft.Client/Build/Common/UI/UIComponent_Logo.cpp @@ -8,7 +8,7 @@ UIComponent_Logo::UIComponent_Logo(int iPad, void *initData, UILayer *parentLaye initialiseMovie(); } -wstring UIComponent_Logo::getMoviePath() +std::wstring UIComponent_Logo::getMoviePath() { switch( m_parentLayer->getViewport() ) { diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_Logo.h b/Minecraft.Client/Build/Common/UI/UIComponent_Logo.h index 1a8cf8190..08398cbd5 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_Logo.h +++ b/Minecraft.Client/Build/Common/UI/UIComponent_Logo.h @@ -9,7 +9,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual EUIScene getSceneType() { return eUIComponent_Logo;} diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_MenuBackground.cpp b/Minecraft.Client/Build/Common/UI/UIComponent_MenuBackground.cpp index cf7ba0d99..54a9ddadb 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_MenuBackground.cpp +++ b/Minecraft.Client/Build/Common/UI/UIComponent_MenuBackground.cpp @@ -9,7 +9,7 @@ UIComponent_MenuBackground::UIComponent_MenuBackground(int iPad, void *initData, initialiseMovie(); } -wstring UIComponent_MenuBackground::getMoviePath() +std::wstring UIComponent_MenuBackground::getMoviePath() { switch( m_parentLayer->getViewport() ) { case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_MenuBackground.h b/Minecraft.Client/Build/Common/UI/UIComponent_MenuBackground.h index ac0b9d2f1..f62dbd50e 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_MenuBackground.h +++ b/Minecraft.Client/Build/Common/UI/UIComponent_MenuBackground.h @@ -11,7 +11,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual EUIScene getSceneType() { return eUIComponent_MenuBackground;} diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_Panorama.cpp b/Minecraft.Client/Build/Common/UI/UIComponent_Panorama.cpp index 41565139a..217827574 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_Panorama.cpp +++ b/Minecraft.Client/Build/Common/UI/UIComponent_Panorama.cpp @@ -16,7 +16,7 @@ UIComponent_Panorama::UIComponent_Panorama(int iPad, void *initData, UILayer *pa while(!m_hasTickedOnce) tick(); } -wstring UIComponent_Panorama::getMoviePath() +std::wstring UIComponent_Panorama::getMoviePath() { switch( m_parentLayer->getViewport() ) { diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_Panorama.h b/Minecraft.Client/Build/Common/UI/UIComponent_Panorama.h index 99dc115c4..5788355ec 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_Panorama.h +++ b/Minecraft.Client/Build/Common/UI/UIComponent_Panorama.h @@ -19,7 +19,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual EUIScene getSceneType() { return eUIComponent_Panorama;} diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_PressStartToPlay.cpp b/Minecraft.Client/Build/Common/UI/UIComponent_PressStartToPlay.cpp index b712e8f7e..dbdc39a50 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_PressStartToPlay.cpp +++ b/Minecraft.Client/Build/Common/UI/UIComponent_PressStartToPlay.cpp @@ -22,12 +22,12 @@ UIComponent_PressStartToPlay::UIComponent_PressStartToPlay(int iPad, void *initD m_labelTrialTimer.setVisible(false); #ifdef __ORBIS__ - wstring text = app.GetString(IDS_PRESS_X_TO_JOIN); + std::wstring text = app.GetString(IDS_PRESS_X_TO_JOIN); text = replaceAll(text, L"{*CONTROLLER_VK_A*}", app.GetVKReplacement(VK_PAD_A) ); m_labelPressStart.init(text.c_str()); #elif defined _XBOX_ONE - wstring text = app.GetString(IDS_PRESS_START_TO_JOIN); + std::wstring text = app.GetString(IDS_PRESS_START_TO_JOIN); text = replaceAll(text, L"{*CONTROLLER_VK_START*}", app.GetVKReplacement(VK_PAD_START) ); m_labelPressStart.init(text.c_str()); #else @@ -38,7 +38,7 @@ UIComponent_PressStartToPlay::UIComponent_PressStartToPlay(int iPad, void *initD m_playerDisplayName.setVisible(false); } -wstring UIComponent_PressStartToPlay::getMoviePath() +std::wstring UIComponent_PressStartToPlay::getMoviePath() { return L"PressStartToPlay"; } @@ -104,7 +104,7 @@ void UIComponent_PressStartToPlay::showPressStart(int iPad, bool show) } } -void UIComponent_PressStartToPlay::setTrialTimer(const wstring &label) +void UIComponent_PressStartToPlay::setTrialTimer(const std::wstring &label) { m_trialTimer = label; if(!ui.IsExpectingOrReloadingSkin() && hasMovie()) @@ -122,7 +122,7 @@ void UIComponent_PressStartToPlay::showTrialTimer(bool show) } } -void UIComponent_PressStartToPlay::setAutosaveTimer(const wstring &label) +void UIComponent_PressStartToPlay::setAutosaveTimer(const std::wstring &label) { m_autosaveTimer = label; if(!ui.IsExpectingOrReloadingSkin() && hasMovie()) diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_PressStartToPlay.h b/Minecraft.Client/Build/Common/UI/UIComponent_PressStartToPlay.h index a29b6016f..8141b9f07 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_PressStartToPlay.h +++ b/Minecraft.Client/Build/Common/UI/UIComponent_PressStartToPlay.h @@ -9,8 +9,8 @@ private: bool m_showingAutosaveTimer; bool m_showingTrialTimer; bool m_showingPressStart[XUSER_MAX_COUNT]; - wstring m_trialTimer; - wstring m_autosaveTimer; + std::wstring m_trialTimer; + std::wstring m_autosaveTimer; protected: UIControl_Label m_labelTrialTimer, m_labelPressStart, m_playerDisplayName; @@ -33,7 +33,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual EUIScene getSceneType() { return eUIComponent_PressStartToPlay;} @@ -51,9 +51,9 @@ public: virtual void handleTimerComplete(int id); void showPressStart(int iPad, bool show); - void setTrialTimer(const wstring &label); + void setTrialTimer(const std::wstring &label); void showTrialTimer(bool show); - void setAutosaveTimer(const wstring &label); + void setAutosaveTimer(const std::wstring &label); void showAutosaveTimer(bool show); void showSaveIcon(bool show); void showPlayerDisplayName(bool show); diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_Tooltips.cpp b/Minecraft.Client/Build/Common/UI/UIComponent_Tooltips.cpp index bb3db8e7b..7ae7e1fc2 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_Tooltips.cpp +++ b/Minecraft.Client/Build/Common/UI/UIComponent_Tooltips.cpp @@ -34,7 +34,7 @@ UIComponent_Tooltips::UIComponent_Tooltips(int iPad, void *initData, UILayer *pa #endif } -wstring UIComponent_Tooltips::getMoviePath() +std::wstring UIComponent_Tooltips::getMoviePath() { switch( m_parentLayer->getViewport() ) { @@ -306,7 +306,7 @@ bool UIComponent_Tooltips::_SetTooltip(unsigned int iToolTip, int iTextID) return changed; } -void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId, const wstring &label, bool show, bool force) +void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId, const std::wstring &label, bool show, bool force) { if(!force && !show && !m_tooltipValues[iToolTipId].show) { diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_Tooltips.h b/Minecraft.Client/Build/Common/UI/UIComponent_Tooltips.h index 4b4c82685..8e2c61dd3 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_Tooltips.h +++ b/Minecraft.Client/Build/Common/UI/UIComponent_Tooltips.h @@ -60,7 +60,7 @@ protected: UI_MAP_NAME( m_funcUpdateLayout, L"UpdateLayout") UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual F64 getSafeZoneHalfWidth(); @@ -99,7 +99,7 @@ public: private: bool _SetTooltip(unsigned int iToolTip, int iTextID); - void _SetTooltip(unsigned int iToolTipId, const wstring &label, bool show, bool force = false); + void _SetTooltip(unsigned int iToolTipId, const std::wstring &label, bool show, bool force = false); void _Relayout(); bool m_overrideSFX[XUSER_MAX_COUNT][ACTION_MAX_MENU]; diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_TutorialPopup.cpp b/Minecraft.Client/Build/Common/UI/UIComponent_TutorialPopup.cpp index a6f6bb8d4..5b60179d3 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_TutorialPopup.cpp +++ b/Minecraft.Client/Build/Common/UI/UIComponent_TutorialPopup.cpp @@ -25,7 +25,7 @@ UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void *initData, U m_labelDescription.init(L""); } -wstring UIComponent_TutorialPopup::getMoviePath() +std::wstring UIComponent_TutorialPopup::getMoviePath() { switch( m_parentLayer->getViewport() ) { @@ -69,7 +69,7 @@ void UIComponent_TutorialPopup::SetTutorialDescription(TutorialPopupInfo *info) { m_interactScene = info->interactScene; - wstring parsed = _SetIcon(info->icon, info->iAuxVal, info->isFoil, info->desc); + std::wstring parsed = _SetIcon(info->icon, info->iAuxVal, info->isFoil, info->desc); parsed = _SetImage( parsed ); parsed = ParseDescription(m_iPad, parsed); @@ -125,7 +125,7 @@ void UIComponent_TutorialPopup::handleTimerComplete(int id) } } -void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const wstring &desc, const wstring &title, bool allowFade, bool isReminder) +void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const std::wstring &desc, const std::wstring &title, bool allowFade, bool isReminder) { m_interactScene = interactScene; app.DebugPrintf("Setting m_interactScene to %08x\n", m_interactScene); @@ -158,7 +158,7 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const ws if(isReminder) { - wstring text(app.GetString( IDS_TUTORIAL_REMINDER )); + std::wstring text(app.GetString( IDS_TUTORIAL_REMINDER )); text.append( desc ); stripWhitespaceForHtml( text ); // set the text colour @@ -172,7 +172,7 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const ws } else { - wstring text(desc); + std::wstring text(desc); stripWhitespaceForHtml( text ); // set the text colour wchar_t formatting[40]; @@ -199,9 +199,9 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const ws } } -wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc) +std::wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc) { - wstring temp(desc); + std::wstring temp(desc); bool isFixedIcon = false; @@ -209,13 +209,13 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, if( icon != TUTORIAL_NO_ICON ) { m_iconIsFoil = false; - m_iconItem = shared_ptr(new ItemInstance(icon,1,iAuxVal)); + m_iconItem = std::shared_ptr(new ItemInstance(icon,1,iAuxVal)); } else { m_iconItem = nullptr; - wstring openTag(L"{*ICON*}"); - wstring closeTag(L"{*/ICON*}"); + std::wstring openTag(L"{*ICON*}"); + std::wstring closeTag(L"{*/ICON*}"); int iconTagStartPos = (int)temp.find(openTag); int iconStartPos = iconTagStartPos + (int)openTag.length(); if( iconTagStartPos > 0 && iconStartPos < (int)temp.length() ) @@ -224,9 +224,9 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, if(iconEndPos > iconStartPos && iconEndPos < (int)temp.length() ) { - wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos); + std::wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos); - vector idAndAux = stringSplit(id,L':'); + std::vector idAndAux = stringSplit(id,L':'); int iconId = _fromString(idAndAux[0]); @@ -238,86 +238,86 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, { iAuxVal = 0; } - m_iconItem = shared_ptr(new ItemInstance(iconId,1,iAuxVal)); + m_iconItem = std::shared_ptr(new ItemInstance(iconId,1,iAuxVal)); temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L""); } } // remove any icon text - else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos) + else if(temp.find(L"{*CraftingTableIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Tile::workBench_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Tile::workBench_Id,1,0)); } - else if(temp.find(L"{*SticksIcon*}")!=wstring::npos) + else if(temp.find(L"{*SticksIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Item::stick_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Item::stick_Id,1,0)); } - else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos) + else if(temp.find(L"{*PlanksIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Tile::wood_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Tile::wood_Id,1,0)); } - else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos) + else if(temp.find(L"{*WoodenShovelIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Item::shovel_wood_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Item::shovel_wood_Id,1,0)); } - else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos) + else if(temp.find(L"{*WoodenHatchetIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Item::hatchet_wood_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Item::hatchet_wood_Id,1,0)); } - else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos) + else if(temp.find(L"{*WoodenPickaxeIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Item::pickAxe_wood_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Item::pickAxe_wood_Id,1,0)); } - else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos) + else if(temp.find(L"{*FurnaceIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Tile::furnace_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Tile::furnace_Id,1,0)); } - else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos) + else if(temp.find(L"{*WoodenDoorIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Item::door_wood,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Item::door_wood,1,0)); } - else if(temp.find(L"{*TorchIcon*}")!=wstring::npos) + else if(temp.find(L"{*TorchIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Tile::torch_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Tile::torch_Id,1,0)); } - else if(temp.find(L"{*BoatIcon*}")!=wstring::npos) + else if(temp.find(L"{*BoatIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Item::boat_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Item::boat_Id,1,0)); } - else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos) + else if(temp.find(L"{*FishingRodIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Item::fishingRod_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Item::fishingRod_Id,1,0)); } - else if(temp.find(L"{*FishIcon*}")!=wstring::npos) + else if(temp.find(L"{*FishIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Item::fish_raw_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Item::fish_raw_Id,1,0)); } - else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos) + else if(temp.find(L"{*MinecartIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Item::minecart_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Item::minecart_Id,1,0)); } - else if(temp.find(L"{*RailIcon*}")!=wstring::npos) + else if(temp.find(L"{*RailIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Tile::rail_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Tile::rail_Id,1,0)); } - else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos) + else if(temp.find(L"{*PoweredRailIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Tile::goldenRail_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Tile::goldenRail_Id,1,0)); } - else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos) + else if(temp.find(L"{*StructuresIcon*}")!=std::wstring::npos) { isFixedIcon = true; setupIconHolder(e_ICON_TYPE_STRUCTURES); } - else if(temp.find(L"{*ToolsIcon*}")!=wstring::npos) + else if(temp.find(L"{*ToolsIcon*}")!=std::wstring::npos) { isFixedIcon = true; setupIconHolder(e_ICON_TYPE_TOOLS); } - else if(temp.find(L"{*StoneIcon*}")!=wstring::npos) + else if(temp.find(L"{*StoneIcon*}")!=std::wstring::npos) { - m_iconItem = shared_ptr(new ItemInstance(Tile::rock_Id,1,0)); + m_iconItem = std::shared_ptr(new ItemInstance(Tile::rock_Id,1,0)); } else { @@ -330,14 +330,14 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, return temp; } -wstring UIComponent_TutorialPopup::_SetImage(wstring &desc) +std::wstring UIComponent_TutorialPopup::_SetImage(std::wstring &desc) { // 4J Stu - Unused #if 0 BOOL imageShowAtStart = m_image.IsShown(); - wstring openTag(L"{*IMAGE*}"); - wstring closeTag(L"{*/IMAGE*}"); + std::wstring openTag(L"{*IMAGE*}"); + std::wstring closeTag(L"{*/IMAGE*}"); int imageTagStartPos = (int)desc.find(openTag); int imageStartPos = imageTagStartPos + (int)openTag.length(); if( imageTagStartPos > 0 && imageStartPos < (int)desc.length() ) @@ -346,7 +346,7 @@ wstring UIComponent_TutorialPopup::_SetImage(wstring &desc) if(imageEndPos > imageStartPos && imageEndPos < (int)desc.length() ) { - wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos); + std::wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos); m_image.SetImagePath( id.c_str() ); m_image.SetShow( TRUE ); @@ -385,7 +385,7 @@ wstring UIComponent_TutorialPopup::_SetImage(wstring &desc) } -wstring UIComponent_TutorialPopup::ParseDescription(int iPad, wstring &text) +std::wstring UIComponent_TutorialPopup::ParseDescription(int iPad, std::wstring &text) { text = replaceAll(text, L"{*CraftingTableIcon*}", L""); text = replaceAll(text, L"{*SticksIcon*}", L""); @@ -408,7 +408,7 @@ wstring UIComponent_TutorialPopup::ParseDescription(int iPad, wstring &text) bool exitScreenshot = false; size_t pos = text.find(L"{*EXIT_PICTURE*}"); - if(pos != wstring::npos) exitScreenshot = true; + if(pos != std::wstring::npos) exitScreenshot = true; text = replaceAll(text, L"{*EXIT_PICTURE*}", L""); m_controlExitScreenshot.setVisible(exitScreenshot); /* diff --git a/Minecraft.Client/Build/Common/UI/UIComponent_TutorialPopup.h b/Minecraft.Client/Build/Common/UI/UIComponent_TutorialPopup.h index 36f78300d..59d038278 100644 --- a/Minecraft.Client/Build/Common/UI/UIComponent_TutorialPopup.h +++ b/Minecraft.Client/Build/Common/UI/UIComponent_TutorialPopup.h @@ -15,7 +15,7 @@ private: bool m_lastSceneMovedLeft; bool m_bAllowFade; Tutorial *m_tutorial; - shared_ptr m_iconItem; + std::shared_ptr m_iconItem; bool m_iconIsFoil; //int m_iLocalPlayerC; @@ -57,7 +57,7 @@ protected: UI_MAP_NAME( m_funcSetupIconHolder, L"SetupIconHolder") UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual EUIScene getSceneType() { return eUIComponent_TutorialPopup;} @@ -91,10 +91,10 @@ protected: void handleTimerComplete(int id); private: - void _SetDescription(UIScene *interactScene, const wstring &desc, const wstring &title, bool allowFade, bool isReminder); - wstring _SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc); - wstring _SetImage(wstring &desc); - wstring ParseDescription(int iPad, wstring &text); + void _SetDescription(UIScene *interactScene, const std::wstring &desc, const std::wstring &title, bool allowFade, bool isReminder); + std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc); + std::wstring _SetImage(std::wstring &desc); + std::wstring ParseDescription(int iPad, std::wstring &text); void UpdateInteractScenePosition(bool visible); void setupIconHolder(EIcons icon); diff --git a/Minecraft.Client/Build/Common/UI/UIControl.cpp b/Minecraft.Client/Build/Common/UI/UIControl.cpp index 0fb3608c6..19d5b011c 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl.cpp @@ -14,7 +14,7 @@ UIControl::UIControl() m_eControlType = eNoControl; } -bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { m_parentScene = scene; m_controlName = controlName; @@ -147,7 +147,7 @@ bool UIControl::getVisible() return bVisible; } -IggyName UIControl::registerFastName(const wstring &name) +IggyName UIControl::registerFastName(const std::wstring &name) { return m_parentScene->registerFastName(name); } diff --git a/Minecraft.Client/Build/Common/UI/UIControl.h b/Minecraft.Client/Build/Common/UI/UIControl.h index 3b4ef050a..c55521530 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl.h +++ b/Minecraft.Client/Build/Common/UI/UIControl.h @@ -47,7 +47,7 @@ public: protected: IggyValuePath m_iggyPath; UIScene *m_parentScene; - string m_controlName; + std::string m_controlName; IggyName m_nameXPos, m_nameYPos, m_nameWidth, m_nameHeight; IggyName m_funcSetAlpha, m_nameVisible; @@ -59,7 +59,7 @@ protected: public: UIControl(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); #ifdef __PSVITA__ void UpdateControl(); void setHidden(bool bHidden) {m_bHidden=bHidden;} @@ -68,7 +68,7 @@ public: IggyValuePath *getIggyValuePath(); - string getControlName() { return m_controlName; } + std::string getControlName() { return m_controlName; } virtual void tick() {} virtual void ReInit(); @@ -88,5 +88,5 @@ public: virtual bool hasFocus() { return false; } protected: - IggyName registerFastName(const wstring &name); + IggyName registerFastName(const std::wstring &name); }; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Base.cpp b/Minecraft.Client/Build/Common/UI/UIControl_Base.cpp index d04592776..6bb1d9f41 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Base.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_Base.cpp @@ -11,7 +11,7 @@ UIControl_Base::UIControl_Base() m_id = 0; } -bool UIControl_Base::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_Base::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { bool success = UIControl::setupControl(scene,parent,controlName); @@ -45,7 +45,7 @@ void UIControl_Base::tick() } } -void UIControl_Base::setLabel(const wstring &label, bool instant, bool force) +void UIControl_Base::setLabel(const std::wstring &label, bool instant, bool force) { if( force || ((!m_label.empty() || !label.empty()) && m_label.compare(label) != 0) ) m_bLabelChanged = true; m_label = label; @@ -67,9 +67,9 @@ void UIControl_Base::setLabel(const wstring &label, bool instant, bool force) } } -void UIControl_Base::setLabel(const string &label) +void UIControl_Base::setLabel(const std::string &label) { - wstring wlabel = convStringToWstring(label); + std::wstring wlabel = convStringToWstring(label); setLabel(wlabel); } @@ -80,7 +80,7 @@ const wchar_t* UIControl_Base::getLabel() if(result.type == IGGY_DATATYPE_string_UTF16) { - m_label = wstring( (wchar_t *)result.string16.string, result.string16.length); + m_label = std::wstring( (wchar_t *)result.string16.string, result.string16.length); } return m_label.c_str(); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Base.h b/Minecraft.Client/Build/Common/UI/UIControl_Base.h index e70997c3e..0ed506ae7 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Base.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_Base.h @@ -12,16 +12,16 @@ protected: IggyName m_funcCheckLabelWidths; bool m_bLabelChanged; - wstring m_label; + std::wstring m_label; public: UIControl_Base(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); virtual void tick(); - virtual void setLabel(const wstring &label, bool instant = false, bool force = false); - virtual void setLabel(const string &label); + virtual void setLabel(const std::wstring &label, bool instant = false, bool force = false); + virtual void setLabel(const std::string &label); const wchar_t* getLabel(); virtual void setAllPossibleLabels(int labelCount, wchar_t labels[][256]); int getId() { return m_id; } diff --git a/Minecraft.Client/Build/Common/UI/UIControl_BitmapIcon.cpp b/Minecraft.Client/Build/Common/UI/UIControl_BitmapIcon.cpp index c2c56bf9c..ae3c3a189 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_BitmapIcon.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_BitmapIcon.cpp @@ -2,7 +2,7 @@ #include "UI.h" #include "UIControl_BitmapIcon.h" -bool UIControl_BitmapIcon::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_BitmapIcon::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eBitmapIcon); bool success = UIControl::setupControl(scene,parent,controlName); @@ -13,7 +13,7 @@ bool UIControl_BitmapIcon::setupControl(UIScene *scene, IggyValuePath *parent, c return success; } -void UIControl_BitmapIcon::setTextureName(const wstring &iconName) +void UIControl_BitmapIcon::setTextureName(const std::wstring &iconName) { IggyDataValue result; IggyDataValue value[1]; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_BitmapIcon.h b/Minecraft.Client/Build/Common/UI/UIControl_BitmapIcon.h index 9b2fe0a87..6de7d6c30 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_BitmapIcon.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_BitmapIcon.h @@ -8,7 +8,7 @@ private: IggyName m_funcSetTextureName; public: - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); - void setTextureName(const wstring &iconName); + void setTextureName(const std::wstring &iconName); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Button.cpp b/Minecraft.Client/Build/Common/UI/UIControl_Button.cpp index ec4efde8d..7ba833abb 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Button.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_Button.cpp @@ -6,7 +6,7 @@ UIControl_Button::UIControl_Button() { } -bool UIControl_Button::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_Button::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eButton); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -17,7 +17,7 @@ bool UIControl_Button::setupControl(UIScene *scene, IggyValuePath *parent, const return success; } -void UIControl_Button::init(const wstring &label, int id) +void UIControl_Button::init(const std::wstring &label, int id) { m_label = label; m_id = id; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Button.h b/Minecraft.Client/Build/Common/UI/UIControl_Button.h index 367a48d7f..4dde5983a 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Button.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_Button.h @@ -10,9 +10,9 @@ private: public: UIControl_Button(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); - void init(const wstring &label, int id); + void init(const std::wstring &label, int id); virtual void ReInit(); void setEnable(bool enable); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_ButtonList.cpp b/Minecraft.Client/Build/Common/UI/UIControl_ButtonList.cpp index 7e3bcd78a..875d12365 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_ButtonList.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_ButtonList.cpp @@ -8,7 +8,7 @@ UIControl_ButtonList::UIControl_ButtonList() m_iCurrentSelection = 0; } -bool UIControl_ButtonList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_ButtonList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eButtonList); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -65,17 +65,17 @@ void UIControl_ButtonList::clearList() m_itemCount = 0; } -void UIControl_ButtonList::addItem(const string &label) +void UIControl_ButtonList::addItem(const std::string &label) { addItem(label, m_itemCount); } -void UIControl_ButtonList::addItem(const wstring &label) +void UIControl_ButtonList::addItem(const std::wstring &label) { addItem(label, m_itemCount); } -void UIControl_ButtonList::addItem(const string &label, int data) +void UIControl_ButtonList::addItem(const std::string &label, int data) { IggyDataValue result; IggyDataValue value[2]; @@ -93,7 +93,7 @@ void UIControl_ButtonList::addItem(const string &label, int data) ++m_itemCount; } -void UIControl_ButtonList::addItem(const wstring &label, int data) +void UIControl_ButtonList::addItem(const std::wstring &label, int data) { IggyDataValue result; IggyDataValue value[2]; @@ -143,7 +143,7 @@ void UIControl_ButtonList::updateChildFocus(int iChild) m_iCurrentSelection = iChild; } -void UIControl_ButtonList::setButtonLabel(int iButtonId, const wstring &label) +void UIControl_ButtonList::setButtonLabel(int iButtonId, const std::wstring &label) { IggyDataValue result; IggyDataValue value[2]; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_ButtonList.h b/Minecraft.Client/Build/Common/UI/UIControl_ButtonList.h index a3c5da3a7..cee0199f3 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_ButtonList.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_ButtonList.h @@ -13,18 +13,18 @@ protected: public: UIControl_ButtonList(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); void init(int id); virtual void ReInit(); void clearList(); - void addItem(const wstring &label); - void addItem(const string &label); + void addItem(const std::wstring &label); + void addItem(const std::string &label); - void addItem(const wstring &label, int data); - void addItem(const string &label, int data); + void addItem(const std::wstring &label, int data); + void addItem(const std::string &label, int data); void removeItem(int index); @@ -35,7 +35,7 @@ public: void updateChildFocus(int iChild); - void setButtonLabel(int iButtonId, const wstring &label); + void setButtonLabel(int iButtonId, const std::wstring &label); #ifdef __PSVITA__ void SetTouchFocus(S32 iX, S32 iY, bool bRepeat); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_CheckBox.cpp b/Minecraft.Client/Build/Common/UI/UIControl_CheckBox.cpp index 23490d2ce..8fd0398ed 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_CheckBox.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_CheckBox.cpp @@ -6,7 +6,7 @@ UIControl_CheckBox::UIControl_CheckBox() { } -bool UIControl_CheckBox::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_CheckBox::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eCheckBox); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -21,7 +21,7 @@ bool UIControl_CheckBox::setupControl(UIScene *scene, IggyValuePath *parent, con return success; } -void UIControl_CheckBox::init(const wstring &label, int id, bool checked) +void UIControl_CheckBox::init(const std::wstring &label, int id, bool checked) { m_label = label; m_id = id; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_CheckBox.h b/Minecraft.Client/Build/Common/UI/UIControl_CheckBox.h index 924e9c688..83f0d9db6 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_CheckBox.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_CheckBox.h @@ -12,9 +12,9 @@ private: public: UIControl_CheckBox(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); - void init(const wstring &label, int id, bool checked); + void init(const std::wstring &label, int id, bool checked); bool IsChecked(); bool IsEnabled(); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Cursor.cpp b/Minecraft.Client/Build/Common/UI/UIControl_Cursor.cpp index b824fd4b9..2c8bb1af8 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Cursor.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_Cursor.cpp @@ -6,7 +6,7 @@ UIControl_Cursor::UIControl_Cursor() { } -bool UIControl_Cursor::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_Cursor::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eCursor); bool success = UIControl_Base::setupControl(scene,parent,controlName); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Cursor.h b/Minecraft.Client/Build/Common/UI/UIControl_Cursor.h index cc7705d47..e165c919d 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Cursor.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_Cursor.h @@ -7,5 +7,5 @@ class UIControl_Cursor : public UIControl_Base public: UIControl_Cursor(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIControl_DLCList.cpp b/Minecraft.Client/Build/Common/UI/UIControl_DLCList.cpp index 374197c09..253f18e27 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_DLCList.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_DLCList.cpp @@ -2,7 +2,7 @@ #include "UI.h" #include "UIControl_DLCList.h" -bool UIControl_DLCList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_DLCList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eDLCList); bool success = UIControl_ButtonList::setupControl(scene,parent,controlName); @@ -13,7 +13,7 @@ bool UIControl_DLCList::setupControl(UIScene *scene, IggyValuePath *parent, cons return success; } -void UIControl_DLCList::addItem(const string &label, bool showTick, int iId) +void UIControl_DLCList::addItem(const std::string &label, bool showTick, int iId) { IggyDataValue result; IggyDataValue value[3]; @@ -34,7 +34,7 @@ void UIControl_DLCList::addItem(const string &label, bool showTick, int iId) ++m_itemCount; } -void UIControl_DLCList::addItem(const wstring &label, bool showTick, int iId) +void UIControl_DLCList::addItem(const std::wstring &label, bool showTick, int iId) { IggyDataValue result; IggyDataValue value[3]; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_DLCList.h b/Minecraft.Client/Build/Common/UI/UIControl_DLCList.h index 9c917cbfb..e0afaec2d 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_DLCList.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_DLCList.h @@ -8,10 +8,10 @@ private: IggyName m_funcShowTick; public: - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); using UIControl_ButtonList::addItem; - void addItem(const string &label, bool showTick, int iId); - void addItem(const wstring &label, bool showTick, int iId); + void addItem(const std::string &label, bool showTick, int iId); + void addItem(const std::wstring &label, bool showTick, int iId); void showTick(int iId, bool showTick); }; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_DynamicLabel.cpp b/Minecraft.Client/Build/Common/UI/UIControl_DynamicLabel.cpp index 93806f929..023f776f9 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_DynamicLabel.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_DynamicLabel.cpp @@ -6,7 +6,7 @@ UIControl_DynamicLabel::UIControl_DynamicLabel() { } -bool UIControl_DynamicLabel::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_DynamicLabel::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eDynamicLabel); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -20,7 +20,7 @@ bool UIControl_DynamicLabel::setupControl(UIScene *scene, IggyValuePath *parent, return success; } -void UIControl_DynamicLabel::addText(const wstring &text, bool bLastEntry) +void UIControl_DynamicLabel::addText(const std::wstring &text, bool bLastEntry) { IggyDataValue result; IggyDataValue value[2]; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_DynamicLabel.h b/Minecraft.Client/Build/Common/UI/UIControl_DynamicLabel.h index 902c706d2..dc34e945a 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_DynamicLabel.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_DynamicLabel.h @@ -10,9 +10,9 @@ private: public: UIControl_DynamicLabel(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); - virtual void addText(const wstring &text, bool bLastEntry); + virtual void addText(const std::wstring &text, bool bLastEntry); virtual void ReInit(); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentBook.cpp b/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentBook.cpp index 89cbd8b48..e37f889fd 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentBook.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentBook.cpp @@ -100,7 +100,7 @@ void UIControl_EnchantmentBook::tickBook() { UIScene_EnchantingMenu *m_containerScene = (UIScene_EnchantingMenu *)m_parentScene; EnchantmentMenu *menu = m_containerScene->getMenu(); - shared_ptr current = menu->getSlot(0)->getItem(); + std::shared_ptr current = menu->getSlot(0)->getItem(); if (!ItemInstance::matches(current, last)) { last = current; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentBook.h b/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentBook.h index cbe2cf2bf..5cd78a89a 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentBook.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentBook.h @@ -19,7 +19,7 @@ private: //BOOL m_bDirty; //float m_fScale,m_fAlpha; //int m_iPad; - shared_ptr last; + std::shared_ptr last; //float m_fScreenWidth,m_fScreenHeight; //float m_fRawWidth,m_fRawHeight; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentButton.cpp b/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentButton.cpp index 955d0d718..021fa59c6 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentButton.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentButton.cpp @@ -23,7 +23,7 @@ UIControl_EnchantmentButton::UIControl_EnchantmentButton() m_textDisabledColour = app.GetHTMLColour(eTextColor_EnchantDisabled); } -bool UIControl_EnchantmentButton::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_EnchantmentButton::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eEnchantmentButton); bool success = UIControl_Button::setupControl(scene,parent,controlName); @@ -93,7 +93,7 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region) glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.1f); Minecraft *pMinecraft = Minecraft::GetInstance(); - wstring line = _toString(cost); + std::wstring line = _toString(cost); Font *font = pMinecraft->altFont; //int col = 0x685E4A; unsigned int col = m_textColour; @@ -191,15 +191,15 @@ UIControl_EnchantmentButton::EnchantmentNames UIControl_EnchantmentButton::Encha UIControl_EnchantmentButton::EnchantmentNames::EnchantmentNames() { - wstring allWords = L"the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale "; + std::wstring allWords = L"the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale "; std::wistringstream iss(allWords); std::copy(std::istream_iterator< std::wstring, wchar_t, std::char_traits >(iss), std::istream_iterator< std::wstring, wchar_t, std::char_traits >(),std::back_inserter(words)); } -wstring UIControl_EnchantmentButton::EnchantmentNames::getRandomName() +std::wstring UIControl_EnchantmentButton::EnchantmentNames::getRandomName() { int wordCount = random.nextInt(2) + 3; - wstring word = L""; + std::wstring word = L""; for (int i = 0; i < wordCount; i++) { if (i > 0) word += L" "; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentButton.h b/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentButton.h index 9b8a3c8f3..9e6f40167 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentButton.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_EnchantmentButton.h @@ -16,7 +16,7 @@ private: EState m_lastState; int m_lastCost; int m_index; - wstring m_enchantmentString; + std::wstring m_enchantmentString; bool m_bHasFocus; IggyName m_funcChangeState; @@ -30,18 +30,18 @@ private: private: Random random; - vector words; + std::vector words; EnchantmentNames(); public: - wstring getRandomName(); + std::wstring getRandomName(); }; public: UIControl_EnchantmentButton(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); virtual void tick(); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_HTMLLabel.cpp b/Minecraft.Client/Build/Common/UI/UIControl_HTMLLabel.cpp index 78081462b..fb2dda142 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_HTMLLabel.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_HTMLLabel.cpp @@ -6,7 +6,7 @@ UIControl_HTMLLabel::UIControl_HTMLLabel() { } -bool UIControl_HTMLLabel::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_HTMLLabel::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eHTMLLabel); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -33,7 +33,7 @@ void UIControl_HTMLLabel::ReInit() init(L""); } -void UIControl_HTMLLabel::setLabel(const string &label) +void UIControl_HTMLLabel::setLabel(const std::string &label) { IggyDataValue result; IggyDataValue value[1]; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_HTMLLabel.h b/Minecraft.Client/Build/Common/UI/UIControl_HTMLLabel.h index 17e7cfb40..61e59e95f 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_HTMLLabel.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_HTMLLabel.h @@ -10,13 +10,13 @@ private: public: UIControl_HTMLLabel(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); void startAutoScroll(); virtual void ReInit(); using UIControl_Base::setLabel; - void setLabel(const string &label); + void setLabel(const std::string &label); virtual void SetupTouch(); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Label.cpp b/Minecraft.Client/Build/Common/UI/UIControl_Label.cpp index ad620ba8c..3dbaa041f 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Label.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_Label.cpp @@ -7,7 +7,7 @@ UIControl_Label::UIControl_Label() { } -bool UIControl_Label::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_Label::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eLabel); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -17,7 +17,7 @@ bool UIControl_Label::setupControl(UIScene *scene, IggyValuePath *parent, const return success; } -void UIControl_Label::init(const wstring &label) +void UIControl_Label::init(const std::wstring &label) { m_label = label; @@ -32,7 +32,7 @@ void UIControl_Label::init(const wstring &label) IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value ); } -void UIControl_Label::init(const string &label) +void UIControl_Label::init(const std::string &label) { m_label = convStringToWstring(label); IggyDataValue result; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Label.h b/Minecraft.Client/Build/Common/UI/UIControl_Label.h index aa0f3f14c..d95b3c48d 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Label.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_Label.h @@ -7,9 +7,9 @@ class UIControl_Label : public UIControl_Base public: UIControl_Label(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); - void init(const wstring &label); - void init(const string &label); + void init(const std::wstring &label); + void init(const std::string &label); virtual void ReInit(); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIControl_LeaderboardList.cpp b/Minecraft.Client/Build/Common/UI/UIControl_LeaderboardList.cpp index e404a8b07..4ca314f95 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_LeaderboardList.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_LeaderboardList.cpp @@ -6,7 +6,7 @@ UIControl_LeaderboardList::UIControl_LeaderboardList() { } -bool UIControl_LeaderboardList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_LeaderboardList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eLeaderboardList); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -48,7 +48,7 @@ void UIControl_LeaderboardList::clearList() IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcResetLeaderboard , 0 , NULL ); } -void UIControl_LeaderboardList::setupTitles(const wstring &rank, const wstring &gamertag) +void UIControl_LeaderboardList::setupTitles(const std::wstring &rank, const std::wstring &gamertag) { IggyDataValue result; IggyDataValue value[2]; @@ -111,7 +111,7 @@ void UIControl_LeaderboardList::setColumnIcon(int iColumn, int iType) IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetColumnIcon , 2 , value ); } -void UIControl_LeaderboardList::addDataSet(bool bLast, int iId, int iRank, const wstring &gamertag, bool bDisplayMessage, const wstring &col0, const wstring &col1, const wstring &col2, const wstring &col3, const wstring &col4, const wstring &col5, const wstring &col6) +void UIControl_LeaderboardList::addDataSet(bool bLast, int iId, int iRank, const std::wstring &gamertag, bool bDisplayMessage, const std::wstring &col0, const std::wstring &col1, const std::wstring &col2, const std::wstring &col3, const std::wstring &col4, const std::wstring &col5, const std::wstring &col6) { IggyDataValue result; IggyDataValue value[12]; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_LeaderboardList.h b/Minecraft.Client/Build/Common/UI/UIControl_LeaderboardList.h index e102ddd75..63597d28f 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_LeaderboardList.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_LeaderboardList.h @@ -32,17 +32,17 @@ public: }; UIControl_LeaderboardList(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); void init(int id); virtual void ReInit(); void clearList(); - void setupTitles(const wstring &rank, const wstring &gamertag); + void setupTitles(const std::wstring &rank, const std::wstring &gamertag); void initLeaderboard(int iFirstFocus, int iTotalEntries, int iNumColumns); void setColumnIcon(int iColumn, int iType); - void addDataSet(bool bLast, int iId, int iRank, const wstring &gamertag, bool bDisplayMessage, const wstring &col0, const wstring &col1, const wstring &col2, const wstring &col3, const wstring &col4, const wstring &col5, const wstring &col6); + void addDataSet(bool bLast, int iId, int iRank, const std::wstring &gamertag, bool bDisplayMessage, const std::wstring &col0, const std::wstring &col1, const std::wstring &col2, const std::wstring &col3, const std::wstring &col4, const std::wstring &col5, const std::wstring &col6); #ifdef __PSVITA__ void SetTouchFocus(S32 iX, S32 iY, bool bRepeat); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_PlayerList.cpp b/Minecraft.Client/Build/Common/UI/UIControl_PlayerList.cpp index c12311557..bf92af647 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_PlayerList.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_PlayerList.cpp @@ -2,7 +2,7 @@ #include "UI.h" #include "UIControl_PlayerList.h" -bool UIControl_PlayerList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_PlayerList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::ePlayerList); bool success = UIControl_ButtonList::setupControl(scene,parent,controlName); @@ -14,7 +14,7 @@ bool UIControl_PlayerList::setupControl(UIScene *scene, IggyValuePath *parent, c return success; } -void UIControl_PlayerList::addItem(const wstring &label, int iPlayerIcon, int iVOIPIcon) +void UIControl_PlayerList::addItem(const std::wstring &label, int iPlayerIcon, int iVOIPIcon) { IggyDataValue result; IggyDataValue value[4]; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_PlayerList.h b/Minecraft.Client/Build/Common/UI/UIControl_PlayerList.h index 8647d9500..2da9433c1 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_PlayerList.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_PlayerList.h @@ -8,10 +8,10 @@ private: IggyName m_funcSetPlayerIcon, m_funcSetVOIPIcon; public: - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); using UIControl_ButtonList::addItem; - void addItem(const wstring &label, int iPlayerIcon, int iVOIPIcon); + void addItem(const std::wstring &label, int iPlayerIcon, int iVOIPIcon); void setPlayerIcon(int iId, int iPlayerIcon); void setVOIPIcon(int iId, int iVOIPIcon); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Build/Common/UI/UIControl_PlayerSkinPreview.cpp index 5aa953738..3ce250ba8 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -105,7 +105,7 @@ void UIControl_PlayerSkinPreview::tick() } } -void UIControl_PlayerSkinPreview::SetTexture(const wstring &url, TEXTURE_NAME backupTexture) +void UIControl_PlayerSkinPreview::SetTexture(const std::wstring &url, TEXTURE_NAME backupTexture) { m_customTextureUrl = url; m_backupTexture = backupTexture; @@ -221,7 +221,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region) if (renderer != NULL) { // 4J-PB - any additional parts to turn on for this player (skin dependent) - //vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); + //std::vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) { @@ -473,7 +473,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou model->holdingLeftHand = false; } -bool UIControl_PlayerSkinPreview::bindTexture(const wstring& urlTexture, int backupTexture) +bool UIControl_PlayerSkinPreview::bindTexture(const std::wstring& urlTexture, int backupTexture) { Textures *t = Minecraft::GetInstance()->textures; @@ -493,7 +493,7 @@ bool UIControl_PlayerSkinPreview::bindTexture(const wstring& urlTexture, int bac } } -bool UIControl_PlayerSkinPreview::bindTexture(const wstring& urlTexture, const wstring& backupTexture) +bool UIControl_PlayerSkinPreview::bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture) { Textures *t = Minecraft::GetInstance()->textures; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_PlayerSkinPreview.h b/Minecraft.Client/Build/Common/UI/UIControl_PlayerSkinPreview.h index 18ab3cecf..b493acc04 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_PlayerSkinPreview.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_PlayerSkinPreview.h @@ -26,9 +26,9 @@ private: BOOL m_bDirty; float m_fScale,m_fAlpha; - wstring m_customTextureUrl; + std::wstring m_customTextureUrl; TEXTURE_NAME m_backupTexture; - wstring m_capeTextureUrl; + std::wstring m_capeTextureUrl; unsigned int m_uiAnimOverrideBitmask; float m_fScreenWidth,m_fScreenHeight; @@ -51,8 +51,8 @@ private: float m_swingTime; ESkinPreviewAnimations m_currentAnimation; - //vector *m_pvAdditionalBoxes; - vector *m_pvAdditionalModelParts; + //std::vector *m_pvAdditionalBoxes; + std::vector *m_pvAdditionalModelParts; public: enum ESkinPreviewFacing { @@ -67,8 +67,8 @@ public: void render(IggyCustomDrawCallbackRegion *region); - void SetTexture(const wstring &url, TEXTURE_NAME backupTexture = TN_MOB_CHAR); - void SetCapeTexture(const wstring &url) { m_capeTextureUrl = url; } + void SetTexture(const std::wstring &url, TEXTURE_NAME backupTexture = TN_MOB_CHAR); + void SetCapeTexture(const std::wstring &url) { m_capeTextureUrl = url; } void ResetRotation() { m_xRot = 0; m_yRot = 0; } void IncrementYRotation() { m_yRot = (m_yRot+4); if(m_yRot >= 180) m_yRot = -180; } void DecrementYRotation() { m_yRot = (m_yRot-4); if(m_yRot <= -180) m_yRot = 180; } @@ -85,6 +85,6 @@ public: private: void render(EntityRenderer *renderer, double x, double y, double z, float rot, float a); - bool bindTexture(const wstring& urlTexture, int backupTexture); - bool bindTexture(const wstring& urlTexture, const wstring& backupTexture); + bool bindTexture(const std::wstring& urlTexture, int backupTexture); + bool bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Progress.cpp b/Minecraft.Client/Build/Common/UI/UIControl_Progress.cpp index 6d55c637b..074ef381b 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Progress.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_Progress.cpp @@ -11,7 +11,7 @@ UIControl_Progress::UIControl_Progress() m_showingBar = true; } -bool UIControl_Progress::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_Progress::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eProgress); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -23,7 +23,7 @@ bool UIControl_Progress::setupControl(UIScene *scene, IggyValuePath *parent, con return success; } -void UIControl_Progress::init(const wstring &label, int id, int min, int max, int current) +void UIControl_Progress::init(const std::wstring &label, int id, int min, int max, int current) { m_label = label; m_id = id; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Progress.h b/Minecraft.Client/Build/Common/UI/UIControl_Progress.h index 8398a1880..48c681454 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Progress.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_Progress.h @@ -15,9 +15,9 @@ private: public: UIControl_Progress(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); - void init(const wstring &label, int id, int min, int max, int current); + void init(const std::wstring &label, int id, int min, int max, int current); virtual void ReInit(); void setProgress(int current); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_SaveList.cpp b/Minecraft.Client/Build/Common/UI/UIControl_SaveList.cpp index 70464fd63..7e9ff5e39 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_SaveList.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_SaveList.cpp @@ -2,7 +2,7 @@ #include "UI.h" #include "UIControl_SaveList.h" -bool UIControl_SaveList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_SaveList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eSaveList); bool success = UIControl_ButtonList::setupControl(scene,parent,controlName); @@ -13,39 +13,39 @@ bool UIControl_SaveList::setupControl(UIScene *scene, IggyValuePath *parent, con return success; } -void UIControl_SaveList::addItem(const wstring &label) +void UIControl_SaveList::addItem(const std::wstring &label) { addItem(label, L""); } -void UIControl_SaveList::addItem(const string &label) +void UIControl_SaveList::addItem(const std::string &label) { addItem(label, L""); } -void UIControl_SaveList::addItem(const wstring &label, int data) +void UIControl_SaveList::addItem(const std::wstring &label, int data) { addItem(label, L"", data); } -void UIControl_SaveList::addItem(const string &label, int data) +void UIControl_SaveList::addItem(const std::string &label, int data) { addItem(label, L"", data); } -void UIControl_SaveList::addItem(const string &label, const wstring &iconName) +void UIControl_SaveList::addItem(const std::string &label, const std::wstring &iconName) { addItem(label, iconName, m_itemCount); ++m_itemCount; } -void UIControl_SaveList::addItem(const wstring &label, const wstring &iconName) +void UIControl_SaveList::addItem(const std::wstring &label, const std::wstring &iconName) { addItem(label, iconName, m_itemCount); ++m_itemCount; } -void UIControl_SaveList::addItem(const string &label, const wstring &iconName, int data) +void UIControl_SaveList::addItem(const std::string &label, const std::wstring &iconName, int data) { IggyDataValue result; IggyDataValue value[3]; @@ -67,7 +67,7 @@ void UIControl_SaveList::addItem(const string &label, const wstring &iconName, i IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addNewItemFunc , 3 , value ); } -void UIControl_SaveList::addItem(const wstring &label, const wstring &iconName, int data) +void UIControl_SaveList::addItem(const std::wstring &label, const std::wstring &iconName, int data) { IggyDataValue result; IggyDataValue value[3]; @@ -89,7 +89,7 @@ void UIControl_SaveList::addItem(const wstring &label, const wstring &iconName, IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addNewItemFunc , 3 , value ); } -void UIControl_SaveList::setTextureName(int iId, const wstring &iconName) +void UIControl_SaveList::setTextureName(int iId, const std::wstring &iconName) { IggyDataValue result; IggyDataValue value[2]; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_SaveList.h b/Minecraft.Client/Build/Common/UI/UIControl_SaveList.h index 7c72fea9c..53bfbc6ff 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_SaveList.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_SaveList.h @@ -8,22 +8,22 @@ private: IggyName m_funcSetTextureName; public: - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); using UIControl_ButtonList::addItem; - void addItem(const wstring &label); - void addItem(const string &label); + void addItem(const std::wstring &label); + void addItem(const std::string &label); - void addItem(const wstring &label, int data); - void addItem(const string &label, int data); + void addItem(const std::wstring &label, int data); + void addItem(const std::string &label, int data); - void addItem(const string &label, const wstring &iconName); - void addItem(const wstring &label, const wstring &iconName); - void setTextureName(int iId, const wstring &iconName); + void addItem(const std::string &label, const std::wstring &iconName); + void addItem(const std::wstring &label, const std::wstring &iconName); + void setTextureName(int iId, const std::wstring &iconName); private: - void addItem(const string &label, const wstring &iconName, int data); - void addItem(const wstring &label, const wstring &iconName, int data); + void addItem(const std::string &label, const std::wstring &iconName, int data); + void addItem(const std::wstring &label, const std::wstring &iconName, int data); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Slider.cpp b/Minecraft.Client/Build/Common/UI/UIControl_Slider.cpp index bff6a5b7e..6624987f0 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Slider.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_Slider.cpp @@ -10,7 +10,7 @@ UIControl_Slider::UIControl_Slider() m_current = 0; } -bool UIControl_Slider::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_Slider::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eSlider); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -22,7 +22,7 @@ bool UIControl_Slider::setupControl(UIScene *scene, IggyValuePath *parent, const return success; } -void UIControl_Slider::init(const wstring &label, int id, int min, int max, int current) +void UIControl_Slider::init(const std::wstring &label, int id, int min, int max, int current) { m_label = label; m_id = id; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Slider.h b/Minecraft.Client/Build/Common/UI/UIControl_Slider.h index 0b57c2f1f..5429b65e2 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Slider.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_Slider.h @@ -10,7 +10,7 @@ private: int m_max; int m_current; - vector m_allPossibleLabels; + std::vector m_allPossibleLabels; // 4J-TomK - function for setting slider position on touch IggyName m_funcSetRelativeSliderPos; @@ -19,9 +19,9 @@ private: public: UIControl_Slider(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); - void init(const wstring &label, int id, int min, int max, int current); + void init(const std::wstring &label, int id, int min, int max, int current); void handleSliderMove(int newValue); void SetSliderTouchPos(float fTouchPos); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_SlotList.cpp b/Minecraft.Client/Build/Common/UI/UIControl_SlotList.cpp index f3cab73a2..268dbd511 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_SlotList.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_SlotList.cpp @@ -7,7 +7,7 @@ UIControl_SlotList::UIControl_SlotList() m_lastHighlighted = -1; } -bool UIControl_SlotList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_SlotList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eSlotList); bool success = UIControl_Base::setupControl(scene,parent,controlName); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_SlotList.h b/Minecraft.Client/Build/Common/UI/UIControl_SlotList.h index ee741c4de..82b5b4acd 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_SlotList.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_SlotList.h @@ -13,7 +13,7 @@ private: public: UIControl_SlotList(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); void addSlot(int id); void addSlots(int iStartValue, int iCount); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_SpaceIndicatorBar.cpp b/Minecraft.Client/Build/Common/UI/UIControl_SpaceIndicatorBar.cpp index fdfc7ff4a..ae629157f 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_SpaceIndicatorBar.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_SpaceIndicatorBar.cpp @@ -11,7 +11,7 @@ UIControl_SpaceIndicatorBar::UIControl_SpaceIndicatorBar() m_currentOffset = 0.0f; } -bool UIControl_SpaceIndicatorBar::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_SpaceIndicatorBar::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eProgress); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -24,7 +24,7 @@ bool UIControl_SpaceIndicatorBar::setupControl(UIScene *scene, IggyValuePath *pa return success; } -void UIControl_SpaceIndicatorBar::init(const wstring &label, int id, __int64 min, __int64 max) +void UIControl_SpaceIndicatorBar::init(const std::wstring &label, int id, __int64 min, __int64 max) { m_label = label; m_id = id; @@ -65,7 +65,7 @@ void UIControl_SpaceIndicatorBar::addSave(__int64 size) { float startPercent = (float)((m_currentTotal-m_min))/(m_max-m_min); - m_sizeAndOffsets.push_back( pair<__int64, float>(size, startPercent) ); + m_sizeAndOffsets.push_back( std::pair<__int64, float>(size, startPercent) ); m_currentTotal += size; setTotalSize(m_currentTotal); @@ -75,7 +75,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index) { if(index >= 0 && index < m_sizeAndOffsets.size()) { - pair<__int64,float> values = m_sizeAndOffsets[index]; + std::pair<__int64,float> values = m_sizeAndOffsets[index]; setSaveSize(values.first); setSaveGameOffset(values.second); } diff --git a/Minecraft.Client/Build/Common/UI/UIControl_SpaceIndicatorBar.h b/Minecraft.Client/Build/Common/UI/UIControl_SpaceIndicatorBar.h index 39f9a746e..ac0da22d7 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_SpaceIndicatorBar.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_SpaceIndicatorBar.h @@ -11,14 +11,14 @@ private: __int64 m_currentSave, m_currentTotal; float m_currentOffset; - vector > m_sizeAndOffsets; + std::vector > m_sizeAndOffsets; public: UIControl_SpaceIndicatorBar(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); - void init(const wstring &label, int id, __int64 min, __int64 max); + void init(const std::wstring &label, int id, __int64 min, __int64 max); virtual void ReInit(); void reset(); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_TextInput.cpp b/Minecraft.Client/Build/Common/UI/UIControl_TextInput.cpp index 619872864..c635a588c 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_TextInput.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_TextInput.cpp @@ -7,7 +7,7 @@ UIControl_TextInput::UIControl_TextInput() m_bHasFocus = false; } -bool UIControl_TextInput::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_TextInput::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eTextInput); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -20,7 +20,7 @@ bool UIControl_TextInput::setupControl(UIScene *scene, IggyValuePath *parent, co return success; } -void UIControl_TextInput::init(const wstring &label, int id) +void UIControl_TextInput::init(const std::wstring &label, int id) { m_label = label; m_id = id; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_TextInput.h b/Minecraft.Client/Build/Common/UI/UIControl_TextInput.h index d4023884e..642841f01 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_TextInput.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_TextInput.h @@ -11,9 +11,9 @@ private: public: UIControl_TextInput(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); - void init(const wstring &label, int id); + void init(const std::wstring &label, int id); void ReInit(); virtual void setFocus(bool focus); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_TexturePackList.cpp b/Minecraft.Client/Build/Common/UI/UIControl_TexturePackList.cpp index 95e776973..0944c850f 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_TexturePackList.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_TexturePackList.cpp @@ -6,7 +6,7 @@ UIControl_TexturePackList::UIControl_TexturePackList() { } -bool UIControl_TexturePackList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_TexturePackList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eTexturePackList); bool success = UIControl_Base::setupControl(scene,parent,controlName); @@ -23,7 +23,7 @@ bool UIControl_TexturePackList::setupControl(UIScene *scene, IggyValuePath *pare return success; } -void UIControl_TexturePackList::init(const wstring &label, int id) +void UIControl_TexturePackList::init(const std::wstring &label, int id) { m_label = label; m_id = id; @@ -55,7 +55,7 @@ void UIControl_TexturePackList::init(const wstring &label, int id) #endif } -void UIControl_TexturePackList::addPack(int id, const wstring &textureName) +void UIControl_TexturePackList::addPack(int id, const std::wstring &textureName) { IggyDataValue result; IggyDataValue value[2]; diff --git a/Minecraft.Client/Build/Common/UI/UIControl_TexturePackList.h b/Minecraft.Client/Build/Common/UI/UIControl_TexturePackList.h index ce476fb18..69b4b826a 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_TexturePackList.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_TexturePackList.h @@ -11,11 +11,11 @@ private: public: UIControl_TexturePackList(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); - void init(const wstring &label, int id); + void init(const std::wstring &label, int id); - void addPack(int id, const wstring &textureName); + void addPack(int id, const std::wstring &textureName); void selectSlot(int id); void clearSlots(); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Touch.cpp b/Minecraft.Client/Build/Common/UI/UIControl_Touch.cpp index 3abdea101..a3336364f 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Touch.cpp +++ b/Minecraft.Client/Build/Common/UI/UIControl_Touch.cpp @@ -6,7 +6,7 @@ UIControl_Touch::UIControl_Touch() { } -bool UIControl_Touch::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) +bool UIControl_Touch::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName) { UIControl::setControlType(UIControl::eTouchControl); bool success = UIControl_Base::setupControl(scene,parent,controlName); diff --git a/Minecraft.Client/Build/Common/UI/UIControl_Touch.h b/Minecraft.Client/Build/Common/UI/UIControl_Touch.h index 8ae799a02..3e77c6cad 100644 --- a/Minecraft.Client/Build/Common/UI/UIControl_Touch.h +++ b/Minecraft.Client/Build/Common/UI/UIControl_Touch.h @@ -9,7 +9,7 @@ private: public: UIControl_Touch(); - virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); + virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName); void init(int id); virtual void ReInit(); diff --git a/Minecraft.Client/Build/Common/UI/UIController.cpp b/Minecraft.Client/Build/Common/UI/UIController.cpp index 9ee22da29..5448446be 100644 --- a/Minecraft.Client/Build/Common/UI/UIController.cpp +++ b/Minecraft.Client/Build/Common/UI/UIController.cpp @@ -125,7 +125,7 @@ extern "C" void __real_free(void *t); #endif __int64 UIController::iggyAllocCount = 0; -static unordered_map allocations; +static std::unordered_map allocations; static void * RADLINK AllocateFunction ( void * alloc_callback_user_data , size_t size_requested , size_t * size_returned ) { UIController *controller = (UIController *)alloc_callback_user_data; @@ -419,7 +419,7 @@ void UIController::tick() void UIController::loadSkins() { - wstring platformSkinPath = L""; + std::wstring platformSkinPath = L""; #ifdef __PS3__ platformSkinPath = L"skinPS3.swf"; @@ -508,7 +508,7 @@ void UIController::loadSkins() #endif // HD platforms } -IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinName) +IggyLibrary UIController::loadSkin(const std::wstring &skinPath, const std::wstring &skinName) { IggyLibrary lib = IGGY_INVALID_LIBRARY; // 4J Stu - We need to load the platformskin before the normal skin, as the normal skin requires some elements from the platform skin @@ -650,7 +650,7 @@ void UIController::CleanUpSkinReload() m_queuedMessageBoxData.clear(); } -byteArray UIController::getMovieData(const wstring &filename) +byteArray UIController::getMovieData(const std::wstring &filename) { // Cache everything we load in the current tick __int64 targetTime = System::currentTimeMillis() + (1000LL * 60); @@ -1252,10 +1252,10 @@ void UIController::setupCustomDrawMatrices(UIScene *scene, CustomDrawData *custo top = m_tileOriginY + (sceneHeight - customDrawRegion->mat[(1*4)+3]*sceneHeight)/2; bottom = top + (sceneHeight * -customDrawRegion->mat[(1*4) + 1])/2 * customDrawRegion->y1; - m_customRenderingClearRect.left = min(m_customRenderingClearRect.left, left); - m_customRenderingClearRect.right = max(m_customRenderingClearRect.right, right);; - m_customRenderingClearRect.top = min(m_customRenderingClearRect.top, top); - m_customRenderingClearRect.bottom = max(m_customRenderingClearRect.bottom, bottom); + m_customRenderingClearRect.left = std::min(m_customRenderingClearRect.left, left); + m_customRenderingClearRect.right = std::max(m_customRenderingClearRect.right, right);; + m_customRenderingClearRect.top = std::min(m_customRenderingClearRect.top, top); + m_customRenderingClearRect.bottom = std::max(m_customRenderingClearRect.bottom, bottom); if(!m_bScreenWidthSetup) { @@ -1383,7 +1383,7 @@ void RADLINK UIController::TextureSubstitutionDestroyCallback ( void * user_call t->releaseTexture( id ); } -void UIController::registerSubstitutionTexture(const wstring &textureName, PBYTE pbData, DWORD dwLength) +void UIController::registerSubstitutionTexture(const std::wstring &textureName, PBYTE pbData, DWORD dwLength) { // Remove it if it already exists unregisterSubstitutionTexture(textureName,false); @@ -1391,7 +1391,7 @@ void UIController::registerSubstitutionTexture(const wstring &textureName, PBYTE m_substitutionTextures[textureName] = byteArray(pbData, dwLength); } -void UIController::unregisterSubstitutionTexture(const wstring &textureName, bool deleteData) +void UIController::unregisterSubstitutionTexture(const std::wstring &textureName, bool deleteData) { AUTO_VAR(it,m_substitutionTextures.find(textureName)); @@ -2027,7 +2027,7 @@ void UIController::DisplayGamertag(unsigned int iPad, bool show) } } -void UIController::SetSelectedItem(unsigned int iPad, const wstring &name) +void UIController::SetSelectedItem(unsigned int iPad, const std::wstring &name) { EUIGroup group; @@ -2385,7 +2385,7 @@ void UIController::ShowUIDebugMarketingGuide(bool show) #endif } -void UIController::logDebugString(const string &text) +void UIController::logDebugString(const std::string &text) { if(m_uiDebugConsole) m_uiDebugConsole->addText(text); } diff --git a/Minecraft.Client/Build/Common/UI/UIController.h b/Minecraft.Client/Build/Common/UI/UIController.h index ef064f80c..4ba7eaefd 100644 --- a/Minecraft.Client/Build/Common/UI/UIController.h +++ b/Minecraft.Client/Build/Common/UI/UIController.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "IUIController.h" #include "UIEnums.h" #include "UIGroup.h" @@ -52,7 +52,7 @@ private: } UIELEMENT; // E3 - Fine for now, but we need to make this better! - vector m_TouchBoxes[eUIGroup_COUNT][eUILayer_COUNT][eUIScene_COUNT]; + std::vector m_TouchBoxes[eUIGroup_COUNT][eUILayer_COUNT][eUIScene_COUNT]; bool m_bTouchscreenPressed; #endif // 4J Stu - These should be in the order that they reference each other (i.e. they can only reference one with a lower value in the enum) @@ -113,14 +113,14 @@ private: static DWORD m_dwTrialTimerLimitSecs; - unordered_map m_substitutionTextures; + std::unordered_map m_substitutionTextures; typedef struct _CachedMovieData { byteArray m_ba; __int64 m_expiry; } CachedMovieData; - unordered_map m_cachedMovieData; + std::unordered_map m_cachedMovieData; typedef struct _QueuedMessageBoxData { @@ -128,7 +128,7 @@ private: int iPad; EUILayer layer; } QueuedMessageBoxData; - vector m_queuedMessageBoxData; + std::vector m_queuedMessageBoxData; unsigned int m_winUserIndex; //bool m_bSysUIShowing; @@ -139,7 +139,7 @@ private: D3D11_RECT m_customRenderingClearRect; - unordered_map m_registeredCallbackScenes; // A collection of scenes and unique id's that are used in async callbacks so we can safely handle when they get destroyed + std::unordered_map m_registeredCallbackScenes; // A collection of scenes and unique id's that are used in async callbacks so we can safely handle when they get destroyed CRITICAL_SECTION m_registeredCallbackScenesCS;; public: @@ -188,7 +188,7 @@ public: private: void loadSkins(); - IggyLibrary loadSkin(const wstring &skinPath, const wstring &skinName); + IggyLibrary loadSkin(const std::wstring &skinPath, const std::wstring &skinName); public: void ReloadSkin(); @@ -201,7 +201,7 @@ private: static int reloadSkinThreadProc(void* lpParam); public: - byteArray getMovieData(const wstring &filename); + byteArray getMovieData(const std::wstring &filename); // INPUT private: @@ -256,8 +256,8 @@ protected: virtual void destroySubstitutionTexture(void *destroyCallBackData, GDrawTexture *handle) {} public: - void registerSubstitutionTexture(const wstring &textureName, PBYTE pbData, DWORD dwLength); - void unregisterSubstitutionTexture(const wstring &textureName, bool deleteData); + void registerSubstitutionTexture(const std::wstring &textureName, PBYTE pbData, DWORD dwLength); + void unregisterSubstitutionTexture(const std::wstring &textureName, bool deleteData); public: // NAVIGATION @@ -302,7 +302,7 @@ public: virtual void PlayUISFX(ESoundEffect eSound); virtual void DisplayGamertag(unsigned int iPad, bool show); - virtual void SetSelectedItem(unsigned int iPad, const wstring &name); + virtual void SetSelectedItem(unsigned int iPad, const std::wstring &name); virtual void UpdateSelectedItemPos(unsigned int iPad); virtual void HandleDLCMountingComplete(); @@ -358,7 +358,7 @@ public: virtual void ShowUIDebugConsole(bool show); virtual void ShowUIDebugMarketingGuide(bool show); - void logDebugString(const string &text); + void logDebugString(const std::string &text); UIScene* FindScene(EUIScene sceneType); public: diff --git a/Minecraft.Client/Build/Common/UI/UIFontData.cpp b/Minecraft.Client/Build/Common/UI/UIFontData.cpp index c68e84974..b3fb63bdb 100644 --- a/Minecraft.Client/Build/Common/UI/UIFontData.cpp +++ b/Minecraft.Client/Build/Common/UI/UIFontData.cpp @@ -143,7 +143,7 @@ unsigned short SFontData::Codepoints[FONTSIZE] = CFontData::CFontData() { - m_unicodeMap = unordered_map(); + m_unicodeMap = std::unordered_map(); m_sFontData = NULL; m_kerningTable = NULL; @@ -181,7 +181,7 @@ CFontData::CFontData(SFontData &sFontData, int *pbRawImage) // CREATE UNICODE MAP // for (unsigned int i = 0; i < sFontData.m_uiGlyphCount; i++) { - unordered_map::value_type pair(sFontData.Codepoints[i], i); + std::unordered_map::value_type pair(sFontData.Codepoints[i], i); m_unicodeMap.insert( pair ); } @@ -260,7 +260,7 @@ CFontData::CFontData(SFontData &sFontData, int *pbRawImage) getPos(i, row, col); - string state = "ok"; + std::string state = "ok"; if (i != getGlyphId(unicode)) { state = "MISSMATCHED!"; @@ -279,7 +279,7 @@ void CFontData::release() delete [] m_pbRawImage; } -const string CFontData::getFontName() +const std::string CFontData::getFontName() { return m_sFontData->m_strFontName; } @@ -291,7 +291,7 @@ SFontData *CFontData::getFontData() unsigned short CFontData::getGlyphId(unsigned int unicodepoint) { - unordered_map::iterator out = m_unicodeMap.find(unicodepoint); + std::unordered_map::iterator out = m_unicodeMap.find(unicodepoint); if (out != m_unicodeMap.end()) return out->second; return 0; diff --git a/Minecraft.Client/Build/Common/UI/UIFontData.h b/Minecraft.Client/Build/Common/UI/UIFontData.h index b7e38ffa0..312750e59 100644 --- a/Minecraft.Client/Build/Common/UI/UIFontData.h +++ b/Minecraft.Client/Build/Common/UI/UIFontData.h @@ -2,7 +2,7 @@ #include -using namespace std; +//using namespace std; #define _DEBUG_BLOCK_CHARS 0 @@ -17,10 +17,10 @@ public: public: // Font name. - string m_strFontName; + std::string m_strFontName; // Filename of the glyph archive. - wstring m_wstrFilename; + std::wstring m_wstrFilename; // Number of glyphs in the archive. unsigned int m_uiGlyphCount; @@ -82,7 +82,7 @@ protected: SFontData *m_sFontData; // Map Unicodepoints to glyph ids. - unordered_map m_unicodeMap; + std::unordered_map m_unicodeMap; // Kerning value for each glyph. unsigned short *m_kerningTable; @@ -96,7 +96,7 @@ protected: public: // Accessor for the font name in the internal SFontData. - const string getFontName(); + const std::string getFontName(); // Accessor for the hardcoded internal font data. SFontData *getFontData(); diff --git a/Minecraft.Client/Build/Common/UI/UILayer.cpp b/Minecraft.Client/Build/Common/UI/UILayer.cpp index 8bbbae10e..71735c73b 100644 --- a/Minecraft.Client/Build/Common/UI/UILayer.cpp +++ b/Minecraft.Client/Build/Common/UI/UILayer.cpp @@ -17,7 +17,7 @@ UILayer::UILayer(UIGroup *parent) void UILayer::tick() { // Delete old scenes - deleting a scene can cause a new scene to be deleted, so we need to make a copy of the scenes that we are going to try and destroy this tick - vectorscenesToDeleteCopy; + std::vectorscenesToDeleteCopy; for( AUTO_VAR(it,m_scenesToDelete.begin()); it != m_scenesToDelete.end(); it++) { UIScene *scene = (*it); @@ -513,45 +513,45 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData) { case eUIComponent_Panorama: newScene = new UIComponent_Panorama(iPad, initData, this); - m_componentRefCount[scene] = pair(1,true); + m_componentRefCount[scene] = std::pair(1,true); break; case eUIComponent_DebugUIConsole: newScene = new UIComponent_DebugUIConsole(iPad, initData, this); - m_componentRefCount[scene] = pair(1,true); + m_componentRefCount[scene] = std::pair(1,true); break; case eUIComponent_DebugUIMarketingGuide: newScene = new UIComponent_DebugUIMarketingGuide(iPad, initData, this); - m_componentRefCount[scene] = pair(1,true); + m_componentRefCount[scene] = std::pair(1,true); break; case eUIComponent_Logo: newScene = new UIComponent_Logo(iPad, initData, this); - m_componentRefCount[scene] = pair(1,true); + m_componentRefCount[scene] = std::pair(1,true); break; case eUIComponent_Tooltips: newScene = new UIComponent_Tooltips(iPad, initData, this); - m_componentRefCount[scene] = pair(1,true); + m_componentRefCount[scene] = std::pair(1,true); break; case eUIComponent_TutorialPopup: newScene = new UIComponent_TutorialPopup(iPad, initData, this); // Start hidden - m_componentRefCount[scene] = pair(1,false); + m_componentRefCount[scene] = std::pair(1,false); break; case eUIScene_HUD: newScene = new UIScene_HUD(iPad, initData, this); // Start hidden - m_componentRefCount[scene] = pair(1,false); + m_componentRefCount[scene] = std::pair(1,false); break; case eUIComponent_Chat: newScene = new UIComponent_Chat(iPad, initData, this); - m_componentRefCount[scene] = pair(1,true); + m_componentRefCount[scene] = std::pair(1,true); break; case eUIComponent_PressStartToPlay: newScene = new UIComponent_PressStartToPlay(iPad, initData, this); - m_componentRefCount[scene] = pair(1,true); + m_componentRefCount[scene] = std::pair(1,true); break; case eUIComponent_MenuBackground: newScene = new UIComponent_MenuBackground(iPad, initData, this); - m_componentRefCount[scene] = pair(1,true); + m_componentRefCount[scene] = std::pair(1,true); break; }; @@ -620,7 +620,7 @@ void UILayer::removeScene(UIScene *scene) void UILayer::closeAllScenes() { - vector temp; + std::vector temp; temp.insert(temp.end(), m_sceneStack.begin(), m_sceneStack.end()); m_sceneStack.clear(); for(AUTO_VAR(it, temp.begin()); it != temp.end(); ++it) diff --git a/Minecraft.Client/Build/Common/UI/UILayer.h b/Minecraft.Client/Build/Common/UI/UILayer.h index 2840f23f2..dbe77e093 100644 --- a/Minecraft.Client/Build/Common/UI/UILayer.h +++ b/Minecraft.Client/Build/Common/UI/UILayer.h @@ -1,6 +1,6 @@ #pragma once #include "UIEnums.h" -using namespace std; +//using namespace std; class UIScene; class UIGroup; @@ -8,15 +8,15 @@ class UIGroup; class UILayer { private: - vector m_sceneStack; // Operates as a stack mainly, but we may wish to iterate over all elements - vector m_components; // Other componenents in this scene that to do not conform the the user nav stack, and cannot take focus - vector m_scenesToDelete; // A list of scenes to delete - vector m_scenesToDestroy; // A list of scenes where we want to dump the swf + std::vector m_sceneStack; // Operates as a stack mainly, but we may wish to iterate over all elements + std::vector m_components; // Other componenents in this scene that to do not conform the the user nav stack, and cannot take focus + std::vector m_scenesToDelete; // A list of scenes to delete + std::vector m_scenesToDestroy; // A list of scenes where we want to dump the swf #ifdef __ORBIS__ - unordered_map,std::hash> m_componentRefCount; + std::unordered_map,std::hash> m_componentRefCount; #else - unordered_map > m_componentRefCount; + std::unordered_map > m_componentRefCount; #endif public: diff --git a/Minecraft.Client/Build/Common/UI/UIScene.cpp b/Minecraft.Client/Build/Common/UI/UIScene.cpp index b74d73143..13c82279c 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene.cpp @@ -267,7 +267,7 @@ extern CRITICAL_SECTION s_loadSkinCS; void UIScene::loadMovie() { EnterCriticalSection(&UIController::ms_reloadSkinCS); // MGH - added to prevent crash loading Iggy movies while the skins were being reloaded - wstring moviePath = getMoviePath(); + std::wstring moviePath = getMoviePath(); #ifdef __PS3__ if(RenderManager.IsWidescreen()) @@ -386,7 +386,7 @@ void UIScene::loadMovie() } -void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo) +void UIScene::getDebugMemoryUseRecursive(const std::wstring &moviePath, IggyMemoryUseInfo &memoryInfo) { rrbool res; IggyMemoryUseInfo internalMemoryInfo; @@ -497,7 +497,7 @@ void UIScene::tickTimers() } } -IggyName UIScene::registerFastName(const wstring &name) +IggyName UIScene::registerFastName(const std::wstring &name) { IggyName var; AUTO_VAR(it,m_fastNames.find(name)); @@ -518,7 +518,7 @@ void UIScene::removeControl( UIControl_Base *control, bool centreScene) IggyDataValue result; IggyDataValue value[2]; - string name = control->getControlName(); + std::string name = control->getControlName(); IggyStringUTF8 stringVal; stringVal.string = (char*)name.c_str(); stringVal.length = name.length(); @@ -597,7 +597,7 @@ void UIScene::customDraw(IggyCustomDrawCallbackRegion *region) app.DebugPrintf("Handling custom draw for scene with no override!\n"); } -void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr item, float fAlpha, bool isFoil, bool bDecorations) +void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, std::shared_ptr item, float fAlpha, bool isFoil, bool bDecorations) { if (item!= NULL) { @@ -608,7 +608,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP //Make sure that pMinecraft->player is the correct player so that player specific rendering // eg clock and compass, are rendered correctly Minecraft *pMinecraft=Minecraft::GetInstance(); - shared_ptr oldPlayer = pMinecraft->player; + std::shared_ptr oldPlayer = pMinecraft->player; if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad]; // Setup GDraw, normal game render states and matrices @@ -688,7 +688,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP //Make sure that pMinecraft->player is the correct player so that player specific rendering // eg clock and compass, are rendered correctly - shared_ptr oldPlayer = pMinecraft->player; + std::shared_ptr oldPlayer = pMinecraft->player; if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad]; _customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, false); @@ -701,7 +701,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP } } -void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_ptr item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer) +void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, std::shared_ptr item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer) { Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -1161,13 +1161,13 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16 * call) } } -void UIScene::registerSubstitutionTexture(const wstring &textureName, PBYTE pbData, DWORD dwLength, bool deleteData) +void UIScene::registerSubstitutionTexture(const std::wstring &textureName, PBYTE pbData, DWORD dwLength, bool deleteData) { m_registeredTextures[textureName] = deleteData;; ui.registerSubstitutionTexture(textureName, pbData, dwLength); } -bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName) +bool UIScene::hasRegisteredSubstitutionTexture(const std::wstring &textureName) { AUTO_VAR(it, m_registeredTextures.find( textureName ) ); diff --git a/Minecraft.Client/Build/Common/UI/UIScene.h b/Minecraft.Client/Build/Common/UI/UIScene.h index 823c510c7..315229390 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene.h +++ b/Minecraft.Client/Build/Common/UI/UIScene.h @@ -1,7 +1,7 @@ #pragma once // 4J-PB - remove the inherits via dominance warnings #pragma warning( disable : 4250 ) -using namespace std; +//using namespace std; // A scene map directly to an Iggy movie (or more accurately a collection of different sized movies) #include "UIEnums.h" @@ -49,8 +49,8 @@ private: IggyName m_funcSetAlpha; ItemRenderer *m_pItemRenderer; - unordered_map m_fastNames; - unordered_map m_registeredTextures; + std::unordered_map m_fastNames; + std::unordered_map m_registeredTextures; typedef struct _TimerInfo { @@ -58,7 +58,7 @@ private: int targetTime; bool running; } TimerInfo; - unordered_map m_timers; + std::unordered_map m_timers; int m_iFocusControl, m_iFocusChild; float m_lastOpacity; @@ -86,7 +86,7 @@ protected: int m_movieWidth, m_movieHeight; int m_renderWidth, m_renderHeight; - vector m_controls; + std::vector m_controls; protected: UILayer *m_parentLayer; @@ -109,7 +109,7 @@ public: #ifdef __PSVITA__ UILayer *GetParentLayer() {return m_parentLayer;} EUIGroup GetParentLayerGroup() {return m_parentLayer->m_parentGroup->GetGroup();} - vector *GetControls() {return &m_controls;} + std::vector *GetControls() {return &m_controls;} #endif protected: @@ -117,14 +117,14 @@ protected: virtual F64 getSafeZoneHalfWidth(); void setSafeZone(S32 top, S32 bottom, S32 left, S32 right); void doHorizontalResizeCheck(); - virtual wstring getMoviePath() = 0; + virtual std::wstring getMoviePath() = 0; virtual bool mapElementsAndNames(); void initialiseMovie(); void loadMovie(); private: - void getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo); + void getDebugMemoryUseRecursive(const std::wstring &moviePath, IggyMemoryUseInfo &memoryInfo); public: void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic); @@ -138,7 +138,7 @@ public: virtual void tick(); - IggyName registerFastName(const wstring &name); + IggyName registerFastName(const std::wstring &name); #ifdef __PSVITA__ void SetFocusToElement(int iID); void UpdateSceneControls(); @@ -187,7 +187,7 @@ public: protected: //void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, int iID, int iCount, int iAuxVal, float fAlpha, bool isFoil, bool bDecorations); - void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr item, float fAlpha, bool isFoil, bool bDecorations); + void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, std::shared_ptr item, float fAlpha, bool isFoil, bool bDecorations); bool m_cacheSlotRenders; bool m_needsCacheRendered; @@ -196,14 +196,14 @@ private: typedef struct _CachedSlotDrawData { CustomDrawData *customDrawRegion; - shared_ptr item; + std::shared_ptr item; float fAlpha; bool isFoil; bool bDecorations; } CachedSlotDrawData; - vector m_cachedSlotDraw; + std::vector m_cachedSlotDraw; - void _customDrawSlotControl(CustomDrawData *region, int iPad, shared_ptr item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer); + void _customDrawSlotControl(CustomDrawData *region, int iPad, std::shared_ptr item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer); public: // INPUT @@ -251,8 +251,8 @@ public: #ifdef _XBOX_ONE virtual void HandleDLCLicenseChange() {} #endif - void registerSubstitutionTexture(const wstring &textureName, PBYTE pbData, DWORD dwLength, bool deleteData = false); - bool hasRegisteredSubstitutionTexture(const wstring &textureName); + void registerSubstitutionTexture(const std::wstring &textureName, PBYTE pbData, DWORD dwLength, bool deleteData = false); + bool hasRegisteredSubstitutionTexture(const std::wstring &textureName); virtual void handleUnlockFullVersion() {} diff --git a/Minecraft.Client/Build/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_AbstractContainerMenu.cpp index fb7c0c28a..7fc8bc2cc 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -221,7 +221,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; - shared_ptr item = nullptr; + std::shared_ptr item = nullptr; if(wcscmp((wchar_t *)region->name,L"pointerIcon")==0) { m_cacheSlotRenders = false; @@ -259,7 +259,7 @@ void UIScene_AbstractContainerMenu::handleInput(int iPad, int key, bool repeat, } } -void UIScene_AbstractContainerMenu::SetPointerText(const wstring &description, vector &unformattedStrings, bool newSlot) +void UIScene_AbstractContainerMenu::SetPointerText(const std::wstring &description, std::vector &unformattedStrings, bool newSlot) { //app.DebugPrintf("Setting pointer text\n"); m_cursorPath.setLabel(description,false,newSlot); @@ -287,7 +287,7 @@ void UIScene_AbstractContainerMenu::setFocusToPointer(int iPad) m_focusSection = eSectionNone; } -shared_ptr UIScene_AbstractContainerMenu::getSlotItem(ESceneSection eSection, int iSlot) +std::shared_ptr UIScene_AbstractContainerMenu::getSlotItem(ESceneSection eSection, int iSlot) { Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot ); if(slot) return slot->getItem(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_AbstractContainerMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_AbstractContainerMenu.h index b98b37637..56be30a44 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_AbstractContainerMenu.h @@ -45,8 +45,8 @@ protected: virtual bool doesSectionTreeHaveFocus(ESceneSection eSection) { return false; } virtual void setSectionFocus(ESceneSection eSection, int iPad); void setFocusToPointer(int iPad); - void SetPointerText(const wstring &description, vector &unformattedStrings, bool newSlot); - virtual shared_ptr getSlotItem(ESceneSection eSection, int iSlot); + void SetPointerText(const std::wstring &description, std::vector &unformattedStrings, bool newSlot); + virtual std::shared_ptr getSlotItem(ESceneSection eSection, int iSlot); virtual bool isSlotEmpty(ESceneSection eSection, int iSlot); virtual void adjustPointerForSafeZone(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_AnvilMenu.cpp index 99df06ac3..606fde556 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_AnvilMenu.cpp @@ -37,7 +37,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void *_initData, UILayer *parentL m_slotListResult.addSlots(RepairMenu::RESULT_SLOT, 1); bool expensive = false; - wstring m_costString = L""; + std::wstring m_costString = L""; if(m_repairMenu->cost > 0) { @@ -56,7 +56,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void *_initData, UILayer *parentL wchar_t temp[256]; swprintf(temp, 256, costString, m_repairMenu->cost); m_costString = temp; - if(!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->mayPickup(dynamic_pointer_cast(m_inventory->player->shared_from_this()))) + if(!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->mayPickup(std::dynamic_pointer_cast(m_inventory->player->shared_from_this()))) { expensive = true; } @@ -71,7 +71,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void *_initData, UILayer *parentL app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_ANVIL); } -wstring UIScene_AnvilMenu::getMoviePath() +std::wstring UIScene_AnvilMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { @@ -346,7 +346,7 @@ void UIScene_AnvilMenu::handleEditNamePressed() #endif } -void UIScene_AnvilMenu::setEditNameValue(const wstring &name) +void UIScene_AnvilMenu::setEditNameValue(const std::wstring &name) { m_textInputAnvil.setLabel(name); } @@ -355,7 +355,7 @@ void UIScene_AnvilMenu::setEditNameEditable(bool enabled) { } -void UIScene_AnvilMenu::setCostLabel(const wstring &label, bool canAfford) +void UIScene_AnvilMenu::setCostLabel(const std::wstring &label, bool canAfford) { IggyDataValue result; IggyDataValue value[2]; diff --git a/Minecraft.Client/Build/Common/UI/UIScene_AnvilMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_AnvilMenu.h index de262d9e4..8261091be 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_AnvilMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_AnvilMenu.h @@ -41,7 +41,7 @@ protected: UI_MAP_NAME(m_funcSetCostLabel, L"SetCostLabel") UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleReload(); virtual void tick(); @@ -57,10 +57,10 @@ protected: static int KeyboardCompleteCallback(LPVOID lpParam,bool bRes); virtual void handleEditNamePressed(); - virtual void setEditNameValue(const wstring &name); + virtual void setEditNameValue(const std::wstring &name); virtual void setEditNameEditable(bool enabled); virtual void handleDestroy(); - void setCostLabel(const wstring &label, bool canAfford); + void setCostLabel(const std::wstring &label, bool canAfford); void showCross(bool show); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIScene_BrewingStandMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_BrewingStandMenu.cpp index 59eb68494..d4d190fb0 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_BrewingStandMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_BrewingStandMenu.cpp @@ -43,7 +43,7 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void *_initData, UI app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BREWING); } -wstring UIScene_BrewingStandMenu::getMoviePath() +std::wstring UIScene_BrewingStandMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_BrewingStandMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_BrewingStandMenu.h index 5441a1acb..d8a47c5fe 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_BrewingStandMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_BrewingStandMenu.h @@ -8,7 +8,7 @@ class InventoryMenu; class UIScene_BrewingStandMenu : public UIScene_AbstractContainerMenu, public IUIScene_BrewingMenu { private: - shared_ptr m_brewingStand; + std::shared_ptr m_brewingStand; public: UIScene_BrewingStandMenu(int iPad, void *initData, UILayer *parentLayer); @@ -33,7 +33,7 @@ protected: UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleReload(); virtual void tick(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_ConnectingProgress.cpp b/Minecraft.Client/Build/Common/UI/UIScene_ConnectingProgress.cpp index e9d1acbba..aa9c66a76 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_ConnectingProgress.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_ConnectingProgress.cpp @@ -74,7 +74,7 @@ void UIScene_ConnectingProgress::tick() } } -wstring UIScene_ConnectingProgress::getMoviePath() +std::wstring UIScene_ConnectingProgress::getMoviePath() { if(app.GetLocalPlayerCount() > 1 && !m_parentLayer->IsFullscreenGroup()) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_ConnectingProgress.h b/Minecraft.Client/Build/Common/UI/UIScene_ConnectingProgress.h index 2c52284c4..19a5eedd8 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_ConnectingProgress.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_ConnectingProgress.h @@ -46,7 +46,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); #ifdef _DURANGO virtual long long getDefaultGtcButtons() { return 0; } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_ContainerMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_ContainerMenu.cpp index a2828a4fe..386f0ce92 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_ContainerMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_ContainerMenu.cpp @@ -40,7 +40,7 @@ UIScene_ContainerMenu::UIScene_ContainerMenu(int iPad, void *_initData, UILayer if(initData) delete initData; } -wstring UIScene_ContainerMenu::getMoviePath() +std::wstring UIScene_ContainerMenu::getMoviePath() { if(m_bLargeChest) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_ContainerMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_ContainerMenu.h index f2ad743c2..02eb01d53 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_ContainerMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_ContainerMenu.h @@ -26,7 +26,7 @@ protected: UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleReload(); virtual int getSectionColumns(ESceneSection eSection); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_ControlsMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_ControlsMenu.cpp index de9d6f18c..a1b619207 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_ControlsMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_ControlsMenu.cpp @@ -107,7 +107,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void *initData, UILayer *pa PositionAllText(m_iPad); } -wstring UIScene_ControlsMenu::getMoviePath() +std::wstring UIScene_ControlsMenu::getMoviePath() { #ifdef __ORBIS__ if(InputManager.UsingRemoteVita()) diff --git a/Minecraft.Client/Build/Common/UI/UIScene_ControlsMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_ControlsMenu.h index 538207fe0..e714f042d 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_ControlsMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_ControlsMenu.h @@ -124,7 +124,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_CraftingMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_CraftingMenu.cpp index def563d84..4bd45608c 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_CraftingMenu.cpp @@ -224,7 +224,7 @@ EUIScene UIScene_CraftingMenu::getSceneType() } } -wstring UIScene_CraftingMenu::getMoviePath() +std::wstring UIScene_CraftingMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { @@ -435,7 +435,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; - shared_ptr item = nullptr; + std::shared_ptr item = nullptr; int slotId = -1; float alpha = 1.0f; bool decorations = true; @@ -606,21 +606,21 @@ void UIScene_CraftingMenu::hideAllIngredientsSlots() } } -void UIScene_CraftingMenu::setCraftHSlotItem(int iPad, int iIndex, shared_ptr item, unsigned int uiAlpha) +void UIScene_CraftingMenu::setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr item, unsigned int uiAlpha) { m_hSlotsInfo[iIndex].item = item; m_hSlotsInfo[iIndex].alpha = uiAlpha; m_hSlotsInfo[iIndex].show = true; } -void UIScene_CraftingMenu::setCraftVSlotItem(int iPad, int iIndex, shared_ptr item, unsigned int uiAlpha) +void UIScene_CraftingMenu::setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr item, unsigned int uiAlpha) { m_vSlotsInfo[iIndex].item = item; m_vSlotsInfo[iIndex].alpha = uiAlpha; m_vSlotsInfo[iIndex].show = true; } -void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, shared_ptr item) +void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, std::shared_ptr item) { m_craftingOutputSlotInfo.item = item; m_craftingOutputSlotInfo.alpha = 31; @@ -632,7 +632,7 @@ void UIScene_CraftingMenu::setCraftingOutputSlotRedBox(bool show) m_slotListCraftingOutput.showSlotRedBox(0,show); } -void UIScene_CraftingMenu::setIngredientSlotItem(int iPad, int index, shared_ptr item) +void UIScene_CraftingMenu::setIngredientSlotItem(int iPad, int index, std::shared_ptr item) { m_ingredientsSlotsInfo[index].item = item; m_ingredientsSlotsInfo[index].alpha = 31; @@ -644,7 +644,7 @@ void UIScene_CraftingMenu::setIngredientSlotRedBox(int index, bool show) m_slotListIngredientsLayout.showSlotRedBox(index,show); } -void UIScene_CraftingMenu::setIngredientDescriptionItem(int iPad, int index, shared_ptr item) +void UIScene_CraftingMenu::setIngredientDescriptionItem(int iPad, int index, std::shared_ptr item) { m_ingredientsInfo[index].item = item; m_ingredientsInfo[index].alpha = 31; diff --git a/Minecraft.Client/Build/Common/UI/UIScene_CraftingMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_CraftingMenu.h index 44a39d615..04318c582 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_CraftingMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_CraftingMenu.h @@ -32,7 +32,7 @@ class UIScene_CraftingMenu : public UIScene, public IUIScene_CraftingMenu private: typedef struct _SlotInfo { - shared_ptr item; + std::shared_ptr item; unsigned int alpha; bool show; @@ -171,7 +171,7 @@ protected: UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleReload(); virtual bool allowRepeat(int key); @@ -182,13 +182,13 @@ protected: virtual void hideAllHSlots(); virtual void hideAllVSlots(); virtual void hideAllIngredientsSlots(); - virtual void setCraftHSlotItem(int iPad, int iIndex, shared_ptr item, unsigned int uiAlpha); - virtual void setCraftVSlotItem(int iPad, int iIndex, shared_ptr item, unsigned int uiAlpha); - virtual void setCraftingOutputSlotItem(int iPad, shared_ptr item); + virtual void setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr item, unsigned int uiAlpha); + virtual void setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr item, unsigned int uiAlpha); + virtual void setCraftingOutputSlotItem(int iPad, std::shared_ptr item); virtual void setCraftingOutputSlotRedBox(bool show); - virtual void setIngredientSlotItem(int iPad, int index, shared_ptr item); + virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr item); virtual void setIngredientSlotRedBox(int index, bool show); - virtual void setIngredientDescriptionItem(int iPad, int index, shared_ptr item); + virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr item); virtual void setIngredientDescriptionRedBox(int index, bool show); virtual void setIngredientDescriptionText(int index, LPCWSTR text); virtual void setShowCraftHSlot(int iIndex, bool show); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_CreateWorldMenu.cpp index bb44c9b02..dede6c4a5 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_CreateWorldMenu.cpp @@ -261,7 +261,7 @@ void UIScene_CreateWorldMenu::updateComponents() m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false); } -wstring UIScene_CreateWorldMenu::getMoviePath() +std::wstring UIScene_CreateWorldMenu::getMoviePath() { return L"CreateWorldMenu"; } @@ -1083,13 +1083,13 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD app.ClearTerrainFeaturePosition(); // create the world and launch - wstring wWorldName = pClass->m_worldName; + std::wstring wWorldName = pClass->m_worldName; StorageManager.ResetSaveData(); // Make our next save default to the name of the level StorageManager.SetSaveTitle((wchar_t *)wWorldName.c_str()); - wstring wSeed; + std::wstring wSeed; if(!pClass->m_MoreOptionsParams.seed.empty() ) { wSeed=pClass->m_MoreOptionsParams.seed; diff --git a/Minecraft.Client/Build/Common/UI/UIScene_CreateWorldMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_CreateWorldMenu.h index ebb383e85..be1f60dd4 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_CreateWorldMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_CreateWorldMenu.h @@ -20,8 +20,8 @@ private: static int m_iDifficultyTitleSettingA[4]; - wstring m_worldName; - wstring m_seed; + std::wstring m_worldName; + std::wstring m_seed; UIControl m_controlMainPanel; UIControl_Label m_labelWorldName, m_labelSeed, m_labelRandomSeed; @@ -78,7 +78,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleTimerComplete(int id); virtual void handleGainFocus(bool navBack); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_CreativeMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_CreativeMenu.cpp index ac941d43f..b4588e7ef 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_CreativeMenu.cpp @@ -21,7 +21,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p InventoryScreenInput *initData = (InventoryScreenInput *)_initData; - shared_ptr creativeContainer = shared_ptr(new SimpleContainer( 0, TabSpec::MAX_SIZE )); + std::shared_ptr creativeContainer = std::shared_ptr(new SimpleContainer( 0, TabSpec::MAX_SIZE )); itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory); Initialize( initData->iPad, itemPickerMenu, false, -1, eSectionInventoryCreativeUsing, eSectionInventoryCreativeMax, initData->bNavigateBack); @@ -63,7 +63,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p #endif } -wstring UIScene_CreativeMenu::getMoviePath() +std::wstring UIScene_CreativeMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_CreativeMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_CreativeMenu.h index 6fbec2ba8..a10459aff 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_CreativeMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_CreativeMenu.h @@ -56,7 +56,7 @@ protected: UI_MAP_NAME(m_funcSetScrollBar, L"SetScrollBar") UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleReload(); virtual int getSectionColumns(ESceneSection eSection); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_Credits.cpp b/Minecraft.Client/Build/Common/UI/UIScene_Credits.cpp index 3bdb02e15..fcb4fa8c2 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_Credits.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_Credits.cpp @@ -530,7 +530,7 @@ UIScene_Credits::UIScene_Credits(int iPad, void *initData, UILayer *parentLayer) } } -wstring UIScene_Credits::getMoviePath() +std::wstring UIScene_Credits::getMoviePath() { return L"Credits"; } @@ -637,7 +637,7 @@ void UIScene_Credits::handleInput(int iPad, int key, bool repeat, bool pressed, } } -void UIScene_Credits::setNextLabel(const wstring &label, ECreditTextTypes size) +void UIScene_Credits::setNextLabel(const std::wstring &label, ECreditTextTypes size) { IggyDataValue result; IggyDataValue value[3]; diff --git a/Minecraft.Client/Build/Common/UI/UIScene_Credits.h b/Minecraft.Client/Build/Common/UI/UIScene_Credits.h index 015170e5a..9e449063c 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_Credits.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_Credits.h @@ -59,7 +59,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT @@ -68,6 +68,6 @@ public: virtual void handleRequestMoreData(F64 startIndex, bool up); private: - void setNextLabel(const wstring &label, ECreditTextTypes size); + void setNextLabel(const std::wstring &label, ECreditTextTypes size); void addImage(ECreditIcons icon); }; diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DLCMainMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_DLCMainMenu.cpp index 52e705d40..b7fbe8543 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DLCMainMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_DLCMainMenu.cpp @@ -73,7 +73,7 @@ UIScene_DLCMainMenu::~UIScene_DLCMainMenu() #endif } -wstring UIScene_DLCMainMenu::getMoviePath() +std::wstring UIScene_DLCMainMenu::getMoviePath() { return L"DLCMainMenu"; } @@ -212,7 +212,7 @@ void UIScene_DLCMainMenu::tick() // add a button in with the subcategory category = (SonyCommerce::CategoryInfoSub)(*iter); - string teststring=category.categoryName; + std::string teststring=category.categoryName; m_buttonListOffers.addItem(teststring,i); iter++; diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DLCMainMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_DLCMainMenu.h index 15272fe19..7fc7cf609 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DLCMainMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_DLCMainMenu.h @@ -41,7 +41,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_DLCOffersMenu.cpp index 4622c8720..5a96a7428 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_DLCOffersMenu.cpp @@ -115,7 +115,7 @@ int UIScene_DLCOffersMenu::ExitDLCOffersMenu(void *pParam,int iPad,C4JStorage::E return 0; } -wstring UIScene_DLCOffersMenu::getMoviePath() +std::wstring UIScene_DLCOffersMenu::getMoviePath() { return L"DLCOffersMenu"; } @@ -226,8 +226,8 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) #if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) // buy the DLC - vector::iterator it = m_pvProductInfo->begin(); - string teststring; + std::vector::iterator it = m_pvProductInfo->begin(); + std::string teststring; for(int i=0;i::iterator it = m_pvProductInfo->begin(); - string teststring; + std::vector::iterator it = m_pvProductInfo->begin(); + std::string teststring; for(int i=0;isize(); } - vector::iterator it = m_pvProductInfo->begin(); - string teststring; + std::vector::iterator it = m_pvProductInfo->begin(); + std::string teststring; bool bFirstItemSet=false; for(int i=0;i::iterator it = m_pvProductInfo->begin(); + std::vector::iterator it = m_pvProductInfo->begin(); for(int i=0;i::iterator it = m_pvProductInfo->begin(); - string teststring; + std::vector::iterator it = m_pvProductInfo->begin(); + std::string teststring; for(int i=0;ieDLCType==(eDLCContentType)m_iProductInfoIndex) { - wstring wstrTemp=xOffer.wszOfferName; + std::wstring wstrTemp=xOffer.wszOfferName; // 4J-PB - Rog requested we remove the Minecraft at the start of the name. It's required for the Bing search, but gets in the way here app.DebugPrintf("Adding %ls at %d\n",wstrTemp.c_str(), i); @@ -790,7 +790,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // set the default text wchar_t formatting[40]; - wstring wstrTemp = app.GetString(IDS_NO_DLCOFFERS); + std::wstring wstrTemp = app.GetString(IDS_NO_DLCOFFERS); // swprintf(formatting, 40, L"", m_bIsSD?12:14); // wstrTemp = formatting + wstrTemp; @@ -885,7 +885,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) else { wchar_t formatting[40]; - wstring wstrTemp = app.GetString(IDS_NO_DLCOFFERS); + std::wstring wstrTemp = app.GetString(IDS_NO_DLCOFFERS); m_labelHTMLSellText.setLabel(wstrTemp.c_str()); m_labelPriceTag.setVisible(false); } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DLCOffersMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_DLCOffersMenu.h index c5fcac7e5..1923cedf2 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DLCOffersMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_DLCOffersMenu.h @@ -43,7 +43,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT @@ -80,7 +80,7 @@ private: } SORTINDEXSTRUCT; - vector m_vIconRetrieval; + std::vector m_vIconRetrieval; bool m_bSelectionChanged; #endif diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DeathMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_DeathMenu.cpp index cfecabfdd..dcd7602f8 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DeathMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_DeathMenu.cpp @@ -39,7 +39,7 @@ UIScene_DeathMenu::~UIScene_DeathMenu() } } -wstring UIScene_DeathMenu::getMoviePath() +std::wstring UIScene_DeathMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DeathMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_DeathMenu.h index 7285e413e..0c36246e4 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DeathMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_DeathMenu.h @@ -29,7 +29,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DebugCreateSchematic.cpp b/Minecraft.Client/Build/Common/UI/UIScene_DebugCreateSchematic.cpp index 32ea3d0ea..ce1ed2eb5 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DebugCreateSchematic.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_DebugCreateSchematic.cpp @@ -36,7 +36,7 @@ UIScene_DebugCreateSchematic::UIScene_DebugCreateSchematic(int iPad, void *initD m_data = new ConsoleSchematicFile::XboxSchematicInitParam(); } -wstring UIScene_DebugCreateSchematic::getMoviePath() +std::wstring UIScene_DebugCreateSchematic::getMoviePath() { return L"DebugCreateSchematic"; } @@ -144,7 +144,7 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool b if(pchText[0]!=0) { - wstring value = (wchar_t *)pchText; + std::wstring value = (wchar_t *)pchText; int iVal = 0; if(!value.empty()) iVal = _fromString( value ); switch(pClass->m_keyboardCallbackControl) diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DebugCreateSchematic.h b/Minecraft.Client/Build/Common/UI/UIScene_DebugCreateSchematic.h index 3863d271c..80ec8d057 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DebugCreateSchematic.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_DebugCreateSchematic.h @@ -57,7 +57,7 @@ protected: UI_MAP_ELEMENT( m_labelTitle, "LabelTitle") UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DebugOptions.cpp b/Minecraft.Client/Build/Common/UI/UIScene_DebugOptions.cpp index 649a67f28..32a309f28 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DebugOptions.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_DebugOptions.cpp @@ -39,12 +39,12 @@ UIScene_DebugOptionsMenu::UIScene_DebugOptionsMenu(int iPad, void *initData, UIL IggyValuePath *root = IggyPlayerRootPath ( getMovie() ); for(m_iTotalCheckboxElements = 0; m_iTotalCheckboxElements < eDebugSetting_Max && m_iTotalCheckboxElements < 21; ++m_iTotalCheckboxElements) { - wstring label(m_DebugCheckboxTextA[m_iTotalCheckboxElements]); + std::wstring label(m_DebugCheckboxTextA[m_iTotalCheckboxElements]); m_checkboxes[m_iTotalCheckboxElements].init(label,m_iTotalCheckboxElements,(uiDebugBitmask&(1<getMinLevel(); level <= ench->getMaxLevel(); ++level) { - m_enchantmentIdAndLevels.push_back(pair(ench->id,level)); + m_enchantmentIdAndLevels.push_back(std::pair(ench->id,level)); m_buttonListEnchantments.addItem(app.GetString( ench->getDescriptionId() ) + _toString(level) ); } } @@ -109,7 +109,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa m_mobFactories.push_back(eTYPE_LAVASLIME); } -wstring UIScene_DebugOverlay::getMoviePath() +std::wstring UIScene_DebugOverlay::getMoviePath() { return L"DebugMenu"; } @@ -127,7 +127,7 @@ void UIScene_DebugOverlay::customDraw(IggyCustomDrawCallbackRegion *region) } else { - shared_ptr item = shared_ptr( new ItemInstance(itemId,1,0) ); + std::shared_ptr item = std::shared_ptr( new ItemInstance(itemId,1,0) ); if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,false,false); } } @@ -169,7 +169,7 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) int id = childId; //app.SetXuiServerAction(m_iPad, eXuiServerAction_DropItem, (void *)m_itemIds[id]); ClientConnection *conn = Minecraft::GetInstance()->getConnection(ProfileManager.GetPrimaryPad()); - conn->send( GiveItemCommand::preparePacket(dynamic_pointer_cast(Minecraft::GetInstance()->localplayers[ProfileManager.GetPrimaryPad()]), m_itemIds[id]) ); + conn->send( GiveItemCommand::preparePacket(std::dynamic_pointer_cast(Minecraft::GetInstance()->localplayers[ProfileManager.GetPrimaryPad()]), m_itemIds[id]) ); } break; case eControl_Mobs: @@ -185,7 +185,7 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { int id = childId; ClientConnection *conn = Minecraft::GetInstance()->getConnection(ProfileManager.GetPrimaryPad()); - conn->send( EnchantItemCommand::preparePacket(dynamic_pointer_cast(Minecraft::GetInstance()->localplayers[ProfileManager.GetPrimaryPad()]), m_enchantmentIdAndLevels[id].first, m_enchantmentIdAndLevels[id].second) ); + conn->send( EnchantItemCommand::preparePacket(std::dynamic_pointer_cast(Minecraft::GetInstance()->localplayers[ProfileManager.GetPrimaryPad()]), m_enchantmentIdAndLevels[id].first, m_enchantmentIdAndLevels[id].second) ); } break; case eControl_Schematic: diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DebugOverlay.h b/Minecraft.Client/Build/Common/UI/UIScene_DebugOverlay.h index 9a0e1cd8b..76fff24b2 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DebugOverlay.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_DebugOverlay.h @@ -22,9 +22,9 @@ private: eControl_Items, }; - vector m_itemIds; - vector m_mobFactories; - vector< pair > m_enchantmentIdAndLevels; + std::vector m_itemIds; + std::vector m_mobFactories; + std::vector< std::pair > m_enchantmentIdAndLevels; public: UIScene_DebugOverlay(int iPad, void *initData, UILayer *parentLayer); @@ -49,7 +49,7 @@ protected: UI_MAP_ELEMENT( m_buttonSetCamera, "setCamera") UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual void customDraw(IggyCustomDrawCallbackRegion *region); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Build/Common/UI/UIScene_DebugSetCamera.cpp index b638e9a97..d83f83f90 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_DebugSetCamera.cpp @@ -57,7 +57,7 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void *initData, UILayer m_labelYRotElev.init(L"Y-Rot & Elevation (Degs)"); } -wstring UIScene_DebugSetCamera::getMoviePath() +std::wstring UIScene_DebugSetCamera::getMoviePath() { return L"DebugSetCamera"; } @@ -125,7 +125,7 @@ int UIScene_DebugSetCamera::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) if(pchText[0]!=0) { - wstring value = (wchar_t *)pchText; + std::wstring value = (wchar_t *)pchText; double val = 0; if(!value.empty()) val = _fromString( value ); switch(pClass->m_keyboardCallbackControl) diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DebugSetCamera.h b/Minecraft.Client/Build/Common/UI/UIScene_DebugSetCamera.h index 38db1258b..926a54040 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DebugSetCamera.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_DebugSetCamera.h @@ -53,7 +53,7 @@ protected: UI_MAP_ELEMENT( m_labelYRotElev, "LabelYRotElev") UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DispenserMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_DispenserMenu.cpp index 8e5899f5e..f024873c4 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DispenserMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_DispenserMenu.cpp @@ -32,7 +32,7 @@ UIScene_DispenserMenu::UIScene_DispenserMenu(int iPad, void *_initData, UILayer delete initData; } -wstring UIScene_DispenserMenu::getMoviePath() +std::wstring UIScene_DispenserMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_DispenserMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_DispenserMenu.h index 6661c7a15..3e9c58f9b 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_DispenserMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_DispenserMenu.h @@ -26,7 +26,7 @@ protected: UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleReload(); virtual int getSectionColumns(ESceneSection eSection); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_EULA.cpp b/Minecraft.Client/Build/Common/UI/UIScene_EULA.cpp index 735eb3f6c..4bc8265fc 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_EULA.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_EULA.cpp @@ -14,7 +14,7 @@ UIScene_EULA::UIScene_EULA(int iPad, void *initData, UILayer *parentLayer) : UIS m_buttonConfirm.init(app.GetString(IDS_TOOLTIPS_ACCEPT),eControl_Confirm); #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - wstring EULA = app.GetString(IDS_EULA); + std::wstring EULA = app.GetString(IDS_EULA); EULA.append(L"\r\n"); #if defined(__PS3__) @@ -44,13 +44,13 @@ UIScene_EULA::UIScene_EULA(int iPad, void *initData, UILayer *parentLayer) : UIS } #endif #else - wstring EULA = L""; + std::wstring EULA = L""; #endif - vector paragraphs; + std::vector paragraphs; int lastIndex = 0; for ( int index = EULA.find(L"\r\n", lastIndex, 2); - index != wstring::npos; + index != std::wstring::npos; index = EULA.find(L"\r\n", lastIndex, 2) ) { @@ -92,7 +92,7 @@ UIScene_EULA::~UIScene_EULA() m_parentLayer->removeComponent(eUIComponent_Logo); } -wstring UIScene_EULA::getMoviePath() +std::wstring UIScene_EULA::getMoviePath() { return L"EULA"; } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_EULA.h b/Minecraft.Client/Build/Common/UI/UIScene_EULA.h index 4715b1126..d1188d935 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_EULA.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_EULA.h @@ -32,7 +32,7 @@ public: virtual void updateTooltips(); protected: - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_EnchantingMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_EnchantingMenu.cpp index 5a3016dea..796862cc3 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_EnchantingMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_EnchantingMenu.cpp @@ -37,7 +37,7 @@ UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void *_initData, UILaye delete initData; } -wstring UIScene_EnchantingMenu::getMoviePath() +std::wstring UIScene_EnchantingMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_EnchantingMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_EnchantingMenu.h index 89ccd1209..e1e5dc62f 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_EnchantingMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_EnchantingMenu.h @@ -38,7 +38,7 @@ protected: UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleReload(); virtual int getSectionColumns(ESceneSection eSection); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_EndPoem.cpp b/Minecraft.Client/Build/Common/UI/UIScene_EndPoem.cpp index 967623160..973c83acc 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_EndPoem.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_EndPoem.cpp @@ -18,7 +18,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) // 4J Stu - Don't need these, the AS handles the scrolling and makes it look nice #if 0 - wstring halfScreenLineBreaks; + std::wstring halfScreenLineBreaks; if(RenderManager.IsHiDef()) { @@ -49,7 +49,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) Minecraft *pMinecraft = Minecraft::GetInstance(); - wstring playerName = L""; + std::wstring playerName = L""; if(pMinecraft->localplayers[ui.GetWinUserIndex()] != NULL) { playerName = escapeXML( pMinecraft->localplayers[ui.GetWinUserIndex()]->getDisplayName() ); @@ -63,7 +63,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) Random random(8124371); int found=(int)noNoiseString.find(L"{*NOISE*}"); int length; - while (found!=string::npos) + while (found!=std::string::npos) { length = random.nextInt(4) + 3; m_noiseLengths.push_back(length); @@ -74,10 +74,10 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) // 4J-JEV: Find paragraph start and end points. - m_paragraphs = vector(); + m_paragraphs = std::vector(); int lastIndex = 0; for ( int index = 0; - index != wstring::npos; + index != std::wstring::npos; index = noiseString.find(L"

", index+12, 12) ) { @@ -90,7 +90,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) //m_htmlPoem.init(noiseString.c_str()); //m_htmlPoem.startAutoScroll(); - //wstring result = m_htmlControl.GetText(); + //std::wstring result = m_htmlControl.GetText(); //wcout << result.c_str(); @@ -105,7 +105,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) m_requestedLabel = 0; } -wstring UIScene_EndPoem::getMoviePath() +std::wstring UIScene_EndPoem::getMoviePath() { return L"EndPoem"; } @@ -121,7 +121,7 @@ void UIScene_EndPoem::tick() if( m_requestedLabel >= 0 && m_requestedLabel < m_paragraphs.size()) { - wstring label = m_paragraphs[m_requestedLabel]; + std::wstring label = m_paragraphs[m_requestedLabel]; IggyDataValue result; IggyDataValue value[3]; @@ -201,17 +201,17 @@ void UIScene_EndPoem::updateNoise() int length = 0; wchar_t replacements[64]; - wstring replaceString = L""; + std::wstring replaceString = L""; wchar_t randomChar = L'a'; Random *random = pMinecraft->font->random; bool darken = false; - wstring tag = L"{*NOISE*}"; + std::wstring tag = L"{*NOISE*}"; AUTO_VAR(it, m_noiseLengths.begin()); int found=(int)noiseString.find(tag); - while (found!=string::npos && it != m_noiseLengths.end() ) + while (found!=std::string::npos && it != m_noiseLengths.end() ) { length = *it; ++it; @@ -221,7 +221,7 @@ void UIScene_EndPoem::updateNoise() { randomChar = SharedConstants::acceptableLetters[random->nextInt((int)SharedConstants::acceptableLetters.length())]; - wstring randomCharStr = L""; + std::wstring randomCharStr = L""; randomCharStr.push_back(randomChar); if(randomChar == L'<') { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_EndPoem.h b/Minecraft.Client/Build/Common/UI/UIScene_EndPoem.h index 75024f683..dc1a7aa8f 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_EndPoem.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_EndPoem.h @@ -5,13 +5,13 @@ class UIScene_EndPoem : public UIScene { private: - wstring noNoiseString; - wstring noiseString; - vector m_noiseLengths; + std::wstring noNoiseString; + std::wstring noiseString; + std::vector m_noiseLengths; bool m_bIgnoreInput; int m_requestedLabel; - vector m_paragraphs; + std::vector m_paragraphs; IggyName m_funcSetNextLabel; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) @@ -25,7 +25,7 @@ public: virtual void updateTooltips(); protected: - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual void tick(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_FullscreenProgress.cpp b/Minecraft.Client/Build/Common/UI/UIScene_FullscreenProgress.cpp index 07e728355..85b3068dc 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_FullscreenProgress.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_FullscreenProgress.cpp @@ -47,7 +47,7 @@ UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void *initData, m_progressBar.init(L"",0,0,100,0); // set the tip - wstring wsText= app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); + std::wstring wsText= app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); wchar_t startTags[64]; swprintf(startTags,64,L"

",app.GetHTMLColour(eHTMLColor_White)); @@ -86,7 +86,7 @@ UIScene_FullscreenProgress::~UIScene_FullscreenProgress() delete m_CompletionData; } -wstring UIScene_FullscreenProgress::getMoviePath() +std::wstring UIScene_FullscreenProgress::getMoviePath() { return L"FullscreenProgress"; } @@ -146,7 +146,7 @@ void UIScene_FullscreenProgress::tick() } else { - wstring& wstrText = pMinecraft->progressRenderer->getProgressString(); + std::wstring& wstrText = pMinecraft->progressRenderer->getProgressString(); m_progressBar.setLabel(wstrText.c_str()); } @@ -350,7 +350,7 @@ void UIScene_FullscreenProgress::handleTimerComplete(int id) case TIMER_FULLSCREEN_TIPS: { // display the next tip - wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); + std::wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); wchar_t startTags[64]; swprintf(startTags,64,L"

",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText + L"

"; diff --git a/Minecraft.Client/Build/Common/UI/UIScene_FullscreenProgress.h b/Minecraft.Client/Build/Common/UI/UIScene_FullscreenProgress.h index aeb428c3d..2ecb71ea2 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_FullscreenProgress.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_FullscreenProgress.h @@ -24,7 +24,7 @@ private: LPVOID m_completeFuncParam; bool m_bWaitForThreadToDelete; - wstring m_titleText, m_statusText; + std::wstring m_titleText, m_statusText; int m_lastTitle, m_lastStatus, m_lastProgress; int m_cancelText; bool m_bWasCancelled; @@ -52,7 +52,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual long long getDefaultGtcButtons() { return 0; } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_FurnaceMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_FurnaceMenu.cpp index 92fec78b6..493e8944f 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_FurnaceMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_FurnaceMenu.cpp @@ -41,7 +41,7 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void *_initData, UILayer *par delete initData; } -wstring UIScene_FurnaceMenu::getMoviePath() +std::wstring UIScene_FurnaceMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_FurnaceMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_FurnaceMenu.h index dcea967e1..ecbe01254 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_FurnaceMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_FurnaceMenu.h @@ -8,7 +8,7 @@ class InventoryMenu; class UIScene_FurnaceMenu : public UIScene_AbstractContainerMenu, public IUIScene_FurnaceMenu { private: - shared_ptr m_furnace; + std::shared_ptr m_furnace; public: UIScene_FurnaceMenu(int iPad, void *initData, UILayer *parentLayer); @@ -34,7 +34,7 @@ protected: UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleReload(); virtual void tick(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_HUD.cpp b/Minecraft.Client/Build/Common/UI/UIScene_HUD.cpp index aed555e1c..4191fdf2e 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_HUD.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_HUD.cpp @@ -55,7 +55,7 @@ UIScene_HUD::UIScene_HUD(int iPad, void *initData, UILayer *parentLayer) : UISce addTimer(0, 100); } -wstring UIScene_HUD::getMoviePath() +std::wstring UIScene_HUD::getMoviePath() { switch( m_parentLayer->getViewport() ) { @@ -161,7 +161,7 @@ void UIScene_HUD::tick() } else { - shared_ptr boss = EnderDragonRenderer::bossInstance; + std::shared_ptr boss = EnderDragonRenderer::bossInstance; // 4J Stu - Don't clear this here as it's wiped for other players //EnderDragonRenderer::bossInstance = nullptr; m_ticksWithNoBoss = 0; @@ -191,7 +191,7 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) else { Slot *invSlot = pMinecraft->localplayers[m_iPad]->inventoryMenu->getSlot(InventoryMenu::USE_ROW_SLOT_START + slot); - shared_ptr item = invSlot->getItem(); + std::shared_ptr item = invSlot->getItem(); if(item != NULL) { unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); @@ -342,7 +342,7 @@ void UIScene_HUD::SetActiveSlot(int slot) void UIScene_HUD::SetHealth(int iHealth, int iLastHealth, bool bBlink, bool bPoison) { - int maxHealth = max(iHealth, iLastHealth); + int maxHealth = std::max(iHealth, iLastHealth); if(maxHealth != m_lastMaxHealth || bBlink != m_lastHealthBlink || bPoison != m_lastHealthPoison) { m_lastMaxHealth = maxHealth; @@ -530,7 +530,7 @@ void UIScene_HUD::SetDragonHealth(float health) } } -void UIScene_HUD::SetDragonLabel(const wstring &label) +void UIScene_HUD::SetDragonLabel(const std::wstring &label) { IggyDataValue result; IggyDataValue value[1]; @@ -557,7 +557,7 @@ void UIScene_HUD::ShowDragonHealth(bool show) } } -void UIScene_HUD::SetSelectedLabel(const wstring &label) +void UIScene_HUD::SetSelectedLabel(const std::wstring &label) { // 4J Stu - Timing here is kept the same as on Xbox360, even though we do it differently now and do the fade out in Flash rather than directly setting opacity if(!label.empty()) m_uiSelectedItemOpacityCountDown = SharedConstants::TICKS_PER_SECOND * 3; @@ -656,7 +656,7 @@ void UIScene_HUD::handleTimerComplete(int id) if(pMinecraft->localplayers[m_iPad]!= NULL) { Gui *pGui = pMinecraft->gui; - //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); + //DWORD messagesToDisplay = std::min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); for( unsigned int i = 0; i < CHAT_LINES_COUNT; ++i ) { float opacity = pGui->getOpacity(m_iPad, i); @@ -730,7 +730,7 @@ void UIScene_HUD::ShowDisplayName(bool show) m_labelDisplayName.setVisible(show); } -void UIScene_HUD::SetDisplayName(const wstring &displayName) +void UIScene_HUD::SetDisplayName(const std::wstring &displayName) { if(displayName.compare(m_displayName) != 0) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_HUD.h b/Minecraft.Client/Build/Common/UI/UIScene_HUD.h index cd0d88061..3aca1d118 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_HUD.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_HUD.h @@ -31,7 +31,7 @@ private: unsigned int m_uiSelectedItemOpacityCountDown; - wstring m_displayName; + std::wstring m_displayName; protected: UIControl_Label m_labelChatText[CHAT_LINES_COUNT]; @@ -114,7 +114,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual EUIScene getSceneType() { return eUIScene_HUD;} @@ -153,17 +153,17 @@ private: void SetFoodSaturationLevel(int iSaturation); void SetDragonHealth(float health); - void SetDragonLabel(const wstring &label); + void SetDragonLabel(const std::wstring &label); void ShowDragonHealth(bool show); void HideSelectedLabel(); - void SetDisplayName(const wstring &displayName); + void SetDisplayName(const std::wstring &displayName); void SetTooltipsEnabled(bool bEnabled); public: - void SetSelectedLabel(const wstring &label); + void SetSelectedLabel(const std::wstring &label); void ShowDisplayName(bool show); void handleGameTick(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_HelpAndOptionsMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_HelpAndOptionsMenu.cpp index 14a1a7fb1..3024de692 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_HelpAndOptionsMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_HelpAndOptionsMenu.cpp @@ -83,7 +83,7 @@ UIScene_HelpAndOptionsMenu::~UIScene_HelpAndOptionsMenu() { } -wstring UIScene_HelpAndOptionsMenu::getMoviePath() +std::wstring UIScene_HelpAndOptionsMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_HelpAndOptionsMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_HelpAndOptionsMenu.h index 203011d37..d8e8cf249 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_HelpAndOptionsMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_HelpAndOptionsMenu.h @@ -37,7 +37,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual void handleReload(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_HowToPlay.cpp b/Minecraft.Client/Build/Common/UI/UIScene_HowToPlay.cpp index 55a990bfa..aca89ae19 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_HowToPlay.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_HowToPlay.cpp @@ -70,7 +70,7 @@ UIScene_HowToPlay::UIScene_HowToPlay(int iPad, void *initData, UILayer *parentLa // Setup all the Iggy references we need for this scene initialiseMovie(); - wstring inventoryString = app.GetString(IDS_INVENTORY); + std::wstring inventoryString = app.GetString(IDS_INVENTORY); m_labels[ eHowToPlay_LabelCTItem].init(app.GetString(IDS_ITEM_HATCHET_WOOD)); m_labels[ eHowToPlay_LabelCTGroup].init(app.GetString(IDS_GROUPNAME_TOOLS)); m_labels[ eHowToPlay_LabelCTInventory3x3].init(inventoryString); @@ -95,8 +95,8 @@ UIScene_HowToPlay::UIScene_HowToPlay(int iPad, void *initData, UILayer *parentLa m_labels[ eHowToPlay_LabelBInventory].init(inventoryString); m_labels[ eHowToPlay_LabelAnvil_Inventory].init(inventoryString.c_str()); - wstring wsTemp = app.GetString(IDS_REPAIR_COST); - wsTemp.replace( wsTemp.find(L"%d"), 2, wstring(L"8") ); + std::wstring wsTemp = app.GetString(IDS_REPAIR_COST); + wsTemp.replace( wsTemp.find(L"%d"), 2, std::wstring(L"8") ); m_labels[ eHowToPlay_LabelAnvil_Cost].init(wsTemp.c_str()); m_labels[ eHowToPlay_LabelAnvil_ARepairAndName].init(app.GetString(IDS_REPAIR_AND_NAME)); @@ -120,7 +120,7 @@ UIScene_HowToPlay::UIScene_HowToPlay(int iPad, void *initData, UILayer *parentLa StartPage( eStartPage ); } -wstring UIScene_HowToPlay::getMoviePath() +std::wstring UIScene_HowToPlay::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { @@ -263,7 +263,7 @@ void UIScene_HowToPlay::StartPage( EHowToPlayPage ePage ) SHowToPlayPageDef* pDef = &( gs_aPageDefs[ m_eCurrPage ] ); // Replace button identifiers in the text with actual button images. - wstring replacedText = app.FormatHTMLString(m_iPad, app.GetString( pDef->m_iTextStringID )); + std::wstring replacedText = app.FormatHTMLString(m_iPad, app.GetString( pDef->m_iTextStringID )); // 4J-PB - replace the title with the platform specific title, and the platform name // replacedText = replaceAll(replacedText,L"{*TITLE_UPDATE_NAME*}",app.GetString(IDS_TITLE_UPDATE_NAME)); #ifndef _WINDOWS64 @@ -279,15 +279,15 @@ void UIScene_HowToPlay::StartPage( EHowToPlayPage ePage ) stripWhitespaceForHtml( replacedText, true ); // Set the text colour - wstring finalText(replacedText.c_str() ); + std::wstring finalText(replacedText.c_str() ); wchar_t startTags[64]; swprintf(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); finalText = startTags + finalText; - vector paragraphs; + std::vector paragraphs; int lastIndex = 0; for ( int index = finalText.find(L"\r\n", lastIndex, 2); - index != wstring::npos; + index != std::wstring::npos; index = finalText.find(L"\r\n", lastIndex, 2) ) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_HowToPlay.h b/Minecraft.Client/Build/Common/UI/UIScene_HowToPlay.h index cff07256d..93ab75b2f 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_HowToPlay.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_HowToPlay.h @@ -110,7 +110,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual void handleReload(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_HowToPlayMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_HowToPlayMenu.cpp index fafcfe7df..33b8dd600 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_HowToPlayMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_HowToPlayMenu.cpp @@ -98,7 +98,7 @@ UIScene_HowToPlayMenu::UIScene_HowToPlayMenu(int iPad, void *initData, UILayer * } } -wstring UIScene_HowToPlayMenu::getMoviePath() +std::wstring UIScene_HowToPlayMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_HowToPlayMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_HowToPlayMenu.h index 5a60cdd02..5dfae4c14 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_HowToPlayMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_HowToPlayMenu.h @@ -57,7 +57,7 @@ public: virtual void handleReload(); protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_InGameHostOptionsMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_InGameHostOptionsMenu.cpp index b692c7544..291ef6dfe 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_InGameHostOptionsMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_InGameHostOptionsMenu.cpp @@ -31,7 +31,7 @@ UIScene_InGameHostOptionsMenu::UIScene_InGameHostOptionsMenu(int iPad, void *ini } } -wstring UIScene_InGameHostOptionsMenu::getMoviePath() +std::wstring UIScene_InGameHostOptionsMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { @@ -66,10 +66,10 @@ void UIScene_InGameHostOptionsMenu::handleInput(int iPad, int key, bool repeat, if(hostOptions != app.GetGameHostOption(eGameHostOption_All) ) { Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr player = pMinecraft->localplayers[m_iPad]; + std::shared_ptr player = pMinecraft->localplayers[m_iPad]; if(player->connection) { - player->connection->send( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) ); + player->connection->send( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) ); } } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_InGameHostOptionsMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_InGameHostOptionsMenu.h index 247114124..a88dbd5b4 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_InGameHostOptionsMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_InGameHostOptionsMenu.h @@ -29,7 +29,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_InGameInfoMenu.cpp index 8f99c92ae..d88c3233c 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_InGameInfoMenu.cpp @@ -32,7 +32,7 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer m_players[i] = player->GetSmallId(); ++m_playersCount; - wstring playerName = L""; + std::wstring playerName = L""; #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<IsHost() == TRUE; Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; if(!m_isHostPlayer && !localPlayer->isModerator() ) { removeControl( &m_buttonGameOptions, false ); @@ -98,7 +98,7 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer #endif } -wstring UIScene_InGameInfoMenu::getMoviePath() +std::wstring UIScene_InGameInfoMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { @@ -131,7 +131,7 @@ void UIScene_InGameInfoMenu::updateTooltips() int keyA = -1; Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; bool isOp = m_isHostPlayer || localPlayer->isModerator(); bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; @@ -208,7 +208,7 @@ void UIScene_InGameInfoMenu::handleReload() m_players[i] = player->GetSmallId(); ++m_playersCount; - wstring playerName = L""; + std::wstring playerName = L""; #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<IsHost() == TRUE; Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; if(!m_isHostPlayer && !localPlayer->isModerator() ) { removeControl( &m_buttonGameOptions, false ); @@ -311,7 +311,7 @@ void UIScene_InGameInfoMenu::tick() m_playerList.setPlayerIcon( i, (int)app.GetPlayerColour( m_players[i] ) ); } - wstring playerName = L""; + std::wstring playerName = L""; #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L< localPlayer = pMinecraft->localplayers[m_iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; bool isOp = m_isHostPlayer || localPlayer->isModerator(); bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; @@ -512,7 +512,7 @@ void UIScene_InGameInfoMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer scene->m_players[scene->m_playersCount] = pPlayer->GetSmallId(); ++scene->m_playersCount; - wstring playerName = L""; + std::wstring playerName = L""; #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L< localPlayer = pMinecraft->localplayers[iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[iPad]; if(localPlayer->connection) { - localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); + localPlayer->connection->send( std::shared_ptr( new KickPlayerPacket(smallId) ) ); } } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_InGameInfoMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_InGameInfoMenu.h index 94966fa35..9bed08c6b 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_InGameInfoMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_InGameInfoMenu.h @@ -16,7 +16,7 @@ private: BYTE m_players[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's char m_playersVoiceState[MINECRAFT_NET_MAX_PLAYERS]; short m_playersColourState[MINECRAFT_NET_MAX_PLAYERS]; - wstring m_playerNames[MINECRAFT_NET_MAX_PLAYERS]; + std::wstring m_playerNames[MINECRAFT_NET_MAX_PLAYERS]; UIControl_Button m_buttonGameOptions; UIControl_PlayerList m_playerList; @@ -38,7 +38,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp index 6aaacefaa..4dd5ec20a 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp @@ -215,7 +215,7 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void #endif } -wstring UIScene_InGamePlayerOptionsMenu::getMoviePath() +std::wstring UIScene_InGamePlayerOptionsMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { @@ -316,10 +316,10 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat { // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr player = pMinecraft->localplayers[m_iPad]; + std::shared_ptr player = pMinecraft->localplayers[m_iPad]; if(player->connection) { - player->connection->send( shared_ptr( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) ); + player->connection->send( std::shared_ptr( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) ); } } navigateBack(); @@ -366,10 +366,10 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4 if(result==C4JStorage::EMessage_ResultAccept) { Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr localPlayer = pMinecraft->localplayers[iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[iPad]; if(localPlayer->connection) { - localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); + localPlayer->connection->send( std::shared_ptr( new KickPlayerPacket(smallId) ) ); } // Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game. diff --git a/Minecraft.Client/Build/Common/UI/UIScene_InGamePlayerOptionsMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_InGamePlayerOptionsMenu.h index 78e30f6e5..670da1d4e 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_InGamePlayerOptionsMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_InGamePlayerOptionsMenu.h @@ -64,7 +64,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleCheckboxToggled(F64 controlId, bool selected); virtual void handleTimerComplete(int id); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_InGameSaveManagementMenu.cpp index 7247854f1..89b4c40da 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -168,7 +168,7 @@ void UIScene_InGameSaveManagementMenu::handleGainFocus(bool navBack) } } -wstring UIScene_InGameSaveManagementMenu::getMoviePath() +std::wstring UIScene_InGameSaveManagementMenu::getMoviePath() { return L"SaveMenu"; } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_InGameSaveManagementMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_InGameSaveManagementMenu.h index 3f9ace3a9..904eee00c 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_InGameSaveManagementMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_InGameSaveManagementMenu.h @@ -48,7 +48,7 @@ private: int m_iState; - vector *m_saves; + std::vector *m_saves; bool m_bIgnoreInput; bool m_bAllLoaded; @@ -92,7 +92,7 @@ private: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: diff --git a/Minecraft.Client/Build/Common/UI/UIScene_Intro.cpp b/Minecraft.Client/Build/Common/UI/UIScene_Intro.cpp index 25b57cc40..b34da34c5 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_Intro.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_Intro.cpp @@ -55,7 +55,7 @@ UIScene_Intro::UIScene_Intro(int iPad, void *initData, UILayer *parentLayer) : U #endif } -wstring UIScene_Intro::getMoviePath() +std::wstring UIScene_Intro::getMoviePath() { return L"Intro"; } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_Intro.h b/Minecraft.Client/Build/Common/UI/UIScene_Intro.h index dbdc72613..2c595c368 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_Intro.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_Intro.h @@ -32,7 +32,7 @@ public: protected: - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); #ifdef _DURANGO virtual long long getDefaultGtcButtons() { return 0; } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_InventoryMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_InventoryMenu.cpp index 35f0d7480..90459f049 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_InventoryMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_InventoryMenu.cpp @@ -52,7 +52,7 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer addTimer(INVENTORY_UPDATE_EFFECTS_TIMER_ID,INVENTORY_UPDATE_EFFECTS_TIMER_TIME); } -wstring UIScene_InventoryMenu::getMoviePath() +std::wstring UIScene_InventoryMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { @@ -251,11 +251,11 @@ void UIScene_InventoryMenu::updateEffectsDisplay() { // Update with the current effects Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr player = pMinecraft->localplayers[m_iPad]; + std::shared_ptr player = pMinecraft->localplayers[m_iPad]; if(player == NULL) return; - vector *activeEffects = player->getActiveEffects(); + std::vector *activeEffects = player->getActiveEffects(); // 4J - TomK setup time update value array size to update the active effects int iValue = 0; @@ -267,10 +267,10 @@ void UIScene_InventoryMenu::updateEffectsDisplay() if(effect->getDuration() >= m_bEffectTime[effect->getId()]) { - wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim(); + std::wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim(); if (effect->getAmplifier() > 0) { - wstring potencyString = L""; + std::wstring potencyString = L""; switch(effect->getAmplifier()) { case 1: diff --git a/Minecraft.Client/Build/Common/UI/UIScene_InventoryMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_InventoryMenu.h index 40ec78429..eb8f0c8f6 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_InventoryMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_InventoryMenu.h @@ -31,7 +31,7 @@ protected: UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void handleReload(); virtual int getSectionColumns(ESceneSection eSection); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_JoinMenu.cpp index 66604e90c..b6331cccf 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_JoinMenu.cpp @@ -72,7 +72,7 @@ void UIScene_JoinMenu::tick() else #endif { - string playerName(m_selectedSession->data.players[i].getOnlineID()); + std::string playerName(m_selectedSession->data.players[i].getOnlineID()); #ifndef __PSVITA__ // Append guest number (any players in an online game not signed into PSN are guests) @@ -246,7 +246,7 @@ void UIScene_JoinMenu::updateComponents() m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); } -wstring UIScene_JoinMenu::getMoviePath() +std::wstring UIScene_JoinMenu::getMoviePath() { return L"JoinMenu"; } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_JoinMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_JoinMenu.h index 817360efc..a97ee5a3e 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_JoinMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_JoinMenu.h @@ -75,7 +75,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_Keyboard.cpp b/Minecraft.Client/Build/Common/UI/UIScene_Keyboard.cpp index 530f7b754..004eb0e75 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_Keyboard.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_Keyboard.cpp @@ -24,7 +24,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye m_ButtonBackspace.init(L"Backspace", -1); // Initialise function keyboard Buttons and set alternative symbol button string - wstring label = L"Abc"; + std::wstring label = L"Abc"; IggyStringUTF16 stringVal; stringVal.string = (IggyUTF16*)label.c_str(); stringVal.length = label.length(); @@ -46,7 +46,7 @@ UIScene_Keyboard::~UIScene_Keyboard() m_parentLayer->removeComponent(eUIComponent_MenuBackground); } -wstring UIScene_Keyboard::getMoviePath() +std::wstring UIScene_Keyboard::getMoviePath() { if(app.GetLocalPlayerCount() > 1 && !m_parentLayer->IsFullscreenGroup()) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_Keyboard.h b/Minecraft.Client/Build/Common/UI/UIScene_Keyboard.h index f4e4c899d..f731669a4 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_Keyboard.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_Keyboard.h @@ -56,7 +56,7 @@ protected: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); private: void KeyboardDonePressed(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index 0852d0ba4..d16af5c17 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -94,7 +94,7 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini // set the default text #ifdef _LARGE_WORLDS - wstring wsText=L""; + std::wstring wsText=L""; if(m_params->bGenerateOptions) { wsText = app.GetString(IDS_GAMEOPTION_SEED); @@ -104,7 +104,7 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini wsText = app.GetString(IDS_GAMEOPTION_ONLINE); } #else - wstring wsText=app.GetString(IDS_GAMEOPTION_ONLINE); + std::wstring wsText=app.GetString(IDS_GAMEOPTION_ONLINE); #endif EHTMLFontSize size = eHTMLSize_Normal; if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) @@ -161,7 +161,7 @@ void UIScene_LaunchMoreOptionsMenu::updateComponents() #endif } -wstring UIScene_LaunchMoreOptionsMenu::getMoviePath() +std::wstring UIScene_LaunchMoreOptionsMenu::getMoviePath() { return L"LaunchMoreOptionsMenu"; } @@ -360,7 +360,7 @@ void UIScene_LaunchMoreOptionsMenu::handleFocusChange(F64 controlId, F64 childId #endif }; - wstring wsText=app.GetString(stringId); + std::wstring wsText=app.GetString(stringId); EHTMLFontSize size = eHTMLSize_Normal; if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_LaunchMoreOptionsMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_LaunchMoreOptionsMenu.h index 62d75115c..ef4fe9e93 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_LaunchMoreOptionsMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_LaunchMoreOptionsMenu.h @@ -107,7 +107,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual void tick(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_LeaderboardsMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_LeaderboardsMenu.cpp index 68c614e27..bf9d335d2 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -154,7 +154,7 @@ void UIScene_LeaderboardsMenu::updateComponents() m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false); } -wstring UIScene_LeaderboardsMenu::getMoviePath() +std::wstring UIScene_LeaderboardsMenu::getMoviePath() { return L"LeaderboardMenu"; } @@ -437,7 +437,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) else { m_newEntryIndex = (unsigned int)startIndex; - // m_newReadSize = min((int)READ_SIZE, (int)m_leaderboard.m_totalEntryCount-(startIndex-1)); + // m_newReadSize = std::min((int)READ_SIZE, (int)m_leaderboard.m_totalEntryCount-(startIndex-1)); } //app.DebugPrintf("Requesting stats read %d - %d - %d\n", m_currentLeaderboard, startIndex == -1 ? m_currentFilter : LeaderboardManager::eFM_TopRank, m_currentDifficulty); @@ -731,7 +731,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor #ifdef __PS3__ // m_name can be unicode characters somehow for Japan - should use m_onlineID - wstring wstr=convStringToWstring(statsRow->m_uid.getOnlineID()); + std::wstring wstr=convStringToWstring(statsRow->m_uid.getOnlineID()); swprintf(leaderboardEntry->m_gamerTag, XUSER_NAME_SIZE, L"%ls",wstr.c_str()); #else memcpy(leaderboardEntry->m_gamerTag, statsRow->m_name.data(), statsRow->m_name.size() * sizeof(wchar_t)); @@ -969,7 +969,7 @@ void UIScene_LeaderboardsMenu::customDraw(IggyCustomDrawCallbackRegion *region) } else { - shared_ptr item = shared_ptr( new ItemInstance(TitleIcons[m_currentLeaderboard][slotId], 1, 0) ); + std::shared_ptr item = std::shared_ptr( new ItemInstance(TitleIcons[m_currentLeaderboard][slotId], 1, 0) ); customDrawSlotControl(region,m_iPad,item,1.0f,false,false); } } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_LeaderboardsMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_LeaderboardsMenu.h index 728992ce7..4d92cef00 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_LeaderboardsMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_LeaderboardsMenu.h @@ -50,7 +50,7 @@ private: struct Leaderboard { DWORD m_totalEntryCount; //Either total number of entries in leaderboard, or total number of results for a friends query - vector m_entries; + std::vector m_entries; DWORD m_numColumns; }; @@ -102,7 +102,7 @@ private: int GetEntryStartIndex(); protected: - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: void handleReload(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_LoadMenu.cpp index 398709c0d..ff8000f40 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_LoadMenu.cpp @@ -386,7 +386,7 @@ void UIScene_LoadMenu::updateComponents() } } -wstring UIScene_LoadMenu::getMoviePath() +std::wstring UIScene_LoadMenu::getMoviePath() { return L"LoadMenu"; } @@ -932,7 +932,7 @@ void UIScene_LoadMenu::handleTimerComplete(int id) if(pDLCInfo) { // retrieve the image - if we haven't already - wstring textureName = filenametowstring(pDLCInfo->chImageURL); + std::wstring textureName = filenametostd::wstring(pDLCInfo->chImageURL); if(hasRegisteredSubstitutionTexture(textureName)==false) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_LoadMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_LoadMenu.h index e45fa09c9..11ace0c2b 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_LoadMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_LoadMenu.h @@ -70,7 +70,7 @@ private: PBYTE m_pbThumbnailData; unsigned int m_uiThumbnailSize; - wstring m_thumbnailName; + std::wstring m_thumbnailName; bool m_bRebuildTouchBoxes; public: @@ -89,7 +89,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_LoadOrJoinMenu.cpp index d29c44893..e8f0dc13f 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -28,7 +28,7 @@ #ifdef SONY_REMOTE_STORAGE_DOWNLOAD unsigned long UIScene_LoadOrJoinMenu::m_ulFileSize=0L; -wstring UIScene_LoadOrJoinMenu::m_wstrStageText=L""; +std::wstring UIScene_LoadOrJoinMenu::m_wstrStageText=L""; #endif @@ -44,7 +44,7 @@ wstring UIScene_LoadOrJoinMenu::m_wstrStageText=L""; UIScene_LoadOrJoinMenu::ESaveTransferFiles UIScene_LoadOrJoinMenu::s_eSaveTransferFile; unsigned long UIScene_LoadOrJoinMenu::s_ulFileSize=0L; byteArray UIScene_LoadOrJoinMenu::s_transferData = byteArray(); -wstring UIScene_LoadOrJoinMenu::m_wstrStageText=L""; +std::wstring UIScene_LoadOrJoinMenu::m_wstrStageText=L""; #ifdef _DEBUG_MENUS_ENABLED C4JStorage::SAVETRANSFER_FILE_DETAILS UIScene_LoadOrJoinMenu::m_debugTransferDetails; @@ -539,7 +539,7 @@ void UIScene_LoadOrJoinMenu::handleLoseFocus() killTimer(JOIN_LOAD_ONLINE_TIMER_ID); } -wstring UIScene_LoadOrJoinMenu::getMoviePath() +std::wstring UIScene_LoadOrJoinMenu::getMoviePath() { return L"LoadOrJoinMenu"; } @@ -850,7 +850,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() for(unsigned int i=0;iat(i)->getName(); + std::wstring wName = m_saves->at(i)->getName(); wchar_t *name = new wchar_t[wName.size()+1]; for(unsigned int j = 0; j < wName.size(); ++j) { @@ -1844,7 +1844,7 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) if(pDLCInfo) { // retrieve the image - if we haven't already - wstring textureName = filenametowstring(pDLCInfo->chImageURL); + std::wstring textureName = filenametostd::wstring(pDLCInfo->chImageURL); if(hasRegisteredSubstitutionTexture(textureName)==false) { @@ -2199,7 +2199,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS { if (ProfileManager.IsSignedInLive(iPad)) { - wstring ProductId; + std::wstring ProductId; app.GetDLCFullOfferIDForPackID(pClass->m_initData->selectedSession->data.texturePackParentId,ProductId); StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL); @@ -3062,10 +3062,10 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) ByteArrayInputStream bais(UIScene_LoadOrJoinMenu::s_transferData); DataInputStream dis(&bais); - wstring saveTitle = dis.readUTF(); + std::wstring saveTitle = dis.readUTF(); StorageManager.SetSaveTitle(saveTitle.c_str()); - wstring saveUniqueName = dis.readUTF(); + std::wstring saveUniqueName = dis.readUTF(); // 4J Stu - Don't set this any more. We added it so that we could share the ban list data for this save // However if the player downloads the same save multiple times, it will overwrite the previous version @@ -3204,7 +3204,7 @@ void UIScene_LoadOrJoinMenu::RequestFileSize( SaveTransferStateContainer *pClass { ZeroMemory(&m_debugTransferDetails, sizeof(C4JStorage::SAVETRANSFER_FILE_DETAILS) ); - File targetFile( wstring(L"FakeTMSPP\\").append(filename) ); + File targetFile( std::wstring(L"FakeTMSPP\\").append(filename) ); if(targetFile.exists()) m_debugTransferDetails.ulFileLen = targetFile.length(); SaveTransferReturned(pClass,&m_debugTransferDetails); @@ -3238,7 +3238,7 @@ void UIScene_LoadOrJoinMenu::RequestFileData( SaveTransferStateContainer *pClass #ifdef _DEBUG_MENUS_ENABLED if(app.GetLoadSavesFromFolderEnabled()) { - File targetFile( wstring(L"FakeTMSPP\\").append(filename) ); + File targetFile( std::wstring(L"FakeTMSPP\\").append(filename) ); if(targetFile.exists()) { HANDLE hSaveFile = CreateFile( targetFile.getPath().c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_LoadOrJoinMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_LoadOrJoinMenu.h index 01d94b05c..02f850978 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_LoadOrJoinMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_LoadOrJoinMenu.h @@ -77,9 +77,9 @@ private: int m_iMashUpButtonsC; int m_iState; - vector *m_currentSessions; - vector m_generators; - vector *m_saves; + std::vector *m_currentSessions; + std::vector m_generators; + std::vector *m_saves; bool m_bIgnoreInput; bool m_bAllLoaded; @@ -141,7 +141,7 @@ private: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: @@ -197,7 +197,7 @@ private: static ESaveTransferFiles s_eSaveTransferFile; static unsigned long s_ulFileSize; static byteArray s_transferData; - static wstring m_wstrStageText; + static std::wstring m_wstrStageText; LoadMenuInitData *m_loadMenuInitData; #ifdef _DEBUG_MENUS_ENABLED @@ -249,7 +249,7 @@ private: }; eSaveTransferState m_eSaveTransferState; static unsigned long m_ulFileSize; - static wstring m_wstrStageText; + static std::wstring m_wstrStageText; int m_iProgress; char m_downloadedUniqueFilename[64];//SCE_SAVE_DATA_DIRNAME_DATA_MAXSIZE]; bool m_saveTransferDownloadCancelled; diff --git a/Minecraft.Client/Build/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_MainMenu.cpp index dfd485a4b..eac1997d0 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_MainMenu.cpp @@ -77,7 +77,7 @@ UIScene_MainMenu::UIScene_MainMenu(int iPad, void *initData, UILayer *parentLaye m_splash = L""; - wstring filename = L"splashes.txt"; + std::wstring filename = L"splashes.txt"; if( app.hasArchiveFile(filename) ) { byteArray splashesArray = app.getArchiveFile(filename); @@ -85,7 +85,7 @@ UIScene_MainMenu::UIScene_MainMenu(int iPad, void *initData, UILayer *parentLaye InputStreamReader isr( &bais ); BufferedReader br( &isr ); - wstring line = L""; + std::wstring line = L""; while ( !(line = br.readLine()).empty() ) { line = trimString( line ); @@ -218,7 +218,7 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) m_splash = m_splashes.at( splashIndex ); } -wstring UIScene_MainMenu::getMoviePath() +std::wstring UIScene_MainMenu::getMoviePath() { return L"MainMenu"; } @@ -2008,7 +2008,7 @@ void UIScene_MainMenu::LoadTrial(void) param->saveData = NULL; param->settings = app.GetGameHostOption( eGameHostOption_Tutorial ) | app.GetGameHostOption(eGameHostOption_DisableSaving); - vector *generators = app.getLevelGenerators(); + std::vector *generators = app.getLevelGenerators(); if (generators->empty()) { app.DebugPrintf("LoadTrial: no level generators available, cannot start tutorial\n"); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_MainMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_MainMenu.h index f1b358dab..d562736b5 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_MainMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_MainMenu.h @@ -59,8 +59,8 @@ private: float m_fScreenWidth,m_fScreenHeight; float m_fRawWidth,m_fRawHeight; - vector m_splashes; - wstring m_splash; + std::vector m_splashes; + std::wstring m_splash; enum eSplashIndexes { eSplashHappyBirthdayEx = 0, @@ -109,7 +109,7 @@ protected: void customDrawSplash(IggyCustomDrawCallbackRegion *region); - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: virtual void tick(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_MessageBox.cpp b/Minecraft.Client/Build/Common/UI/UIScene_MessageBox.cpp index b0f8c6415..e3f11e1cb 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_MessageBox.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_MessageBox.cpp @@ -59,7 +59,7 @@ UIScene_MessageBox::~UIScene_MessageBox() m_parentLayer->removeComponent(eUIComponent_MenuBackground); } -wstring UIScene_MessageBox::getMoviePath() +std::wstring UIScene_MessageBox::getMoviePath() { if(app.GetLocalPlayerCount() > 1 && !m_parentLayer->IsFullscreenGroup()) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_MessageBox.h b/Minecraft.Client/Build/Common/UI/UIScene_MessageBox.h index 3c349dea7..38d850d03 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_MessageBox.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_MessageBox.h @@ -45,7 +45,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void updateTooltips(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_PauseMenu.cpp index 82fdb60ab..ddd17416a 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_PauseMenu.cpp @@ -127,7 +127,7 @@ UIScene_PauseMenu::~UIScene_PauseMenu() m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false); } -wstring UIScene_PauseMenu::getMoviePath() +std::wstring UIScene_PauseMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_PauseMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_PauseMenu.h index f1bd53aab..d1bb6ee66 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_PauseMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_PauseMenu.h @@ -76,7 +76,7 @@ protected: void updateControlsVisibility(); // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_QuadrantSignin.cpp b/Minecraft.Client/Build/Common/UI/UIScene_QuadrantSignin.cpp index 0c822b3d6..80e94034f 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_QuadrantSignin.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_QuadrantSignin.cpp @@ -71,7 +71,7 @@ UIScene_QuadrantSignin::~UIScene_QuadrantSignin() m_parentLayer->removeComponent(eUIComponent_MenuBackground); } -wstring UIScene_QuadrantSignin::getMoviePath() +std::wstring UIScene_QuadrantSignin::getMoviePath() { return L"QuadrantSignin"; } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_QuadrantSignin.h b/Minecraft.Client/Build/Common/UI/UIScene_QuadrantSignin.h index b500fcc33..bc9bb4325 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_QuadrantSignin.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_QuadrantSignin.h @@ -91,7 +91,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_ReinstallMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_ReinstallMenu.cpp index fb7a1a5b4..eef2bb84a 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_ReinstallMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_ReinstallMenu.cpp @@ -17,7 +17,7 @@ UIScene_ReinstallMenu::UIScene_ReinstallMenu(int iPad, void *initData, UILayer * #endif } -wstring UIScene_ReinstallMenu::getMoviePath() +std::wstring UIScene_ReinstallMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_ReinstallMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_ReinstallMenu.h index 54c20a6e8..2a833e9ef 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_ReinstallMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_ReinstallMenu.h @@ -36,7 +36,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SaveMessage.cpp b/Minecraft.Client/Build/Common/UI/UIScene_SaveMessage.cpp index 4a59279c8..f38e60cf8 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SaveMessage.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_SaveMessage.cpp @@ -48,7 +48,7 @@ UIScene_SaveMessage::~UIScene_SaveMessage() m_parentLayer->removeComponent(eUIComponent_Logo); } -wstring UIScene_SaveMessage::getMoviePath() +std::wstring UIScene_SaveMessage::getMoviePath() { return L"SaveMessage"; } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SaveMessage.h b/Minecraft.Client/Build/Common/UI/UIScene_SaveMessage.h index cedc8c8fa..88b84e22b 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SaveMessage.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_SaveMessage.h @@ -37,7 +37,7 @@ public: virtual void updateTooltips(); protected: - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsAudioMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_SettingsAudioMenu.cpp index e6733eedd..6351f4e0b 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsAudioMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsAudioMenu.cpp @@ -28,7 +28,7 @@ UIScene_SettingsAudioMenu::~UIScene_SettingsAudioMenu() { } -wstring UIScene_SettingsAudioMenu::getMoviePath() +std::wstring UIScene_SettingsAudioMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsAudioMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_SettingsAudioMenu.h index 6c48b22bc..28b176dd2 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsAudioMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsAudioMenu.h @@ -28,7 +28,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsControlMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_SettingsControlMenu.cpp index 3d6d00f74..b0ea3c0b1 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsControlMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsControlMenu.cpp @@ -28,7 +28,7 @@ UIScene_SettingsControlMenu::~UIScene_SettingsControlMenu() { } -wstring UIScene_SettingsControlMenu::getMoviePath() +std::wstring UIScene_SettingsControlMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsControlMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_SettingsControlMenu.h index 6d3b864c6..2094dc389 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsControlMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsControlMenu.h @@ -27,7 +27,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_SettingsGraphicsMenu.cpp index 16bc39ccd..f867d170d 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -60,7 +60,7 @@ UIScene_SettingsGraphicsMenu::~UIScene_SettingsGraphicsMenu() { } -wstring UIScene_SettingsGraphicsMenu::getMoviePath() +std::wstring UIScene_SettingsGraphicsMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsGraphicsMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_SettingsGraphicsMenu.h index e9c4905cd..0995ffc7c 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsGraphicsMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsGraphicsMenu.h @@ -36,7 +36,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_SettingsMenu.cpp index 5f5b1651d..70c643f61 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsMenu.cpp @@ -37,7 +37,7 @@ UIScene_SettingsMenu::~UIScene_SettingsMenu() { } -wstring UIScene_SettingsMenu::getMoviePath() +std::wstring UIScene_SettingsMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_SettingsMenu.h index 7f5fe169a..5d575a82a 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsMenu.h @@ -34,7 +34,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsOptionsMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_SettingsOptionsMenu.cpp index 0021d1341..d1554f564 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsOptionsMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsOptionsMenu.cpp @@ -75,7 +75,7 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat m_sliderDifficulty.setAllPossibleLabels(4,difficultyLabels); m_sliderDifficulty.init(difficultyLabels[ucValue],eControl_Difficulty,0,3,ucValue); - wstring wsText=app.GetString(m_iDifficultySettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]); + std::wstring wsText=app.GetString(m_iDifficultySettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]); EHTMLFontSize size = eHTMLSize_Normal; if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { @@ -142,7 +142,7 @@ UIScene_SettingsOptionsMenu::~UIScene_SettingsOptionsMenu() { } -wstring UIScene_SettingsOptionsMenu::getMoviePath() +std::wstring UIScene_SettingsOptionsMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { @@ -238,7 +238,7 @@ void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValu app.SetGameSettings(m_iPad,eGameSetting_Difficulty,value); - wstring wsText=app.GetString(m_iDifficultySettingA[value]); + std::wstring wsText=app.GetString(m_iDifficultySettingA[value]); EHTMLFontSize size = eHTMLSize_Normal; if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsOptionsMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_SettingsOptionsMenu.h index 265a0790c..7a66166de 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsOptionsMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsOptionsMenu.h @@ -47,7 +47,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsUIMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_SettingsUIMenu.cpp index 4f37bb184..8cdc2ef72 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsUIMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsUIMenu.cpp @@ -77,7 +77,7 @@ UIScene_SettingsUIMenu::~UIScene_SettingsUIMenu() { } -wstring UIScene_SettingsUIMenu::getMoviePath() +std::wstring UIScene_SettingsUIMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SettingsUIMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_SettingsUIMenu.h index 8968bbe79..9f9dac782 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SettingsUIMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_SettingsUIMenu.h @@ -43,7 +43,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SignEntryMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_SignEntryMenu.cpp index e31f4064e..201136635 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SignEntryMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_SignEntryMenu.cpp @@ -56,7 +56,7 @@ UIScene_SignEntryMenu::~UIScene_SignEntryMenu() m_parentLayer->removeComponent(eUIComponent_MenuBackground); } -wstring UIScene_SignEntryMenu::getMoviePath() +std::wstring UIScene_SignEntryMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { @@ -84,7 +84,7 @@ void UIScene_SignEntryMenu::tick() // Set the sign text here so we on;y call the verify once it has been set, not while we're typing in to it for(int i=0;i<4;i++) { - wstring temp=m_textInputLines[i].getLabel(); + std::wstring temp=m_textInputLines[i].getLabel(); m_sign->SetMessage(i,temp); } @@ -94,10 +94,10 @@ void UIScene_SignEntryMenu::tick() // need to send the new data if (pMinecraft->level->isClientSide) { - shared_ptr player = pMinecraft->localplayers[m_iPad]; + std::shared_ptr player = pMinecraft->localplayers[m_iPad]; if(player != NULL && player->connection && player->connection->isStarted()) { - player->connection->send( shared_ptr( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) ); + player->connection->send( std::shared_ptr( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) ); } } ui.CloseUIScenes(m_iPad); @@ -116,7 +116,7 @@ void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pre if(pressed) { // user backed out, so wipe the sign - wstring temp=L""; + std::wstring temp=L""; for(int i=0;i<4;i++) { diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SignEntryMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_SignEntryMenu.h index 28b37d531..d2535ce78 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SignEntryMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_SignEntryMenu.h @@ -17,7 +17,7 @@ private: eControl_Confirm }; - shared_ptr m_sign; + std::shared_ptr m_sign; int m_iEditingLine; bool m_bConfirmed; bool m_bIgnoreInput; @@ -45,7 +45,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_SkinSelectMenu.cpp index e75be7482..5690faa87 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_SkinSelectMenu.cpp @@ -143,7 +143,7 @@ void UIScene_SkinSelectMenu::updateComponents() m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false); } -wstring UIScene_SkinSelectMenu::getMoviePath() +std::wstring UIScene_SkinSelectMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { @@ -746,8 +746,8 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { BOOL showPrevious = FALSE, showNext = FALSE; DWORD previousIndex = 0, nextIndex = 0; - wstring skinName = L""; - wstring skinOrigin = L""; + std::wstring skinName = L""; + std::wstring skinOrigin = L""; bool bSkinIsFree=false; bool bLicensed=false; DLCSkinFile *skinFile=NULL; @@ -872,7 +872,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { // add the boxes to the humanoid model, but only if we've not done this already - vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); + std::vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),m_vAdditionalSkinBoxes); @@ -892,9 +892,9 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() nextIndex = getNextSkinIndex(m_skinIndex); previousIndex = getPreviousSkinIndex(m_skinIndex); - wstring otherSkinPath = L""; - wstring otherCapePath = L""; - vector *othervAdditionalSkinBoxes=NULL; + std::wstring otherSkinPath = L""; + std::wstring otherCapePath = L""; + std::vector *othervAdditionalSkinBoxes=NULL; wchar_t chars[256]; // turn off all displays @@ -986,7 +986,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() } if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { - vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); + std::vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); @@ -1057,7 +1057,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() } if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { - vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); + std::vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); @@ -1358,7 +1358,7 @@ void UIScene_SkinSelectMenu::setCharacterLocked(bool locked) IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetCharacterLocked , 1 , value ); } -void UIScene_SkinSelectMenu::setLeftLabel(const wstring &label) +void UIScene_SkinSelectMenu::setLeftLabel(const std::wstring &label) { if(label.compare(m_leftLabel) != 0) { @@ -1377,7 +1377,7 @@ void UIScene_SkinSelectMenu::setLeftLabel(const wstring &label) } } -void UIScene_SkinSelectMenu::setCentreLabel(const wstring &label) +void UIScene_SkinSelectMenu::setCentreLabel(const std::wstring &label) { if(label.compare(m_centreLabel) != 0) { @@ -1396,7 +1396,7 @@ void UIScene_SkinSelectMenu::setCentreLabel(const wstring &label) } } -void UIScene_SkinSelectMenu::setRightLabel(const wstring &label) +void UIScene_SkinSelectMenu::setRightLabel(const std::wstring &label) { if(label.compare(m_rightLabel) != 0) { @@ -1664,7 +1664,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: // need to get info on the pack to see if the user has already downloaded it // retrieve the store name for the skin pack - wstring wStrPackName=pScene->m_currentPack->getName(); + std::wstring wStrPackName=pScene->m_currentPack->getName(); const char *pchPackName=wstringtofilename(wStrPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_SkinSelectMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_SkinSelectMenu.h index 1ee114ca0..58de0bdc0 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_SkinSelectMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_SkinSelectMenu.h @@ -102,8 +102,8 @@ private: DLCPack *m_currentPack; DWORD m_packIndex, m_skinIndex; DWORD m_originalSkinId; - wstring m_currentSkinPath, m_selectedSkinPath, m_selectedCapePath; - vector *m_vAdditionalSkinBoxes; + std::wstring m_currentSkinPath, m_selectedSkinPath, m_selectedCapePath; + std::vector *m_vAdditionalSkinBoxes; bool m_bSlidingSkins, m_bAnimatingMove; ESkinSelectNavigation m_currentNavigation; @@ -112,7 +112,7 @@ private: DWORD m_currentPackCount; bool m_bIgnoreInput; bool m_bSkinIndexChanged; - wstring m_leftLabel, m_centreLabel, m_rightLabel; + std::wstring m_leftLabel, m_centreLabel, m_rightLabel; S32 m_iTouchXStart; bool m_bTouchScrolled; @@ -134,7 +134,7 @@ public: protected: // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT @@ -157,9 +157,9 @@ private: void setCharacterSelected(bool selected); void setCharacterLocked(bool locked); - void setLeftLabel(const wstring &label); - void setCentreLabel(const wstring &label); - void setRightLabel(const wstring &label); + void setLeftLabel(const std::wstring &label); + void setCentreLabel(const std::wstring &label); + void setRightLabel(const std::wstring &label); virtual void HandleDLCMountingComplete(); virtual void HandleDLCInstalled(); diff --git a/Minecraft.Client/Build/Common/UI/UIScene_TeleportMenu.cpp b/Minecraft.Client/Build/Common/UI/UIScene_TeleportMenu.cpp index 2f4ecb409..07866bff7 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_TeleportMenu.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_TeleportMenu.cpp @@ -46,7 +46,7 @@ UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void *initData, UILayer *pa m_players[m_playersCount] = player->GetSmallId(); ++m_playersCount; - wstring playerName = L""; + std::wstring playerName = L""; #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L< 1) { @@ -136,7 +136,7 @@ void UIScene_TeleportMenu::handleReload() m_players[m_playersCount] = player->GetSmallId(); ++m_playersCount; - wstring playerName = L""; + std::wstring playerName = L""; #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L< packet; + std::shared_ptr packet; if(m_teleportToPlayer) { packet = TeleportCommand::preparePacket(thisPlayer->GetUID(),selectedPlayer->GetUID()); @@ -307,7 +307,7 @@ void UIScene_TeleportMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer * scene->m_players[scene->m_playersCount] = pPlayer->GetSmallId(); ++scene->m_playersCount; - wstring playerName = L""; + std::wstring playerName = L""; #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L< 1) { @@ -147,7 +147,7 @@ void UIScene_TradingMenu::customDraw(IggyCustomDrawCallbackRegion *region) Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; - shared_ptr item = nullptr; + std::shared_ptr item = nullptr; int slotId = -1; swscanf((wchar_t*)region->name,L"slot_%d",&slotId); @@ -223,17 +223,17 @@ void UIScene_TradingMenu::moveSelector(bool right) IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcMoveSelector , 1 , value ); } -void UIScene_TradingMenu::setTitle(const wstring &name) +void UIScene_TradingMenu::setTitle(const std::wstring &name) { m_labelTrading.setLabel(name); } -void UIScene_TradingMenu::setRequest1Name(const wstring &name) +void UIScene_TradingMenu::setRequest1Name(const std::wstring &name) { m_labelRequest1.setLabel(name); } -void UIScene_TradingMenu::setRequest2Name(const wstring &name) +void UIScene_TradingMenu::setRequest2Name(const std::wstring &name) { m_labelRequest2.setLabel(name); } @@ -253,7 +253,7 @@ void UIScene_TradingMenu::setTradeRedBox(int index, bool show) m_slotListTrades.showSlotRedBox(index,show); } -void UIScene_TradingMenu::setOfferDescription(const wstring &name, vector &unformattedStrings) +void UIScene_TradingMenu::setOfferDescription(const std::wstring &name, std::vector &unformattedStrings) { IggyDataValue result; IggyDataValue value[1]; diff --git a/Minecraft.Client/Build/Common/UI/UIScene_TradingMenu.h b/Minecraft.Client/Build/Common/UI/UIScene_TradingMenu.h index 08263a1cc..794e353a1 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_TradingMenu.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_TradingMenu.h @@ -50,7 +50,7 @@ protected: UI_MAP_NAME(m_funcSetOfferDescription, L"SetOfferDescription") UI_END_MAP_ELEMENTS_AND_NAMES() - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); virtual void updateTooltips(); virtual void handleDestroy(); virtual void handleReload(); @@ -64,15 +64,15 @@ protected: virtual void showScrollRightArrow(bool show); virtual void showScrollLeftArrow(bool show); virtual void moveSelector(bool right); - virtual void setTitle(const wstring &name); - virtual void setRequest1Name(const wstring &name); - virtual void setRequest2Name(const wstring &name); + virtual void setTitle(const std::wstring &name); + virtual void setRequest1Name(const std::wstring &name); + virtual void setRequest2Name(const std::wstring &name); virtual void setRequest1RedBox(bool show); virtual void setRequest2RedBox(bool show); virtual void setTradeRedBox(int index, bool show); - virtual void setOfferDescription(const wstring &name, vector &unformattedStrings); + virtual void setOfferDescription(const std::wstring &name, std::vector &unformattedStrings); int getPad() { return m_iPad; } }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/UI/UIScene_TrialExitUpsell.cpp b/Minecraft.Client/Build/Common/UI/UIScene_TrialExitUpsell.cpp index 3894bc0f8..0df8d1987 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_TrialExitUpsell.cpp +++ b/Minecraft.Client/Build/Common/UI/UIScene_TrialExitUpsell.cpp @@ -9,7 +9,7 @@ UIScene_TrialExitUpsell::UIScene_TrialExitUpsell(int iPad, void *initData, UILay initialiseMovie(); } -wstring UIScene_TrialExitUpsell::getMoviePath() +std::wstring UIScene_TrialExitUpsell::getMoviePath() { return L"TrialExitUpsell"; } diff --git a/Minecraft.Client/Build/Common/UI/UIScene_TrialExitUpsell.h b/Minecraft.Client/Build/Common/UI/UIScene_TrialExitUpsell.h index 79e9edf5b..802a89eb4 100644 --- a/Minecraft.Client/Build/Common/UI/UIScene_TrialExitUpsell.h +++ b/Minecraft.Client/Build/Common/UI/UIScene_TrialExitUpsell.h @@ -20,7 +20,7 @@ public: virtual void updateTooltips(); protected: - virtual wstring getMoviePath(); + virtual std::wstring getMoviePath(); public: // INPUT diff --git a/Minecraft.Client/Build/Common/UI/UIStructs.h b/Minecraft.Client/Build/Common/UI/UIStructs.h index ea57b3a1f..d59a666fa 100644 --- a/Minecraft.Client/Build/Common/UI/UIStructs.h +++ b/Minecraft.Client/Build/Common/UI/UIStructs.h @@ -31,8 +31,8 @@ typedef struct _UIVec2D // Brewing typedef struct _BrewingScreenInput { - shared_ptr inventory; - shared_ptr brewingStand; + std::shared_ptr inventory; + std::shared_ptr brewingStand; int iPad; bool bSplitscreen; } BrewingScreenInput; @@ -40,8 +40,8 @@ typedef struct _BrewingScreenInput // Chest typedef struct _ContainerScreenInput { - shared_ptr inventory; - shared_ptr container; + std::shared_ptr inventory; + std::shared_ptr container; int iPad; bool bSplitscreen; } ContainerScreenInput; @@ -49,8 +49,8 @@ typedef struct _ContainerScreenInput // Dispenser typedef struct _TrapScreenInput { - shared_ptr inventory; - shared_ptr trap; + std::shared_ptr inventory; + std::shared_ptr trap; int iPad; bool bSplitscreen; } TrapScreenInput; @@ -58,7 +58,7 @@ typedef struct _TrapScreenInput // Inventory and creative inventory typedef struct _InventoryScreenInput { - shared_ptr player; + std::shared_ptr player; bool bNavigateBack; // If we came here from the crafting screen, go back to it, rather than closing the xui menus int iPad; bool bSplitscreen; @@ -67,7 +67,7 @@ typedef struct _InventoryScreenInput // Enchanting typedef struct _EnchantingScreenInput { - shared_ptr inventory; + std::shared_ptr inventory; Level *level; int x; int y; @@ -79,8 +79,8 @@ typedef struct _EnchantingScreenInput // Furnace typedef struct _FurnaceScreenInput { - shared_ptr inventory; - shared_ptr furnace; + std::shared_ptr inventory; + std::shared_ptr furnace; int iPad; bool bSplitscreen; } FurnaceScreenInput; @@ -88,7 +88,7 @@ typedef struct _FurnaceScreenInput // Crafting typedef struct _CraftingPanelScreenInput { - shared_ptr player; + std::shared_ptr player; int iContainerType; // RECIPE_TYPE_2x2 or RECIPE_TYPE_3x3 bool bSplitscreen; int iPad; @@ -101,8 +101,8 @@ CraftingPanelScreenInput; // Trading typedef struct _TradingScreenInput { - shared_ptr inventory; - shared_ptr trader; + std::shared_ptr inventory; + std::shared_ptr trader; Level *level; int iPad; bool bSplitscreen; @@ -112,7 +112,7 @@ TradingScreenInput; // Anvil typedef struct _AnvilScreenInput { - shared_ptr inventory; + std::shared_ptr inventory; Level *level; int x; int y; @@ -125,7 +125,7 @@ AnvilScreenInput; // Sign typedef struct _SignEntryScreenInput { - shared_ptr sign; + std::shared_ptr sign; int iPad; } SignEntryScreenInput; @@ -259,13 +259,13 @@ typedef struct _LaunchMoreOptionsMenuInitData DWORD dwTexturePack; - wstring seed; + std::wstring seed; int worldSize; bool bDisableSaving; _LaunchMoreOptionsMenuInitData() { - memset(this,0,sizeof(_LaunchMoreOptionsMenuInitData)); + memset((void*)this,0,sizeof(_LaunchMoreOptionsMenuInitData)); bOnlineGame = TRUE; bAllowFriendsOfFriends = TRUE; bPVP = TRUE; diff --git a/Minecraft.Client/Build/Common/UI/UITTFFont.cpp b/Minecraft.Client/Build/Common/UI/UITTFFont.cpp index e51ecdd34..b00099117 100644 --- a/Minecraft.Client/Build/Common/UI/UITTFFont.cpp +++ b/Minecraft.Client/Build/Common/UI/UITTFFont.cpp @@ -4,12 +4,12 @@ #include "../../../../Minecraft.World/IO/Files/File.h" #include "UITTFFont.h" -UITTFFont::UITTFFont(const string &path, S32 fallbackCharacter) +UITTFFont::UITTFFont(const std::string &path, S32 fallbackCharacter) { app.DebugPrintf("UITTFFont opening %s\n",path.c_str()); #if defined(_UNICODE) && !defined(__linux__) - wstring wPath = convStringToWstring(path); + std::wstring wPath = convStringToWstring(path); HANDLE file = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #else HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); diff --git a/Minecraft.Client/Build/Common/UI/UITTFFont.h b/Minecraft.Client/Build/Common/UI/UITTFFont.h index 0de7c4e05..e489e1e69 100644 --- a/Minecraft.Client/Build/Common/UI/UITTFFont.h +++ b/Minecraft.Client/Build/Common/UI/UITTFFont.h @@ -7,6 +7,6 @@ private: //DWORD dwDataSize; public: - UITTFFont(const string &path, S32 fallbackCharacter); + UITTFFont(const std::string &path, S32 fallbackCharacter); ~UITTFFont(); }; diff --git a/Minecraft.Client/Build/Common/XUI/SlotProgressControl.cpp b/Minecraft.Client/Build/Common/XUI/SlotProgressControl.cpp index 10a0474f8..17eba5d60 100644 --- a/Minecraft.Client/Build/Common/XUI/SlotProgressControl.cpp +++ b/Minecraft.Client/Build/Common/XUI/SlotProgressControl.cpp @@ -21,7 +21,7 @@ int SlotProgressControl::GetValue() { SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; - shared_ptr item = shared_ptr(); + std::shared_ptr item = std::shared_ptr(); if( pUserDataContainer->slot != NULL ) { @@ -69,7 +69,7 @@ void SlotProgressControl::GetRange(int *pnRangeMin, int *pnRangeMax) { SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; - shared_ptr item = shared_ptr(); + std::shared_ptr item = std::shared_ptr(); if( pUserDataContainer->slot != NULL ) { diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Chat.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Chat.cpp index c3651a58f..3360c3c87 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Chat.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Chat.cpp @@ -21,7 +21,7 @@ HRESULT CScene_Chat::OnTimer( XUIMessageTimer *pXUIMessageTimer, BOOL &bHandled) Minecraft *pMinecraft = Minecraft::GetInstance(); Gui *pGui = pMinecraft->gui; - //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); + //DWORD messagesToDisplay = std::min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); for( unsigned int i = 0; i < CHAT_LINES_COUNT; ++i ) { float opacity = pGui->getOpacity(m_iPad, i); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_4JEdit.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_4JEdit.cpp index d4dd3bf06..32ecdfc0c 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_4JEdit.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_4JEdit.cpp @@ -11,7 +11,7 @@ HRESULT CXuiCtrl4JEdit::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled) m_uTextLimit=XUI_4JEDIT_MAX_CHARS-1; XuiEditSetTextLimit(m_hObj,m_uTextLimit); // Find the text limit. (Add one for NULL terminator) - //m_uTextLimit = min( XuiEditGetTextLimit(m_hObj) + 1, XUI_4JEDIT_MAX_CHARS); + //m_uTextLimit = std::min( XuiEditGetTextLimit(m_hObj) + 1, XUI_4JEDIT_MAX_CHARS); ZeroMemory( wchText , sizeof(WCHAR)*(m_uTextLimit+1) ); @@ -146,7 +146,7 @@ HRESULT CXuiCtrl4JEdit::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled) if( pThis->m_bReadOnly ) return hr; // Find the text limit. (Add one for NULL terminator) - //m_uTextLimit = min( XuiEditGetTextLimit(m_hObj) + 1, XUI_4JEDIT_MAX_CHARS); + //m_uTextLimit = std::min( XuiEditGetTextLimit(m_hObj) + 1, XUI_4JEDIT_MAX_CHARS); if((((pInputData->dwKeyCode == VK_PAD_A) && (pInputData->wch == 0)) || (pInputData->dwKeyCode == VK_PAD_START)) && !(pInputData->dwFlags & XUI_INPUT_FLAG_REPEAT)) { diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_4JList.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_4JList.cpp index d0493d649..87e05247f 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_4JList.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_4JList.cpp @@ -231,8 +231,8 @@ bool CXuiCtrl4JList::AlphabeticSortFn(const void *a, const void *b) CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a; CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b; - wstring wstr1=SaveDetailsA->pwszText; - wstring wstr2=SaveDetailsB->pwszText; + std::wstring wstr1=SaveDetailsA->pwszText; + std::wstring wstr2=SaveDetailsB->pwszText; if(wstr1.compare(wstr2)<0) { return true; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BrewProgress.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BrewProgress.h index 2f057a763..471c54eb9 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BrewProgress.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BrewProgress.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "XUI_Ctrl_ProgressCtrlBase.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BubblesProgress.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BubblesProgress.h index 4950cf72a..55f8e3917 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BubblesProgress.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BubblesProgress.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "XUI_Ctrl_ProgressCtrlBase.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BurnProgress.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BurnProgress.h index 1c403e325..1ba70b909 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BurnProgress.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_BurnProgress.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "XUI_Ctrl_ProgressCtrlBase.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp index 4833b9fad..591893a96 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp @@ -92,7 +92,7 @@ void CXuiCtrlCraftIngredientSlot::SetIcon(int iPad, int iId,int iAuxVal, int iCo XuiElementSetShow(m_hObj,bShow); } -void CXuiCtrlCraftIngredientSlot::SetIcon(int iPad, shared_ptr item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow) +void CXuiCtrlCraftIngredientSlot::SetIcon(int iPad, std::shared_ptr item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow) { if(item == NULL) SetIcon(iPad, 0,0,0,0,0,false,false,bShow); else diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_CraftIngredientSlot.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_CraftIngredientSlot.h index 5cf7a7f41..0a46227be 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_CraftIngredientSlot.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_CraftIngredientSlot.h @@ -16,7 +16,7 @@ public: virtual ~CXuiCtrlCraftIngredientSlot() { }; void SetRedBox(BOOL bVal); void SetIcon(int iPad, int iId,int iAuxVal, int iCount, int iScale, unsigned int uiAlpha, bool bDecorations, bool isFoil = false, BOOL bShow=TRUE); - void SetIcon(int iPad, shared_ptr item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow=TRUE); + void SetIcon(int iPad, std::shared_ptr item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow=TRUE); void SetDescription(LPCWSTR Desc); protected: @@ -31,7 +31,7 @@ protected: HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled); private: - shared_ptr m_item; + std::shared_ptr m_item; int m_iID; int m_iAuxVal; int m_iCount; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantButton.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantButton.h index 0b414d69c..948fc5760 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantButton.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantButton.h @@ -25,7 +25,7 @@ private: int m_iPad; int m_index; int m_lastCost; - wstring m_costString; + std::wstring m_costString; CXuiSceneEnchant *m_containerScene; float m_fScreenWidth,m_fScreenHeight; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp index c1823ab77..79158d84f 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp @@ -306,7 +306,7 @@ HRESULT CXuiCtrlEnchantmentBook::OnRender(XUIMessageRender *pRenderData, BOOL &b void CXuiCtrlEnchantmentBook::tickBook() { EnchantmentMenu *menu = m_containerScene->getMenu(); - shared_ptr current = menu->getSlot(0)->getItem(); + std::shared_ptr current = menu->getSlot(0)->getItem(); if (!ItemInstance::matches(current, last)) { last = current; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentBook.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentBook.h index bfd572bec..f08a98b05 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentBook.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentBook.h @@ -1,7 +1,7 @@ #pragma once #include "../../../../Minecraft.World/Util/Random.h" -using namespace std; +//using namespace std; class CXuiSceneEnchant; class BookModel; @@ -42,7 +42,7 @@ private: float m_fScale,m_fAlpha; int m_iPad; CXuiSceneEnchant *m_containerScene; - shared_ptr last; + std::shared_ptr last; float m_fScreenWidth,m_fScreenHeight; float m_fRawWidth,m_fRawHeight; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp index 0feed592e..95e2f388f 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp @@ -124,7 +124,7 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B glColor4f(1, 1, 1, 1); if (cost != 0) { - wstring line = _toString(cost); + std::wstring line = _toString(cost); Font *font = pMinecraft->altFont; //int col = 0x685E4A; unsigned int col = m_textColour; @@ -167,15 +167,15 @@ CXuiCtrlEnchantmentButtonText::EnchantmentNames CXuiCtrlEnchantmentButtonText::E CXuiCtrlEnchantmentButtonText::EnchantmentNames::EnchantmentNames() { - wstring allWords = L"the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale "; + std::wstring allWords = L"the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale "; std::wistringstream iss(allWords); std::copy(std::istream_iterator< std::wstring, wchar_t, std::char_traits >(iss), std::istream_iterator< std::wstring, wchar_t, std::char_traits >(),std::back_inserter(words)); } -wstring CXuiCtrlEnchantmentButtonText::EnchantmentNames::getRandomName() +std::wstring CXuiCtrlEnchantmentButtonText::EnchantmentNames::getRandomName() { int wordCount = random.nextInt(2) + 3; - wstring word = L""; + std::wstring word = L""; for (int i = 0; i < wordCount; i++) { if (i > 0) word += L" "; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentButtonText.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentButtonText.h index c28b29ed1..efdc1ed7f 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentButtonText.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_EnchantmentButtonText.h @@ -24,7 +24,7 @@ private: float m_fRawWidth,m_fRawHeight; int m_lastCost; - wstring m_enchantmentString; + std::wstring m_enchantmentString; unsigned int m_textColour, m_textFocusColour, m_textDisabledColour; @@ -35,11 +35,11 @@ private: private: Random random; - vector words; + std::vector words; EnchantmentNames(); public: - wstring getRandomName(); + std::wstring getRandomName(); }; }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_FireProgress.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_FireProgress.h index 595072efb..216b5a7d6 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_FireProgress.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_FireProgress.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "XUI_Ctrl_ProgressCtrlBase.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftPlayer.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftPlayer.h index fa28d6b83..70692bfe9 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftPlayer.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftPlayer.h @@ -3,7 +3,7 @@ #include #include -using namespace std; +//using namespace std; class TileRenderer; class ItemRenderer; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp index b718d574f..e35567a1c 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp @@ -74,7 +74,7 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnInit(XUIMessageInit* pInitData, BOOL& rf return hr; } -void CXuiCtrlMinecraftSkinPreview::SetTexture(const wstring &url, TEXTURE_NAME backupTexture) +void CXuiCtrlMinecraftSkinPreview::SetTexture(const std::wstring &url, TEXTURE_NAME backupTexture) { m_customTextureUrl = url; m_backupTexture = backupTexture; @@ -252,7 +252,7 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO if (renderer != NULL) { // 4J-PB - any additional parts to turn on for this player (skin dependent) - //vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); + //std::vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) { @@ -510,7 +510,7 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do model->holdingLeftHand = false; } -bool CXuiCtrlMinecraftSkinPreview::bindTexture(const wstring& urlTexture, int backupTexture) +bool CXuiCtrlMinecraftSkinPreview::bindTexture(const std::wstring& urlTexture, int backupTexture) { Textures *t = Minecraft::GetInstance()->textures; @@ -530,7 +530,7 @@ bool CXuiCtrlMinecraftSkinPreview::bindTexture(const wstring& urlTexture, int ba } } -bool CXuiCtrlMinecraftSkinPreview::bindTexture(const wstring& urlTexture, const wstring& backupTexture) +bool CXuiCtrlMinecraftSkinPreview::bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture) { Textures *t = Minecraft::GetInstance()->textures; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.h index 75871d694..88bd0458a 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.h @@ -6,7 +6,7 @@ //#include "../../Xbox/DLC/DLCSkinFile.h" #include "../../../Rendering/Models/Model.h" -using namespace std; +//using namespace std; class EntityRenderer; @@ -42,8 +42,8 @@ public: CXuiCtrlMinecraftSkinPreview(); virtual ~CXuiCtrlMinecraftSkinPreview() { }; - void SetTexture(const wstring &url, TEXTURE_NAME backupTexture = TN_MOB_CHAR); - void SetCapeTexture(const wstring &url) { m_capeTextureUrl = url; } + void SetTexture(const std::wstring &url, TEXTURE_NAME backupTexture = TN_MOB_CHAR); + void SetCapeTexture(const std::wstring &url) { m_capeTextureUrl = url; } void ResetRotation() { m_xRot = 0; m_yRot = 0; } void IncrementYRotation() { m_yRot = (m_yRot+4); if(m_yRot >= 180) m_yRot = -180; } void DecrementYRotation() { m_yRot = (m_yRot-4); if(m_yRot <= -180) m_yRot = 180; } @@ -70,15 +70,15 @@ protected: private: void render(EntityRenderer *renderer, double x, double y, double z, float rot, float a); - bool bindTexture(const wstring& urlTexture, int backupTexture); - bool bindTexture(const wstring& urlTexture, const wstring& backupTexture); + bool bindTexture(const std::wstring& urlTexture, int backupTexture); + bool bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture); BOOL m_bDirty; float m_fScale,m_fAlpha; - wstring m_customTextureUrl; + std::wstring m_customTextureUrl; TEXTURE_NAME m_backupTexture; - wstring m_capeTextureUrl; + std::wstring m_capeTextureUrl; unsigned int m_uiAnimOverrideBitmask; float m_fScreenWidth,m_fScreenHeight; @@ -101,6 +101,6 @@ private: float m_swingTime; ESkinPreviewAnimations m_currentAnimation; - //vector *m_pvAdditionalBoxes; - vector *m_pvAdditionalModelParts; + //std::vector *m_pvAdditionalBoxes; + std::vector *m_pvAdditionalModelParts; }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp index b32098213..ceeb8057f 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp @@ -188,7 +188,7 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa { HXUIDC hDC = pRenderData->hDC; CXuiControl xuiControl(m_hObj); - if(m_item == NULL) m_item = shared_ptr( new ItemInstance(m_iID, m_iCount, m_iAuxVal) ); + if(m_item == NULL) m_item = std::shared_ptr( new ItemInstance(m_iID, m_iCount, m_iAuxVal) ); // build and render with the game call @@ -253,7 +253,7 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa //Make sure that pMinecraft->player is the correct player so that player specific rendering // eg clock and compass, are rendered correctly - shared_ptr oldPlayer = pMinecraft->player; + std::shared_ptr oldPlayer = pMinecraft->player; if( m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[m_iPad]; @@ -343,7 +343,7 @@ void CXuiCtrlMinecraftSlot::SetIcon(int iPad, int iId,int iAuxVal, int iCount, i XuiElementSetShow(m_hObj,bShow); } -void CXuiCtrlMinecraftSlot::SetIcon(int iPad, shared_ptr item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow) +void CXuiCtrlMinecraftSlot::SetIcon(int iPad, std::shared_ptr item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow) { m_item = item; m_isFoil = item->isFoil(); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSlot.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSlot.h index 5dafec53a..1f337f692 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSlot.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MinecraftSlot.h @@ -3,7 +3,7 @@ #include #include -using namespace std; +//using namespace std; class TileRenderer; class ItemRenderer; @@ -23,7 +23,7 @@ public: void renderGuiItem(Font *font, Textures *textures,ItemInstance *item, int x, int y); void RenderItem(); void SetIcon(int iPad, int iId,int iAuxVal, int iCount, int iScale, unsigned int uiAlpha,bool bDecorations,BOOL bShow, bool isFoil); - void SetIcon(int iPad, shared_ptr item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow=TRUE); + void SetIcon(int iPad, std::shared_ptr item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow=TRUE); protected: @@ -38,7 +38,7 @@ protected: HRESULT OnRender(XUIMessageRender *pRenderData, BOOL &rfHandled); private: - shared_ptr m_item; + std::shared_ptr m_item; BOOL m_bDirty; INT m_iPassThroughDataAssociation; INT m_iPassThroughIdAssociation; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MobEffect.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MobEffect.cpp index 0e87be823..d22823689 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MobEffect.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MobEffect.cpp @@ -60,12 +60,12 @@ void CXuiCtrlMobEffect::setIcon(MobEffect::EMobEffectIcon icon) m_icon = icon; } -void CXuiCtrlMobEffect::setName(const wstring &name) +void CXuiCtrlMobEffect::setName(const std::wstring &name) { m_name = name; } -void CXuiCtrlMobEffect::setDuration(const wstring &duration) +void CXuiCtrlMobEffect::setDuration(const std::wstring &duration) { m_duration = duration; } \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MobEffect.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MobEffect.h index 860d780e6..3f73f8517 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MobEffect.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_MobEffect.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../../../../Minecraft.World/Entities/MobEffect.h" @@ -19,13 +19,13 @@ protected: public: void setIcon(MobEffect::EMobEffectIcon icon); - void setName(const wstring &name); - void setDuration(const wstring &duration); + void setName(const std::wstring &name); + void setDuration(const std::wstring &duration); private: MobEffect::EMobEffectIcon m_icon; - wstring m_name; - wstring m_duration; + std::wstring m_name; + std::wstring m_duration; static LPCWSTR iconFrameNames[MobEffect::e_MobEffectIcon_COUNT]; }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp index ff204392c..12606c8a0 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp @@ -36,7 +36,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnDestroy( HXUIOBJ hObj ) HRESULT CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem(HXUIOBJ hObj, CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled) { - shared_ptr item = shared_ptr(); + std::shared_ptr item = std::shared_ptr(); void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); @@ -49,7 +49,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem(HXUIOBJ hObj, Cust } else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); + std::shared_ptr player = std::dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); if(player != NULL) item = player->inventory->getCarried(); } @@ -119,14 +119,14 @@ bool CXuiCtrlSlotItemCtrlBase::isEmpty( HXUIOBJ hObj ) } else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); + std::shared_ptr player = std::dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); if(player != NULL) return player->inventory->getCarried() == NULL; } return true; } -wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector &unformattedStrings ) +std::wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, std::vector &unformattedStrings ) { void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); @@ -134,12 +134,12 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vectorslot != NULL) { - wstring desc = L""; - vector *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings); + std::wstring desc = L""; + std::vector *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings); bool firstLine = true; for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it) { - wstring thisString = *it; + std::wstring thisString = *it; if(!firstLine) { desc.append( L"
" ); @@ -167,10 +167,10 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vectorm_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); + std::shared_ptr player = std::dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); if(player != NULL) { - shared_ptr item = player->inventory->getCarried(); + std::shared_ptr item = player->inventory->getCarried(); if(item != NULL) return app.GetString( item->getDescriptionId() ); } @@ -178,7 +178,7 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector CXuiCtrlSlotItemCtrlBase::getItemInstance( HXUIOBJ hObj ) +std::shared_ptr CXuiCtrlSlotItemCtrlBase::getItemInstance( HXUIOBJ hObj ) { void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); @@ -190,7 +190,7 @@ shared_ptr CXuiCtrlSlotItemCtrlBase::getItemInstance( HXUIOBJ hObj } else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); + std::shared_ptr player = std::dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); if(player != NULL) return player->inventory->getCarried(); } @@ -268,7 +268,7 @@ int CXuiCtrlSlotItemCtrlBase::GetObjectCount( HXUIOBJ hObj ) } else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); + std::shared_ptr player = std::dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); if(player != NULL && player->inventory->getCarried() != NULL) { iCount = player->inventory->getCarried()->count; @@ -309,7 +309,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj } else if(pThisUserDataContainer->m_iPad >= 0 && pThisUserDataContainer->m_iPad < XUSER_MAX_COUNT) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pThisUserDataContainer->m_iPad] ); + std::shared_ptr player = std::dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pThisUserDataContainer->m_iPad] ); if(player != NULL && player->inventory->getCarried() != NULL) { iThisID = player->inventory->getCarried()->id; @@ -336,7 +336,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj } else if(pOtherUserDataContainer->m_iPad >= 0 && pOtherUserDataContainer->m_iPad < XUSER_MAX_COUNT) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pOtherUserDataContainer->m_iPad] ); + std::shared_ptr player = std::dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pOtherUserDataContainer->m_iPad] ); if(player != NULL && player->inventory->getCarried() != NULL) { iOtherID = player->inventory->getCarried()->id; @@ -378,7 +378,7 @@ int CXuiCtrlSlotItemCtrlBase::GetEmptyStackSpace( HXUIOBJ hObj ) if ( bStackable ) { iCount = pUserDataContainer->slot->getItem()->GetCount(); - iMaxStackSize = min(pUserDataContainer->slot->getItem()->getMaxStackSize(), pUserDataContainer->slot->getMaxStackSize() ); + iMaxStackSize = std::min(pUserDataContainer->slot->getItem()->getMaxStackSize(), pUserDataContainer->slot->getMaxStackSize() ); iResult = iMaxStackSize - iCount; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h index 2fd217494..c2423d829 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; class Slot; class ItemInstance; @@ -47,9 +47,9 @@ public: bool isEmpty( HXUIOBJ hObj ); - wstring GetItemDescription( HXUIOBJ hObj, vector &unformattedStrings ); + std::wstring GetItemDescription( HXUIOBJ hObj, std::vector &unformattedStrings ); - shared_ptr getItemInstance( HXUIOBJ hObj ); + std::shared_ptr getItemInstance( HXUIOBJ hObj ); Slot *getSlot( HXUIOBJ hObj ); // 4J WESTY : Pointer Prototype : Added to support prototype only. diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SplashPulser.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SplashPulser.cpp index 7cd96d26a..9c5c757c6 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SplashPulser.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SplashPulser.cpp @@ -41,7 +41,7 @@ HRESULT CXuiCtrlSplashPulser::OnRender(XUIMessageRender *pRenderData, BOOL &bHan Minecraft *pMinecraft=Minecraft::GetInstance(); Font *font = pMinecraft->font; - wstring splash( GetText() ); + std::wstring splash( GetText() ); // build and render with the game call diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SplashPulser.h b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SplashPulser.h index 504cf4c5a..959bb0e55 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SplashPulser.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Ctrl_SplashPulser.h @@ -3,7 +3,7 @@ #include #include -using namespace std; +//using namespace std; //----------------------------------------------------------------------------- // CXuiCtrlSplashPulser class diff --git a/Minecraft.Client/Build/Common/XUI/XUI_CustomMessages.h b/Minecraft.Client/Build/Common/XUI/XUI_CustomMessages.h index 888f8ad00..ae7a0fda3 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_CustomMessages.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_CustomMessages.h @@ -14,7 +14,7 @@ typedef struct { - shared_ptr item; + std::shared_ptr item; // Legacy values for compatibility int iDataBitField; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_DLCOffers.cpp b/Minecraft.Client/Build/Common/XUI/XUI_DLCOffers.cpp index d23245495..5521a8a43 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_DLCOffers.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_DLCOffers.cpp @@ -18,7 +18,7 @@ #define TIMER_ID_NAVIGATE_BACK 2 // Constants -//const wstring CScene_DLCOffers::DEFAULT_BANNER = L"Graphics/banner.png"; +//const std::wstring CScene_DLCOffers::DEFAULT_BANNER = L"Graphics/banner.png"; // DLC Main @@ -364,7 +364,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) //if(Offer.dwOfferType==app.GetDLCContentType((eDLCContentType)m_iType)) if(pDLC->eDLCType==(eDLCContentType)m_iType) { - wstring wstrTemp=xOffer.wszOfferName; + std::wstring wstrTemp=xOffer.wszOfferName; // If the string starts with Minecraft, removed that @@ -493,7 +493,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) } wchar_t formatting[40]; - wstring wstrTemp = xOffer.wszSellText; + std::wstring wstrTemp = xOffer.wszSellText; swprintf(formatting, 40, L"", m_bIsSD?12:14); wstrTemp = formatting + wstrTemp; @@ -503,7 +503,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // set the price info m_PriceTag.SetShow(TRUE); // swprintf(formatting, 40, L"%d",xOffer.dwPointsPrice); -// wstrTemp=wstring(formatting); +// wstrTemp=std::wstring(formatting); // m_PriceTag.SetText(wstrTemp.c_str()); m_PriceTag.SetText(xOffer.wszCurrencyPrice); @@ -517,7 +517,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // set the default text wchar_t formatting[40]; - wstring wstrTemp = app.GetString(IDS_NO_DLCOFFERS); + std::wstring wstrTemp = app.GetString(IDS_NO_DLCOFFERS); swprintf(formatting, 40, L"", m_bIsSD?12:14); wstrTemp = formatting + wstrTemp; @@ -681,16 +681,16 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha wchar_t formatting[40]; - wstring wstrTemp=xOffer.wszSellText; + std::wstring wstrTemp=xOffer.wszSellText; swprintf(formatting, 40, L"",m_bIsSD?12:14); - wstrTemp = wstring(formatting) + wstrTemp; + wstrTemp = std::wstring(formatting) + wstrTemp; m_SellText.SetText(wstrTemp.c_str()); // set the price info m_PriceTag.SetShow(TRUE); // swprintf(formatting, 40, L"%d",xOffer.dwPointsPrice); -// wstrTemp=wstring(formatting); +// wstrTemp=std::wstring(formatting); // m_PriceTag.SetText(wstrTemp.c_str()); m_PriceTag.SetText(xOffer.wszCurrencyPrice); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_DLCOffers.h b/Minecraft.Client/Build/Common/XUI/XUI_DLCOffers.h index 0717846ee..e913fbcb0 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_DLCOffers.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_DLCOffers.h @@ -55,7 +55,7 @@ private: class CScene_DLCOffers : public CXuiSceneImpl { protected: - //static const wstring DEFAULT_BANNER; + //static const std::wstring DEFAULT_BANNER; // Control and Element wrapper objects. CXuiList m_List; @@ -120,7 +120,7 @@ public: private: - //vector offerIndexes; + //std::vector offerIndexes; CScene_DLCMain *pMain; bool m_bIgnorePress; int m_iPad; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_DebugItemEditor.cpp b/Minecraft.Client/Build/Common/XUI/XUI_DebugItemEditor.cpp index 7cfcb0286..6f378305c 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_DebugItemEditor.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_DebugItemEditor.cpp @@ -59,8 +59,8 @@ HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfH m_slot->set(m_item); Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player != NULL && player->connection) player->connection->send( shared_ptr( new ContainerSetSlotPacket(m_menu->containerId, m_slot->index, m_item) ) ); + std::shared_ptr player = pMinecraft->localplayers[m_iPad]; + if(player != NULL && player->connection) player->connection->send( std::shared_ptr( new ContainerSetSlotPacket(m_menu->containerId, m_slot->index, m_item) ) ); } // kill the crafting xui app.NavigateBack(m_iPad); @@ -76,11 +76,11 @@ HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfH HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled) { - if(m_item == NULL) m_item = shared_ptr( new ItemInstance(0,1,0) ); + if(m_item == NULL) m_item = std::shared_ptr( new ItemInstance(0,1,0) ); if(hObjSource == m_itemId) { int id = 0; - wstring value = m_itemId.GetText(); + std::wstring value = m_itemId.GetText(); if(!value.empty()) id = _fromString( value ); // TODO Proper validation of the valid item ids @@ -89,21 +89,21 @@ HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot else if(hObjSource == m_itemAuxValue) { int auxVal = 0; - wstring value = m_itemAuxValue.GetText(); + std::wstring value = m_itemAuxValue.GetText(); if(!value.empty()) auxVal = _fromString( value ); if(auxVal >= 0) m_item->setAuxValue( auxVal ); } else if(hObjSource == m_itemCount) { int count = 0; - wstring value = m_itemCount.GetText(); + std::wstring value = m_itemCount.GetText(); if(!value.empty()) count = _fromString( value ); if(count > 0 && count <= Item::items[m_item->id]->getMaxStackSize()) m_item->count = count; } else if(hObjSource == m_item4JData) { int data = 0; - wstring value = m_item4JData.GetText(); + std::wstring value = m_item4JData.GetText(); if(!value.empty()) data = _fromString( value ); m_item->set4JData(data); } diff --git a/Minecraft.Client/Build/Common/XUI/XUI_DebugItemEditor.h b/Minecraft.Client/Build/Common/XUI/XUI_DebugItemEditor.h index facc0f683..0f969254f 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_DebugItemEditor.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_DebugItemEditor.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../media/xuiscene_debug_item_editor.h" #include "XUI_Ctrl_CraftIngredientSlot.h" @@ -18,7 +18,7 @@ public: } ItemEditorInput; private: int m_iPad; - shared_ptr m_item; + std::shared_ptr m_item; Slot *m_slot; AbstractContainerMenu *m_menu; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_DebugOverlay.cpp b/Minecraft.Client/Build/Common/XUI/XUI_DebugOverlay.cpp index 458dc8955..0f9f710fd 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_DebugOverlay.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_DebugOverlay.cpp @@ -128,7 +128,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress int id = m_itemIds[nIndex]; //app.SetXuiServerAction(pNotifyPressData->UserIndex, eXuiServerAction_DropItem, (void *)id); ClientConnection *conn = Minecraft::GetInstance()->getConnection(ProfileManager.GetPrimaryPad()); - conn->send( GiveItemCommand::preparePacket(dynamic_pointer_cast(Minecraft::GetInstance()->localplayers[ProfileManager.GetPrimaryPad()]), id) ); + conn->send( GiveItemCommand::preparePacket(std::dynamic_pointer_cast(Minecraft::GetInstance()->localplayers[ProfileManager.GetPrimaryPad()]), id) ); } } else if ( hObjPressed == m_mobs ) @@ -143,7 +143,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress { nIndex = m_enchantments.GetCurSel(); ClientConnection *conn = Minecraft::GetInstance()->getConnection(ProfileManager.GetPrimaryPad()); - conn->send( EnchantItemCommand::preparePacket(dynamic_pointer_cast(Minecraft::GetInstance()->localplayers[ProfileManager.GetPrimaryPad()]), m_enchantmentIds[nIndex]) ); + conn->send( EnchantItemCommand::preparePacket(std::dynamic_pointer_cast(Minecraft::GetInstance()->localplayers[ProfileManager.GetPrimaryPad()]), m_enchantmentIds[nIndex]) ); } /*else if( hObjPressed == m_saveToDisc ) // 4J-JEV: Doesn't look like we use this debug option anymore. { @@ -294,7 +294,7 @@ void CScene_DebugOverlay::SetSpawnToPlayerPos() #ifndef _CONTENT_PACKAGE void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) { - unordered_map newFileCache; + std::unordered_map newFileCache; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -305,7 +305,7 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) // TODO Make this only happen for the new save //SetSpawnToPlayerPos(); - FileEntry *origFileEntry = currentSave->createFile( wstring( L"level.dat" ) ); + FileEntry *origFileEntry = currentSave->createFile( std::wstring( L"level.dat" ) ); byteArray levelData( origFileEntry->getFileSize() ); DWORD bytesRead; currentSave->setFilePointer(origFileEntry,0,NULL,FILE_BEGIN); @@ -316,7 +316,7 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) &bytesRead // number of bytes read ); - FileEntry *newFileEntry = newSave.createFile( wstring( L"level.dat" ) ); + FileEntry *newFileEntry = newSave.createFile( std::wstring( L"level.dat" ) ); DWORD bytesWritten; newSave.writeFile( newFileEntry, levelData.data, // data buffer @@ -363,9 +363,9 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) } #endif -RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized +RegionFile *CScene_DebugOverlay::getRegionFile(std::unordered_map &newFileCache, ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized { - File file( prefix + wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" ); + File file( prefix + std::wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" ); RegionFile *ref = NULL; AUTO_VAR(it, newFileCache.find(file)); @@ -383,7 +383,7 @@ RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) +DataOutputStream *CScene_DebugOverlay::getChunkDataOutputStream(std::unordered_map &newFileCache, ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { RegionFile *r = getRegionFile(newFileCache, saveFile, prefix, chunkX, chunkZ); return r->getChunkDataOutputStream(chunkX & 31, chunkZ & 31); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_DebugOverlay.h b/Minecraft.Client/Build/Common/XUI/XUI_DebugOverlay.h index 15dd6e897..210b5b9d9 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_DebugOverlay.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_DebugOverlay.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../media/xuiscene_debugoverlay.h" #define DEBUG_OVERLAY_UPDATE_TIME_PERIOD 10000 @@ -18,9 +18,9 @@ private: CXuiControl m_resetTutorial, m_createSchematic, m_toggleRain, m_toggleThunder, m_setCamera; CXuiControl m_setDay, m_setNight; CXuiSlider m_chunkRadius, m_setTime,m_setFov; - vector m_itemIds; - vector m_mobFactories; - vector m_enchantmentIds; + std::vector m_itemIds; + std::vector m_mobFactories; + std::vector m_enchantmentIds; protected: // Message map. Here we tie messages to message handlers. @@ -65,8 +65,8 @@ private: #ifndef _CONTENT_PACKAGE void SaveLimitedFile(int chunkRadius); #endif - RegionFile *getRegionFile(unordered_map &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ); + RegionFile *getRegionFile(std::unordered_map &newFileCache, ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ); - DataOutputStream *getChunkDataOutputStream(unordered_map &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ); + DataOutputStream *getChunkDataOutputStream(std::unordered_map &newFileCache, ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ); #endif }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/XUI/XUI_DebugSchematicCreator.cpp b/Minecraft.Client/Build/Common/XUI/XUI_DebugSchematicCreator.cpp index fee23f35a..f1e44ce7c 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_DebugSchematicCreator.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_DebugSchematicCreator.cpp @@ -57,7 +57,7 @@ HRESULT CScene_DebugSchematicCreator::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINo else if(m_data->endZ < 0 && m_data->endZ%2 ==0) m_data->endZ+=1; - wstring value = m_name.GetText(); + std::wstring value = m_name.GetText(); if(!value.empty()) { swprintf(m_data->name,64,L"%ls", value.c_str()); @@ -110,7 +110,7 @@ HRESULT CScene_DebugSchematicCreator::OnNotifyValueChanged( HXUIOBJ hObjSource, if(hObjSource == m_startX) { int iVal = 0; - wstring value = m_startX.GetText(); + std::wstring value = m_startX.GetText(); if(!value.empty()) iVal = _fromString( value ); if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) @@ -121,7 +121,7 @@ HRESULT CScene_DebugSchematicCreator::OnNotifyValueChanged( HXUIOBJ hObjSource, else if(hObjSource == m_startY) { int iVal = 0; - wstring value = m_startY.GetText(); + std::wstring value = m_startY.GetText(); if(!value.empty()) iVal = _fromString( value ); if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) @@ -132,7 +132,7 @@ HRESULT CScene_DebugSchematicCreator::OnNotifyValueChanged( HXUIOBJ hObjSource, else if(hObjSource == m_startZ) { int iVal = 0; - wstring value = m_startZ.GetText(); + std::wstring value = m_startZ.GetText(); if(!value.empty()) iVal = _fromString( value ); if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) @@ -143,7 +143,7 @@ HRESULT CScene_DebugSchematicCreator::OnNotifyValueChanged( HXUIOBJ hObjSource, else if(hObjSource == m_endX) { int iVal = 0; - wstring value = m_endX.GetText(); + std::wstring value = m_endX.GetText(); if(!value.empty()) iVal = _fromString( value ); if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) @@ -154,7 +154,7 @@ HRESULT CScene_DebugSchematicCreator::OnNotifyValueChanged( HXUIOBJ hObjSource, else if(hObjSource == m_endY) { int iVal = 0; - wstring value = m_endY.GetText(); + std::wstring value = m_endY.GetText(); if(!value.empty()) iVal = _fromString( value ); if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) @@ -165,7 +165,7 @@ HRESULT CScene_DebugSchematicCreator::OnNotifyValueChanged( HXUIOBJ hObjSource, else if(hObjSource == m_endZ) { int iVal = 0; - wstring value = m_endZ.GetText(); + std::wstring value = m_endZ.GetText(); if(!value.empty()) iVal = _fromString( value ); if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) diff --git a/Minecraft.Client/Build/Common/XUI/XUI_DebugSetCamera.cpp b/Minecraft.Client/Build/Common/XUI/XUI_DebugSetCamera.cpp index 93bc257d8..b61478b84 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_DebugSetCamera.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_DebugSetCamera.cpp @@ -109,7 +109,7 @@ HRESULT CScene_DebugSetCamera::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINoti if (hObjSource == m_camX) { double iVal = 0; - wstring value = m_camX.GetText(); + std::wstring value = m_camX.GetText(); if(!value.empty()) iVal = _fromString( value ); currentPosition->m_camX = iVal; bHandled = TRUE; @@ -117,7 +117,7 @@ HRESULT CScene_DebugSetCamera::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINoti else if (hObjSource == m_camY) { double iVal = 0; - wstring value = m_camY.GetText(); + std::wstring value = m_camY.GetText(); if(!value.empty()) iVal = _fromString( value ); currentPosition->m_camY = iVal - 1.62; bHandled = TRUE; @@ -125,7 +125,7 @@ HRESULT CScene_DebugSetCamera::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINoti else if (hObjSource == m_camZ) { double iVal = 0; - wstring value = m_camZ.GetText(); + std::wstring value = m_camZ.GetText(); if(!value.empty()) iVal = _fromString( value ); currentPosition->m_camZ = iVal; bHandled = TRUE; @@ -133,7 +133,7 @@ HRESULT CScene_DebugSetCamera::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINoti else if (hObjSource == m_yRot) { double iVal = 0; - wstring value = m_yRot.GetText(); + std::wstring value = m_yRot.GetText(); if(!value.empty()) iVal = _fromString( value ); currentPosition->m_yRot = iVal; bHandled = TRUE; @@ -141,7 +141,7 @@ HRESULT CScene_DebugSetCamera::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINoti else if (hObjSource == m_elevation) { double iVal = 0; - wstring value = m_elevation.GetText(); + std::wstring value = m_elevation.GetText(); if(!value.empty()) iVal = _fromString( value ); currentPosition->m_elev = iVal; bHandled = TRUE; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_DebugTips.cpp b/Minecraft.Client/Build/Common/XUI/XUI_DebugTips.cpp index b3452a63a..851d8043a 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_DebugTips.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_DebugTips.cpp @@ -18,7 +18,7 @@ HRESULT CScene_DebugTips::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) // Display the tooltips //ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT); // display the next tip - wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); + std::wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); wchar_t startTags[64]; swprintf(startTags,64,L"
",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText + L"
"; @@ -41,7 +41,7 @@ HRESULT CScene_DebugTips::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled // next tip // display the next tip - wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); + std::wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); wchar_t startTags[64]; swprintf(startTags,64,L"
",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText + L"
"; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_FullscreenProgress.cpp b/Minecraft.Client/Build/Common/XUI/XUI_FullscreenProgress.cpp index 1628780c1..a9626f962 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_FullscreenProgress.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_FullscreenProgress.cpp @@ -53,7 +53,7 @@ HRESULT CScene_FullscreenProgress::OnInit( XUIMessageInit* pInitData, BOOL& bHan pMinecraft->progressRenderer->progressStage(-1); // set the tip - wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); + std::wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); wchar_t startTags[64]; swprintf(startTags,64,L"
",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText + L"
"; @@ -359,7 +359,7 @@ HRESULT CScene_FullscreenProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHand case TIMER_FULLSCREEN_TIPS: { // display the next tip - wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); + std::wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); wchar_t startTags[64]; swprintf(startTags,64,L"
",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText + L"
"; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_HelpHowToPlay.cpp b/Minecraft.Client/Build/Common/XUI/XUI_HelpHowToPlay.cpp index c01ea68c9..77672ba82 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_HelpHowToPlay.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_HelpHowToPlay.cpp @@ -48,7 +48,7 @@ HRESULT CScene_HowToPlay::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) MapChildControls(); - wstring wsTemp, inventoryString = app.GetString(IDS_INVENTORY); + std::wstring wsTemp, inventoryString = app.GetString(IDS_INVENTORY); XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelCTItem],app.GetString(IDS_ITEM_HATCHET_WOOD)); XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelCTGroup],app.GetString(IDS_GROUPNAME_TOOLS)); XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelCTInventory3x3],inventoryString.c_str()); @@ -74,7 +74,7 @@ HRESULT CScene_HowToPlay::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelAnvil_Inventory], inventoryString.c_str()); wsTemp = app.GetString(IDS_REPAIR_COST); - wsTemp.replace( wsTemp.find(L"%d"), 2, wstring(L"8") ); + wsTemp.replace( wsTemp.find(L"%d"), 2, std::wstring(L"8") ); XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelAnvil_Cost], wsTemp.c_str()); XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelAnvil_ARepairAndName], app.GetString(IDS_REPAIR_AND_NAME)); @@ -176,7 +176,7 @@ void CScene_HowToPlay::StartPage( EHowToPlayPage ePage ) if ( pDef->m_iTextControlIndex != eHowToPlay_TextNone ) { // Replace button identifiers in the text with actual button images. - wstring replacedText = app.FormatHTMLString(m_iPad, app.GetString( pDef->m_iTextStringID )); + std::wstring replacedText = app.FormatHTMLString(m_iPad, app.GetString( pDef->m_iTextStringID )); // 4J-PB - replace the title with the platform specific title, and the platform name replacedText = replaceAll(replacedText,L"{*PLATFORM_NAME*}",app.GetString(IDS_PLATFORM_NAME)); @@ -184,7 +184,7 @@ void CScene_HowToPlay::StartPage( EHowToPlayPage ePage ) replacedText = replaceAll(replacedText,L"{*DISABLES_ACHIEVEMENTS*}",app.GetString(IDS_HOST_OPTION_DISABLES_ACHIEVEMENTS)); // Set the text colour - wstring finalText(replacedText.c_str() ); + std::wstring finalText(replacedText.c_str() ); wchar_t startTags[64]; swprintf(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); finalText = startTags + finalText; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_InGameHostOptions.cpp b/Minecraft.Client/Build/Common/XUI/XUI_InGameHostOptions.cpp index ff7020390..d1a188d63 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_InGameHostOptions.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_InGameHostOptions.cpp @@ -75,10 +75,10 @@ HRESULT CScene_InGameHostOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& r if(hostOptions != app.GetGameHostOption(eGameHostOption_All) ) { Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr player = pMinecraft->localplayers[m_iPad]; + std::shared_ptr player = pMinecraft->localplayers[m_iPad]; if(player != NULL && player->connection) { - player->connection->send( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) ); + player->connection->send( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) ); } } diff --git a/Minecraft.Client/Build/Common/XUI/XUI_InGameInfo.cpp b/Minecraft.Client/Build/Common/XUI/XUI_InGameInfo.cpp index 461ab00c5..c51fcd3f4 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_InGameInfo.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_InGameInfo.cpp @@ -58,7 +58,7 @@ HRESULT CScene_InGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) if(thisPlayer != NULL) m_isHostPlayer = thisPlayer->IsHost() == TRUE; Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; if(!m_isHostPlayer && !localPlayer->isModerator() ) { m_gameOptionsButton.SetEnable(FALSE); @@ -183,7 +183,7 @@ HRESULT CScene_InGameInfo::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId( m_players[ playersList.GetCurSel() ] ); Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; bool isOp = m_isHostPlayer || localPlayer->isModerator(); bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; @@ -465,7 +465,7 @@ void CScene_InGameInfo::updateTooltips() int keyA = -1; Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; bool isOp = m_isHostPlayer || localPlayer->isModerator(); bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; @@ -526,10 +526,10 @@ int CScene_InGameInfo::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMes if(result==C4JStorage::EMessage_ResultAccept) { Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr localPlayer = pMinecraft->localplayers[iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[iPad]; if(localPlayer != NULL && localPlayer->connection) { - localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); + localPlayer->connection->send( std::shared_ptr( new KickPlayerPacket(smallId) ) ); } } diff --git a/Minecraft.Client/Build/Common/XUI/XUI_InGameInfo.h b/Minecraft.Client/Build/Common/XUI/XUI_InGameInfo.h index 8b685aaf7..b0802e4c7 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_InGameInfo.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_InGameInfo.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../media/xuiscene_ingameinfo.h" #include "XUI_CustomMessages.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_InGamePlayerOptions.cpp b/Minecraft.Client/Build/Common/XUI/XUI_InGamePlayerOptions.cpp index 3f11e5595..d9566a028 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_InGamePlayerOptions.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_InGamePlayerOptions.cpp @@ -277,10 +277,10 @@ HRESULT CScene_InGamePlayerOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& { // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr player = pMinecraft->localplayers[m_iPad]; + std::shared_ptr player = pMinecraft->localplayers[m_iPad]; if(player != NULL && player->connection) { - player->connection->send( shared_ptr( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) ); + player->connection->send( std::shared_ptr( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) ); } } @@ -336,10 +336,10 @@ int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStor if(result==C4JStorage::EMessage_ResultAccept) { Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr localPlayer = pMinecraft->localplayers[iPad]; + std::shared_ptr localPlayer = pMinecraft->localplayers[iPad]; if(localPlayer != NULL && localPlayer->connection) { - localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); + localPlayer->connection->send( std::shared_ptr( new KickPlayerPacket(smallId) ) ); } // Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game. diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Leaderboards.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Leaderboards.cpp index cf48a57bd..cd402d898 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Leaderboards.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Leaderboards.cpp @@ -548,7 +548,7 @@ void CScene_Leaderboards::ReadStats(int startIndex) else { m_newEntryIndex = (unsigned int)startIndex; - m_newReadSize = min((int)READ_SIZE, (int)m_leaderboard.m_totalEntryCount-(startIndex-1)); + m_newReadSize = std::min((int)READ_SIZE, (int)m_leaderboard.m_totalEntryCount-(startIndex-1)); } //Setup the spec structure for the read request @@ -741,7 +741,7 @@ bool CScene_Leaderboards::RetrieveStats() insertPosition = 0; //Entry count is either max possible entries or current entry count + read size, whichever is smaller - m_leaderboard.m_currentEntryCount = min((int)NUM_ENTRIES, (int)(m_leaderboard.m_currentEntryCount+m_newReadSize)); + m_leaderboard.m_currentEntryCount = std::min((int)NUM_ENTRIES, (int)(m_leaderboard.m_currentEntryCount+m_newReadSize)); } //If the last new entry is at a greater position than the last possible entry else if( m_newEntryIndex+m_newReadSize-1 >= m_leaderboard.m_entryStartIndex+NUM_ENTRIES ) diff --git a/Minecraft.Client/Build/Common/XUI/XUI_MainMenu.cpp b/Minecraft.Client/Build/Common/XUI/XUI_MainMenu.cpp index 278dec9fa..5982f74cd 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_MainMenu.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_MainMenu.cpp @@ -88,7 +88,7 @@ HRESULT CScene_Main::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) InputStreamReader *isr = new InputStreamReader( bais ); BufferedReader *br = new BufferedReader( isr ); - wstring line = L""; + std::wstring line = L""; while ( !(line = br->readLine()).empty() ) { line = trimString( line ); @@ -350,7 +350,7 @@ HRESULT CScene_Main::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& //splashIndex = 197; // Very long string //splashIndex = 296; // Coloured //splashIndex = 297; // Noise - wstring splash = m_splashes.at( splashIndex ); + std::wstring splash = m_splashes.at( splashIndex ); m_Subtitle.SetText(splash.c_str()); m_SubtitleMCFont.SetText(splash.c_str()); @@ -374,7 +374,7 @@ HRESULT CScene_Main::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& float diff = fWidth / (xuiRect.right+5); - diff = min(diff,MAIN_MENU_MAX_TEXT_SCALE); + diff = std::min(diff,MAIN_MENU_MAX_TEXT_SCALE); // Resize XuiElementGetBounds(m_Subtitle,&fWidth, &fHeight); @@ -910,7 +910,7 @@ void CScene_Main::LoadTrial(void) param->saveData = NULL; param->settings = app.GetGameHostOption( eGameHostOption_Tutorial ); - vector *generators = app.getLevelGenerators(); + std::vector *generators = app.getLevelGenerators(); if (generators->empty()) { app.DebugPrintf("XUI LoadTrial: no level generators available, cannot start tutorial\n"); @@ -1239,7 +1239,7 @@ int CScene_Main::TMSReadFileListReturned(void *pParam,int iPad,C4JStorage::PTMSP // push the file details in to a unordered map if they are not already in there // for(int i=0;iiCount;i++) // { -// app.PutTMSPP_FileSize(filenametowstring(pTmsFileList->FileDetailsA[i].szFilename),pTmsFileList->FileDetailsA[i].iFileSize); +// app.PutTMSPP_FileSize(filenametostd::wstring(pTmsFileList->FileDetailsA[i].szFilename),pTmsFileList->FileDetailsA[i].iFileSize); // } return 0; } @@ -1251,7 +1251,7 @@ int CScene_Main::TMSFileWriteReturned(void *pParam,int iPad,int iResult) // push the file details in to a unordered map if they are not already in there // for(int i=0;iiCount;i++) // { - // app.PutTMSPP_FileSize(filenametowstring(pTmsFileList->FileDetailsA[i].szFilename),pTmsFileList->FileDetailsA[i].iFileSize); + // app.PutTMSPP_FileSize(filenametostd::wstring(pTmsFileList->FileDetailsA[i].szFilename),pTmsFileList->FileDetailsA[i].iFileSize); // } return 0; } @@ -1263,7 +1263,7 @@ int CScene_Main::TMSFileReadReturned(void *pParam,int iPad,C4JStorage::PTMSPP_FI // push the file details in to a unordered map if they are not already in there // for(int i=0;iiCount;i++) // { - // app.PutTMSPP_FileSize(filenametowstring(pTmsFileList->FileDetailsA[i].szFilename),pTmsFileList->FileDetailsA[i].iFileSize); + // app.PutTMSPP_FileSize(filenametostd::wstring(pTmsFileList->FileDetailsA[i].szFilename),pTmsFileList->FileDetailsA[i].iFileSize); // } return 0; } diff --git a/Minecraft.Client/Build/Common/XUI/XUI_MainMenu.h b/Minecraft.Client/Build/Common/XUI/XUI_MainMenu.h index 2e4279e42..cc451808b 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_MainMenu.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_MainMenu.h @@ -19,7 +19,7 @@ class CScene_Main : public CXuiSceneImpl { private: static Random *random; - vector m_splashes; + std::vector m_splashes; D3DXVECTOR3 m_vPosExitGame; bool m_bIgnorePress; float m_fSubtitleHeight, m_fSubtitleWidth; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameCreate.cpp index dfa05cba5..f1c66a041 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameCreate.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameCreate.cpp @@ -136,7 +136,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle m_EditWorldName.SetTextLimit(XCONTENT_MAX_DISPLAYNAME_LENGTH); - wstring wWorldName = m_EditWorldName.GetText(); + std::wstring wWorldName = m_EditWorldName.GetText(); // set the caret to the end of the default text m_EditWorldName.SetCaretPosition((int)wWorldName.length()); @@ -627,7 +627,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINot if(hObjSource == m_EditWorldName) { // Enable the done button when we have all of the necessary information - wstring wWorldName = m_EditWorldName.GetText(); + std::wstring wWorldName = m_EditWorldName.GetText(); BOOL bHasWorldName = ( wWorldName.length()!=0); m_NewWorld.SetEnable(bHasWorldName); } @@ -883,7 +883,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw app.ClearTerrainFeaturePosition(); // create the world and launch - wstring wWorldName = pClass->m_EditWorldName.GetText(); + std::wstring wWorldName = pClass->m_EditWorldName.GetText(); StorageManager.ResetSaveData(); // Make our next save default to the name of the level @@ -891,7 +891,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw BOOL bHasSeed = (pClass->m_EditSeed.GetText() != NULL); - wstring wSeed; + std::wstring wSeed; if(bHasSeed) { wSeed=pClass->m_EditSeed.GetText(); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameInfo.h b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameInfo.h index 32a3d095a..d2b9b2446 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameInfo.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameInfo.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include #ifndef __linux__ #include diff --git a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameJoinLoad.cpp index a2237716a..db51dbe22 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -342,7 +342,7 @@ HRESULT CScene_MultiGameJoinLoad::GetSaveInfo( ) for(unsigned int i=0;iat(i)->getName(); + std::wstring wName = m_saves->at(i)->getName(); wchar_t *name = new wchar_t[wName.size()+1]; for(unsigned int j = 0; j < wName.size(); ++j) { @@ -1424,7 +1424,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear { sessionInfo->data = *(GameSessionData *)pxnqi->pbData; - wstring gamerName = convStringToWstring(sessionInfo->data.hostName); + std::wstring gamerName = convStringToWstring(sessionInfo->data.hostName); swprintf(sessionInfo->displayLabel,L"%ls's Game", gamerName.c_str() ); } else @@ -2190,7 +2190,7 @@ void CScene_MultiGameJoinLoad::UploadFile(CScene_MultiGameJoinLoad *pClass, char { File targetFileDir(L"GAME:\\FakeTMSPP"); if(!targetFileDir.exists()) targetFileDir.mkdir(); - string path = string( wstringtofilename( targetFileDir.getPath() ) ).append("\\").append(filename); + std::string path = string( wstringtofilename( targetFileDir.getPath() ) ).append("\\").append(filename); HANDLE hSaveFile = CreateFile( path.c_str(), GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL); DWORD numberOfBytesWritten = 0; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameJoinLoad.h b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameJoinLoad.h index b7d5ddc0f..3c1082afa 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameJoinLoad.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameJoinLoad.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include #include "../Media/xuiscene_multi_joinload.h" #include "XUI_CustomMessages.h" @@ -135,7 +135,7 @@ private: bool m_bIgnoreInput; - vector *m_saves; + std::vector *m_saves; int m_iSaveInfoC; int m_iDefaultButtonsC; @@ -145,14 +145,14 @@ private: bool m_bMultiplayerAllowed; bool m_bKillSaveInfoEnumerate; - vector currentSessions; + std::vector currentSessions; bool m_bReady; bool m_bRetrievingSaveInfo; //bool m_bSaveRenamed; WCHAR m_wchNewName[XCONTENT_MAX_DISPLAYNAME_LENGTH]; unsigned char m_szSeed[50]; - vector *m_generators; + std::vector *m_generators; JoinMenuInitData *m_initData; UINT m_DefaultMinecraftIconSize; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp index 2c164ff37..62ecd1dc8 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp @@ -213,7 +213,7 @@ HRESULT CScene_MultiGameLaunchMoreOptions::OnNotifySetFocus( HXUIOBJ hObjSource, stringId = IDS_GAMEOPTION_RESET_NETHER; } - wstring wsText=app.GetString(stringId); + std::wstring wsText=app.GetString(stringId); int size = 14; if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { diff --git a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameLaunchMoreOptions.h b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameLaunchMoreOptions.h index 1e5ebd029..cdf17bd45 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_MultiGameLaunchMoreOptions.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_MultiGameLaunchMoreOptions.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../Media/xuiscene_multi_launch_more_options.h" class CScene_MultiGameLaunchMoreOptions : public CXuiSceneImpl diff --git a/Minecraft.Client/Build/Common/XUI/XUI_NewUpdateMessage.cpp b/Minecraft.Client/Build/Common/XUI/XUI_NewUpdateMessage.cpp index 41ac335d2..31d94b0e1 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_NewUpdateMessage.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_NewUpdateMessage.cpp @@ -17,11 +17,11 @@ HRESULT CScene_NewUpdateMessage::OnInit( XUIMessageInit* pInitData, BOOL& bHandl // set the text in the XuiHTMLMessage wchar_t formatting[40]; - wstring wstrTemp = app.GetString(IDS_TITLEUPDATE); + std::wstring wstrTemp = app.GetString(IDS_TITLEUPDATE); swprintf(formatting, 40, L"", m_bIsSD?12:14); wstrTemp = formatting + wstrTemp; - wstring wsText=app.FormatHTMLString(m_iPad,wstrTemp); + std::wstring wsText=app.FormatHTMLString(m_iPad,wstrTemp); m_HTMLText.SetText(wsText.c_str()); m_HTMLText.SetShow(TRUE); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_PartnernetPassword.cpp b/Minecraft.Client/Build/Common/XUI/XUI_PartnernetPassword.cpp index a320fdf49..8d6fa1eb8 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_PartnernetPassword.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_PartnernetPassword.cpp @@ -37,7 +37,7 @@ HRESULT CScene_PartnernetPassword::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotif if(hObjPressed==m_OK) { // create the world and launch - wstring wPassword = m_PartnernetPassword.GetText(); + std::wstring wPassword = m_PartnernetPassword.GetText(); if(wPassword==L"5183") { app.NavigateBack(pNotifyPressData->UserIndex); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_AbstractContainer.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Scene_AbstractContainer.cpp index 9c75520e9..1542df707 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_AbstractContainer.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_AbstractContainer.cpp @@ -306,7 +306,7 @@ void CXuiSceneAbstractContainer::GetItemScreenData( ESceneSection eSection, int } } -shared_ptr CXuiSceneAbstractContainer::getSlotItem(ESceneSection eSection, int iSlot) +std::shared_ptr CXuiSceneAbstractContainer::getSlotItem(ESceneSection eSection, int iSlot) { CXuiCtrlSlotItemListItem* pCXuiCtrlSlotItem; GetSectionSlotList( eSection )->GetCXuiCtrlSlotItem( iSlot, &( pCXuiCtrlSlotItem ) ); @@ -377,7 +377,7 @@ void CXuiSceneAbstractContainer::setFocusToPointer(int iPad) m_pointerControl->SetFocus( iPad ); } -void CXuiSceneAbstractContainer::SetPointerText(const wstring &description, vector &unformattedStrings, bool newSlot) +void CXuiSceneAbstractContainer::SetPointerText(const std::wstring &description, std::vector &unformattedStrings, bool newSlot) { if(description.empty()) { @@ -388,7 +388,7 @@ void CXuiSceneAbstractContainer::SetPointerText(const wstring &description, vect } bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()); - wstring desc = L"(smallPointer ? 12 :14) + L"\">" + description + L""; + std::wstring desc = L"(smallPointer ? 12 :14) + L"\">" + description + L""; XUIRect tempXuiRect, xuiRect; HRESULT hr; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_AbstractContainer.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_AbstractContainer.h index 6311032ee..11aa15786 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_AbstractContainer.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_AbstractContainer.h @@ -76,8 +76,8 @@ public: virtual void setSectionFocus(ESceneSection eSection, int iPad); void setSectionSelectedSlot(ESceneSection eSection, int x, int y); void setFocusToPointer(int iPad); - void SetPointerText(const wstring &description, vector &unformattedStrings, bool newSlot); - virtual shared_ptr getSlotItem(ESceneSection eSection, int iSlot); + void SetPointerText(const std::wstring &description, std::vector &unformattedStrings, bool newSlot); + virtual std::shared_ptr getSlotItem(ESceneSection eSection, int iSlot); virtual bool isSlotEmpty(ESceneSection eSection, int iSlot); virtual void adjustPointerForSafeZone(); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Anvil.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Anvil.cpp index 8f06d3119..8d585eab5 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Anvil.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Anvil.cpp @@ -83,23 +83,23 @@ HRESULT CXuiSceneAnvil::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValue { if(hObjSource == m_editName) { - wstring newValue = m_editName.GetText(); + std::wstring newValue = m_editName.GetText(); LPCWSTR szText=newValue.c_str(); stripWhitespaceForHtml(newValue); // strip leading spaces - wstring b; + std::wstring b; int start = (int)newValue.find_first_not_of(L" "); int end = (int)newValue.find_last_not_of(L" "); - if( start == wstring::npos ) + if( start == std::wstring::npos ) { // the string is all space newValue=L""; } else { - if( end == wstring::npos ) end = (int)newValue.size()-1; + if( end == std::wstring::npos ) end = (int)newValue.size()-1; b = newValue.substr(start,(end-start)+1); newValue=b; } @@ -209,9 +209,9 @@ void CXuiSceneAnvil::handleEditNamePressed() //m_editName.RequestKeyboard(m_iPad); } -void CXuiSceneAnvil::setEditNameValue(const wstring &name) +void CXuiSceneAnvil::setEditNameValue(const std::wstring &name) { - wstring parsedName = parseXMLSpecials(name); + std::wstring parsedName = parseXMLSpecials(name); m_editName.SetText(parsedName.c_str()); m_editName.SetCaretPosition(parsedName.length()); } @@ -220,7 +220,7 @@ void CXuiSceneAnvil::setEditNameEditable(bool enabled) { } -void CXuiSceneAnvil::setCostLabel(const wstring &label, bool canAfford) +void CXuiSceneAnvil::setCostLabel(const std::wstring &label, bool canAfford) { if(canAfford) { diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Anvil.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Anvil.h index 0aaa1764a..b62d1edb9 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Anvil.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Anvil.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../Media/xuiscene_anvil.h" #include "XUI_Scene_AbstractContainer.h" #include "../UI/IUIScene_AnvilMenu.h" @@ -81,8 +81,8 @@ private: protected: virtual void handleEditNamePressed(); - virtual void setEditNameValue(const wstring &name); + virtual void setEditNameValue(const std::wstring &name); virtual void setEditNameEditable(bool enabled); - virtual void setCostLabel(const wstring &label, bool canAfford); + virtual void setCostLabel(const std::wstring &label, bool canAfford); virtual void showCross(bool show); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Base.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Base.cpp index a8e63aab6..fadfc3849 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Base.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Base.cpp @@ -215,7 +215,7 @@ void CXuiSceneBase::_TickAllBaseScenes() } else { - shared_ptr boss = EnderDragonRenderer::bossInstance; + std::shared_ptr boss = EnderDragonRenderer::bossInstance; EnderDragonRenderer::bossInstance = nullptr; m_ticksWithNoBoss = 0; @@ -1609,7 +1609,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay ) { if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL) { - wstring wsGamertag = convStringToWstring( ProfileManager.GetGamertag(iPad)); + std::wstring wsGamertag = convStringToWstring( ProfileManager.GetGamertag(iPad)); XuiControlSetText(m_hGamerTagA[iPad],wsGamertag.c_str()); } @@ -1666,7 +1666,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay ) return S_OK; } -void CXuiSceneBase::_SetSelectedItem( unsigned int iPad, const wstring& name) +void CXuiSceneBase::_SetSelectedItem( unsigned int iPad, const std::wstring& name) { if(app.GetGameSettings(eGameSetting_Hints) == 0 || name.empty()) { @@ -2217,7 +2217,7 @@ HRESULT CXuiSceneBase::DisplayGamertag( unsigned int iPad, BOOL bDisplay ) return S_OK; } -void CXuiSceneBase::SetSelectedItem( unsigned int iPad, const wstring &name) +void CXuiSceneBase::SetSelectedItem( unsigned int iPad, const std::wstring &name) { CXuiSceneBase::Instance->_SetSelectedItem(iPad,name); } diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Base.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Base.h index a9aaa445a..3c3115e92 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Base.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Base.h @@ -364,7 +364,7 @@ private: HRESULT _PlayUISFX(ESoundEffect eSound); void _SetEmptyQuadrantLogo(int iPad,EBaseScenePosition ePos); HRESULT _DisplayGamertag( unsigned int iPad, BOOL bDisplay ); - void _SetSelectedItem( unsigned int iPad, const wstring& name); + void _SetSelectedItem( unsigned int iPad, const std::wstring& name); void _HideAllGameUIElements(); bool _GetBaseSceneSafeZone( unsigned int iPad, D3DXVECTOR2 &origin, float &width, float &height); @@ -420,7 +420,7 @@ public: static HRESULT PlayUISFX(ESoundEffect eSound); static void SetEmptyQuadrantLogo(int iSection); static HRESULT DisplayGamertag( unsigned int iPad, BOOL bDisplay ); - static void SetSelectedItem( unsigned int iPad, const wstring &name); + static void SetSelectedItem( unsigned int iPad, const std::wstring &name); static void HideAllGameUIElements(); // Returns details on the fully transformed (ie screen space) base scene position, adjusted for safe zones diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_BrewingStand.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_BrewingStand.h index 96b414650..b089f2af9 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_BrewingStand.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_BrewingStand.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../Media/xuiscene_brewingstand.h" #include "XUI_Scene_AbstractContainer.h" #include "../UI/IUIScene_BrewingMenu.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Container.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Container.cpp index 3e4a6f72b..4a94a17a3 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Container.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Container.cpp @@ -35,7 +35,7 @@ HRESULT CXuiSceneContainer::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) ContainerMenu* menu = new ContainerMenu( initData->inventory, initData->container ); - shared_ptr container = initData->container; + std::shared_ptr container = initData->container; m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_CraftingPanel.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Scene_CraftingPanel.cpp index 505b24aba..c53e5272f 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_CraftingPanel.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_CraftingPanel.cpp @@ -417,21 +417,21 @@ void CXuiSceneCraftingPanel::hideAllIngredientsSlots() } } -void CXuiSceneCraftingPanel::setCraftHSlotItem(int iPad, int iIndex, shared_ptr item, unsigned int uiAlpha) +void CXuiSceneCraftingPanel::setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr item, unsigned int uiAlpha) { m_pHSlotsBrushImageControl[iIndex]->SetIcon(iPad, item, 9, uiAlpha, false); //m_pHSlotsBrushImageControl[iIndex]->SetPassThroughDataAssociation(MAKE_SLOTDISPLAY_ITEM_BITMASK(item->id,item->getAuxValue(),item->isFoil()),MAKE_SLOTDISPLAY_DATA_BITMASK (iPad, uiAlpha, false, item->GetCount(), 9,0) ); //m_pHSlotsBrushImageControl[iIndex]->SetShow(TRUE); } -void CXuiSceneCraftingPanel::setCraftVSlotItem(int iPad, int iIndex, shared_ptr item, unsigned int uiAlpha) +void CXuiSceneCraftingPanel::setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr item, unsigned int uiAlpha) { m_pVSlotsBrushImageControl[iIndex]->SetIcon(iPad, item, 9, uiAlpha, false); //m_pVSlotsBrushImageControl[iIndex]->SetPassThroughDataAssociation(MAKE_SLOTDISPLAY_ITEM_BITMASK(item->id,item->getAuxValue(),item->isFoil()),MAKE_SLOTDISPLAY_DATA_BITMASK (iPad, uiAlpha, false, item->GetCount(), 9,0) ); //m_pVSlotsBrushImageControl[iIndex]->SetShow(TRUE); } -void CXuiSceneCraftingPanel::setCraftingOutputSlotItem(int iPad, shared_ptr item) +void CXuiSceneCraftingPanel::setCraftingOutputSlotItem(int iPad, std::shared_ptr item) { if(item == NULL) { @@ -448,7 +448,7 @@ void CXuiSceneCraftingPanel::setCraftingOutputSlotRedBox(bool show) m_pCraftingOutput->SetRedBox(show?TRUE:FALSE); } -void CXuiSceneCraftingPanel::setIngredientSlotItem(int iPad, int index, shared_ptr item) +void CXuiSceneCraftingPanel::setIngredientSlotItem(int iPad, int index, std::shared_ptr item) { if(item == NULL) { @@ -465,7 +465,7 @@ void CXuiSceneCraftingPanel::setIngredientSlotRedBox(int index, bool show) m_pCraftingIngredientA[index]->SetRedBox(show?TRUE:FALSE); } -void CXuiSceneCraftingPanel::setIngredientDescriptionItem(int iPad, int index, shared_ptr item) +void CXuiSceneCraftingPanel::setIngredientDescriptionItem(int iPad, int index, std::shared_ptr item) { m_pCraftIngredientDescA[index]->SetIcon(iPad, item->id,item->getAuxValue(),item->GetCount(),8,31,TRUE,item->isFoil(),FALSE); } diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_CraftingPanel.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_CraftingPanel.h index 5eec55653..ff93c0a42 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_CraftingPanel.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_CraftingPanel.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../media/xuiscene_craftingpanel_2x2.h" #include "XUI_Ctrl_MinecraftSlot.h" @@ -182,13 +182,13 @@ protected: virtual void hideAllHSlots(); virtual void hideAllVSlots(); virtual void hideAllIngredientsSlots(); - virtual void setCraftHSlotItem(int iPad, int iIndex, shared_ptr item, unsigned int uiAlpha); - virtual void setCraftVSlotItem(int iPad, int iIndex, shared_ptr item, unsigned int uiAlpha); - virtual void setCraftingOutputSlotItem(int iPad, shared_ptr item); + virtual void setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr item, unsigned int uiAlpha); + virtual void setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr item, unsigned int uiAlpha); + virtual void setCraftingOutputSlotItem(int iPad, std::shared_ptr item); virtual void setCraftingOutputSlotRedBox(bool show); - virtual void setIngredientSlotItem(int iPad, int index, shared_ptr item); + virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr item); virtual void setIngredientSlotRedBox(int index, bool show); - virtual void setIngredientDescriptionItem(int iPad, int index, shared_ptr item); + virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr item); virtual void setIngredientDescriptionRedBox(int index, bool show); virtual void setIngredientDescriptionText(int index, LPCWSTR text); virtual void setShowCraftHSlot(int iIndex, bool show); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Enchant.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Enchant.h index 038f5dd0f..8bc0dfdf1 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Enchant.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Enchant.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../Media/xuiscene_enchant.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Furnace.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Furnace.h index 8c965e8bf..6c0930d12 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Furnace.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Furnace.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../Media/xuiscene_furnace.h" #include "XUI_Scene_AbstractContainer.h" #include "../UI/IUIScene_FurnaceMenu.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory.cpp index debbdd2c2..702ce9f54 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory.cpp @@ -154,11 +154,11 @@ void CXuiSceneInventory::updateEffectsDisplay() { // Update with the current effects Minecraft *pMinecraft = Minecraft::GetInstance(); - shared_ptr player = pMinecraft->localplayers[m_iPad]; + std::shared_ptr player = pMinecraft->localplayers[m_iPad]; if(player == NULL) return; - vector *activeEffects = player->getActiveEffects(); + std::vector *activeEffects = player->getActiveEffects(); // Work out how to arrange the effects int effectCount = (int)activeEffects->size(); @@ -194,10 +194,10 @@ void CXuiSceneInventory::updateEffectsDisplay() m_hEffectDisplayA[i]->setIcon(mobEffect->getIcon()); } - wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim(); + std::wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim(); if (effect->getAmplifier() > 0) { - wstring potencyString = L""; + std::wstring potencyString = L""; switch(effect->getAmplifier()) { case 1: @@ -220,7 +220,7 @@ void CXuiSceneInventory::updateEffectsDisplay() } m_hEffectDisplayA[i]->setName(effectString); - wstring durationString = MobEffect::formatDuration(effect); + std::wstring durationString = MobEffect::formatDuration(effect); m_hEffectDisplayA[i]->setDuration(durationString); ++it; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory.h index 6cccad7fa..9fb452b47 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../Media/xuiscene_inventory.h" #include "XUI_Scene_AbstractContainer.h" #include "XUI_CustomMessages.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory_Creative.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory_Creative.cpp index 7b29096f7..f6038cbae 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory_Creative.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory_Creative.cpp @@ -60,7 +60,7 @@ HRESULT CXuiSceneInventoryCreative::OnInit( XUIMessageInit *pInitData, BOOL &bHa initData->player->awardStat(GenericStats::openInventory(), GenericStats::param_noArgs()); // 4J JEV - Item Picker Menu - shared_ptr creativeContainer = shared_ptr(new SimpleContainer( 0, TabSpec::MAX_SIZE + 9 )); + std::shared_ptr creativeContainer = std::shared_ptr(new SimpleContainer( 0, TabSpec::MAX_SIZE + 9 )); itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory); // 4J JEV - InitDataAssociations. @@ -176,7 +176,7 @@ void CXuiSceneInventoryCreative::updateTabHighlightAndText(ECreativeInventoryTab } m_hTabGroupA[tab].SetShow(TRUE); - wstring wsText=app.GetString(specs[tab]->m_descriptionId); + std::wstring wsText=app.GetString(specs[tab]->m_descriptionId); m_GroupDescription.SetText(wsText.c_str()); m_GroupDescription.SetShow(TRUE); } diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory_Creative.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory_Creative.h index d8e2f5733..60fc45ed5 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory_Creative.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Inventory_Creative.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../Media/xuiscene_inventory_creative.h" #include "XUI_Scene_AbstractContainer.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trading.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trading.cpp index 0b863e4a2..192b04fef 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trading.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trading.cpp @@ -215,17 +215,17 @@ void CXuiSceneTrading::moveSelector(bool right) m_tradingSelector.SetPosition(&vec); } -void CXuiSceneTrading::setTitle(const wstring &name) +void CXuiSceneTrading::setTitle(const std::wstring &name) { XuiControlSetText(m_villagerText,name.c_str()); } -void CXuiSceneTrading::setRequest1Name(const wstring &name) +void CXuiSceneTrading::setRequest1Name(const std::wstring &name) { m_request1Label.SetText(name.c_str()); } -void CXuiSceneTrading::setRequest2Name(const wstring &name) +void CXuiSceneTrading::setRequest2Name(const std::wstring &name) { m_request2Label.SetText(name.c_str()); } @@ -245,22 +245,22 @@ void CXuiSceneTrading::setTradeRedBox(int index, bool show) m_tradeHSlots[index]->SetRedBox(show?TRUE:FALSE); } -void CXuiSceneTrading::setRequest1Item(shared_ptr item) +void CXuiSceneTrading::setRequest1Item(std::shared_ptr item) { m_request1Control->SetIcon(getPad(), item, 12, 31, true); } -void CXuiSceneTrading::setRequest2Item(shared_ptr item) +void CXuiSceneTrading::setRequest2Item(std::shared_ptr item) { m_request2Control->SetIcon(getPad(), item, 12, 31, true); } -void CXuiSceneTrading::setTradeItem(int index, shared_ptr item) +void CXuiSceneTrading::setTradeItem(int index, std::shared_ptr item) { m_tradeHSlots[index]->SetIcon(getPad(), item, 12, 31, true); } -void CXuiSceneTrading::setOfferDescription(const wstring &name, vector &unformattedStrings) +void CXuiSceneTrading::setOfferDescription(const std::wstring &name, std::vector &unformattedStrings) { if(name.empty()) { @@ -270,7 +270,7 @@ void CXuiSceneTrading::setOfferDescription(const wstring &name, vector } bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()); - wstring desc = L"(smallPointer ? 12 :14) + L"\">" + name + L""; + std::wstring desc = L"(smallPointer ? 12 :14) + L"\">" + name + L""; XUIRect tempXuiRect, xuiRect; HRESULT hr; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trading.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trading.h index 5916f713c..fe6022951 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trading.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trading.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../Media/xuiscene_trading.h" #include "../UI/IUIScene_TradingMenu.h" @@ -112,17 +112,17 @@ protected: virtual void showScrollRightArrow(bool show); virtual void showScrollLeftArrow(bool show); virtual void moveSelector(bool right); - virtual void setRequest1Name(const wstring &name); - virtual void setRequest2Name(const wstring &name); - virtual void setTitle(const wstring &name); + virtual void setRequest1Name(const std::wstring &name); + virtual void setRequest2Name(const std::wstring &name); + virtual void setTitle(const std::wstring &name); virtual void setRequest1RedBox(bool show); virtual void setRequest2RedBox(bool show); virtual void setTradeRedBox(int index, bool show); - virtual void setRequest1Item(shared_ptr item); - virtual void setRequest2Item(shared_ptr item); - virtual void setTradeItem(int index, shared_ptr item); + virtual void setRequest1Item(std::shared_ptr item); + virtual void setRequest2Item(std::shared_ptr item); + virtual void setTradeItem(int index, std::shared_ptr item); - virtual void setOfferDescription(const wstring &name, vector &unformattedStrings); + virtual void setOfferDescription(const std::wstring &name, std::vector &unformattedStrings); }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trap.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trap.h index 233825afc..9a6119f1a 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trap.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Trap.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../Media/xuiscene_trap.h" #include "XUI_Scene_AbstractContainer.h" #include "../UI/IUIScene_DispenserMenu.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Win.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Win.cpp index 1235c13e8..0144074bb 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Win.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Win.cpp @@ -30,7 +30,7 @@ HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) // Display the tooltips ui.SetTooltips( m_iPad, -1, IDS_TOOLTIPS_CONTINUE); - wstring halfScreenLineBreaks; + std::wstring halfScreenLineBreaks; if(RenderManager.IsHiDef()) { @@ -81,7 +81,7 @@ HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) m_htmlControl.SetText(noiseString.c_str()); - //wstring result = m_htmlControl.GetText(); + //std::wstring result = m_htmlControl.GetText(); //wcout << result.c_str(); @@ -197,13 +197,13 @@ void CScene_Win::updateNoise() int length = 0; wchar_t replacements[64]; - wstring replaceString = L""; + std::wstring replaceString = L""; wchar_t randomChar = L'a'; Random *random = pMinecraft->font->random; bool darken = false; - wstring tag = L"{*NOISE*}"; + std::wstring tag = L"{*NOISE*}"; AUTO_VAR(it, m_noiseLengths.begin()); int found=(int)noiseString.find_first_of(L"{"); @@ -217,7 +217,7 @@ void CScene_Win::updateNoise() { randomChar = SharedConstants::acceptableLetters[random->nextInt((int)SharedConstants::acceptableLetters.length())]; - wstring randomCharStr = L""; + std::wstring randomCharStr = L""; randomCharStr.push_back(randomChar); if(randomChar == L'<') { diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Win.h b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Win.h index 7a5e9da09..a498cd316 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Scene_Win.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Scene_Win.h @@ -44,11 +44,11 @@ private: bool m_bIgnoreInput; int m_iPad; D3DXVECTOR3 m_OriginalPosition; - wstring noNoiseString; - wstring noiseString; + std::wstring noNoiseString; + std::wstring noiseString; int m_scrollDir; - vector m_noiseLengths; + std::vector m_noiseLengths; void updateNoise(); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_SettingsOptions.cpp b/Minecraft.Client/Build/Common/XUI/XUI_SettingsOptions.cpp index b9ae1f973..758eef3d9 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_SettingsOptions.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_SettingsOptions.cpp @@ -80,7 +80,7 @@ HRESULT CScene_SettingsOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandle m_SliderA[SLIDER_SETTINGS_DIFFICULTY].SetText(TempString); - wstring wsText=app.GetString(m_iDifficultySettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]); + std::wstring wsText=app.GetString(m_iDifficultySettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]); int size = 14; if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { @@ -138,7 +138,7 @@ HRESULT CScene_SettingsOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandle } else { - wstring wsText=app.GetString(m_iDifficultySettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]); + std::wstring wsText=app.GetString(m_iDifficultySettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]); int size = 14; if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { @@ -284,7 +284,7 @@ HRESULT CScene_SettingsOptions::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue])); m_SliderA[SLIDER_SETTINGS_DIFFICULTY].SetText(TempString); - wstring wsText=app.GetString(m_iDifficultySettingA[pNotifyValueChanged->nValue]); + std::wstring wsText=app.GetString(m_iDifficultySettingA[pNotifyValueChanged->nValue]); int size = 14; if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { diff --git a/Minecraft.Client/Build/Common/XUI/XUI_SignEntry.cpp b/Minecraft.Client/Build/Common/XUI/XUI_SignEntry.cpp index 5a7e9cde2..f84e4281d 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_SignEntry.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_SignEntry.cpp @@ -64,7 +64,7 @@ HRESULT CScene_SignEntry::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* p // Set the sign text here so we on;y call the verify once it has been set, not while we're typing in to it for(int i=0;i<4;i++) { - wstring temp=m_signRows[i].GetText(); + std::wstring temp=m_signRows[i].GetText(); m_sign->SetMessage(i,temp); } @@ -74,10 +74,10 @@ HRESULT CScene_SignEntry::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* p // need to send the new data if (pMinecraft->level->isClientSide) { - shared_ptr player = pMinecraft->localplayers[pNotifyPressData->UserIndex]; + std::shared_ptr player = pMinecraft->localplayers[pNotifyPressData->UserIndex]; if(player != NULL && player->connection && player->connection->isStarted()) { - player->connection->send( shared_ptr( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) ); + player->connection->send( std::shared_ptr( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) ); } } app.CloseXuiScenes(pNotifyPressData->UserIndex); @@ -94,7 +94,7 @@ HRESULT CScene_SignEntry::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled case VK_PAD_B: case VK_ESCAPE: // user backed out, so wipe the sign - wstring temp=L""; + std::wstring temp=L""; for(int i=0;i<4;i++) { diff --git a/Minecraft.Client/Build/Common/XUI/XUI_SignEntry.h b/Minecraft.Client/Build/Common/XUI/XUI_SignEntry.h index 4f8c44d26..c8d5aae28 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_SignEntry.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_SignEntry.h @@ -43,7 +43,7 @@ public: XUI_IMPLEMENT_CLASS( CScene_SignEntry, L"CScene_SignEntry", XUI_CLASS_SCENE ) private: - shared_ptr m_sign; + std::shared_ptr m_sign; D3DXVECTOR3 m_OriginalPosition; }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/XUI/XUI_SkinSelect.cpp b/Minecraft.Client/Build/Common/XUI/XUI_SkinSelect.cpp index d3275680e..9114b553f 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_SkinSelect.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_SkinSelect.cpp @@ -622,8 +622,8 @@ void CScene_SkinSelect::handleSkinIndexChanged() { BOOL showPrevious = FALSE, showNext = FALSE; DWORD previousIndex = 0, nextIndex = 0; - wstring skinName = L""; - wstring skinOrigin = L""; + std::wstring skinName = L""; + std::wstring skinOrigin = L""; bool bSkinIsFree=false; bool bLicensed=false; DLCSkinFile *skinFile=NULL; @@ -752,7 +752,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() if(m_vAdditionalSkinBoxes && m_vAdditionalSkinBoxes->size()!=0) { // add the boxes to the humanoid model, but only if we've not done this already - vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); + std::vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),m_vAdditionalSkinBoxes); @@ -772,9 +772,9 @@ void CScene_SkinSelect::handleSkinIndexChanged() nextIndex = getNextSkinIndex(m_skinIndex); previousIndex = getPreviousSkinIndex(m_skinIndex); - wstring otherSkinPath = L""; - wstring otherCapePath = L""; - vector *othervAdditionalSkinBoxes=NULL; + std::wstring otherSkinPath = L""; + std::wstring otherCapePath = L""; + std::vector *othervAdditionalSkinBoxes=NULL; wchar_t chars[256]; // turn off all displays @@ -866,7 +866,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() } if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { - vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); + std::vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); @@ -938,7 +938,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() } if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { - vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); + std::vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_SkinSelect.h b/Minecraft.Client/Build/Common/XUI/XUI_SkinSelect.h index 4c2e062ad..9b1f41d04 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_SkinSelect.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_SkinSelect.h @@ -109,9 +109,9 @@ protected: int m_iPad; D3DXVECTOR3 m_OriginalPosition; - wstring m_currentSkinPath, m_selectedSkinPath, m_selectedCapePath; - vector *m_vAdditionalSkinBoxes; - //vector *m_vAdditionalModelParts; + std::wstring m_currentSkinPath, m_selectedSkinPath, m_selectedCapePath; + std::vector *m_vAdditionalSkinBoxes; + //std::vector *m_vAdditionalModelParts; DWORD m_originalSkinId; DLCPack *m_currentPack; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_SocialPost.cpp b/Minecraft.Client/Build/Common/XUI/XUI_SocialPost.cpp index 1a0214cac..73730e98a 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_SocialPost.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_SocialPost.cpp @@ -44,8 +44,8 @@ HRESULT CScene_SocialPost::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) m_EditCaption.SetTitleAndText(IDS_NAME_CAPTION,IDS_NAME_CAPTION_TEXT); m_EditDesc.SetTitleAndText(IDS_NAME_DESC,IDS_NAME_DESC_TEXT); - wstring wCaption = m_EditCaption.GetText(); - wstring wDesc = m_EditDesc.GetText(); + std::wstring wCaption = m_EditCaption.GetText(); + std::wstring wDesc = m_EditDesc.GetText(); // set the caret to the end of the default text m_EditCaption.SetCaretPosition((int)wCaption.length()); @@ -67,16 +67,16 @@ HRESULT CScene_SocialPost::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) HRESULT CScene_SocialPost::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValueChanged* pValueChangedData, BOOL& rfHandled) -{ wstring wCaption = m_EditCaption.GetText(); -wstring wDesc = m_EditDesc.GetText(); +{ std::wstring wCaption = m_EditCaption.GetText(); +std::wstring wDesc = m_EditDesc.GetText(); if(/*(hObjSource == m_EditTitle) || */(hObjSource == m_EditCaption) || (hObjSource == m_EditDesc)) { // Enable the done button when we have all of the necessary information - //wstring wTitle = m_EditTitle.GetText(); - wstring wCaption = m_EditCaption.GetText(); - wstring wDesc = m_EditDesc.GetText(); + //std::wstring wTitle = m_EditTitle.GetText(); + std::wstring wCaption = m_EditCaption.GetText(); + std::wstring wDesc = m_EditDesc.GetText(); BOOL bHasAllText = /*( wTitle.length()!=0) &&*/ (wCaption.length()!=0) && (wDesc.length()!=0); m_OK.SetEnable(bHasAllText); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_SocialPost.h b/Minecraft.Client/Build/Common/XUI/XUI_SocialPost.h index 5d39e41eb..24b6f7e6d 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_SocialPost.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_SocialPost.h @@ -13,7 +13,7 @@ class CScene_SocialPost : public CXuiSceneImpl CXuiCtrl4JEdit m_EditCaption; CXuiCtrl4JEdit m_EditDesc; CXuiControl m_text, m_LabelCaption, m_LabelDescription; - wstring m_wTitle; + std::wstring m_wTitle; // Message map. Here we tie messages to message handlers. XUI_BEGIN_MSG_MAP() diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Teleport.cpp b/Minecraft.Client/Build/Common/XUI/XUI_Teleport.cpp index 40e1384cf..9b7c445e5 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Teleport.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_Teleport.cpp @@ -108,7 +108,7 @@ HRESULT CScene_Teleport::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pN INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId( m_players[ playersList.GetCurSel() ] ); INetworkPlayer *thisPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(m_iPad); - shared_ptr packet; + std::shared_ptr packet; if(m_teleportToPlayer) { packet = TeleportCommand::preparePacket(thisPlayer->GetUID(),selectedPlayer->GetUID()); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_Teleport.h b/Minecraft.Client/Build/Common/XUI/XUI_Teleport.h index cf60eab0d..49543af61 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_Teleport.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_Teleport.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; #include "../media/xuiscene_teleportmenu.h" #include "XUI_CustomMessages.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_TextEntry.cpp b/Minecraft.Client/Build/Common/XUI/XUI_TextEntry.cpp index 6a7caeb0c..4c4c763fc 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_TextEntry.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_TextEntry.cpp @@ -56,7 +56,7 @@ HRESULT CScene_TextEntry::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyVal if(pText) { - wstring wText = pText; + std::wstring wText = pText; InterpretString(wText); } @@ -80,7 +80,7 @@ HRESULT CScene_TextEntry::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled if(pText) { - wstring wText = pText; + std::wstring wText = pText; InterpretString(wText); } @@ -99,9 +99,9 @@ HRESULT CScene_TextEntry::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled return S_OK; } -HRESULT CScene_TextEntry::InterpretString(wstring &wsText) +HRESULT CScene_TextEntry::InterpretString(std::wstring &wsText) { - wstring wsFormat; + std::wstring wsFormat; WCHAR wchCommand[40]; int iCommand=-1; WCHAR wchSep[2]; @@ -158,7 +158,7 @@ HRESULT CScene_TextEntry::InterpretString(wstring &wsText) app.DebugPrintf("eCommand_Give, item=%d count=%d\n",iItem,iCount); Minecraft *pMinecraft=Minecraft::GetInstance(); for(int i=0;ilocalplayers[m_iPad]->drop(); // shared_ptr(new ItemInstance( iItem, 1, 0 )) ); + pMinecraft->localplayers[m_iPad]->drop(); // std::shared_ptr(new ItemInstance( iItem, 1, 0 )) ); } break; diff --git a/Minecraft.Client/Build/Common/XUI/XUI_TextEntry.h b/Minecraft.Client/Build/Common/XUI/XUI_TextEntry.h index 884ec678e..f7a865234 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_TextEntry.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_TextEntry.h @@ -48,7 +48,7 @@ protected: HRESULT OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValueChanged* pValueChangedData, BOOL& rfHandled); HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled); - HRESULT InterpretString(wstring &wsText); + HRESULT InterpretString(std::wstring &wsText); HRESULT Init_Commands(); public: @@ -60,5 +60,5 @@ private: int m_iPad; WCHAR m_wchInitialChar; static CommandParams CommandA[eCommand_MAX]; - unordered_map m_CommandSet; + std::unordered_map m_CommandSet; }; \ No newline at end of file diff --git a/Minecraft.Client/Build/Common/XUI/XUI_TransferToXboxOne.h b/Minecraft.Client/Build/Common/XUI/XUI_TransferToXboxOne.h index dc80495cf..300d187c2 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_TransferToXboxOne.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_TransferToXboxOne.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; +//using namespace std; //#include #include "../Media/xuiscene_TransferToXboxOne.h" diff --git a/Minecraft.Client/Build/Common/XUI/XUI_TutorialPopup.cpp b/Minecraft.Client/Build/Common/XUI/XUI_TutorialPopup.cpp index 7a0926d0c..68e74ade1 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_TutorialPopup.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_TutorialPopup.cpp @@ -171,7 +171,7 @@ HRESULT CScene_TutorialPopup::_SetDescription(CXuiScene *interactScene, LPCWSTR if(isReminder) { - wstring text(app.GetString( IDS_TUTORIAL_REMINDER )); + std::wstring text(app.GetString( IDS_TUTORIAL_REMINDER )); text.append( desc ); // set the text colour wchar_t formatting[40]; @@ -182,7 +182,7 @@ HRESULT CScene_TutorialPopup::_SetDescription(CXuiScene *interactScene, LPCWSTR } else { - wstring text(desc); + std::wstring text(desc); // set the text colour wchar_t formatting[40]; swprintf(formatting, 40, L"",app.GetHTMLColour(eHTMLColor_White),m_textFontSize); @@ -264,7 +264,7 @@ HRESULT CScene_TutorialPopup::SetDescription(int iPad, TutorialPopupInfo *info) if (FAILED(hr)) return hr; - wstring parsed = pThis->_SetIcon(info->icon, info->iAuxVal, info->isFoil, info->desc); + std::wstring parsed = pThis->_SetIcon(info->icon, info->iAuxVal, info->isFoil, info->desc); parsed = pThis->_SetImage( parsed ); parsed = CScene_TutorialPopup::ParseDescription(iPad, parsed); if(parsed.empty()) @@ -280,24 +280,24 @@ HRESULT CScene_TutorialPopup::SetDescription(int iPad, TutorialPopupInfo *info) return hr; } -wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc) +std::wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc) { - wstring temp(desc); + std::wstring temp(desc); BOOL iconShowAtStart = m_pCraftingPic->IsShown(); if( icon != TUTORIAL_NO_ICON ) { bool itemIsFoil = false; - itemIsFoil = (shared_ptr(new ItemInstance(icon,1,iAuxVal)))->isFoil(); + itemIsFoil = (std::shared_ptr(new ItemInstance(icon,1,iAuxVal)))->isFoil(); if(!itemIsFoil) itemIsFoil = isFoil; m_pCraftingPic->SetIcon(m_iPad, icon,iAuxVal,1,10,31,false,itemIsFoil); } else { - wstring openTag(L"{*ICON*}"); - wstring closeTag(L"{*/ICON*}"); + std::wstring openTag(L"{*ICON*}"); + std::wstring closeTag(L"{*/ICON*}"); int iconTagStartPos = (int)temp.find(openTag); int iconStartPos = iconTagStartPos + (int)openTag.length(); if( iconTagStartPos > 0 && iconStartPos < (int)temp.length() ) @@ -306,9 +306,9 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS if(iconEndPos > iconStartPos && iconEndPos < (int)temp.length() ) { - wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos); + std::wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos); - vector idAndAux = stringSplit(id,L':'); + std::vector idAndAux = stringSplit(id,L':'); int iconId = _fromString(idAndAux[0]); @@ -322,7 +322,7 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS } bool itemIsFoil = false; - itemIsFoil = (shared_ptr(new ItemInstance(iconId,1,iAuxVal)))->isFoil(); + itemIsFoil = (std::shared_ptr(new ItemInstance(iconId,1,iAuxVal)))->isFoil(); if(!itemIsFoil) itemIsFoil = isFoil; m_pCraftingPic->SetIcon(m_iPad, iconId,iAuxVal,1,10,31,false,itemIsFoil); @@ -332,75 +332,75 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS } // remove any icon text - else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos) + else if(temp.find(L"{*CraftingTableIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Tile::workBench->id,0,1,10,31,false); } - else if(temp.find(L"{*SticksIcon*}")!=wstring::npos) + else if(temp.find(L"{*SticksIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Item::stick->id,0,1,10,31,false); } - else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos) + else if(temp.find(L"{*PlanksIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Tile::wood->id,0,1,10,31,false); } - else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos) + else if(temp.find(L"{*WoodenShovelIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Item::shovel_wood->id,0,1,10,31,false); } - else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos) + else if(temp.find(L"{*WoodenHatchetIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Item::hatchet_wood->id,0,1,10,31,false); } - else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos) + else if(temp.find(L"{*WoodenPickaxeIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Item::pickAxe_wood->id,0,1,10,31,false); } - else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos) + else if(temp.find(L"{*FurnaceIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Tile::furnace_Id,0,1,10,31,false); } - else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos) + else if(temp.find(L"{*WoodenDoorIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Item::door_wood->id,0,1,10,31,false); } - else if(temp.find(L"{*TorchIcon*}")!=wstring::npos) + else if(temp.find(L"{*TorchIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Tile::torch_Id,0,1,10,31,false); } - else if(temp.find(L"{*BoatIcon*}")!=wstring::npos) + else if(temp.find(L"{*BoatIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Item::boat_Id,0,1,10,31,false); } - else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos) + else if(temp.find(L"{*FishingRodIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Item::fishingRod_Id,0,1,10,31,false); } - else if(temp.find(L"{*FishIcon*}")!=wstring::npos) + else if(temp.find(L"{*FishIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Item::fish_raw_Id,0,1,10,31,false); } - else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos) + else if(temp.find(L"{*MinecartIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Item::minecart_Id,0,1,10,31,false); } - else if(temp.find(L"{*RailIcon*}")!=wstring::npos) + else if(temp.find(L"{*RailIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Tile::rail_Id,0,1,10,31,false); } - else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos) + else if(temp.find(L"{*PoweredRailIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Tile::goldenRail_Id,0,1,10,31,false); } - else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos) + else if(temp.find(L"{*StructuresIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, XZP_ICON_STRUCTURES,0,1,10,31,false); } - else if(temp.find(L"{*ToolsIcon*}")!=wstring::npos) + else if(temp.find(L"{*ToolsIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, XZP_ICON_TOOLS,0,1,10,31,false); } - else if(temp.find(L"{*StoneIcon*}")!=wstring::npos) + else if(temp.find(L"{*StoneIcon*}")!=std::wstring::npos) { m_pCraftingPic->SetIcon(m_iPad, Tile::rock_Id,0,1,10,31,false); } @@ -436,13 +436,13 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS return temp; } -wstring CScene_TutorialPopup::_SetImage(wstring &desc) +std::wstring CScene_TutorialPopup::_SetImage(std::wstring &desc) { BOOL imageShowAtStart = m_image.IsShown(); - wstring openTag(L"{*IMAGE*}"); - wstring closeTag(L"{*/IMAGE*}"); + std::wstring openTag(L"{*IMAGE*}"); + std::wstring closeTag(L"{*/IMAGE*}"); int imageTagStartPos = (int)desc.find(openTag); int imageStartPos = imageTagStartPos + (int)openTag.length(); if( imageTagStartPos > 0 && imageStartPos < (int)desc.length() ) @@ -451,7 +451,7 @@ wstring CScene_TutorialPopup::_SetImage(wstring &desc) if(imageEndPos > imageStartPos && imageEndPos < (int)desc.length() ) { - wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos); + std::wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos); m_image.SetImagePath( id.c_str() ); m_image.SetShow( TRUE ); @@ -490,7 +490,7 @@ wstring CScene_TutorialPopup::_SetImage(wstring &desc) } -wstring CScene_TutorialPopup::ParseDescription(int iPad, wstring &text) +std::wstring CScene_TutorialPopup::ParseDescription(int iPad, std::wstring &text) { text = replaceAll(text, L"{*CraftingTableIcon*}", L""); text = replaceAll(text, L"{*SticksIcon*}", L""); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_TutorialPopup.h b/Minecraft.Client/Build/Common/XUI/XUI_TutorialPopup.h index 657167594..fc2124131 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_TutorialPopup.h +++ b/Minecraft.Client/Build/Common/XUI/XUI_TutorialPopup.h @@ -62,15 +62,15 @@ public: private: HRESULT _SetDescription(CXuiScene *interactScene, LPCWSTR desc, LPCWSTR title, bool allowFade, bool isReminder); - wstring _SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc); - wstring _SetImage(wstring &desc); + std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc); + std::wstring _SetImage(std::wstring &desc); HRESULT _SetVisible(bool show); bool _IsSceneVisible(); void UpdateInteractScenePosition(bool visible); public: static HRESULT SetDescription(int iPad, TutorialPopupInfo *info); - static wstring ParseDescription(int iPad, wstring &text); + static std::wstring ParseDescription(int iPad, std::wstring &text); static HRESULT SetSceneVisible(int iPad, bool show); static bool IsSceneVisible(int iPad); diff --git a/Minecraft.Client/Build/Common/XUI/XUI_debug.cpp b/Minecraft.Client/Build/Common/XUI/XUI_debug.cpp index 592d3c5b9..d9ae01496 100644 --- a/Minecraft.Client/Build/Common/XUI/XUI_debug.cpp +++ b/Minecraft.Client/Build/Common/XUI/XUI_debug.cpp @@ -186,7 +186,7 @@ HRESULT CScene_Debug::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) #ifdef _DEBUG // testing the upload of the player custom skin -// wstring wsTemp; +// std::wstring wsTemp; // // wsTemp=L"Deadmau5_Skin.png"; // app.UploadFileToGlobalStorage(m_iPad,C4JStorage::eGlobalStorage_TitleUser,&wsTemp); diff --git a/Minecraft.Client/Build/Extrax64Stubs.cpp b/Minecraft.Client/Build/Extrax64Stubs.cpp index a4626cb7b..0d7476e9f 100644 --- a/Minecraft.Client/Build/Extrax64Stubs.cpp +++ b/Minecraft.Client/Build/Extrax64Stubs.cpp @@ -500,7 +500,7 @@ void SetFakeGamertag(char *name){ strcpy_s(fakeGamerTag, name); } char* C_4JProfile::GetGamertag(int iPad){ return fakeGamerTag; } #else char* C_4JProfile::GetGamertag(int iPad){ return "PlayerName"; } -wstring C_4JProfile::GetDisplayName(int iPad){ return L"PlayerName"; } +std::wstring C_4JProfile::GetDisplayName(int iPad){ return L"PlayerName"; } #endif bool C_4JProfile::IsFullVersion() { return s_bProfileIsFullVersion; } void C_4JProfile::SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam) {} diff --git a/Minecraft.Client/Build/stubs.h b/Minecraft.Client/Build/stubs.h index dcb411079..56756ea6c 100644 --- a/Minecraft.Client/Build/stubs.h +++ b/Minecraft.Client/Build/stubs.h @@ -229,7 +229,7 @@ class ZipFile public: ZipFile(File *file) {} InputStream *getInputStream(ZipEntry *entry) { return NULL; } - ZipEntry *getEntry(const wstring& name) {return NULL;} + ZipEntry *getEntry(const std::wstring& name) {return NULL;} void close() {} }; @@ -245,7 +245,7 @@ public: static void create() {} static void destroy() {} static bool isKeyDown(int) {return false;} - static wstring getKeyName(int) { return L"KEYNAME"; } + static std::wstring getKeyName(int) { return L"KEYNAME"; } static void enableRepeatEvents(bool) {} static const int KEY_A = 0; static const int KEY_B = 1; diff --git a/Minecraft.Client/ClientConstants.cpp b/Minecraft.Client/ClientConstants.cpp index 844d94050..50ba494f7 100644 --- a/Minecraft.Client/ClientConstants.cpp +++ b/Minecraft.Client/ClientConstants.cpp @@ -1,4 +1,4 @@ #include "Build/stdafx.h" #include "ClientConstants.h" -const wstring ClientConstants::VERSION_STRING = wstring(L"Minecraft Xbox ") + VER_FILEVERSION_STR_W;//+ SharedConstants::VERSION_STRING; \ No newline at end of file +const std::wstring ClientConstants::VERSION_STRING = std::wstring(L"Minecraft Xbox ") + VER_FILEVERSION_STR_W;//+ SharedConstants::VERSION_STRING; \ No newline at end of file diff --git a/Minecraft.Client/ClientConstants.h b/Minecraft.Client/ClientConstants.h index 850eb05e6..8533f59f4 100644 --- a/Minecraft.Client/ClientConstants.h +++ b/Minecraft.Client/ClientConstants.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + class ClientConstants { @@ -12,7 +12,7 @@ class ClientConstants // INTERNAL DEVELOPMENT SETTINGS public: - static const wstring VERSION_STRING; + static const std::wstring VERSION_STRING; static const bool DEADMAU5_CAMERA_CHEATS = false; static const bool IS_DEMO_VERSION = false; diff --git a/Minecraft.Client/Commands/TeleportCommand.cpp b/Minecraft.Client/Commands/TeleportCommand.cpp index ca1b2a6a6..a81db8e4e 100644 --- a/Minecraft.Client/Commands/TeleportCommand.cpp +++ b/Minecraft.Client/Commands/TeleportCommand.cpp @@ -14,7 +14,7 @@ EGameCommand TeleportCommand::getId() return eGameCommand_Teleport; } -void TeleportCommand::execute(shared_ptr source, byteArray commandData) +void TeleportCommand::execute(std::shared_ptr source, byteArray commandData) { ByteArrayInputStream bais(commandData); DataInputStream dis(&bais); @@ -26,8 +26,8 @@ void TeleportCommand::execute(shared_ptr source, byteArray comman PlayerList *players = MinecraftServer::getInstance()->getPlayerList(); - shared_ptr subject = players->getPlayer(subjectID); - shared_ptr destination = players->getPlayer(destinationID); + std::shared_ptr subject = players->getPlayer(subjectID); + std::shared_ptr destination = players->getPlayer(destinationID); if(subject != NULL && destination != NULL && subject->level->dimension->id == destination->level->dimension->id && subject->isAlive() ) { @@ -78,7 +78,7 @@ void TeleportCommand::execute(shared_ptr source, byteArray comman //} } -shared_ptr TeleportCommand::preparePacket(PlayerUID subject, PlayerUID destination) +std::shared_ptr TeleportCommand::preparePacket(PlayerUID subject, PlayerUID destination) { ByteArrayOutputStream baos; DataOutputStream dos(&baos); @@ -86,5 +86,5 @@ shared_ptr TeleportCommand::preparePacket(PlayerUID subject, dos.writePlayerUID(subject); dos.writePlayerUID(destination); - return shared_ptr( new GameCommandPacket(eGameCommand_Teleport, baos.toByteArray() )); + return std::shared_ptr( new GameCommandPacket(eGameCommand_Teleport, baos.toByteArray() )); } \ No newline at end of file diff --git a/Minecraft.Client/Commands/TeleportCommand.h b/Minecraft.Client/Commands/TeleportCommand.h index 5e487cfae..f17e728df 100644 --- a/Minecraft.Client/Commands/TeleportCommand.h +++ b/Minecraft.Client/Commands/TeleportCommand.h @@ -6,7 +6,7 @@ class TeleportCommand : public Command { public: virtual EGameCommand getId(); - virtual void execute(shared_ptr source, byteArray commandData); + virtual void execute(std::shared_ptr source, byteArray commandData); - static shared_ptr preparePacket(PlayerUID subject, PlayerUID destination); + static std::shared_ptr preparePacket(PlayerUID subject, PlayerUID destination); }; \ No newline at end of file diff --git a/Minecraft.Client/GameState/CreativeMode.cpp b/Minecraft.Client/GameState/CreativeMode.cpp index 10adfce8f..20f7aa8ce 100644 --- a/Minecraft.Client/GameState/CreativeMode.cpp +++ b/Minecraft.Client/GameState/CreativeMode.cpp @@ -21,7 +21,7 @@ void CreativeMode::init() // initPlayer(); } -void CreativeMode::enableCreativeForPlayer(shared_ptr player) +void CreativeMode::enableCreativeForPlayer(std::shared_ptr player) { // please check ServerPlayerGameMode.java if you change these player->abilities.mayfly = true; @@ -29,7 +29,7 @@ void CreativeMode::enableCreativeForPlayer(shared_ptr player) player->abilities.invulnerable = true; } -void CreativeMode::disableCreativeForPlayer(shared_ptr player) +void CreativeMode::disableCreativeForPlayer(std::shared_ptr player) { player->abilities.mayfly = false; player->abilities.flying = false; @@ -37,7 +37,7 @@ void CreativeMode::disableCreativeForPlayer(shared_ptr player) player->abilities.invulnerable = false; } -void CreativeMode::adjustPlayer(shared_ptr player) +void CreativeMode::adjustPlayer(std::shared_ptr player) { enableCreativeForPlayer(player); @@ -45,7 +45,7 @@ void CreativeMode::adjustPlayer(shared_ptr player) { if (player->inventory->items[i] == NULL) { - player->inventory->items[i] = shared_ptr( new ItemInstance(User::allowedTiles[i]) ); + player->inventory->items[i] = std::shared_ptr( new ItemInstance(User::allowedTiles[i]) ); } else { @@ -63,7 +63,7 @@ void CreativeMode::creativeDestroyBlock(Minecraft *minecraft, GameMode *gameMode } } -bool CreativeMode::useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly, bool *pbUsedItem) +bool CreativeMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly, bool *pbUsedItem) { int t = level->getTile(x, y, z); if (t > 0) diff --git a/Minecraft.Client/GameState/CreativeMode.h b/Minecraft.Client/GameState/CreativeMode.h index 10b27a53c..9732cfd0f 100644 --- a/Minecraft.Client/GameState/CreativeMode.h +++ b/Minecraft.Client/GameState/CreativeMode.h @@ -9,11 +9,11 @@ private: public: CreativeMode(Minecraft *minecraft); virtual void init(); - static void enableCreativeForPlayer(shared_ptr player); - static void disableCreativeForPlayer(shared_ptr player); - virtual void adjustPlayer(shared_ptr player); + static void enableCreativeForPlayer(std::shared_ptr player); + static void disableCreativeForPlayer(std::shared_ptr player); + virtual void adjustPlayer(std::shared_ptr player); static void creativeDestroyBlock(Minecraft *minecraft, GameMode *gameMode, int x, int y, int z, int face); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem = NULL); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem = NULL); virtual void startDestroyBlock(int x, int y, int z, int face); virtual void continueDestroyBlock(int x, int y, int z, int face); virtual void stopDestroyBlock(); diff --git a/Minecraft.Client/GameState/DemoMode.cpp b/Minecraft.Client/GameState/DemoMode.cpp index 3a48f2d78..d001377e5 100644 --- a/Minecraft.Client/GameState/DemoMode.cpp +++ b/Minecraft.Client/GameState/DemoMode.cpp @@ -32,7 +32,7 @@ void DemoMode::tick() else if (day == 1) { Options *options = minecraft->options; - wstring message; + std::wstring message; if (time == 100) { minecraft.gui.addMessage("Seed: " + minecraft.level.getSeed()); @@ -95,7 +95,7 @@ bool DemoMode::destroyBlock(int x, int y, int z, int face) return SurvivalMode::destroyBlock(x, y, z, face); } -bool DemoMode::useItem(shared_ptr player, Level *level, shared_ptr item) +bool DemoMode::useItem(std::shared_ptr player, Level *level, std::shared_ptr item) { if (demoHasEnded) { @@ -105,7 +105,7 @@ bool DemoMode::useItem(shared_ptr player, Level *level, shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face) +bool DemoMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face) { if (demoHasEnded) { outputDemoReminder(); @@ -114,7 +114,7 @@ bool DemoMode::useItemOn(shared_ptr player, Level *level, shared_ptr player, shared_ptr entity) +void DemoMode::attack(std::shared_ptr player, std::shared_ptr entity) { if (demoHasEnded) { diff --git a/Minecraft.Client/GameState/DemoMode.h b/Minecraft.Client/GameState/DemoMode.h index 429c9ec3c..9b5f19401 100644 --- a/Minecraft.Client/GameState/DemoMode.h +++ b/Minecraft.Client/GameState/DemoMode.h @@ -21,7 +21,7 @@ public: virtual void startDestroyBlock(int x, int y, int z, int face); virtual void continueDestroyBlock(int x, int y, int z, int face); virtual bool destroyBlock(int x, int y, int z, int face); - virtual bool useItem(shared_ptr player, Level *level, shared_ptr item); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face); - virtual void attack(shared_ptr player, shared_ptr entity); + virtual bool useItem(std::shared_ptr player, Level *level, std::shared_ptr item); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face); + virtual void attack(std::shared_ptr player, std::shared_ptr entity); }; diff --git a/Minecraft.Client/GameState/GameMode.cpp b/Minecraft.Client/GameState/GameMode.cpp index b8f4bde32..29ee5fc6d 100644 --- a/Minecraft.Client/GameState/GameMode.cpp +++ b/Minecraft.Client/GameState/GameMode.cpp @@ -47,12 +47,12 @@ void GameMode::render(float a) { } -bool GameMode::useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly) +bool GameMode::useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly) { return false; } -void GameMode::initPlayer(shared_ptr player) +void GameMode::initPlayer(std::shared_ptr player) { } @@ -60,11 +60,11 @@ void GameMode::tick() { } -void GameMode::adjustPlayer(shared_ptr player) +void GameMode::adjustPlayer(std::shared_ptr player) { } -//bool GameMode::useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly) +//bool GameMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly) //{ // // 4J-PB - Adding a test only version to allow tooltips to be displayed // int t = level->getTile(x, y, z); @@ -102,27 +102,27 @@ void GameMode::adjustPlayer(shared_ptr player) //} -shared_ptr GameMode::createPlayer(Level *level) +std::shared_ptr GameMode::createPlayer(Level *level) { - return shared_ptr( new LocalPlayer(minecraft, level, minecraft->user, level->dimension->id) ); + return std::shared_ptr( new LocalPlayer(minecraft, level, minecraft->user, level->dimension->id) ); } -bool GameMode::interact(shared_ptr player, shared_ptr entity) +bool GameMode::interact(std::shared_ptr player, std::shared_ptr entity) { return player->interact(entity); } -void GameMode::attack(shared_ptr player, shared_ptr entity) +void GameMode::attack(std::shared_ptr player, std::shared_ptr entity) { player->attack(entity); } -shared_ptr GameMode::handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, shared_ptr player) +std::shared_ptr GameMode::handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, std::shared_ptr player) { return nullptr; } -void GameMode::handleCloseInventory(int containerId, shared_ptr player) +void GameMode::handleCloseInventory(int containerId, std::shared_ptr player) { player->containerMenu->removed(player); delete player->containerMenu; @@ -139,7 +139,7 @@ bool GameMode::isCutScene() return false; } -void GameMode::releaseUsingItem(shared_ptr player) +void GameMode::releaseUsingItem(std::shared_ptr player) { player->releaseUsingItem(); } @@ -164,21 +164,21 @@ bool GameMode::hasFarPickRange() return false; } -void GameMode::handleCreativeModeItemAdd(shared_ptr clicked, int i) +void GameMode::handleCreativeModeItemAdd(std::shared_ptr clicked, int i) { } -void GameMode::handleCreativeModeItemDrop(shared_ptr clicked) +void GameMode::handleCreativeModeItemDrop(std::shared_ptr clicked) { } -bool GameMode::handleCraftItem(int recipe, shared_ptr player) +bool GameMode::handleCraftItem(int recipe, std::shared_ptr player) { return true; } // 4J-PB -void GameMode::handleDebugOptions(unsigned int uiVal, shared_ptr player) +void GameMode::handleDebugOptions(unsigned int uiVal, std::shared_ptr player) { player->SetDebugOptions(uiVal); } diff --git a/Minecraft.Client/GameState/GameMode.h b/Minecraft.Client/GameState/GameMode.h index ab9ec9d12..71559708a 100644 --- a/Minecraft.Client/GameState/GameMode.h +++ b/Minecraft.Client/GameState/GameMode.h @@ -25,32 +25,32 @@ public: virtual void stopDestroyBlock() = 0; virtual void render(float a); virtual float getPickRange() = 0; - virtual void initPlayer(shared_ptr player); + virtual void initPlayer(std::shared_ptr player); virtual void tick(); virtual bool canHurtPlayer() = 0; - virtual void adjustPlayer(shared_ptr player); - virtual bool useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly=false); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem = NULL) = 0; + virtual void adjustPlayer(std::shared_ptr player); + virtual bool useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly=false); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem = NULL) = 0; - virtual shared_ptr createPlayer(Level *level); - virtual bool interact(shared_ptr player, shared_ptr entity); - virtual void attack(shared_ptr player, shared_ptr entity); - virtual shared_ptr handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, shared_ptr player); - virtual void handleCloseInventory(int containerId, shared_ptr player); + virtual std::shared_ptr createPlayer(Level *level); + virtual bool interact(std::shared_ptr player, std::shared_ptr entity); + virtual void attack(std::shared_ptr player, std::shared_ptr entity); + virtual std::shared_ptr handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, std::shared_ptr player); + virtual void handleCloseInventory(int containerId, std::shared_ptr player); virtual void handleInventoryButtonClick(int containerId, int buttonId); virtual bool isCutScene(); - virtual void releaseUsingItem(shared_ptr player); + virtual void releaseUsingItem(std::shared_ptr player); virtual bool hasExperience(); virtual bool hasMissTime(); virtual bool hasInfiniteItems(); virtual bool hasFarPickRange(); - virtual void handleCreativeModeItemAdd(shared_ptr clicked, int i); - virtual void handleCreativeModeItemDrop(shared_ptr clicked); + virtual void handleCreativeModeItemAdd(std::shared_ptr clicked, int i); + virtual void handleCreativeModeItemDrop(std::shared_ptr clicked); // 4J Stu - Added so we can send packets for this in the network game - virtual bool handleCraftItem(int recipe, shared_ptr player); - virtual void handleDebugOptions(unsigned int uiVal, shared_ptr player); + virtual bool handleCraftItem(int recipe, std::shared_ptr player); + virtual void handleDebugOptions(unsigned int uiVal, std::shared_ptr player); // 4J Stu - Added for tutorial checks virtual bool isInputAllowed(int mapping) { return true; } diff --git a/Minecraft.Client/GameState/Options.cpp b/Minecraft.Client/GameState/Options.cpp index a3e58311d..e59ce7406 100644 --- a/Minecraft.Client/GameState/Options.cpp +++ b/Minecraft.Client/GameState/Options.cpp @@ -60,7 +60,7 @@ const Options::Option *Options::Option::getItem(int id) return &options[id]; } -Options::Option::Option(const wstring& captionId, bool hasProgress, bool isBoolean) : _isProgress(hasProgress), _isBoolean(isBoolean), captionId(captionId) +Options::Option::Option(const std::wstring& captionId, bool hasProgress, bool isBoolean) : _isProgress(hasProgress), _isBoolean(isBoolean), captionId(captionId) { } @@ -79,29 +79,29 @@ int Options::Option::getId() const return (int)(this-options); } -wstring Options::Option::getCaptionId() const +std::wstring Options::Option::getCaptionId() const { return captionId; } -const wstring Options::RENDER_DISTANCE_NAMES[] = +const std::wstring Options::RENDER_DISTANCE_NAMES[] = { L"options.renderDistance.far", L"options.renderDistance.normal", L"options.renderDistance.short", L"options.renderDistance.tiny" }; -const wstring Options::DIFFICULTY_NAMES[] = +const std::wstring Options::DIFFICULTY_NAMES[] = { L"options.difficulty.peaceful", L"options.difficulty.easy", L"options.difficulty.normal", L"options.difficulty.hard" }; -const wstring Options::GUI_SCALE[] = +const std::wstring Options::GUI_SCALE[] = { L"options.guiScale.auto", L"options.guiScale.small", L"options.guiScale.normal", L"options.guiScale.large" }; -const wstring Options::FRAMERATE_LIMITS[] = +const std::wstring Options::FRAMERATE_LIMITS[] = { L"performance.max", L"performance.balanced", L"performance.powersaver" }; -const wstring Options::PARTICLES[] = { +const std::wstring Options::PARTICLES[] = { L"options.particles.all", L"options.particles.decreased", L"options.particles.minimal" }; @@ -184,13 +184,13 @@ Options::Options() init(); } -wstring Options::getKeyDescription(int i) +std::wstring Options::getKeyDescription(int i) { Language *language = Language::getInstance(); return language->getElement(keyMappings[i]->name); } -wstring Options::getKeyMessage(int i) +std::wstring Options::getKeyMessage(int i) { int key = keyMappings[i]->key; if (key < 0) { @@ -307,12 +307,12 @@ bool Options::getBooleanValue(const Options::Option *item) return false; } -wstring Options::getMessage(const Options::Option *item) +std::wstring Options::getMessage(const Options::Option *item) { - // 4J TODO, should these wstrings append rather than add? + // 4J TODO, should these std::wstrings append rather than add? Language *language = Language::getInstance(); - wstring caption = language->getElement(item->getCaptionId()) + L": "; + std::wstring caption = language->getElement(item->getCaptionId()) + L": "; if (item->isProgress()) { @@ -411,14 +411,14 @@ void Options::load() // 4J - was new BufferedReader(new FileReader(optionsFile)); BufferedReader *br = new BufferedReader(new InputStreamReader( new FileInputStream( optionsFile ) ) ); - wstring line = L""; + std::wstring line = L""; while ((line = br->readLine()) != L"") // 4J - was check against NULL - do we need to distinguish between empty lines and a fail here? { // 4J - removed try/catch // try { - wstring cmds[2]; + std::wstring cmds[2]; int splitpos = (int)line.find(L":"); - if( splitpos == wstring::npos ) + if( splitpos == std::wstring::npos ) { cmds[0] = line; cmds[1] = L""; @@ -469,7 +469,7 @@ void Options::load() } -float Options::readFloat(wstring string) +float Options::readFloat(std::wstring string) { if (string == L"true") return 1; if (string == L"false") return 0; @@ -488,20 +488,20 @@ void Options::save() dos.writeChars(L"music:" + _toString(music) + L"\n"); dos.writeChars(L"sound:" + _toString(sound) + L"\n"); - dos.writeChars(L"invertYMouse:" + wstring(invertYMouse ? L"true" : L"false") + L"\n"); + dos.writeChars(L"invertYMouse:" + std::wstring(invertYMouse ? L"true" : L"false") + L"\n"); dos.writeChars(L"mouseSensitivity:" + _toString(sensitivity)); dos.writeChars(L"fov:" + _toString(fov)); dos.writeChars(L"gamma:" + _toString(gamma)); dos.writeChars(L"viewDistance:" + _toString(viewDistance)); dos.writeChars(L"guiScale:" + _toString(guiScale)); dos.writeChars(L"particles:" + _toString(particles)); - dos.writeChars(L"bobView:" + wstring(bobView ? L"true" : L"false")); - dos.writeChars(L"anaglyph3d:" + wstring(anaglyph3d ? L"true" : L"false")); - dos.writeChars(L"advancedOpengl:" + wstring(advancedOpengl ? L"true" : L"false")); + dos.writeChars(L"bobView:" + std::wstring(bobView ? L"true" : L"false")); + dos.writeChars(L"anaglyph3d:" + std::wstring(anaglyph3d ? L"true" : L"false")); + dos.writeChars(L"advancedOpengl:" + std::wstring(advancedOpengl ? L"true" : L"false")); dos.writeChars(L"fpsLimit:" + _toString(framerateLimit)); dos.writeChars(L"difficulty:" + _toString(difficulty)); - dos.writeChars(L"fancyGraphics:" + wstring(fancyGraphics ? L"true" : L"false")); - dos.writeChars(L"ao:" + wstring(ambientOcclusion ? L"true" : L"false")); + dos.writeChars(L"fancyGraphics:" + std::wstring(fancyGraphics ? L"true" : L"false")); + dos.writeChars(L"ao:" + std::wstring(ambientOcclusion ? L"true" : L"false")); dos.writeChars(L"clouds:" + _toString(renderClouds)); dos.writeChars(L"skin:" + skin); dos.writeChars(L"lastServer:" + lastMpIp); diff --git a/Minecraft.Client/GameState/Options.h b/Minecraft.Client/GameState/Options.h index 8dfe15ed5..b9d2d4928 100644 --- a/Minecraft.Client/GameState/Options.h +++ b/Minecraft.Client/GameState/Options.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + class Minecraft; class KeyMapping; #include "../../Minecraft.World/IO/Files/File.h" @@ -37,24 +37,24 @@ public: private: const bool _isProgress; const bool _isBoolean; - const wstring captionId; + const std::wstring captionId; public: static const Option *getItem(int id); - Option(const wstring& captionId, bool hasProgress, bool isBoolean); + Option(const std::wstring& captionId, bool hasProgress, bool isBoolean); bool isProgress() const; bool isBoolean() const; int getId() const; - wstring getCaptionId() const; + std::wstring getCaptionId() const; }; private: - static const wstring RENDER_DISTANCE_NAMES[]; - static const wstring DIFFICULTY_NAMES[]; - static const wstring GUI_SCALE[]; - static const wstring FRAMERATE_LIMITS[]; - static const wstring PARTICLES[]; + static const std::wstring RENDER_DISTANCE_NAMES[]; + static const std::wstring DIFFICULTY_NAMES[]; + static const std::wstring GUI_SCALE[]; + static const std::wstring FRAMERATE_LIMITS[]; + static const std::wstring PARTICLES[]; public: float music; @@ -69,7 +69,7 @@ public: bool fancyGraphics; bool ambientOcclusion; bool renderClouds; - wstring skin; + std::wstring skin; KeyMapping *keyUp; KeyMapping *keyLeft; @@ -99,7 +99,7 @@ public: bool hideGui; bool thirdPersonView; bool renderDebug; - wstring lastMpIp; + std::wstring lastMpIp; bool isFlying; bool smoothCamera; @@ -114,17 +114,17 @@ public: void init(); // 4J added Options(Minecraft *minecraft, File workingDirectory); Options(); - wstring getKeyDescription(int i); - wstring getKeyMessage(int i); + std::wstring getKeyDescription(int i); + std::wstring getKeyMessage(int i); void setKey(int i, int key); void set(const Options::Option *item, float value); void toggle(const Options::Option *option, int dir); float getProgressValue(const Options::Option *item); bool getBooleanValue(const Options::Option *item); - wstring getMessage(const Options::Option *item); + std::wstring getMessage(const Options::Option *item); void load(); private: - float readFloat(wstring string); + float readFloat(std::wstring string); public: void save(); diff --git a/Minecraft.Client/GameState/Settings.cpp b/Minecraft.Client/GameState/Settings.cpp index 377c812dd..296f8c920 100644 --- a/Minecraft.Client/GameState/Settings.cpp +++ b/Minecraft.Client/GameState/Settings.cpp @@ -15,7 +15,7 @@ void Settings::saveProperties() { } -wstring Settings::getString(const wstring& key, const wstring& defaultValue) +std::wstring Settings::getString(const std::wstring& key, const std::wstring& defaultValue) { if(properties.find(key) == properties.end()) { @@ -25,7 +25,7 @@ wstring Settings::getString(const wstring& key, const wstring& defaultValue) return properties[key]; } -int Settings::getInt(const wstring& key, int defaultValue) +int Settings::getInt(const std::wstring& key, int defaultValue) { if(properties.find(key) == properties.end()) { @@ -35,7 +35,7 @@ int Settings::getInt(const wstring& key, int defaultValue) return _fromString(properties[key]); } -bool Settings::getBoolean(const wstring& key, bool defaultValue) +bool Settings::getBoolean(const std::wstring& key, bool defaultValue) { if(properties.find(key) == properties.end()) { @@ -48,7 +48,7 @@ bool Settings::getBoolean(const wstring& key, bool defaultValue) return retval; } -void Settings::setBooleanAndSave(const wstring& key, bool value) +void Settings::setBooleanAndSave(const std::wstring& key, bool value) { properties[key] = _toString(value); saveProperties(); diff --git a/Minecraft.Client/GameState/Settings.h b/Minecraft.Client/GameState/Settings.h index b6a2c0181..8ead97244 100644 --- a/Minecraft.Client/GameState/Settings.h +++ b/Minecraft.Client/GameState/Settings.h @@ -1,21 +1,21 @@ #pragma once class File; -using namespace std; + class Settings { // public static Logger logger = Logger.getLogger("Minecraft"); // private Properties properties = new Properties(); private: - unordered_map properties; // 4J - TODO was Properties type, will need to implement something we can serialise/deserialise too + std::unordered_map properties; // 4J - TODO was Properties type, will need to implement something we can serialise/deserialise too //File *file; public: Settings(File *file); void generateNewProperties(); void saveProperties(); - wstring getString(const wstring& key, const wstring& defaultValue); - int getInt(const wstring& key, int defaultValue); - bool getBoolean(const wstring& key, bool defaultValue); - void setBooleanAndSave(const wstring& key, bool value); + std::wstring getString(const std::wstring& key, const std::wstring& defaultValue); + int getInt(const std::wstring& key, int defaultValue); + bool getBoolean(const std::wstring& key, bool defaultValue); + void setBooleanAndSave(const std::wstring& key, bool value); }; diff --git a/Minecraft.Client/GameState/StatsCounter.cpp b/Minecraft.Client/GameState/StatsCounter.cpp index df944f326..47eddcbd9 100644 --- a/Minecraft.Client/GameState/StatsCounter.cpp +++ b/Minecraft.Client/GameState/StatsCounter.cpp @@ -22,7 +22,7 @@ Stat** StatsCounter::LARGE_STATS[] = { &Stats::timePlayed }; -unordered_map StatsCounter::statBoards; +std::unordered_map StatsCounter::statBoards; StatsCounter::StatsCounter() { @@ -43,7 +43,7 @@ void StatsCounter::award(Stat* stat, unsigned int difficulty, unsigned int count { StatContainer newVal; newVal.stats[difficulty] = count; - stats.insert( make_pair(stat, newVal) ); + stats.insert( std::make_pair(stat, newVal) ); } else { @@ -64,7 +64,7 @@ void StatsCounter::award(Stat* stat, unsigned int difficulty, unsigned int count requiresSave = true; //If this stat is on a leaderboard, mark that leaderboard as needing updated - unordered_map::iterator leaderboardEntry = statBoards.find(stat); + std::unordered_map::iterator leaderboardEntry = statBoards.find(stat); if( leaderboardEntry != statBoards.end() ) { app.DebugPrintf("[StatsCounter] award(): %X\n", leaderboardEntry->second << difficulty); @@ -150,8 +150,8 @@ void StatsCounter::parse(void* data) StatContainer newVal; //For each stat - vector::iterator end = Stats::all->end(); - for( vector::iterator iter = Stats::all->begin() ; iter != end ; ++iter ) + std::vector::iterator end = Stats::all->end(); + for( std::vector::iterator iter = Stats::all->begin() ; iter != end ; ++iter ) { if( !(*iter)->isAchievement() ) { @@ -163,7 +163,7 @@ void StatsCounter::parse(void* data) newVal.stats[1] = statData[1]; newVal.stats[2] = statData[2]; newVal.stats[3] = statData[3]; - stats.insert( make_pair(*iter, newVal) ); + stats.insert( std::make_pair(*iter, newVal) ); } statData += 4; } @@ -176,7 +176,7 @@ void StatsCounter::parse(void* data) newVal.stats[1] = largeStatData[1]; newVal.stats[2] = largeStatData[2]; newVal.stats[3] = largeStatData[3]; - stats.insert( make_pair(*iter, newVal) ); + stats.insert( std::make_pair(*iter, newVal) ); } largeStatData += 4; statData = (unsigned short*)largeStatData; @@ -190,7 +190,7 @@ void StatsCounter::parse(void* data) newVal.stats[1] = 0; newVal.stats[2] = 0; newVal.stats[3] = 0; - stats.insert( make_pair(*iter, newVal) ); + stats.insert( std::make_pair(*iter, newVal) ); } ++statData; } @@ -230,8 +230,8 @@ void StatsCounter::save(int player, bool force) //For each stat StatsMap::iterator val; - vector::iterator end = Stats::all->end(); - for( vector::iterator iter = Stats::all->begin() ; iter != end ; ++iter ) + std::vector::iterator end = Stats::all->end(); + for( std::vector::iterator iter = Stats::all->begin() ; iter != end ; ++iter ) { //If the stat is in the map write out it's value val = stats.find(*iter); @@ -1239,34 +1239,34 @@ void StatsCounter::writeStats() void StatsCounter::setupStatBoards() { #ifndef _DURANGO - statBoards.insert( make_pair(Stats::killsZombie, LEADERBOARD_KILLS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::killsSkeleton, LEADERBOARD_KILLS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::killsCreeper, LEADERBOARD_KILLS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::killsSpider, LEADERBOARD_KILLS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::killsSpiderJockey, LEADERBOARD_KILLS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::killsZombiePigman, LEADERBOARD_KILLS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::killsNetherZombiePigman, LEADERBOARD_KILLS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::killsSlime, LEADERBOARD_KILLS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::killsZombie, LEADERBOARD_KILLS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::killsSkeleton, LEADERBOARD_KILLS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::killsCreeper, LEADERBOARD_KILLS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::killsSpider, LEADERBOARD_KILLS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::killsSpiderJockey, LEADERBOARD_KILLS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::killsZombiePigman, LEADERBOARD_KILLS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::killsNetherZombiePigman, LEADERBOARD_KILLS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::killsSlime, LEADERBOARD_KILLS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::blocksMined[Tile::dirt->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::blocksMined[Tile::stoneBrick->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::blocksMined[Tile::sand->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::blocksMined[Tile::rock->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::blocksMined[Tile::gravel->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::blocksMined[Tile::clay->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::blocksMined[Tile::obsidian->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::blocksMined[Tile::dirt->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::blocksMined[Tile::stoneBrick->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::blocksMined[Tile::sand->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::blocksMined[Tile::rock->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::blocksMined[Tile::gravel->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::blocksMined[Tile::clay->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::blocksMined[Tile::obsidian->id], LEADERBOARD_MININGBLOCKS_PEACEFUL) ); - statBoards.insert( make_pair(Stats::itemsCollected[Item::egg->id], LEADERBOARD_FARMING_PEACEFUL) ); - statBoards.insert( make_pair(Stats::blocksMined[Tile::crops_Id], LEADERBOARD_FARMING_PEACEFUL) ); - statBoards.insert( make_pair(Stats::blocksMined[Tile::mushroom1_Id], LEADERBOARD_FARMING_PEACEFUL) ); - statBoards.insert( make_pair(Stats::blocksMined[Tile::reeds_Id], LEADERBOARD_FARMING_PEACEFUL) ); - statBoards.insert( make_pair(Stats::cowsMilked, LEADERBOARD_FARMING_PEACEFUL) ); - statBoards.insert( make_pair(Stats::itemsCollected[Tile::pumpkin->id], LEADERBOARD_FARMING_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::itemsCollected[Item::egg->id], LEADERBOARD_FARMING_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::blocksMined[Tile::crops_Id], LEADERBOARD_FARMING_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::blocksMined[Tile::mushroom1_Id], LEADERBOARD_FARMING_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::blocksMined[Tile::reeds_Id], LEADERBOARD_FARMING_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::cowsMilked, LEADERBOARD_FARMING_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::itemsCollected[Tile::pumpkin->id], LEADERBOARD_FARMING_PEACEFUL) ); - statBoards.insert( make_pair(Stats::walkOneM, LEADERBOARD_TRAVELLING_PEACEFUL) ); - statBoards.insert( make_pair(Stats::fallOneM, LEADERBOARD_TRAVELLING_PEACEFUL) ); - statBoards.insert( make_pair(Stats::minecartOneM, LEADERBOARD_TRAVELLING_PEACEFUL) ); - statBoards.insert( make_pair(Stats::boatOneM, LEADERBOARD_TRAVELLING_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::walkOneM, LEADERBOARD_TRAVELLING_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::fallOneM, LEADERBOARD_TRAVELLING_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::minecartOneM, LEADERBOARD_TRAVELLING_PEACEFUL) ); + statBoards.insert( std::make_pair(Stats::boatOneM, LEADERBOARD_TRAVELLING_PEACEFUL) ); #endif } @@ -1283,8 +1283,8 @@ bool StatsCounter::isLargeStat(Stat* stat) void StatsCounter::dumpStatsToTTY() { - vector::iterator statsEnd = Stats::all->end(); - for( vector::iterator statsIter = Stats::all->begin() ; statsIter!=statsEnd ; ++statsIter ) + std::vector::iterator statsEnd = Stats::all->end(); + for( std::vector::iterator statsIter = Stats::all->begin() ; statsIter!=statsEnd ; ++statsIter ) { app.DebugPrintf("%ls\t\t%u\t%u\t%u\t%u\n", (*statsIter)->name.c_str(), diff --git a/Minecraft.Client/GameState/StatsCounter.h b/Minecraft.Client/GameState/StatsCounter.h index e292ccf27..4963d3ab8 100644 --- a/Minecraft.Client/GameState/StatsCounter.h +++ b/Minecraft.Client/GameState/StatsCounter.h @@ -3,7 +3,7 @@ class Stat; class Achievement; class StatsSyncher; class User; -using namespace std; + class StatsCounter { @@ -28,7 +28,7 @@ private: } }; - typedef unordered_map StatsMap; + typedef std::unordered_map StatsMap; //static const int STAT_DATA_OFFSET = 32; static const int LARGE_STATS_COUNT = 8; @@ -69,7 +69,7 @@ private: int saveCounter; int modifiedBoards; - static unordered_map statBoards; + static std::unordered_map statBoards; int flushCounter; public: diff --git a/Minecraft.Client/GameState/StatsSyncer.h b/Minecraft.Client/GameState/StatsSyncer.h index 843505bf6..0742acc3d 100644 --- a/Minecraft.Client/GameState/StatsSyncer.h +++ b/Minecraft.Client/GameState/StatsSyncer.h @@ -4,7 +4,7 @@ class StatsCounter; class User; class File; class Stat; -using namespace std; + class StatsSyncher { @@ -14,8 +14,8 @@ private: volatile bool busy; - volatile unordered_map *serverStats; - volatile unordered_map *failedSentStats; + volatile std::unordered_map *serverStats; + volatile std::unordered_map *failedSentStats; StatsCounter *statsCounter; File *unsentFile, *lastServerFile; @@ -28,19 +28,19 @@ private: public: StatsSyncher(User *user, StatsCounter *statsCounter, File *dir); private: - void attemptRename(File *dir, const wstring& name, File *to); - unordered_map *loadStatsFromDisk(File *file, File *tmp, File *old); - unordered_map *loadStatsFromDisk(File *file); - void doSend(unordered_map *stats); - void doSave(unordered_map *stats, File *file, File *tmp, File *old); + void attemptRename(File *dir, const std::wstring& name, File *to); + std::unordered_map *loadStatsFromDisk(File *file, File *tmp, File *old); + std::unordered_map *loadStatsFromDisk(File *file); + void doSend(std::unordered_map *stats); + void doSave(std::unordered_map *stats, File *file, File *tmp, File *old); protected: - unordered_map *doGetStats(); + std::unordered_map *doGetStats(); public: void getStatsFromServer(); - void saveUnsent(unordered_map *stats); - void sendUnsent(unordered_map *stats, unordered_map *fullStats); - void forceSendUnsent(unordered_map *stats); - void forceSaveUnsent(unordered_map *stats); + void saveUnsent(std::unordered_map *stats); + void sendUnsent(std::unordered_map *stats, std::unordered_map *fullStats); + void forceSendUnsent(std::unordered_map *stats); + void forceSaveUnsent(std::unordered_map *stats); bool maySave(); bool maySend(); void tick(); diff --git a/Minecraft.Client/GameState/SurvivalMode.cpp b/Minecraft.Client/GameState/SurvivalMode.cpp index 0b71f4ee8..e797d9905 100644 --- a/Minecraft.Client/GameState/SurvivalMode.cpp +++ b/Minecraft.Client/GameState/SurvivalMode.cpp @@ -45,7 +45,7 @@ SurvivalMode::SurvivalMode(SurvivalMode *copy) : GameMode( copy->minecraft ) destroyDelay = copy->destroyDelay; } -void SurvivalMode::initPlayer(shared_ptr player) +void SurvivalMode::initPlayer(std::shared_ptr player) { player->yRot = -180; } @@ -65,7 +65,7 @@ bool SurvivalMode::destroyBlock(int x, int y, int z, int face) int data = minecraft->level->getData(x, y, z); bool changed = GameMode::destroyBlock(x, y, z, face); - shared_ptr item = minecraft->player->getSelectedItem(); + std::shared_ptr item = minecraft->player->getSelectedItem(); bool couldDestroy = minecraft->player->canDestroy(Tile::tiles[t]); if (item != NULL) { @@ -173,9 +173,9 @@ void SurvivalMode::initLevel(Level *level) GameMode::initLevel(level); } -shared_ptr SurvivalMode::createPlayer(Level *level) +std::shared_ptr SurvivalMode::createPlayer(Level *level) { - shared_ptr player = GameMode::createPlayer(level); + std::shared_ptr player = GameMode::createPlayer(level); // player.inventory.add(new ItemInstance(Item.pickAxe_diamond)); // player.inventory.add(new ItemInstance(Item.hatchet_diamond)); // player.inventory.add(new ItemInstance(Tile.torch, 64)); @@ -191,7 +191,7 @@ void SurvivalMode::tick() //minecraft->soundEngine->playMusicTick(); } -bool SurvivalMode::useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly, bool *pbUsedItem) +bool SurvivalMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly, bool *pbUsedItem) { int t = level->getTile(x, y, z); if (t > 0) diff --git a/Minecraft.Client/GameState/SurvivalMode.h b/Minecraft.Client/GameState/SurvivalMode.h index b4ce5e6dd..643e50d15 100644 --- a/Minecraft.Client/GameState/SurvivalMode.h +++ b/Minecraft.Client/GameState/SurvivalMode.h @@ -15,7 +15,7 @@ private: public: SurvivalMode(Minecraft *minecraft); SurvivalMode(SurvivalMode *copy); - virtual void initPlayer(shared_ptr player); + virtual void initPlayer(std::shared_ptr player); virtual void init(); virtual bool canHurtPlayer(); virtual bool destroyBlock(int x, int y, int z, int face); @@ -25,8 +25,8 @@ public: virtual void render(float a); virtual float getPickRange(); virtual void initLevel(Level *level); - virtual shared_ptr createPlayer(Level *level); + virtual std::shared_ptr createPlayer(Level *level); virtual void tick(); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem=NULL); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, bool bTestUseOnOnly=false, bool *pbUsedItem=NULL); virtual bool hasExperience(); }; \ No newline at end of file diff --git a/Minecraft.Client/Input/ConsoleInput.cpp b/Minecraft.Client/Input/ConsoleInput.cpp index 6a36b606b..ff6c3b6a0 100644 --- a/Minecraft.Client/Input/ConsoleInput.cpp +++ b/Minecraft.Client/Input/ConsoleInput.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "ConsoleInput.h" -ConsoleInput::ConsoleInput(const wstring& msg, ConsoleInputSource *source) +ConsoleInput::ConsoleInput(const std::wstring& msg, ConsoleInputSource *source) { this->msg = msg; this->source = source; diff --git a/Minecraft.Client/Input/ConsoleInput.h b/Minecraft.Client/Input/ConsoleInput.h index 1206b24ec..db228631a 100644 --- a/Minecraft.Client/Input/ConsoleInput.h +++ b/Minecraft.Client/Input/ConsoleInput.h @@ -1,12 +1,12 @@ #pragma once #include "ConsoleInputSource.h" -using namespace std; + class ConsoleInput { public: - wstring msg; + std::wstring msg; ConsoleInputSource *source; - ConsoleInput(const wstring& msg, ConsoleInputSource *source); + ConsoleInput(const std::wstring& msg, ConsoleInputSource *source); }; \ No newline at end of file diff --git a/Minecraft.Client/Input/ConsoleInputSource.h b/Minecraft.Client/Input/ConsoleInputSource.h index ab2a25877..7d79c0941 100644 --- a/Minecraft.Client/Input/ConsoleInputSource.h +++ b/Minecraft.Client/Input/ConsoleInputSource.h @@ -3,7 +3,7 @@ class ConsoleInputSource { public: - virtual void info(const wstring& string) = 0; - virtual void warn(const wstring& string) = 0; - virtual wstring getConsoleName() = 0; + virtual void info(const std::wstring& string) = 0; + virtual void warn(const std::wstring& string) = 0; + virtual std::wstring getConsoleName() = 0; }; diff --git a/Minecraft.Client/Input/KeyMapping.cpp b/Minecraft.Client/Input/KeyMapping.cpp index 64f4d92bb..ade98f6b5 100644 --- a/Minecraft.Client/Input/KeyMapping.cpp +++ b/Minecraft.Client/Input/KeyMapping.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "KeyMapping.h" -KeyMapping::KeyMapping(const wstring& name, int key) +KeyMapping::KeyMapping(const std::wstring& name, int key) { this->name = name; this->key = key; diff --git a/Minecraft.Client/Input/KeyMapping.h b/Minecraft.Client/Input/KeyMapping.h index 45be54a32..85ac8d211 100644 --- a/Minecraft.Client/Input/KeyMapping.h +++ b/Minecraft.Client/Input/KeyMapping.h @@ -1,10 +1,10 @@ #pragma once -using namespace std; + // 4J Stu - Not updated to 1.8.2 as we don't use this class KeyMapping { public: - wstring name; + std::wstring name; int key; - KeyMapping(const wstring& name, int key); + KeyMapping(const std::wstring& name, int key); }; \ No newline at end of file diff --git a/Minecraft.Client/Level/DemoLevel.cpp b/Minecraft.Client/Level/DemoLevel.cpp index 08cea65f1..44c5b1f97 100644 --- a/Minecraft.Client/Level/DemoLevel.cpp +++ b/Minecraft.Client/Level/DemoLevel.cpp @@ -11,7 +11,7 @@ LevelSettings DemoLevel::DEMO_LEVEL_SETTINGS = LevelSettings( 1.0 ); -DemoLevel::DemoLevel(shared_ptr levelStorage, const wstring& levelName) : Level(levelStorage, levelName, &DEMO_LEVEL_SETTINGS) +DemoLevel::DemoLevel(std::shared_ptr levelStorage, const std::wstring& levelName) : Level(levelStorage, levelName, &DEMO_LEVEL_SETTINGS) { } diff --git a/Minecraft.Client/Level/DemoLevel.h b/Minecraft.Client/Level/DemoLevel.h index 7f6c89168..d8639dee7 100644 --- a/Minecraft.Client/Level/DemoLevel.h +++ b/Minecraft.Client/Level/DemoLevel.h @@ -10,7 +10,7 @@ private: static const int DEMO_SPAWN_Z = -731; static LevelSettings DEMO_LEVEL_SETTINGS; public: - DemoLevel(shared_ptr levelStorage, const wstring& levelName); + DemoLevel(std::shared_ptr levelStorage, const std::wstring& levelName); DemoLevel(Level *level, Dimension *dimension); protected: virtual void setInitialSpawn(); diff --git a/Minecraft.Client/Level/DerivedServerLevel.cpp b/Minecraft.Client/Level/DerivedServerLevel.cpp index 407ea6e62..525cdb142 100644 --- a/Minecraft.Client/Level/DerivedServerLevel.cpp +++ b/Minecraft.Client/Level/DerivedServerLevel.cpp @@ -3,7 +3,7 @@ #include "../../Minecraft.World/Level/Storage/SavedDataStorage.h" #include "../../Minecraft.World/Level/DerivedLevelData.h" -DerivedServerLevel::DerivedServerLevel(MinecraftServer *server, shared_ptr levelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped) +DerivedServerLevel::DerivedServerLevel(MinecraftServer *server, std::shared_ptr levelStorage, const std::wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped) : ServerLevel(server, levelStorage, levelName, dimension, levelSettings) { // 4J-PB - we're going to override the savedDataStorage, so we need to delete the current one diff --git a/Minecraft.Client/Level/DerivedServerLevel.h b/Minecraft.Client/Level/DerivedServerLevel.h index 2d49e4fa0..2c9048563 100644 --- a/Minecraft.Client/Level/DerivedServerLevel.h +++ b/Minecraft.Client/Level/DerivedServerLevel.h @@ -4,7 +4,7 @@ class DerivedServerLevel : public ServerLevel { public: - DerivedServerLevel(MinecraftServer *server, shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped); + DerivedServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const std::wstring& levelName, int dimension, LevelSettings *levelSettings, ServerLevel *wrapped); ~DerivedServerLevel(); protected: diff --git a/Minecraft.Client/Level/MultiPlayerLevel.cpp b/Minecraft.Client/Level/MultiPlayerLevel.cpp index a76558ecf..9e8a96803 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.cpp +++ b/Minecraft.Client/Level/MultiPlayerLevel.cpp @@ -24,7 +24,7 @@ MultiPlayerLevel::ResetInfo::ResetInfo(int x, int y, int z, int tile, int data) } MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings *levelSettings, int dimension, int difficulty) - : Level(shared_ptr(new MockedLevelStorage()), L"MpServer", Dimension::getNew(dimension), levelSettings, false) + : Level(std::shared_ptr(new MockedLevelStorage()), L"MpServer", Dimension::getNew(dimension), levelSettings, false) { minecraft = Minecraft::GetInstance(); @@ -108,7 +108,7 @@ void MultiPlayerLevel::tick() EnterCriticalSection(&m_entitiesCS); for (int i = 0; i < 10 && !reEntries.empty(); i++) { - shared_ptr e = *(reEntries.begin()); + std::shared_ptr e = *(reEntries.begin()); if (find(entities.begin(), entities.end(), e) == entities.end() ) addEntity(e); } @@ -117,7 +117,7 @@ void MultiPlayerLevel::tick() PIXBeginNamedEvent(0,"Connection ticking"); // 4J HEG - Copy the connections vector to prevent crash when moving to Nether - vector connectionsTemp = connections; + std::vector connectionsTemp = connections; for(AUTO_VAR(connection, connectionsTemp.begin()); connection < connectionsTemp.end(); ++connection ) { (*connection)->tick(); @@ -403,7 +403,7 @@ void MultiPlayerLevel::setChunkVisible(int x, int z, bool visible) } -bool MultiPlayerLevel::addEntity(shared_ptr e) +bool MultiPlayerLevel::addEntity(std::shared_ptr e) { bool ok = Level::addEntity(e); forced.insert(e); @@ -416,7 +416,7 @@ bool MultiPlayerLevel::addEntity(shared_ptr e) return ok; } -void MultiPlayerLevel::removeEntity(shared_ptr e) +void MultiPlayerLevel::removeEntity(std::shared_ptr e) { // 4J Stu - Add this remove from the reEntries collection to stop us continually removing and re-adding things, // in particular the MultiPlayerLocalPlayer when they die @@ -430,7 +430,7 @@ void MultiPlayerLevel::removeEntity(shared_ptr e) forced.erase(e); } -void MultiPlayerLevel::entityAdded(shared_ptr e) +void MultiPlayerLevel::entityAdded(std::shared_ptr e) { Level::entityAdded(e); AUTO_VAR(it, reEntries.find(e)); @@ -440,7 +440,7 @@ void MultiPlayerLevel::entityAdded(shared_ptr e) } } -void MultiPlayerLevel::entityRemoved(shared_ptr e) +void MultiPlayerLevel::entityRemoved(std::shared_ptr e) { Level::entityRemoved(e); AUTO_VAR(it, forced.find(e)); @@ -450,9 +450,9 @@ void MultiPlayerLevel::entityRemoved(shared_ptr e) } } -void MultiPlayerLevel::putEntity(int id, shared_ptr e) +void MultiPlayerLevel::putEntity(int id, std::shared_ptr e) { - shared_ptr old = getEntity(id); + std::shared_ptr old = getEntity(id); if (old != NULL) { removeEntity(old); @@ -467,16 +467,16 @@ void MultiPlayerLevel::putEntity(int id, shared_ptr e) entitiesById[id] = e; } -shared_ptr MultiPlayerLevel::getEntity(int id) +std::shared_ptr MultiPlayerLevel::getEntity(int id) { AUTO_VAR(it, entitiesById.find(id)); if( it == entitiesById.end() ) return nullptr; return it->second; } -shared_ptr MultiPlayerLevel::removeEntity(int id) +std::shared_ptr MultiPlayerLevel::removeEntity(int id) { - shared_ptr e; + std::shared_ptr e; AUTO_VAR(it, entitiesById.find(id)); if( it != entitiesById.end() ) { @@ -493,11 +493,11 @@ shared_ptr MultiPlayerLevel::removeEntity(int id) // 4J Added to remove the entities from the forced list // This gets called when a chunk is unloaded, but we only do half an unload to remove entities slightly differently -void MultiPlayerLevel::removeEntities(vector > *list) +void MultiPlayerLevel::removeEntities(std::vector > *list) { for(AUTO_VAR(it, list->begin()); it < list->end(); ++it) { - shared_ptr e = *it; + std::shared_ptr e = *it; AUTO_VAR(reIt, reEntries.find(e)); if (reIt!=reEntries.end()) @@ -609,7 +609,7 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) { for(AUTO_VAR(it, connections.begin()); it < connections.end(); ++it ) { - (*it)->sendAndDisconnect( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); + (*it)->sendAndDisconnect( std::shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); } } else @@ -730,7 +730,7 @@ void MultiPlayerLevel::animateTickDoWork() } -void MultiPlayerLevel::playSound(shared_ptr entity, int iSound, float volume, float pitch) +void MultiPlayerLevel::playSound(std::shared_ptr entity, int iSound, float volume, float pitch) { playLocalSound(entity->x, entity->y - entity->heightOffset, entity->z, iSound, volume, pitch); } @@ -790,7 +790,7 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() AUTO_VAR(endIt, entitiesToRemove.end()); for (AUTO_VAR(it, entitiesToRemove.begin()); it != endIt; it++) { - shared_ptr e = *it; + std::shared_ptr e = *it; int xc = e->xChunk; int zc = e->zChunk; if (e->inChunk && hasChunk(xc, zc)) @@ -809,16 +809,16 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() //for (int i = 0; i < entities.size(); i++) EnterCriticalSection(&m_entitiesCS); - vector >::iterator it = entities.begin(); + std::vector >::iterator it = entities.begin(); while( it != entities.end() ) { - shared_ptr e = *it;//entities.at(i); + std::shared_ptr e = *it;//entities.at(i); if (e->riding != NULL) { if (e->riding->removed || e->riding->rider.lock() != e) { - e->riding->rider = weak_ptr(); + e->riding->rider = std::weak_ptr(); e->riding = nullptr; } else @@ -853,7 +853,7 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection *c, bool sendDisc { if( sendDisconnect ) { - c->sendAndDisconnect( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); + c->sendAndDisconnect( std::shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); } AUTO_VAR(it, find( connections.begin(), connections.end(), c )); @@ -886,7 +886,7 @@ void MultiPlayerLevel::removeUnusedTileEntitiesInRegion(int x0, int y0, int z0, for (unsigned int i = 0; i < tileEntityList.size();) { bool removed = false; - shared_ptr te = tileEntityList[i]; + std::shared_ptr te = tileEntityList[i]; if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1) { LevelChunk *lc = getChunk(te->x >> 4, te->z >> 4); diff --git a/Minecraft.Client/Level/MultiPlayerLevel.h b/Minecraft.Client/Level/MultiPlayerLevel.h index d2a7beb2e..ac6ed0812 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.h +++ b/Minecraft.Client/Level/MultiPlayerLevel.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include "../../Minecraft.World/Util/HashExtension.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.h" @@ -8,7 +8,7 @@ using namespace std; class ClientConnection; class MultiPlayerChunkCache; -using namespace std; + class MultiPlayerLevel : public Level { @@ -22,7 +22,7 @@ private: ResetInfo(int x, int y, int z, int tile, int data); }; - vector updatesToReset; // 4J - was linked list but vector seems more appropriate + std::vector updatesToReset; // 4J - was linked list but vector seems more appropriate bool m_bEnableResetChanges; // 4J Added public: void unshareChunkAt(int x, int z); // 4J - added @@ -34,7 +34,7 @@ private: int unshareCheckZ; // 4J - added int compressCheckX; // 4J - added int compressCheckZ; // 4J - added - vector connections; // 4J Stu - Made this a vector as we can have more than one local connection + std::vector connections; // 4J Stu - Made this a vector as we can have more than one local connection MultiPlayerChunkCache *chunkCache; Minecraft *minecraft; @@ -54,21 +54,21 @@ public: void setChunkVisible(int x, int z, bool visible); private: - unordered_map, IntKeyHash2, IntKeyEq> entitiesById; // 4J - was IntHashMap - unordered_set > forced; - unordered_set > reEntries; + std::unordered_map, IntKeyHash2, IntKeyEq> entitiesById; // 4J - was IntHashMap + std::unordered_set > forced; + std::unordered_set > reEntries; public: - virtual bool addEntity(shared_ptr e); - virtual void removeEntity(shared_ptr e); + virtual bool addEntity(std::shared_ptr e); + virtual void removeEntity(std::shared_ptr e); protected: - virtual void entityAdded(shared_ptr e); - virtual void entityRemoved(shared_ptr e); + virtual void entityAdded(std::shared_ptr e); + virtual void entityRemoved(std::shared_ptr e); public: - void putEntity(int id, shared_ptr e); - shared_ptr getEntity(int id); - shared_ptr removeEntity(int id); - virtual void removeEntities(vector > *list); // 4J Added override + void putEntity(int id, std::shared_ptr e); + std::shared_ptr getEntity(int id); + std::shared_ptr removeEntity(int id); + virtual void removeEntities(std::vector > *list); // 4J Added override virtual bool setDataNoUpdate(int x, int y, int z, int data); virtual bool setTileAndDataNoUpdate(int x, int y, int z, int tile, int data); virtual bool setTileNoUpdate(int x, int y, int z, int tile); @@ -82,12 +82,12 @@ protected: public: void animateTickDoWork(); // 4J added - unordered_set chunksToAnimate; // 4J added + std::unordered_set chunksToAnimate; // 4J added public: void removeAllPendingEntityRemovals(); - virtual void playSound(shared_ptr entity, int iSound, float volume, float pitch); + virtual void playSound(std::shared_ptr entity, int iSound, float volume, float pitch); virtual void playLocalSound(double x, double y, double z, int iSound, float volume, float pitch, float fClipSoundDist=16.0f); diff --git a/Minecraft.Client/Level/ServerLevel.cpp b/Minecraft.Client/Level/ServerLevel.cpp index 5a3fa9789..3326dcf98 100644 --- a/Minecraft.Client/Level/ServerLevel.cpp +++ b/Minecraft.Client/Level/ServerLevel.cpp @@ -91,7 +91,7 @@ void ServerLevel::staticCtor() }; -ServerLevel::ServerLevel(MinecraftServer *server, shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings) : Level(levelStorage, levelName, levelSettings, Dimension::getNew(dimension), false) +ServerLevel::ServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const std::wstring& levelName, int dimension, LevelSettings *levelSettings) : Level(levelStorage, levelName, levelSettings, Dimension::getNew(dimension), false) { InitializeCriticalSection(&m_limiterCS); InitializeCriticalSection(&m_tickNextTickCS); @@ -277,10 +277,10 @@ void ServerLevel::tick() Biome::MobSpawnerData *ServerLevel::getRandomMobSpawnAt(MobCategory *mobCategory, int x, int y, int z) { - vector *mobList = getChunkSource()->getMobsAt(mobCategory, x, y, z); + std::vector *mobList = getChunkSource()->getMobsAt(mobCategory, x, y, z); if (mobList == NULL || mobList->empty()) return NULL; - return (Biome::MobSpawnerData *) WeighedRandom::getRandomItem(random, (vector *)mobList); + return (Biome::MobSpawnerData *) WeighedRandom::getRandomItem(random, (std::vector *)mobList); } void ServerLevel::updateSleepingPlayerList() @@ -289,7 +289,7 @@ void ServerLevel::updateSleepingPlayerList() m_bAtLeastOnePlayerSleeping = false; AUTO_VAR(itEnd, players.end()); - for (vector >::iterator it = players.begin(); it != itEnd; it++) + for (std::vector >::iterator it = players.begin(); it != itEnd; it++) { if (!(*it)->isSleeping()) { @@ -310,7 +310,7 @@ void ServerLevel::awakenAllPlayers() m_bAtLeastOnePlayerSleeping = false; AUTO_VAR(itEnd, players.end()); - for (vector >::iterator it = players.begin(); it != itEnd; it++) + for (std::vector >::iterator it = players.begin(); it != itEnd; it++) { if ((*it)->isSleeping()) { @@ -335,7 +335,7 @@ bool ServerLevel::allPlayersAreSleeping() { // all players are sleeping, but have they slept long enough? AUTO_VAR(itEnd, players.end()); - for (vector >::iterator it = players.begin(); it != itEnd; it++ ) + for (std::vector >::iterator it = players.begin(); it != itEnd; it++ ) { // System.out.println(player->entityId + ": " + player->getSleepTimer()); if (! (*it)->isSleepingLongEnough()) @@ -467,7 +467,7 @@ void ServerLevel::tickTiles() if (isRainingAt(x, y, z)) { - addGlobalEntity( shared_ptr( new LightningBolt(this, x, y, z) ) ); + addGlobalEntity( std::shared_ptr( new LightningBolt(this, x, y, z) ) ); lightningTime = 2; } } @@ -625,10 +625,10 @@ bool ServerLevel::tickPendingTicks(bool force) return retval; } -vector *ServerLevel::fetchTicksInChunk(LevelChunk *chunk, bool remove) +std::vector *ServerLevel::fetchTicksInChunk(LevelChunk *chunk, bool remove) { EnterCriticalSection(&m_tickNextTickCS); - vector *results = new vector; + std::vector *results = new std::vector; ChunkPos *pos = chunk->getPos(); int west = pos->x << 4; @@ -665,23 +665,23 @@ vector *ServerLevel::fetchTicksInChunk(LevelChunk *chunk, bool return results; } -void ServerLevel::tick(shared_ptr e, bool actual) +void ServerLevel::tick(std::shared_ptr e, bool actual) { if (!server->isAnimals() && ((e->GetType() & eTYPE_ANIMAL) || (e->GetType() & eTYPE_WATERANIMAL))) { e->remove(); } - if (!server->isNpcsEnabled() && (dynamic_pointer_cast(e) != NULL)) + if (!server->isNpcsEnabled() && (std::dynamic_pointer_cast(e) != NULL)) { e->remove(); } - if (e->rider.lock() == NULL || (dynamic_pointer_cast(e->rider.lock())==NULL) ) // 4J - was !(e->rider instanceof Player) + if (e->rider.lock() == NULL || (std::dynamic_pointer_cast(e->rider.lock())==NULL) ) // 4J - was !(e->rider instanceof Player) { Level::tick(e, actual); } } -void ServerLevel::forceTick(shared_ptr e, bool actual) +void ServerLevel::forceTick(std::shared_ptr e, bool actual) { Level::tick(e, actual); } @@ -693,12 +693,12 @@ ChunkSource *ServerLevel::createChunkSource() return cache; } -vector > *ServerLevel::getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1) +std::vector > *ServerLevel::getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1) { - vector > *result = new vector >; + std::vector > *result = new std::vector >; for (unsigned int i = 0; i < tileEntityList.size(); i++) { - shared_ptr te = tileEntityList[i]; + std::shared_ptr te = tileEntityList[i]; if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1) { result->push_back(te); @@ -707,7 +707,7 @@ vector > *ServerLevel::getTileEntitiesInRegion(int x0, in return result; } -bool ServerLevel::mayInteract(shared_ptr player, int xt, int yt, int zt, int content) +bool ServerLevel::mayInteract(std::shared_ptr player, int xt, int yt, int zt, int content) { // 4J-PB - This will look like a bug to players, and we really should have a message to explain why we're not allowing lava to be placed at or near a spawn point // We'll need to do this in a future update @@ -750,7 +750,7 @@ void ServerLevel::setInitialSpawn(LevelSettings *levelSettings) isFindingSpawn = true; BiomeSource *biomeSource = dimension->biomeSource; - vector playerSpawnBiomes = biomeSource->getPlayerSpawnBiomes(); + std::vector playerSpawnBiomes = biomeSource->getPlayerSpawnBiomes(); Random random(getSeed()); TilePos *findBiome = biomeSource->findBiome(0, 0, 16 * 16, playerSpawnBiomes, &random); @@ -814,7 +814,7 @@ void ServerLevel::generateBonusItemsNearSpawn() if( getTile( x, y, z ) == Tile::chest_Id ) { - shared_ptr chest = dynamic_pointer_cast(getTileEntity(x, y, z)); + std::shared_ptr chest = std::dynamic_pointer_cast(getTileEntity(x, y, z)); if (chest != NULL) { if( chest->isBonusChest ) @@ -896,7 +896,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut { // 4J Stu - This will come in a later change anyway // clean cache - vector *loadedChunkList = cache->getLoadedChunkList(); + std::vector *loadedChunkList = cache->getLoadedChunkList(); for (AUTO_VAR(it, loadedChunkList->begin()); it != loadedChunkList->end(); ++it) { LevelChunk *lc = *it; @@ -948,11 +948,11 @@ void ServerLevel::saveLevelData() savedDataStorage->save(); } -void ServerLevel::entityAdded(shared_ptr e) +void ServerLevel::entityAdded(std::shared_ptr e) { Level::entityAdded(e); entitiesById[e->entityId] = e; - vector > *es = e->getSubEntities(); + std::vector > *es = e->getSubEntities(); if (es != NULL) { //for (int i = 0; i < es.length; i++) @@ -964,11 +964,11 @@ void ServerLevel::entityAdded(shared_ptr e) entityAddedExtra(e); // 4J added } -void ServerLevel::entityRemoved(shared_ptr e) +void ServerLevel::entityRemoved(std::shared_ptr e) { Level::entityRemoved(e); entitiesById.erase(e->entityId); - vector > *es = e->getSubEntities(); + std::vector > *es = e->getSubEntities(); if (es != NULL) { //for (int i = 0; i < es.length; i++) @@ -980,32 +980,32 @@ void ServerLevel::entityRemoved(shared_ptr e) entityRemovedExtra(e); // 4J added } -shared_ptr ServerLevel::getEntity(int id) +std::shared_ptr ServerLevel::getEntity(int id) { return entitiesById[id]; } -bool ServerLevel::addGlobalEntity(shared_ptr e) +bool ServerLevel::addGlobalEntity(std::shared_ptr e) { if (Level::addGlobalEntity(e)) { - server->getPlayers()->broadcast(e->x, e->y, e->z, 512, dimension->id, shared_ptr( new AddGlobalEntityPacket(e) ) ); + server->getPlayers()->broadcast(e->x, e->y, e->z, 512, dimension->id, std::shared_ptr( new AddGlobalEntityPacket(e) ) ); return true; } return false; } -void ServerLevel::broadcastEntityEvent(shared_ptr e, uint8_t event) +void ServerLevel::broadcastEntityEvent(std::shared_ptr e, uint8_t event) { - shared_ptr p = shared_ptr( new EntityEventPacket(e->entityId, event) ); + std::shared_ptr p = std::shared_ptr( new EntityEventPacket(e->entityId, event) ); server->getLevel(dimension->id)->getTracker()->broadcastAndSend(e, p); } -shared_ptr ServerLevel::explode(shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks) +std::shared_ptr ServerLevel::explode(std::shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks) { // instead of calling super, we run the same explosion code here except // we don't generate any particles - shared_ptr explosion = shared_ptr( new Explosion(this, source, x, y, z, r) ); + std::shared_ptr explosion = std::shared_ptr( new Explosion(this, source, x, y, z, r) ); explosion->fire = fire; explosion->destroyBlocks = destroyBlocks; explosion->explode(); @@ -1016,10 +1016,10 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, explosion->toBlow.clear(); } - vector > sentTo; + std::vector > sentTo; for(AUTO_VAR(it, players.begin()); it != players.end(); ++it) { - shared_ptr player = dynamic_pointer_cast(*it); + std::shared_ptr player = std::dynamic_pointer_cast(*it); if (player->dimension != dimension->id) continue; bool knockbackOnly = false; @@ -1034,7 +1034,7 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, { for(unsigned int j = 0; j < sentTo.size(); j++ ) { - shared_ptr player2 = sentTo[j]; + std::shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { @@ -1049,7 +1049,7 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, Vec3 *knockbackVec = explosion->getHitPlayerKnockback(player); //app.DebugPrintf("Sending %s with knockback (%f,%f,%f)\n", knockbackOnly?"knockbackOnly":"allExplosion",knockbackVec->x,knockbackVec->y,knockbackVec->z); // If the player is not the primary on the system, then we only want to send info for the knockback - player->connection->send( shared_ptr( new ExplodePacket(x, y, z, r, &explosion->toBlow, knockbackVec, knockbackOnly))); + player->connection->send( std::shared_ptr( new ExplodePacket(x, y, z, r, &explosion->toBlow, knockbackVec, knockbackOnly))); sentTo.push_back( player ); } } @@ -1088,7 +1088,7 @@ void ServerLevel::runTileEvents() if (doTileEvent(&(*it))) { TileEventData te = *it; - server->getPlayers()->broadcast(te.getX(), te.getY(), te.getZ(), 64, dimension->id, shared_ptr( new TileEventPacket(te.getX(), te.getY(), te.getZ(), te.getTile(), te.getParamA(), te.getParamB()))); + server->getPlayers()->broadcast(te.getX(), te.getY(), te.getZ(), 64, dimension->id, std::shared_ptr( new TileEventPacket(te.getX(), te.getY(), te.getZ(), te.getTile(), te.getParamA(), te.getParamB()))); } } tileEvents[runList].clear(); @@ -1119,11 +1119,11 @@ void ServerLevel::tickWeather() { if (wasRaining) { - server->getPlayers()->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) ); } else { - server->getPlayers()->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) ); } } @@ -1144,7 +1144,7 @@ void ServerLevel::setTimeAndAdjustTileTicks(__int64 newTime) __int64 delta = newTime - levelData->getTime(); // 4J - can't directly adjust m_delay in a set as it has a const interator, since changing values in here might change the ordering of the elements in the set. // Instead move to a vector, do the adjustment, put back in the set. - vector temp; + std::vector temp; for(AUTO_VAR(it, tickNextTickList.begin()); it != tickNextTickList.end(); ++it) { temp.push_back(*it); @@ -1185,10 +1185,10 @@ void ServerLevel::runQueuedSendTileUpdates() } // 4J - added special versions of addEntity and extra processing on entity removed and added so we can limit the number of itementities created -bool ServerLevel::addEntity(shared_ptr e) +bool ServerLevel::addEntity(std::shared_ptr e) { // If its an item entity, and we've got to our capacity, delete the oldest - if( dynamic_pointer_cast(e) != NULL ) + if( std::dynamic_pointer_cast(e) != NULL ) { // printf("Adding item entity count %d\n",m_itemEntities.size()); EnterCriticalSection(&m_limiterCS); @@ -1200,7 +1200,7 @@ bool ServerLevel::addEntity(shared_ptr e) LeaveCriticalSection(&m_limiterCS); } // If its an hanging entity, and we've got to our capacity, delete the oldest - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { // printf("Adding item entity count %d\n",m_itemEntities.size()); EnterCriticalSection(&m_limiterCS); @@ -1217,7 +1217,7 @@ bool ServerLevel::addEntity(shared_ptr e) LeaveCriticalSection(&m_limiterCS); } // If its an arrow entity, and we've got to our capacity, delete the oldest - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { // printf("Adding arrow entity count %d\n",m_arrowEntities.size()); EnterCriticalSection(&m_limiterCS); @@ -1229,7 +1229,7 @@ bool ServerLevel::addEntity(shared_ptr e) LeaveCriticalSection(&m_limiterCS); } // If its an experience orb entity, and we've got to our capacity, delete the oldest - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { // printf("Adding arrow entity count %d\n",m_arrowEntities.size()); EnterCriticalSection(&m_limiterCS); @@ -1244,43 +1244,43 @@ bool ServerLevel::addEntity(shared_ptr e) } // Maintain a cound of primed tnt & falling tiles in this level -void ServerLevel::entityAddedExtra(shared_ptr e) +void ServerLevel::entityAddedExtra(std::shared_ptr e) { - if( dynamic_pointer_cast(e) != NULL ) + if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); m_itemEntities.push_back(e); // printf("entity added: item entity count now %d\n",m_itemEntities.size()); LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); m_hangingEntities.push_back(e); // printf("entity added: item entity count now %d\n",m_itemEntities.size()); LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); m_arrowEntities.push_back(e); // printf("entity added: arrow entity count now %d\n",m_arrowEntities.size()); LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); m_experienceOrbEntities.push_back(e); // printf("entity added: experience orb entity count now %d\n",m_arrowEntities.size()); LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); m_primedTntCount++; LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); m_fallingTileCount++; @@ -1289,9 +1289,9 @@ void ServerLevel::entityAddedExtra(shared_ptr e) } // Maintain a cound of primed tnt & falling tiles in this level, and remove any item entities from our list -void ServerLevel::entityRemovedExtra(shared_ptr e) +void ServerLevel::entityRemovedExtra(std::shared_ptr e) { - if( dynamic_pointer_cast(e) != NULL ) + if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: item entity count %d\n",m_itemEntities.size()); @@ -1304,7 +1304,7 @@ void ServerLevel::entityRemovedExtra(shared_ptr e) // printf("entity removed: item entity count now %d\n",m_itemEntities.size()); LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: item entity count %d\n",m_itemEntities.size()); @@ -1317,7 +1317,7 @@ void ServerLevel::entityRemovedExtra(shared_ptr e) // printf("entity removed: item entity count now %d\n",m_itemEntities.size()); LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: arrow entity count %d\n",m_arrowEntities.size()); @@ -1330,7 +1330,7 @@ void ServerLevel::entityRemovedExtra(shared_ptr e) // printf("entity removed: arrow entity count now %d\n",m_arrowEntities.size()); LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: experience orb entity count %d\n",m_arrowEntities.size()); @@ -1343,13 +1343,13 @@ void ServerLevel::entityRemovedExtra(shared_ptr e) // printf("entity removed: experience orb entity count now %d\n",m_arrowEntities.size()); LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); m_primedTntCount--; LeaveCriticalSection(&m_limiterCS); } - else if( dynamic_pointer_cast(e) != NULL ) + else if( std::dynamic_pointer_cast(e) != NULL ) { EnterCriticalSection(&m_limiterCS); m_fallingTileCount--; diff --git a/Minecraft.Client/Level/ServerLevel.h b/Minecraft.Client/Level/ServerLevel.h index 6e2a90b3c..3605eb195 100644 --- a/Minecraft.Client/Level/ServerLevel.h +++ b/Minecraft.Client/Level/ServerLevel.h @@ -6,7 +6,7 @@ class MinecraftServer; class Node; class EntityTracker; class PlayerChunkMap; -using namespace std; + class ServerLevel : public Level { @@ -18,10 +18,10 @@ private: PlayerChunkMap *chunkMap; CRITICAL_SECTION m_tickNextTickCS; // 4J added - set tickNextTickList; // 4J Was TreeSet - unordered_set tickNextTickSet; // 4J Was HashSet + std::set tickNextTickList; // 4J Was TreeSet + std::unordered_set tickNextTickSet; // 4J Was HashSet - vector m_queuedSendTileUpdates; // 4J added + std::vector m_queuedSendTileUpdates; // 4J added CRITICAL_SECTION m_csQueueSendTileUpdates; protected: @@ -37,11 +37,11 @@ private: bool m_bAtLeastOnePlayerSleeping; // 4J Added static WeighedTreasureArray RANDOM_BONUS_ITEMS; // 4J - brought forward from 1.3.2 - vector tileEvents[2]; + std::vector tileEvents[2]; int activeTileEventsList; public: static void staticCtor(); - ServerLevel(MinecraftServer *server, shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings); + ServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const std::wstring& levelName, int dimension, LevelSettings *levelSettings); ~ServerLevel(); void tick(); Biome::MobSpawnerData *getRandomMobSpawnAt(MobCategory *mobCategory, int x, int y, int z); @@ -64,16 +64,16 @@ public: void forceAddTileTick(int x, int y, int z, int tileId, int tickDelay); void tickEntities(); bool tickPendingTicks(bool force); - vector *fetchTicksInChunk(LevelChunk *chunk, bool remove); - virtual void tick(shared_ptr e, bool actual); - void forceTick(shared_ptr e, bool actual); + std::vector *fetchTicksInChunk(LevelChunk *chunk, bool remove); + virtual void tick(std::shared_ptr e, bool actual); + void forceTick(std::shared_ptr e, bool actual); bool AllPlayersAreSleeping() { return allPlayersSleeping;} // 4J added for a message to other players bool isAtLeastOnePlayerSleeping() { return m_bAtLeastOnePlayerSleeping;} protected: ChunkSource *createChunkSource(); // 4J - was virtual, but was called from parent ctor public: - vector > *getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1); - virtual bool mayInteract(shared_ptr player, int xt, int yt, int zt, int id); + std::vector > *getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1); + virtual bool mayInteract(std::shared_ptr player, int xt, int yt, int zt, int id); protected: virtual void initializeLevel(LevelSettings *settings); virtual void setInitialSpawn(LevelSettings *settings); @@ -90,16 +90,16 @@ public: private: void saveLevelData(); - typedef unordered_map , IntKeyHash2, IntKeyEq> intEntityMap; + typedef std::unordered_map , IntKeyHash2, IntKeyEq> intEntityMap; intEntityMap entitiesById; // 4J - was IntHashMap, using same hashing function as this uses protected: - virtual void entityAdded(shared_ptr e); - virtual void entityRemoved(shared_ptr e); + virtual void entityAdded(std::shared_ptr e); + virtual void entityRemoved(std::shared_ptr e); public: - shared_ptr getEntity(int id); - virtual bool addGlobalEntity(shared_ptr e); - void broadcastEntityEvent(shared_ptr e, uint8_t event); - virtual shared_ptr explode(shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks); + std::shared_ptr getEntity(int id); + virtual bool addGlobalEntity(std::shared_ptr e); + void broadcastEntityEvent(std::shared_ptr e, uint8_t event); + virtual std::shared_ptr explode(std::shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks); virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1); private: @@ -134,14 +134,14 @@ public: int m_primedTntCount; int m_fallingTileCount; CRITICAL_SECTION m_limiterCS; - list< shared_ptr > m_itemEntities; - list< shared_ptr > m_hangingEntities; - list< shared_ptr > m_arrowEntities; - list< shared_ptr > m_experienceOrbEntities; + std::list< std::shared_ptr > m_itemEntities; + std::list< std::shared_ptr > m_hangingEntities; + std::list< std::shared_ptr > m_arrowEntities; + std::list< std::shared_ptr > m_experienceOrbEntities; - virtual bool addEntity(shared_ptr e); - void entityAddedExtra(shared_ptr e); - void entityRemovedExtra(shared_ptr e); + virtual bool addEntity(std::shared_ptr e); + void entityAddedExtra(std::shared_ptr e); + void entityRemovedExtra(std::shared_ptr e); virtual bool newPrimedTntAllowed(); virtual bool newFallingTileAllowed(); diff --git a/Minecraft.Client/Level/ServerLevelListener.cpp b/Minecraft.Client/Level/ServerLevelListener.cpp index f77563271..ac92c1657 100644 --- a/Minecraft.Client/Level/ServerLevelListener.cpp +++ b/Minecraft.Client/Level/ServerLevelListener.cpp @@ -20,7 +20,7 @@ ServerLevelListener::ServerLevelListener(MinecraftServer *server, ServerLevel *l // 4J removed - /* -void ServerLevelListener::addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za) +void ServerLevelListener::addParticle(const std::wstring& name, double x, double y, double z, double xa, double ya, double za) { } */ @@ -33,22 +33,22 @@ void ServerLevelListener::allChanged() { } -void ServerLevelListener::entityAdded(shared_ptr entity) +void ServerLevelListener::entityAdded(std::shared_ptr entity) { MemSect(10); level->getTracker()->addEntity(entity); MemSect(0); } -void ServerLevelListener::entityRemoved(shared_ptr entity) +void ServerLevelListener::entityRemoved(std::shared_ptr entity) { level->getTracker()->removeEntity(entity); } // 4J added -void ServerLevelListener::playerRemoved(shared_ptr entity) +void ServerLevelListener::playerRemoved(std::shared_ptr entity) { - shared_ptr player = dynamic_pointer_cast(entity); + std::shared_ptr player = std::dynamic_pointer_cast(entity); player->getLevel()->getTracker()->removePlayer(entity); } @@ -62,11 +62,11 @@ void ServerLevelListener::playSound(int iSound, double x, double y, double z, fl { // 4J-PB - I don't want to broadcast player sounds to my local machine, since we're already playing these in the LevelRenderer::playSound. // The PC version does seem to do this and the result is I can stop walking , and then I'll hear my footstep sound with a delay - server->getPlayers()->broadcast(x, y, z, volume > 1 ? 16 * volume : 16, level->dimension->id, shared_ptr(new LevelSoundPacket(iSound, x, y, z, volume, pitch))); + server->getPlayers()->broadcast(x, y, z, volume > 1 ? 16 * volume : 16, level->dimension->id, std::shared_ptr(new LevelSoundPacket(iSound, x, y, z, volume, pitch))); } } -void ServerLevelListener::playSound(shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist) +void ServerLevelListener::playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist) { if(iSound < 0) { @@ -76,8 +76,8 @@ void ServerLevelListener::playSound(shared_ptr entity,int iSound, double { // 4J-PB - I don't want to broadcast player sounds to my local machine, since we're already playing these in the LevelRenderer::playSound. // The PC version does seem to do this and the result is I can stop walking , and then I'll hear my footstep sound with a delay - shared_ptr player= dynamic_pointer_cast(entity); - server->getPlayers()->broadcast(player,x, y, z, volume > 1 ? 16 * volume : 16, level->dimension->id, shared_ptr(new LevelSoundPacket(iSound, x, y, z, volume, pitch))); + std::shared_ptr player= std::dynamic_pointer_cast(entity); + server->getPlayers()->broadcast(player,x, y, z, volume > 1 ? 16 * volume : 16, level->dimension->id, std::shared_ptr(new LevelSoundPacket(iSound, x, y, z, volume, pitch))); } } @@ -98,13 +98,13 @@ void ServerLevelListener::tileLightChanged(int x, int y, int z) { } -void ServerLevelListener::playStreamingMusic(const wstring& name, int x, int y, int z) +void ServerLevelListener::playStreamingMusic(const std::wstring& name, int x, int y, int z) { } -void ServerLevelListener::levelEvent(shared_ptr source, int type, int x, int y, int z, int data) +void ServerLevelListener::levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data) { - server->getPlayers()->broadcast(source, x, y, z, 64, level->dimension->id, shared_ptr( new LevelEventPacket(type, x, y, z, data) ) ); + server->getPlayers()->broadcast(source, x, y, z, 64, level->dimension->id, std::shared_ptr( new LevelEventPacket(type, x, y, z, data) ) ); } void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z, int progress) @@ -112,7 +112,7 @@ void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z, int p //for (ServerPlayer p : server->getPlayers()->players) for(AUTO_VAR(it, server->getPlayers()->players.begin()); it != server->getPlayers()->players.end(); ++it) { - shared_ptr p = *it; + std::shared_ptr p = *it; if (p == NULL || p->level != level || p->entityId == id) continue; double xd = (double) x - p->x; double yd = (double) y - p->y; @@ -120,7 +120,7 @@ void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z, int p if (xd * xd + yd * yd + zd * zd < 32 * 32) { - p->connection->send(shared_ptr(new TileDestructionPacket(id, x, y, z, progress))); + p->connection->send(std::shared_ptr(new TileDestructionPacket(id, x, y, z, progress))); } } } \ No newline at end of file diff --git a/Minecraft.Client/Level/ServerLevelListener.h b/Minecraft.Client/Level/ServerLevelListener.h index 3af0a977e..d5ba2cbc2 100644 --- a/Minecraft.Client/Level/ServerLevelListener.h +++ b/Minecraft.Client/Level/ServerLevelListener.h @@ -15,19 +15,19 @@ private: public: ServerLevelListener(MinecraftServer *server, ServerLevel *level); - // 4J removed - virtual void addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za); + // 4J removed - virtual void addParticle(const std::wstring& name, double x, double y, double z, double xa, double ya, double za); virtual void addParticle(ePARTICLE_TYPE name, double x, double y, double z, double xa, double ya, double za); // 4J added virtual void allChanged(); - virtual void entityAdded(shared_ptr entity); - virtual void entityRemoved(shared_ptr entity); - virtual void playerRemoved(shared_ptr entity); // 4J added - for when a player is removed from the level's player array, not just the entity storage + virtual void entityAdded(std::shared_ptr entity); + virtual void entityRemoved(std::shared_ptr entity); + virtual void playerRemoved(std::shared_ptr entity); // 4J added - for when a player is removed from the level's player array, not just the entity storage virtual void playSound(int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist); - virtual void playSound(shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist); + virtual void playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist); virtual void setTilesDirty(int x0, int y0, int z0, int x1, int y1, int z1, Level *level); // 4J - added level param virtual void skyColorChanged(); virtual void tileChanged(int x, int y, int z); virtual void tileLightChanged(int x, int y, int z); - virtual void playStreamingMusic(const wstring& name, int x, int y, int z); - virtual void levelEvent(shared_ptr source, int type, int x, int y, int z, int data); + virtual void playStreamingMusic(const std::wstring& name, int x, int y, int z); + virtual void levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data); virtual void destroyTileProgress(int id, int x, int y, int z, int progress); }; diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 4956e35e5..fd35aab8a 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -236,7 +236,7 @@ void Minecraft::clearConnectionFailed() app.SetDisconnectReason(DisconnectPacket::eDisconnect_None); } -void Minecraft::connectTo(const wstring& server, int port) +void Minecraft::connectTo(const std::wstring& server, int port) { connectToIp = server; connectToPort = port; @@ -489,7 +489,7 @@ File Minecraft::getWorkingDirectory() return workDir; } -File Minecraft::getWorkingDirectory(const wstring& applicationName) +File Minecraft::getWorkingDirectory(const std::wstring& applicationName) { #if 0 // 4J - original version @@ -514,7 +514,7 @@ File Minecraft::getWorkingDirectory(const wstring& applicationName) if (!workingDirectory.exists()) if (!workingDirectory.mkdirs()) throw new RuntimeException("The working directory could not be created: " + workingDirectory); return workingDirectory; #else - wstring userHome = L"home"; // 4J - TODO + std::wstring userHome = L"home"; // 4J - TODO File workingDirectory(userHome, applicationName); // 4J Removed //if (!workingDirectory.exists()) @@ -620,7 +620,7 @@ void Minecraft::setScreen(Screen *screen) }*/ } -void Minecraft::checkGlError(const wstring& string) +void Minecraft::checkGlError(const std::wstring& string) { // 4J - TODO } @@ -977,7 +977,7 @@ bool Minecraft::addLocalPlayer(int idx) if(success) { app.DebugPrintf("Adding temp local player on pad %d\n", idx); - localplayers[idx] = shared_ptr( new MultiplayerLocalPlayer(this, level, user, NULL ) ); + localplayers[idx] = std::shared_ptr( new MultiplayerLocalPlayer(this, level, user, NULL ) ); localgameModes[idx] = NULL; updatePlayerViewportAssignments(); @@ -1025,7 +1025,7 @@ void Minecraft::addPendingLocalConnection(int idx, ClientConnection *connection) m_pendingLocalConnections[idx] = connection; } -shared_ptr Minecraft::createExtraLocalPlayer(int idx, const wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= NULL*/,MultiPlayerLevel *levelpassedin) +std::shared_ptr Minecraft::createExtraLocalPlayer(int idx, const std::wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= NULL*/,MultiPlayerLevel *levelpassedin) { if( clientConnection == NULL) return nullptr; @@ -1037,7 +1037,7 @@ shared_ptr Minecraft::createExtraLocalPlayer(int idx, co // A temp player displaying a connecting screen tempScreenSection = localplayers[idx]->m_iScreenSection; } - wstring prevname = user->name; + std::wstring prevname = user->name; user->name = name; // Don't need this any more @@ -1141,7 +1141,7 @@ void Minecraft::removeLocalPlayerIdx(int idx) { if( getLevel( localplayers[idx]->dimension )->isClientSide ) { - shared_ptr mplp = localplayers[idx]; + std::shared_ptr mplp = localplayers[idx]; ( (MultiPlayerLevel *)getLevel( localplayers[idx]->dimension ) )->removeClientConnection(mplp->connection, true); delete mplp->connection; mplp->connection = NULL; @@ -1163,7 +1163,7 @@ void Minecraft::removeLocalPlayerIdx(int idx) } else if( m_pendingLocalConnections[idx] != NULL ) { - m_pendingLocalConnections[idx]->sendAndDisconnect( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );; + m_pendingLocalConnections[idx]->sendAndDisconnect( std::shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );; delete m_pendingLocalConnections[idx]; m_pendingLocalConnections[idx] = NULL; g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); @@ -1584,7 +1584,7 @@ void Minecraft::run_middle() else { // create the localplayer - shared_ptr player = localplayers[i]; + std::shared_ptr player = localplayers[i]; if( player == NULL) { player = createExtraLocalPlayer(i, (convStringToWstring( ProfileManager.GetGamertag(i) )).c_str(), i, level->dimension->id); @@ -1800,7 +1800,7 @@ void Minecraft::run_middle() // if (pause) timer.a = 1; PIXBeginNamedEvent(0,"Sound engine update"); - soundEngine->tick((shared_ptr *)localplayers, timer->a); + soundEngine->tick((std::shared_ptr *)localplayers, timer->a); PIXEndNamedEvent(); PIXBeginNamedEvent(0,"Light update"); @@ -2345,7 +2345,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) else { // no hit result, but we may have something in our hand that we can do something with - shared_ptr itemInstance = player->inventory->getSelected(); + std::shared_ptr itemInstance = player->inventory->getSelected(); // 4J-JEV: Moved all this here to avoid having it in 3 different places. if (itemInstance) @@ -2716,14 +2716,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // is there an object in hand? if(player->inventory->IsHeldItem()) { - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; switch(iID) { default: { - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = std::dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby() && !animal->isInLove() && (animal->getAge() == 0) && animal->isFood(heldItem)) { @@ -2740,7 +2740,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // is there an object in hand? if(player->inventory->IsHeldItem()) { - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; // It's an item @@ -2752,7 +2752,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; default: { - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = std::dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby() && !animal->isInLove() && (animal->getAge() == 0) && animal->isFood(heldItem)) { @@ -2769,7 +2769,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; // It's an item @@ -2783,13 +2783,13 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case Item::shears_Id: { if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = std::dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby()) *piUse=IDS_TOOLTIPS_SHEAR; } break; default: { - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = std::dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby() && !animal->isInLove() && (animal->getAge() == 0) && animal->isFood(heldItem)) { @@ -2811,7 +2811,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) *piAction=IDS_TOOLTIPS_MINE; // are we in the boat already? - if (dynamic_pointer_cast( player->riding ) != NULL) + if (std::dynamic_pointer_cast( player->riding ) != NULL) { *piUse=IDS_TOOLTIPS_EXIT; } @@ -2823,13 +2823,13 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case eTYPE_MINECART: *piAction=IDS_TOOLTIPS_MINE; // are we in the minecart already? - if (dynamic_pointer_cast( player->riding ) != NULL) + if (std::dynamic_pointer_cast( player->riding ) != NULL) { *piUse=IDS_TOOLTIPS_EXIT; } else { - switch(dynamic_pointer_cast(hitResult->entity)->type) + switch(std::dynamic_pointer_cast(hitResult->entity)->type) { case Minecart::RIDEABLE: *piUse=IDS_TOOLTIPS_RIDE; @@ -2842,7 +2842,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // is there an object in hand? if(player->inventory->IsHeldItem()) { - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; if(iID==Item::coal->id) @@ -2864,14 +2864,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; if(player->inventory->IsHeldItem()) { - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; switch(iID) { case Item::dye_powder_Id: { - shared_ptr sheep = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr sheep = std::dynamic_pointer_cast(hitResult->entity); // convert to tile-based color value (0 is white instead of black) int newColor = ClothTile::getTileDataForItemAuxValue(heldItem->getAuxValue()); @@ -2884,7 +2884,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case Item::shears_Id: { - shared_ptr sheep = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr sheep = std::dynamic_pointer_cast(hitResult->entity); // can only shear a sheep that hasn't been sheared if(!sheep->isSheared() ) @@ -2896,7 +2896,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; default: { - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = std::dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby() && !animal->isInLove() && (animal->getAge() == 0) && animal->isFood(heldItem)) { @@ -2911,22 +2911,22 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case eTYPE_PIG: // can ride a pig if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; - if (dynamic_pointer_cast( player->riding ) != NULL) + if (std::dynamic_pointer_cast( player->riding ) != NULL) { *piUse=IDS_TOOLTIPS_EXIT; } else { // does the pig have a saddle? - if(dynamic_pointer_cast(hitResult->entity)->hasSaddle()) + if(std::dynamic_pointer_cast(hitResult->entity)->hasSaddle()) { *piUse=IDS_TOOLTIPS_RIDE; } - else if (!dynamic_pointer_cast(hitResult->entity)->isBaby()) + else if (!std::dynamic_pointer_cast(hitResult->entity)->isBaby()) { if(player->inventory->IsHeldItem()) { - shared_ptr heldItem=player->inventory->getSelected(); + std::shared_ptr heldItem=player->inventory->getSelected(); int iID=heldItem->getItem()->id; switch(iID) @@ -2936,7 +2936,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; default: { - shared_ptr animal = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr animal = std::dynamic_pointer_cast(hitResult->entity); if(!animal->isBaby() && !animal->isInLove() && (animal->getAge() == 0) && animal->isFood(heldItem)) { @@ -2954,8 +2954,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // can be tamed, fed, and made to sit/stand, or enter love mode { int iID=-1; - shared_ptr heldItem=nullptr; - shared_ptr wolf = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr heldItem=nullptr; + std::shared_ptr wolf = std::dynamic_pointer_cast(hitResult->entity); if(player->inventory->IsHeldItem()) { @@ -3044,8 +3044,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case eTYPE_OZELOT: { int iID=-1; - shared_ptr heldItem=nullptr; - shared_ptr ocelot = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr heldItem=nullptr; + std::shared_ptr ocelot = std::dynamic_pointer_cast(hitResult->entity); if(player->inventory->IsHeldItem()) { @@ -3106,7 +3106,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case eTYPE_PLAYER: { // Fix for #58576 - TU6: Content: Gameplay: Hit button prompt is available when attacking a host who has "Invisible" option turned on - shared_ptr TargetPlayer = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr TargetPlayer = std::dynamic_pointer_cast(hitResult->entity); if(!TargetPlayer->hasInvisiblePrivilege()) // This means they are invisible, not just that they have the privilege { @@ -3119,7 +3119,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case eTYPE_ITEM_FRAME: { - shared_ptr itemFrame = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr itemFrame = std::dynamic_pointer_cast(hitResult->entity); // is the frame occupied? if(itemFrame->getItem()!=NULL) @@ -3141,7 +3141,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case eTYPE_VILLAGER: { - shared_ptr villager = dynamic_pointer_cast(hitResult->entity); + std::shared_ptr villager = std::dynamic_pointer_cast(hitResult->entity); if (!villager->isBaby()) { *piUse=IDS_TOOLTIPS_TRADE; @@ -3151,8 +3151,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case eTYPE_ZOMBIE: { - shared_ptr zomb = dynamic_pointer_cast(hitResult->entity); - shared_ptr heldItem=nullptr; + std::shared_ptr zomb = std::dynamic_pointer_cast(hitResult->entity); + std::shared_ptr heldItem=nullptr; if(player->inventory->IsHeldItem()) { @@ -3337,9 +3337,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) if((player->ullButtonsPressed&(1LL< mob = dynamic_pointer_cast(Creeper::_class->newInstance( level )); - //shared_ptr mob = dynamic_pointer_cast(Wolf::_class->newInstance( level )); - shared_ptr mob = dynamic_pointer_cast(shared_ptr(new Spider( level ))); + //std::shared_ptr mob = std::dynamic_pointer_cast(Creeper::_class->newInstance( level )); + //std::shared_ptr mob = std::dynamic_pointer_cast(Wolf::_class->newInstance( level )); + std::shared_ptr mob = std::dynamic_pointer_cast(std::shared_ptr(new Spider( level ))); mob->moveTo(player->x+1, player->y, player->z+1, level->random->nextFloat() * 360, 0); level->addEntity(mob); } @@ -3369,14 +3369,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) if((player->ullButtonsPressed&(1LL<isInputAllowed(MINECRAFT_ACTION_INVENTORY)) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->player ); + std::shared_ptr player = std::dynamic_pointer_cast( Minecraft::GetInstance()->player ); ui.PlayUISFX(eSFX_Press); app.LoadInventoryMenu(iPad,player); } if((player->ullButtonsPressed&(1LL<isInputAllowed(MINECRAFT_ACTION_CRAFTING)) { - shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->player ); + std::shared_ptr player = std::dynamic_pointer_cast( Minecraft::GetInstance()->player ); // 4J-PB - reordered the if statement so creative mode doesn't bring up the crafting table // Fix for #39014 - TU5: Creative Mode: Pressing X to access the creative menu while looking at a crafting table causes the crafting menu to display @@ -3439,8 +3439,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) #endif if( selected || wheel != 0 || (player->ullButtonsPressed&(1LL< selectedItem = player->getSelectedItem(); + std::wstring itemName = L""; + std::shared_ptr selectedItem = player->getSelectedItem(); // Dropping items happens over network, so if we only have one then assume that we dropped it and should hide the item int iCount=0; @@ -3708,7 +3708,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) setLocalPlayerIdx(idx); gameRenderer->setupCamera(timer->a, i); Camera::prepare(localplayers[idx], localplayers[idx]->ThirdPersonView() == 2); - shared_ptr cameraEntity = cameraTargetPlayer; + std::shared_ptr cameraEntity = cameraTargetPlayer; double xOff = cameraEntity->xOld + (cameraEntity->x - cameraEntity->xOld) * timer->a; double yOff = cameraEntity->yOld + (cameraEntity->y - cameraEntity->yOld) * timer->a; double zOff = cameraEntity->zOld + (cameraEntity->z - cameraEntity->zOld) * timer->a; @@ -3782,16 +3782,16 @@ bool Minecraft::isClientSide() return level != NULL && level->isClientSide; } -void Minecraft::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, const wstring& levelName, LevelSettings *levelSettings) +void Minecraft::selectLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, const std::wstring& levelName, LevelSettings *levelSettings) { } -bool Minecraft::saveSlot(int slot, const wstring& name) +bool Minecraft::saveSlot(int slot, const std::wstring& name) { return false; } -bool Minecraft::loadSlot(const wstring& userName, int slot) +bool Minecraft::loadSlot(const std::wstring& userName, int slot) { return false; } @@ -3834,8 +3834,8 @@ MultiPlayerLevel *Minecraft::getLevel(int dimension) //} // Also causing ambiguous call for some reason -// as it is matching shared_ptr from the func below with bool from this one -//void Minecraft::setLevel(Level *level, const wstring& message, bool doForceStatsSave /*= true*/) +// as it is matching std::shared_ptr from the func below with bool from this one +//void Minecraft::setLevel(Level *level, const std::wstring& message, bool doForceStatsSave /*= true*/) //{ // setLevel(level, message, NULL, doForceStatsSave); //} @@ -3848,7 +3848,7 @@ void Minecraft::forceaddLevel(MultiPlayerLevel *level) else levels[0] = level; } -void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_ptr forceInsertPlayer /*=NULL*/, bool doForceStatsSave /*=true*/, bool bPrimaryPlayerSignedOut /*=false*/) +void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, std::shared_ptr forceInsertPlayer /*=NULL*/, bool doForceStatsSave /*=true*/, bool bPrimaryPlayerSignedOut /*=false*/) { EnterCriticalSection(&m_setLevelCS); bool playerAdded = false; @@ -3913,7 +3913,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt // Delete all the player objects for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - shared_ptr mplp = localplayers[idx]; + std::shared_ptr mplp = localplayers[idx]; if(mplp != NULL && mplp->connection != NULL ) { delete mplp->connection; @@ -4106,11 +4106,11 @@ void Minecraft::prepareLevel(int title) } } -void Minecraft::fileDownloaded(const wstring& name, File *file) +void Minecraft::fileDownloaded(const std::wstring& name, File *file) { int p = (int)name.find(L"/"); - wstring category = name.substr(0, p); - wstring name2 = name.substr(p + 1); + std::wstring category = name.substr(0, p); + std::wstring name2 = name.substr(p + 1); toLower(category); if (category==L"sound") { @@ -4134,25 +4134,25 @@ void Minecraft::fileDownloaded(const wstring& name, File *file) } } -wstring Minecraft::gatherStats1() +std::wstring Minecraft::gatherStats1() { //return levelRenderer->gatherStats1(); return L"Time to autosave: " + _toString( app.SecondsToAutosave() ) + L"s"; } -wstring Minecraft::gatherStats2() +std::wstring Minecraft::gatherStats2() { return g_NetworkManager.GatherStats(); //return levelRenderer->gatherStats2(); } -wstring Minecraft::gatherStats3() +std::wstring Minecraft::gatherStats3() { return g_NetworkManager.GatherRTTStats(); //return L"P: " + particleEngine->countParticles() + L". T: " + level->gatherStats(); } -wstring Minecraft::gatherStats4() +std::wstring Minecraft::gatherStats4() { return level->gatherChunkSourceStats(); } @@ -4160,7 +4160,7 @@ wstring Minecraft::gatherStats4() void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { gameRenderer->DisableUpdateThread(); // 4J - don't do updating whilst we are adjusting the player & localplayer array - shared_ptr localPlayer = localplayers[iPad]; + std::shared_ptr localPlayer = localplayers[iPad]; level->validateSpawn(); level->removeAllPendingEntityRemovals(); @@ -4171,7 +4171,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) level->removeEntity(localPlayer); } - shared_ptr oldPlayer = localPlayer; + std::shared_ptr oldPlayer = localPlayer; cameraTargetPlayer = nullptr; // 4J-PB - copy and set the players xbox pad @@ -4260,15 +4260,15 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) gameRenderer->EnableUpdateThread(); } -void Minecraft::start(const wstring& name, const wstring& sid) +void Minecraft::start(const std::wstring& name, const std::wstring& sid) { startAndConnectTo(name, sid, L""); } -void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const wstring& url) +void Minecraft::startAndConnectTo(const std::wstring& name, const std::wstring& sid, const std::wstring& url) { bool fullScreen = false; - wstring userName = name; + std::wstring userName = name; /* 4J - removed window handling things here final Frame frame = new Frame("Minecraft"); @@ -4367,8 +4367,8 @@ int g_iMainThreadId; void Minecraft::main() { - wstring name; - wstring sessionId; + std::wstring name; + std::wstring sessionId; //g_iMainThreadId = GetCurrentThreadId(); @@ -4452,7 +4452,7 @@ bool Minecraft::renderDebug() return (m_instance != NULL && m_instance->options->renderDebug); } -bool Minecraft::handleClientSideCommand(const wstring& chatMessage) +bool Minecraft::handleClientSideCommand(const std::wstring& chatMessage) { /* 4J - TODO if (chatMessage.startsWith("/")) { @@ -4559,7 +4559,7 @@ bool mayUse = true; if(button==1 && (player->isSleeping() && level != NULL && level->isClientSide)) { -shared_ptr mplp = dynamic_pointer_cast( player ); +std::shared_ptr mplp = std::dynamic_pointer_cast( player ); if(mplp) mplp->StopSleeping(); @@ -4608,7 +4608,7 @@ gameMode->startDestroyBlock(x, y, z, hitResult->f); } else { -shared_ptr item = player->inventory->getSelected(); +std::shared_ptr item = player->inventory->getSelected(); int oldCount = item != NULL ? item->count : 0; if (gameMode->useItemOn(player, level, item, x, y, z, face)) { @@ -4634,7 +4634,7 @@ gameRenderer->itemInHandRenderer->itemPlaced(); if (mayUse && button == 1) { -shared_ptr item = player->inventory->getSelected(); +std::shared_ptr item = player->inventory->getSelected(); if (item != NULL) { if (gameMode->useItem(player, level, item)) @@ -4721,7 +4721,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP else if( ProfileManager.IsSignedInLive(iPad) && ProfileManager.AllowedToPlayMultiplayer(iPad) ) { // create the local player for the iPad - shared_ptr player = pClass->localplayers[iPad]; + std::shared_ptr player = pClass->localplayers[iPad]; if( player == NULL) { if( pClass->level->isClientSide ) @@ -4731,7 +4731,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP else { // create the local player for the iPad - shared_ptr player = pClass->localplayers[iPad]; + std::shared_ptr player = pClass->localplayers[iPad]; if( player == NULL) { player = pClass->createExtraLocalPlayer(iPad, (convStringToWstring( ProfileManager.GetGamertag(iPad) )).c_str(), iPad, pClass->level->dimension->id); @@ -4802,7 +4802,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) else { // create the local player for the iPad - shared_ptr player = pMinecraftClass->localplayers[iPad]; + std::shared_ptr player = pMinecraftClass->localplayers[iPad]; if( player == NULL) { player = pMinecraftClass->createExtraLocalPlayer(iPad, (convStringToWstring( ProfileManager.GetGamertag(iPad) )).c_str(), iPad, pMinecraftClass->level->dimension->id); @@ -4831,7 +4831,7 @@ void Minecraft::tickAllConnections() int oldIdx = getLocalPlayerIdx(); for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++ ) { - shared_ptr mplp = localplayers[i]; + std::shared_ptr mplp = localplayers[i]; if( mplp && mplp->connection) { setLocalPlayerIdx(i); @@ -4841,7 +4841,7 @@ void Minecraft::tickAllConnections() setLocalPlayerIdx(oldIdx); } -bool Minecraft::addPendingClientTextureRequest(const wstring &textureName) +bool Minecraft::addPendingClientTextureRequest(const std::wstring &textureName) { AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); if( it == m_pendingTextureRequests.end() ) @@ -4852,7 +4852,7 @@ bool Minecraft::addPendingClientTextureRequest(const wstring &textureName) return false; } -void Minecraft::handleClientTextureReceived(const wstring &textureName) +void Minecraft::handleClientTextureReceived(const std::wstring &textureName) { AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); if( it != m_pendingTextureRequests.end() ) diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index b4b7835e2..0d071fa3f 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -46,7 +46,7 @@ class PsPlusUpsellWrapper; #undef linux #endif -using namespace std; + class Minecraft { @@ -56,7 +56,7 @@ private: }; public: - static const wstring VERSION_STRING; + static const std::wstring VERSION_STRING; Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet *minecraftApplet, int width, int height, bool fullscreen); void init(); @@ -94,11 +94,11 @@ public: MultiPlayerLevel *level; LevelRenderer *levelRenderer; - shared_ptr player; + std::shared_ptr player; MultiPlayerLevelArray levels; - shared_ptr localplayers[XUSER_MAX_COUNT]; + std::shared_ptr localplayers[XUSER_MAX_COUNT]; MultiPlayerGameMode *localgameModes[XUSER_MAX_COUNT]; int localPlayerIdx; ItemInHandRenderer *localitemInHandRenderers[XUSER_MAX_COUNT]; @@ -114,7 +114,7 @@ public: void addPendingLocalConnection(int idx, ClientConnection *connection); void connectionDisconnected(int idx, DisconnectPacket::eDisconnectReason reason) { m_connectionFailed[idx] = true; m_connectionFailedReason[idx] = reason; } - shared_ptr createExtraLocalPlayer(int idx, const wstring& name, int pad, int iDimension, ClientConnection *clientConnection = NULL,MultiPlayerLevel *levelpassedin=NULL); + std::shared_ptr createExtraLocalPlayer(int idx, const std::wstring& name, int pad, int iDimension, ClientConnection *clientConnection = NULL,MultiPlayerLevel *levelpassedin=NULL); void createPrimaryLocalPlayer(int iPad); bool setLocalPlayerIdx(int idx); int getLocalPlayerIdx(); @@ -123,10 +123,10 @@ public: void updatePlayerViewportAssignments(); int unoccupiedQuadrant; // 4J - added - shared_ptr cameraTargetPlayer; + std::shared_ptr cameraTargetPlayer; ParticleEngine *particleEngine; User *user; - wstring serverDomain; + std::wstring serverDomain; Canvas *parent; bool appletMode; @@ -181,12 +181,12 @@ public: StatsCounter* stats[4]; private: - wstring connectToIp; + std::wstring connectToIp; int connectToPort; public: void clearConnectionFailed(); - void connectTo(const wstring& server, int port); + void connectTo(const std::wstring& server, int port); private: void renderLoadingScreen(); @@ -199,14 +199,14 @@ private: public: static File getWorkingDirectory(); - static File getWorkingDirectory(const wstring& applicationName); + static File getWorkingDirectory(const std::wstring& applicationName); private: static OS getPlatform(); public: LevelStorageSource *getLevelSource(); void setScreen(Screen *screen); private: - void checkGlError(const wstring& string); + void checkGlError(const std::wstring& string); #ifdef __ORBIS__ PsPlusUpsellWrapper *m_pPsPlusUpsell; @@ -215,7 +215,7 @@ private: public: void destroy(); volatile bool running; - wstring fpsString; + std::wstring fpsString; void run(); // 4J-PB - split the run into 3 parts so we can run it from our xbox game loop static Minecraft *GetInstance(); @@ -269,36 +269,36 @@ private: void reloadSound(); public: bool isClientSide(); - void selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, const wstring& levelName, LevelSettings *levelSettings); + void selectLevel(ConsoleSaveFile *saveFile, const std::wstring& levelId, const std::wstring& levelName, LevelSettings *levelSettings); //void toggleDimension(int targetDimension); - bool saveSlot(int slot, const wstring& name); - bool loadSlot(const wstring& userName, int slot); + bool saveSlot(int slot, const std::wstring& name); + bool loadSlot(const std::wstring& userName, int slot); void releaseLevel(int message); // 4J Stu - Added the doForceStatsSave param //void setLevel(Level *level, bool doForceStatsSave = true); - //void setLevel(Level *level, const wstring& message, bool doForceStatsSave = true); - void setLevel(MultiPlayerLevel *level, int message = -1, shared_ptr forceInsertPlayer = nullptr, bool doForceStatsSave = true,bool bPrimaryPlayerSignedOut=false); + //void setLevel(Level *level, const std::wstring& message, bool doForceStatsSave = true); + void setLevel(MultiPlayerLevel *level, int message = -1, std::shared_ptr forceInsertPlayer = nullptr, bool doForceStatsSave = true,bool bPrimaryPlayerSignedOut=false); // 4J-PB - added to force in the 'other' level when the main player creates the level at game load time void forceaddLevel(MultiPlayerLevel *level); void prepareLevel(int title); // 4J - changed to public - void fileDownloaded(const wstring& name, File *file); + void fileDownloaded(const std::wstring& name, File *file); // OpenGLCapabilities getOpenGLCapabilities(); // 4J - removed - wstring gatherStats1(); - wstring gatherStats2(); - wstring gatherStats3(); - wstring gatherStats4(); + std::wstring gatherStats1(); + std::wstring gatherStats2(); + std::wstring gatherStats3(); + std::wstring gatherStats4(); void respawnPlayer(int iPad,int dimension,int newEntityId); - static void start(const wstring& name, const wstring& sid); - static void startAndConnectTo(const wstring& name, const wstring& sid, const wstring& url); + static void start(const std::wstring& name, const std::wstring& sid); + static void startAndConnectTo(const std::wstring& name, const std::wstring& sid, const std::wstring& url); ClientConnection *getConnection(int iPad); // 4J Stu added iPad param static void main(); static bool renderNames(); static bool useFancyGraphics(); static bool useAmbientOcclusion(); static bool renderDebug(); - bool handleClientSideCommand(const wstring& chatMessage); + bool handleClientSideCommand(const std::wstring& chatMessage); static int maxSupportedTextureSize(); void delayTextureReload(); @@ -331,15 +331,15 @@ public: Level *animateTickLevel; // 4J added // 4J - When a client requests a texture, it should add it to here while we are waiting for it - vector m_pendingTextureRequests; - vector m_pendingGeometryRequests; // additional skin box geometry + std::vector m_pendingTextureRequests; + std::vector m_pendingGeometryRequests; // additional skin box geometry // 4J Added - bool addPendingClientTextureRequest(const wstring &textureName); - void handleClientTextureReceived(const wstring &textureName); + bool addPendingClientTextureRequest(const std::wstring &textureName); + void handleClientTextureReceived(const std::wstring &textureName); void clearPendingClientTextureRequests() { m_pendingTextureRequests.clear(); } - bool addPendingClientGeometryRequest(const wstring &textureName); - void handleClientGeometryReceived(const wstring &textureName); + bool addPendingClientGeometryRequest(const std::wstring &textureName); + void handleClientGeometryReceived(const std::wstring &textureName); void clearPendingClientGeometryRequests() { m_pendingGeometryRequests.clear(); } unsigned int getCurrentTexturePackId(); diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index f05aec2dc..c1668dbf7 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -64,7 +64,7 @@ int MinecraftServer::s_slowQueuePlayerIndex = 0; int MinecraftServer::s_slowQueueLastTime = 0; bool MinecraftServer::s_slowQueuePacketSent = false; -unordered_map MinecraftServer::ironTimers; +std::unordered_map MinecraftServer::ironTimers; MinecraftServer::MinecraftServer() { @@ -77,7 +77,7 @@ MinecraftServer::MinecraftServer() m_bLoaded = false; stopped = false; tickCount = 0; - wstring progressStatus; + std::wstring progressStatus; progress = 0; motd = L""; @@ -203,8 +203,8 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW __int64 levelNanoTime = System::nanoTime(); - wstring levelName = settings->getString(L"level-name", L"world"); - wstring levelTypeString; + std::wstring levelName = settings->getString(L"level-name", L"world"); + std::wstring levelTypeString; bool gameRuleUseFlatWorld = false; if(app.getLevelGenerationOptions() != NULL) @@ -244,7 +244,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW //settings->setProperty(L"max-build-height", maxBuildHeight); #if 0 - wstring levelSeedString = settings->getString(L"level-seed", L""); + std::wstring levelSeedString = settings->getString(L"level-seed", L""); __int64 levelSeed = (new Random())->nextLong(); if (levelSeedString.length() > 0) { @@ -378,7 +378,7 @@ void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress) DeleteCriticalSection(&m_postProcessCS); } -bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData) +bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const std::wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData) { // 4J - TODO - do with new save stuff // if (storageSource->requiresConversion(name)) @@ -398,7 +398,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring if( app.GetGameHostOption(eGameHostOption_BonusChest ) ) levelSettings->enableStartingBonusItems(); // 4J - temp - load existing level - shared_ptr storage = nullptr; + std::shared_ptr storage = nullptr; bool levelChunksNeedConverted = false; if( initData->saveData != NULL ) { @@ -416,7 +416,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring levelChunksNeedConverted = true; pSave->ConvertToLocalPlatform(); // check if we need to convert this file from PS3->PS4 - storage = shared_ptr(new McRegionLevelStorage(pSave, File(L"."), name, true)); + storage = std::shared_ptr(new McRegionLevelStorage(pSave, File(L"."), name, true)); } else { @@ -441,9 +441,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring newFormatSave = new ConsoleSaveFileSplit( L"" ); } - storage = shared_ptr(new McRegionLevelStorage(newFormatSave, File(L"."), name, true)); + storage = std::shared_ptr(new McRegionLevelStorage(newFormatSave, File(L"."), name, true)); #else - storage = shared_ptr(new McRegionLevelStorage(new ConsoleSaveFileOriginal( L"" ), File(L"."), name, true)); + storage = std::shared_ptr(new McRegionLevelStorage(new ConsoleSaveFileOriginal( L"" ), File(L"."), name, true)); #endif } @@ -750,7 +750,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring return true; } -void MinecraftServer::setProgress(const wstring& status, int progress) +void MinecraftServer::setProgress(const std::wstring& status, int progress) { progressStatus = status; this->progress = progress; @@ -1258,7 +1258,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) players->saveAll(Minecraft::GetInstance()->progressRenderer); } - players->broadcastAll( shared_ptr( new UpdateProgressPacket(20) ) ); + players->broadcastAll( std::shared_ptr( new UpdateProgressPacket(20) ) ); for (unsigned int j = 0; j < levels.length; j++) { @@ -1269,7 +1269,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) ServerLevel *level = levels[levels.length - 1 - j]; level->save(true, Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame)); - players->broadcastAll( shared_ptr( new UpdateProgressPacket(33 + (j*33) ) ) ); + players->broadcastAll( std::shared_ptr( new UpdateProgressPacket(33 + (j*33) ) ) ); } if( !s_bServerHalted ) { @@ -1282,16 +1282,16 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) case eXuiServerAction_DropItem: // Find the player, and drop the id at their feet { - shared_ptr player = players->players.at(0); + std::shared_ptr player = players->players.at(0); size_t id = (size_t) param; - player->drop( shared_ptr( new ItemInstance(id, 1, 0 ) ) ); + player->drop( std::shared_ptr( new ItemInstance(id, 1, 0 ) ) ); } break; case eXuiServerAction_SpawnMob: { - shared_ptr player = players->players.at(0); + std::shared_ptr player = players->players.at(0); eINSTANCEOF factory = (eINSTANCEOF)((size_t)param); - shared_ptr mob = dynamic_pointer_cast(EntityIO::newByEnumType(factory,player->level )); + std::shared_ptr mob = std::dynamic_pointer_cast(EntityIO::newByEnumType(factory,player->level )); mob->moveTo(player->x+1, player->y, player->z+1, player->level->random->nextFloat() * 360, 0); mob->setDespawnProtected(); // 4J added, default to being protected against despawning (has to be done after initial position is set) player->level->addEntity(mob); @@ -1319,20 +1319,20 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) } break; case eXuiServerAction_ServerSettingChanged_Gamertags: - players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_OPTIONS, app.GetGameHostOption(eGameHostOption_Gamertags)) ) ); + players->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_OPTIONS, app.GetGameHostOption(eGameHostOption_Gamertags)) ) ); break; case eXuiServerAction_ServerSettingChanged_BedrockFog: - players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All)) ) ); + players->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All)) ) ); break; case eXuiServerAction_ServerSettingChanged_Difficulty: - players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, Minecraft::GetInstance()->options->difficulty) ) ); + players->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, Minecraft::GetInstance()->options->difficulty) ) ); break; case eXuiServerAction_ExportSchematic: #ifndef _CONTENT_PACKAGE app.EnterSaveNotificationSection(); - //players->broadcastAll( shared_ptr( new UpdateProgressPacket(20) ) ); + //players->broadcastAll( std::shared_ptr( new UpdateProgressPacket(20) ) ); if( !s_bServerHalted ) { @@ -1347,7 +1347,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) wchar_t filename[128]; swprintf(filename,128,L"%ls%dx%dx%d.sch",initData->name,(initData->endX - initData->startX + 1), (initData->endY - initData->startY + 1), (initData->endZ - initData->startZ + 1)); - File dataFile = File( targetFileDir, wstring(filename) ); + File dataFile = File( targetFileDir, std::wstring(filename) ); if(dataFile.exists()) dataFile._delete(); FileOutputStream fos = FileOutputStream(dataFile); DataOutputStream dos = DataOutputStream(&fos); @@ -1370,7 +1370,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) pos->m_yRot, pos->m_elev ); - shared_ptr player = players->players.at(pos->player); + std::shared_ptr player = players->players.at(pos->player); player->debug_setPosition( pos->m_camX, pos->m_camY, pos->m_camZ, pos->m_yRot, pos->m_elev ); @@ -1427,20 +1427,20 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) void MinecraftServer::broadcastStartSavingPacket() { - players->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::START_SAVING, 0) ) );; + players->broadcastAll( std::shared_ptr( new GameEventPacket(GameEventPacket::START_SAVING, 0) ) );; } void MinecraftServer::broadcastStopSavingPacket() { if( !s_bServerHalted ) { - players->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::STOP_SAVING, 0) ) );; + players->broadcastAll( std::shared_ptr( new GameEventPacket(GameEventPacket::STOP_SAVING, 0) ) );; } } void MinecraftServer::tick() { - vector toRemove; + std::vector toRemove; for (AUTO_VAR(it, ironTimers.begin()); it != ironTimers.end(); it++ ) { int t = it->second; @@ -1469,7 +1469,7 @@ void MinecraftServer::tick() /* if(m_lastSentDifficulty != pMinecraft->options->difficulty) { m_lastSentDifficulty = pMinecraft->options->difficulty; - players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, pMinecraft->options->difficulty) ) ); + players->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, pMinecraft->options->difficulty) ) ); }*/ for (unsigned int i = 0; i < levels.length; i++) @@ -1489,7 +1489,7 @@ void MinecraftServer::tick() if (tickCount % 20 == 0) { - players->broadcastAll( shared_ptr( new SetTimePacket(level->getTime() ) ), level->dimension->id); + players->broadcastAll( std::shared_ptr( new SetTimePacket(level->getTime() ) ), level->dimension->id); } // #ifndef __PS3__ static __int64 stc = 0; @@ -1561,7 +1561,7 @@ void MinecraftServer::tick() // } } -void MinecraftServer::handleConsoleInput(const wstring& msg, ConsoleInputSource *source) +void MinecraftServer::handleConsoleInput(const std::wstring& msg, ConsoleInputSource *source) { consoleInput.push_back(new ConsoleInput(msg, source)); } @@ -1599,20 +1599,20 @@ void MinecraftServer::HaltServer(bool bPrimaryPlayerSignedOut) } } -File *MinecraftServer::getFile(const wstring& name) +File *MinecraftServer::getFile(const std::wstring& name) { return new File(name); } -void MinecraftServer::info(const wstring& string) +void MinecraftServer::info(const std::wstring& string) { } -void MinecraftServer::warn(const wstring& string) +void MinecraftServer::warn(const std::wstring& string) { } -wstring MinecraftServer::getConsoleName() +std::wstring MinecraftServer::getConsoleName() { return L"CONSOLE"; } diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 992bb7942..ced9a6c9e 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -24,8 +24,8 @@ typedef struct _LoadSaveDataThreadParam { LPVOID data; __int64 fileSize; - const wstring saveName; - _LoadSaveDataThreadParam(LPVOID data, __int64 filesize, const wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {} + const std::wstring saveName; + _LoadSaveDataThreadParam(LPVOID data, __int64 filesize, const std::wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {} } LoadSaveDataThreadParam; typedef struct _NetworkGameInitData @@ -54,24 +54,24 @@ typedef struct _NetworkGameInitData } } NetworkGameInitData; -using namespace std; + // 4J Stu - 1.0.1 updates the server to implement the ServerInterface class, but I don't think we will use any of the functions that defines so not implementing here class MinecraftServer : public ConsoleInputSource { public: - static const wstring VERSION; + static const std::wstring VERSION; static const int TICK_STATS_SPAN = SharedConstants::TICKS_PER_SECOND * 5; // static Logger logger = Logger.getLogger("Minecraft"); - static unordered_map ironTimers; + static std::unordered_map ironTimers; private: static const int DEFAULT_MINECRAFT_PORT = 25565; static const int MS_PER_TICK = 1000 / SharedConstants::TICKS_PER_SECOND; // 4J Stu - Added 1.0.1, Not needed - //wstring localIp; + //std::wstring localIp; //int port; public: ServerConnection *connection; @@ -93,19 +93,19 @@ public: int tickCount; public: - wstring progressStatus; + std::wstring progressStatus; int progress; private: -// vector tickables = new ArrayList(); // 4J - removed +// std::vector tickables = new ArrayList(); // 4J - removed CommandDispatcher *commandDispatcher; - vector consoleInput; // 4J - was synchronizedList - TODO - investigate + std::vector consoleInput; // 4J - was synchronizedList - TODO - investigate public: bool onlineMode; bool animals; bool npcs; bool pvp; bool allowFlight; - wstring motd; + std::wstring motd; int maxBuildHeight; private: @@ -127,8 +127,8 @@ private: // 4J Added - LoadSaveDataThreadParam bool initServer(__int64 seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed); void postProcessTerminate(ProgressRenderer *mcprogress); - bool loadLevel(LevelStorageSource *storageSource, const wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData); - void setProgress(const wstring& status, int progress); + bool loadLevel(LevelStorageSource *storageSource, const std::wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData); + void setProgress(const std::wstring& status, int progress); void endProgress(); void saveAllChunks(); void saveGameRules(); @@ -162,16 +162,16 @@ public: private: void tick(); public: - void handleConsoleInput(const wstring& msg, ConsoleInputSource *source); + void handleConsoleInput(const std::wstring& msg, ConsoleInputSource *source); void handleConsoleInputs(); // void addTickable(Tickable tickable); // 4J removed static void main(__int64 seed, void *lpParameter); static void HaltServer(bool bPrimaryPlayerSignedOut=false); - File *getFile(const wstring& name); - void info(const wstring& string); - void warn(const wstring& string); - wstring getConsoleName(); + File *getFile(const std::wstring& name); + void info(const std::wstring& string); + void warn(const std::wstring& string); + std::wstring getConsoleName(); ServerLevel *getLevel(int dimension); void setLevel(int dimension, ServerLevel *level); // 4J added static MinecraftServer *getInstance() { return server; } // 4J added @@ -204,7 +204,7 @@ private: ChunkSource *chunkSource; postProcessRequest(int x, int z, ChunkSource *chunkSource) : x(x), z(z), chunkSource(chunkSource) {} }; - vector m_postProcessRequests; + std::vector m_postProcessRequests; CRITICAL_SECTION m_postProcessCS; public: void addPostProcessRequest(ChunkSource *chunkSource, int x, int z); diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index 425f3f5d6..cc7b5e6c9 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -57,7 +57,7 @@ #include "../../Minecraft.World/Stats/GenericStats.h" #endif -ClientConnection::ClientConnection(Minecraft *minecraft, const wstring& ip, int port) +ClientConnection::ClientConnection(Minecraft *minecraft, const std::wstring& ip, int port) { // 4J Stu - No longer used as we use the socket version below. assert(FALSE); @@ -150,7 +150,7 @@ INetworkPlayer *ClientConnection::getNetworkPlayer() else return NULL; } -void ClientConnection::handleLogin(shared_ptr packet) +void ClientConnection::handleLogin(std::shared_ptr packet) { if (done) return; @@ -207,7 +207,7 @@ void ClientConnection::handleLogin(shared_ptr packet) // a skin? if(pMojangData->wchSkin[0]!=0L) { - wstring wstr=pMojangData->wchSkin; + std::wstring wstr=pMojangData->wchSkin; // check the file is not already in bRes=app.IsFileInMemoryTextures(wstr); if(!bRes) @@ -229,7 +229,7 @@ void ClientConnection::handleLogin(shared_ptr packet) // a cloak? if(pMojangData->wchCape[0]!=0L) { - wstring wstr=pMojangData->wchCape; + std::wstring wstr=pMojangData->wchCape; // check the file is not already in bRes=app.IsFileInMemoryTextures(wstr); if(!bRes) @@ -328,7 +328,7 @@ void ClientConnection::handleLogin(shared_ptr packet) // 4J-PB - this isn't the level we want //level = (MultiPlayerLevel *)minecraft->level; level = (MultiPlayerLevel *)minecraft->getLevel( packet->dimension ); - shared_ptr player; + std::shared_ptr player; if(level==NULL) { @@ -355,7 +355,7 @@ void ClientConnection::handleLogin(shared_ptr packet) player = minecraft->createExtraLocalPlayer(m_userIndex, networkPlayer->GetOnlineName(), m_userIndex, packet->dimension, this,levelpassedin); // need to have a player before the setlevel - shared_ptr lastPlayer = minecraft->player; + std::shared_ptr lastPlayer = minecraft->player; minecraft->player = minecraft->localplayers[m_userIndex]; minecraft->setLevel(level); minecraft->player = lastPlayer; @@ -389,7 +389,7 @@ void ClientConnection::handleLogin(shared_ptr packet) maxPlayers = packet->maxPlayers; // need to have a player before the setLocalCreativeMode - shared_ptr lastPlayer = minecraft->player; + std::shared_ptr lastPlayer = minecraft->player; minecraft->player = minecraft->localplayers[m_userIndex]; ((MultiPlayerGameMode *)minecraft->localgameModes[m_userIndex])->setLocalMode(GameType::byId(packet->gameType)); minecraft->player = lastPlayer; @@ -403,32 +403,32 @@ void ClientConnection::handleLogin(shared_ptr packet) TelemetryManager->RecordLevelStart(m_userIndex, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->getLevel(packet->dimension)->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); } -void ClientConnection::handleAddEntity(shared_ptr packet) +void ClientConnection::handleAddEntity(std::shared_ptr packet) { double x = packet->x / 32.0; double y = packet->y / 32.0; double z = packet->z / 32.0; - shared_ptr e; + std::shared_ptr e; boolean setRot = true; // 4J-PB - replacing this massive if nest with switch switch(packet->type) { case AddEntityPacket::MINECART_RIDEABLE: - e = shared_ptr( new Minecart(level, x, y, z, Minecart::RIDEABLE) ); + e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::RIDEABLE) ); break; case AddEntityPacket::MINECART_CHEST: - e = shared_ptr( new Minecart(level, x, y, z, Minecart::CHEST) ); + e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::CHEST) ); break; case AddEntityPacket::MINECART_FURNACE: - e = shared_ptr( new Minecart(level, x, y, z, Minecart::FURNACE) ); + e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::FURNACE) ); break; case AddEntityPacket::FISH_HOOK: { // 4J Stu - Brought forward from 1.4 to be able to drop XP from fishing - shared_ptr owner = getEntity(packet->data); + std::shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match if( owner == NULL ) @@ -446,10 +446,10 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } } - shared_ptr player = dynamic_pointer_cast(owner); + std::shared_ptr player = std::dynamic_pointer_cast(owner); if (player != NULL) { - shared_ptr hook = shared_ptr( new FishingHook(level, x, y, z, player) ); + std::shared_ptr hook = std::shared_ptr( new FishingHook(level, x, y, z, player) ); e = hook; // 4J Stu - Move the player->fishing out of the ctor as we cannot reference 'this' player->fishing = hook; @@ -458,10 +458,10 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } break; case AddEntityPacket::ARROW: - e = shared_ptr( new Arrow(level, x, y, z) ); + e = std::shared_ptr( new Arrow(level, x, y, z) ); break; case AddEntityPacket::SNOWBALL: - e = shared_ptr( new Snowball(level, x, y, z) ); + e = std::shared_ptr( new Snowball(level, x, y, z) ); break; case AddEntityPacket::ITEM_FRAME: { @@ -470,66 +470,66 @@ void ClientConnection::handleAddEntity(shared_ptr packet) int iz = (int) z; app.DebugPrintf("ClientConnection ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz); } - e = shared_ptr(new ItemFrame(level, (int) x, (int) y, (int) z, packet->data)); + e = std::shared_ptr(new ItemFrame(level, (int) x, (int) y, (int) z, packet->data)); packet->data = 0; setRot = false; break; case AddEntityPacket::THROWN_ENDERPEARL: - e = shared_ptr( new ThrownEnderpearl(level, x, y, z) ); + e = std::shared_ptr( new ThrownEnderpearl(level, x, y, z) ); break; case AddEntityPacket::EYEOFENDERSIGNAL: - e = shared_ptr( new EyeOfEnderSignal(level, x, y, z) ); + e = std::shared_ptr( new EyeOfEnderSignal(level, x, y, z) ); break; case AddEntityPacket::FIREBALL: - e = shared_ptr( new Fireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = std::shared_ptr( new Fireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; break; case AddEntityPacket::SMALL_FIREBALL: - e = shared_ptr( new SmallFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = std::shared_ptr( new SmallFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; break; case AddEntityPacket::DRAGON_FIRE_BALL: - e = shared_ptr( new DragonFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = std::shared_ptr( new DragonFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; break; case AddEntityPacket::EGG: - e = shared_ptr( new ThrownEgg(level, x, y, z) ); + e = std::shared_ptr( new ThrownEgg(level, x, y, z) ); break; case AddEntityPacket::THROWN_POTION: - e = shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); + e = std::shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); packet->data = 0; break; case AddEntityPacket::THROWN_EXPBOTTLE: - e = shared_ptr( new ThrownExpBottle(level, x, y, z) ); + e = std::shared_ptr( new ThrownExpBottle(level, x, y, z) ); packet->data = 0; break; case AddEntityPacket::BOAT: - e = shared_ptr( new Boat(level, x, y, z) ); + e = std::shared_ptr( new Boat(level, x, y, z) ); break; case AddEntityPacket::PRIMED_TNT: - e = shared_ptr( new PrimedTnt(level, x, y, z) ); + e = std::shared_ptr( new PrimedTnt(level, x, y, z) ); break; case AddEntityPacket::ENDER_CRYSTAL: - e = shared_ptr( new EnderCrystal(level, x, y, z) ); + e = std::shared_ptr( new EnderCrystal(level, x, y, z) ); break; case AddEntityPacket::ITEM: - e = shared_ptr( new ItemEntity(level, x, y, z) ); + e = std::shared_ptr( new ItemEntity(level, x, y, z) ); break; case AddEntityPacket::FALLING: - e = shared_ptr( new FallingTile(level, x, y, z, packet->data & 0xFFFF, packet->data >> 16) ); + e = std::shared_ptr( new FallingTile(level, x, y, z, packet->data & 0xFFFF, packet->data >> 16) ); packet->data = 0; break; } - /* if (packet->type == AddEntityPacket::MINECART_RIDEABLE) e = shared_ptr( new Minecart(level, x, y, z, Minecart::RIDEABLE) ); - if (packet->type == AddEntityPacket::MINECART_CHEST) e = shared_ptr( new Minecart(level, x, y, z, Minecart::CHEST) ); - if (packet->type == AddEntityPacket::MINECART_FURNACE) e = shared_ptr( new Minecart(level, x, y, z, Minecart::FURNACE) ); + /* if (packet->type == AddEntityPacket::MINECART_RIDEABLE) e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::RIDEABLE) ); + if (packet->type == AddEntityPacket::MINECART_CHEST) e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::CHEST) ); + if (packet->type == AddEntityPacket::MINECART_FURNACE) e = std::shared_ptr( new Minecart(level, x, y, z, Minecart::FURNACE) ); if (packet->type == AddEntityPacket::FISH_HOOK) { // 4J Stu - Brought forward from 1.4 to be able to drop XP from fishing - shared_ptr owner = getEntity(packet->data); + std::shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match if( owner == NULL ) @@ -547,10 +547,10 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } } - shared_ptr player = dynamic_pointer_cast(owner); + std::shared_ptr player = std::dynamic_pointer_cast(owner); if (player != NULL) { - shared_ptr hook = shared_ptr( new FishingHook(level, x, y, z, player) ); + std::shared_ptr hook = std::shared_ptr( new FishingHook(level, x, y, z, player) ); e = hook; // 4J Stu - Move the player->fishing out of the ctor as we cannot reference 'this' player->fishing = hook; @@ -558,37 +558,37 @@ void ClientConnection::handleAddEntity(shared_ptr packet) packet->data = 0; } - if (packet->type == AddEntityPacket::ARROW) e = shared_ptr( new Arrow(level, x, y, z) ); - if (packet->type == AddEntityPacket::SNOWBALL) e = shared_ptr( new Snowball(level, x, y, z) ); - if (packet->type == AddEntityPacket::THROWN_ENDERPEARL) e = shared_ptr( new ThrownEnderpearl(level, x, y, z) ); - if (packet->type == AddEntityPacket::EYEOFENDERSIGNAL) e = shared_ptr( new EyeOfEnderSignal(level, x, y, z) ); + if (packet->type == AddEntityPacket::ARROW) e = std::shared_ptr( new Arrow(level, x, y, z) ); + if (packet->type == AddEntityPacket::SNOWBALL) e = std::shared_ptr( new Snowball(level, x, y, z) ); + if (packet->type == AddEntityPacket::THROWN_ENDERPEARL) e = std::shared_ptr( new ThrownEnderpearl(level, x, y, z) ); + if (packet->type == AddEntityPacket::EYEOFENDERSIGNAL) e = std::shared_ptr( new EyeOfEnderSignal(level, x, y, z) ); if (packet->type == AddEntityPacket::FIREBALL) { - e = shared_ptr( new Fireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = std::shared_ptr( new Fireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; } if (packet->type == AddEntityPacket::SMALL_FIREBALL) { - e = shared_ptr( new SmallFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); + e = std::shared_ptr( new SmallFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; } - if (packet->type == AddEntityPacket::EGG) e = shared_ptr( new ThrownEgg(level, x, y, z) ); + if (packet->type == AddEntityPacket::EGG) e = std::shared_ptr( new ThrownEgg(level, x, y, z) ); if (packet->type == AddEntityPacket::THROWN_POTION) { - e = shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); + e = std::shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); packet->data = 0; } if (packet->type == AddEntityPacket::THROWN_EXPBOTTLE) { - e = shared_ptr( new ThrownExpBottle(level, x, y, z) ); + e = std::shared_ptr( new ThrownExpBottle(level, x, y, z) ); packet->data = 0; } - if (packet->type == AddEntityPacket::BOAT) e = shared_ptr( new Boat(level, x, y, z) ); - if (packet->type == AddEntityPacket::PRIMED_TNT) e = shared_ptr( new PrimedTnt(level, x, y, z) ); - if (packet->type == AddEntityPacket::ENDER_CRYSTAL) e = shared_ptr( new EnderCrystal(level, x, y, z) ); - if (packet->type == AddEntityPacket::FALLING_SAND) e = shared_ptr( new FallingTile(level, x, y, z, Tile::sand->id) ); - if (packet->type == AddEntityPacket::FALLING_GRAVEL) e = shared_ptr( new FallingTile(level, x, y, z, Tile::gravel->id) ); - if (packet->type == AddEntityPacket::FALLING_EGG) e = shared_ptr( new FallingTile(level, x, y, z, Tile::dragonEgg_Id) ); + if (packet->type == AddEntityPacket::BOAT) e = std::shared_ptr( new Boat(level, x, y, z) ); + if (packet->type == AddEntityPacket::PRIMED_TNT) e = std::shared_ptr( new PrimedTnt(level, x, y, z) ); + if (packet->type == AddEntityPacket::ENDER_CRYSTAL) e = std::shared_ptr( new EnderCrystal(level, x, y, z) ); + if (packet->type == AddEntityPacket::FALLING_SAND) e = std::shared_ptr( new FallingTile(level, x, y, z, Tile::sand->id) ); + if (packet->type == AddEntityPacket::FALLING_GRAVEL) e = std::shared_ptr( new FallingTile(level, x, y, z, Tile::gravel->id) ); + if (packet->type == AddEntityPacket::FALLING_EGG) e = std::shared_ptr( new FallingTile(level, x, y, z, Tile::dragonEgg_Id) ); */ @@ -609,7 +609,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) e->xRot = 0.0f; } - vector > *subEntities = e->getSubEntities(); + std::vector > *subEntities = e->getSubEntities(); if (subEntities != NULL) { int offs = packet->id - e->entityId; @@ -635,7 +635,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) if (packet->type == AddEntityPacket::ARROW) { - shared_ptr owner = getEntity(packet->data); + std::shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match if( owner == NULL ) @@ -653,9 +653,9 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } - if (dynamic_pointer_cast(owner) != NULL) + if (std::dynamic_pointer_cast(owner) != NULL) { - dynamic_pointer_cast(e)->owner = dynamic_pointer_cast(owner); + std::dynamic_pointer_cast(e)->owner = std::dynamic_pointer_cast(owner); } } @@ -665,9 +665,9 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } -void ClientConnection::handleAddExperienceOrb(shared_ptr packet) +void ClientConnection::handleAddExperienceOrb(std::shared_ptr packet) { - shared_ptr e = shared_ptr( new ExperienceOrb(level, packet->x / 32.0, packet->y / 32.0, packet->z / 32.0, packet->value) ); + std::shared_ptr e = std::shared_ptr( new ExperienceOrb(level, packet->x / 32.0, packet->y / 32.0, packet->z / 32.0, packet->value) ); e->xp = packet->x; e->yp = packet->y; e->zp = packet->z; @@ -677,13 +677,13 @@ void ClientConnection::handleAddExperienceOrb(shared_ptr level->putEntity(packet->id, e); } -void ClientConnection::handleAddGlobalEntity(shared_ptr packet) +void ClientConnection::handleAddGlobalEntity(std::shared_ptr packet) { double x = packet->x / 32.0; double y = packet->y / 32.0; double z = packet->z / 32.0; - shared_ptr e;// = nullptr; - if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = shared_ptr( new LightningBolt(level, x, y, z) ); + std::shared_ptr e;// = nullptr; + if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = std::shared_ptr( new LightningBolt(level, x, y, z) ); if (e != NULL) { e->xp = packet->x; @@ -696,29 +696,29 @@ void ClientConnection::handleAddGlobalEntity(shared_ptr p } } -void ClientConnection::handleAddPainting(shared_ptr packet) +void ClientConnection::handleAddPainting(std::shared_ptr packet) { - shared_ptr painting = shared_ptr( new Painting(level, packet->x, packet->y, packet->z, packet->dir, packet->motive) ); + std::shared_ptr painting = std::shared_ptr( new Painting(level, packet->x, packet->y, packet->z, packet->dir, packet->motive) ); level->putEntity(packet->id, painting); } -void ClientConnection::handleSetEntityMotion(shared_ptr packet) +void ClientConnection::handleSetEntityMotion(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0); } -void ClientConnection::handleSetEntityData(shared_ptr packet) +void ClientConnection::handleSetEntityData(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e != NULL && packet->getUnpackedData() != NULL) { e->getEntityData()->assignValues(packet->getUnpackedData()); } } -void ClientConnection::handleAddPlayer(shared_ptr packet) +void ClientConnection::handleAddPlayer(std::shared_ptr packet) { // Some remote players could actually be local players that are already added for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) @@ -740,7 +740,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) double z = packet->z / 32.0; float yRot = packet->yRot * 360 / 256.0f; float xRot = packet->xRot * 360 / 256.0f; - shared_ptr player = shared_ptr( new RemotePlayer(minecraft->level, packet->name) ); + std::shared_ptr player = std::shared_ptr( new RemotePlayer(minecraft->level, packet->name) ); player->xo = player->xOld = player->xp = packet->x; player->yo = player->yOld = player->yp = packet->y; player->zo = player->zOld = player->zp = packet->z; @@ -763,11 +763,11 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) int item = packet->carriedItem; if (item == 0) { - player->inventory->items[player->inventory->selected] = shared_ptr(); // NULL; + player->inventory->items[player->inventory->selected] = std::shared_ptr(); // NULL; } else { - player->inventory->items[player->inventory->selected] = shared_ptr( new ItemInstance(item, 1, 0) ); + player->inventory->items[player->inventory->selected] = std::shared_ptr( new ItemInstance(item, 1, 0) ); } player->absMoveTo(x, y, z, yRot, xRot); @@ -782,7 +782,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) { app.DebugPrintf("Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n",player->customTextureUrl.c_str(), player->name.c_str()); - send(shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) ); + send(std::shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) ); } } else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl)) @@ -798,7 +798,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) if( minecraft->addPendingClientTextureRequest(player->customTextureUrl2) ) { app.DebugPrintf("Client sending texture packet to get custom cape %ls for player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str()); - send(shared_ptr( new TexturePacket(player->customTextureUrl2,NULL,0) ) ); + send(std::shared_ptr( new TexturePacket(player->customTextureUrl2,NULL,0) ) ); } } else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2)) @@ -811,7 +811,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) level->putEntity(packet->id, player); - vector > *unpackedData = packet->getUnpackedData(); + std::vector > *unpackedData = packet->getUnpackedData(); if (unpackedData != NULL) { player->getEntityData()->assignValues(unpackedData); @@ -819,9 +819,9 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) } -void ClientConnection::handleTeleportEntity(shared_ptr packet) +void ClientConnection::handleTeleportEntity(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; e->xp = packet->x; e->yp = packet->y; @@ -841,9 +841,9 @@ void ClientConnection::handleTeleportEntity(shared_ptr pac e->lerpTo(x, y, z, yRot, xRot, 3); } -void ClientConnection::handleMoveEntity(shared_ptr packet) +void ClientConnection::handleMoveEntity(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; e->xp += packet->xa; e->yp += packet->ya; @@ -862,17 +862,17 @@ void ClientConnection::handleMoveEntity(shared_ptr packet) e->lerpTo(x, y, z, yRot, xRot, 3); } -void ClientConnection::handleRotateMob(shared_ptr packet) +void ClientConnection::handleRotateMob(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; float yHeadRot = packet->yHeadRot * 360 / 256.f; e->setYHeadRot(yHeadRot); } -void ClientConnection::handleMoveEntitySmall(shared_ptr packet) +void ClientConnection::handleMoveEntitySmall(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; e->xp += packet->xa; e->yp += packet->ya; @@ -891,7 +891,7 @@ void ClientConnection::handleMoveEntitySmall(shared_ptr p e->lerpTo(x, y, z, yRot, xRot, 3); } -void ClientConnection::handleRemoveEntity(shared_ptr packet) +void ClientConnection::handleRemoveEntity(std::shared_ptr packet) { for (int i = 0; i < packet->ids.length; i++) { @@ -899,9 +899,9 @@ void ClientConnection::handleRemoveEntity(shared_ptr packe } } -void ClientConnection::handleMovePlayer(shared_ptr packet) +void ClientConnection::handleMovePlayer(std::shared_ptr packet) { - shared_ptr player = minecraft->localplayers[m_userIndex]; //minecraft->player; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; //minecraft->player; double x = player->x; double y = player->y; @@ -959,19 +959,19 @@ void ClientConnection::handleMovePlayer(shared_ptr packet) } // 4J Added -void ClientConnection::handleChunkVisibilityArea(shared_ptr packet) +void ClientConnection::handleChunkVisibilityArea(std::shared_ptr packet) { for(int z = packet->m_minZ; z <= packet->m_maxZ; ++z) for(int x = packet->m_minX; x <= packet->m_maxX; ++x) level->setChunkVisible(x, z, true); } -void ClientConnection::handleChunkVisibility(shared_ptr packet) +void ClientConnection::handleChunkVisibility(std::shared_ptr packet) { level->setChunkVisible(packet->x, packet->z, packet->visible); } -void ClientConnection::handleChunkTilesUpdate(shared_ptr packet) +void ClientConnection::handleChunkTilesUpdate(std::shared_ptr packet) { // 4J - changed to encode level in packet MultiPlayerLevel *dimensionLevel = (MultiPlayerLevel *)minecraft->levels[packet->levelIdx]; @@ -1040,7 +1040,7 @@ void ClientConnection::handleChunkTilesUpdate(shared_ptr } } -void ClientConnection::handleBlockRegionUpdate(shared_ptr packet) +void ClientConnection::handleBlockRegionUpdate(std::shared_ptr packet) { // 4J - changed to encode level in packet MultiPlayerLevel *dimensionLevel = (MultiPlayerLevel *)minecraft->levels[packet->levelIdx]; @@ -1075,7 +1075,7 @@ void ClientConnection::handleBlockRegionUpdate(shared_ptr packet) +void ClientConnection::handleTileUpdate(std::shared_ptr packet) { // 4J added - using a block of 255 to signify that this is a packet for destroying a tile, where we need to inform the level renderer that we are about to do so. // This is used in creative mode as the point where a tile is first destroyed at the client end of things. Packets formed like this are potentially sent from @@ -1132,7 +1132,7 @@ void ClientConnection::handleTileUpdate(shared_ptr packet) } } -void ClientConnection::handleDisconnect(shared_ptr packet) +void ClientConnection::handleDisconnect(std::shared_ptr packet) { #ifdef __linux__ // Linux fix: On local host connections, ignore DisconnectPacket. The singleplayer internal @@ -1185,23 +1185,23 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, //minecraft->setScreen(new DisconnectedScreen(L"disconnect.lost", reason, reasonObjects)); } -void ClientConnection::sendAndDisconnect(shared_ptr packet) +void ClientConnection::sendAndDisconnect(std::shared_ptr packet) { if (done) return; connection->send(packet); connection->sendAndQuit(); } -void ClientConnection::send(shared_ptr packet) +void ClientConnection::send(std::shared_ptr packet) { if (done) return; connection->send(packet); } -void ClientConnection::handleTakeItemEntity(shared_ptr packet) +void ClientConnection::handleTakeItemEntity(std::shared_ptr packet) { - shared_ptr from = getEntity(packet->itemId); - shared_ptr to = dynamic_pointer_cast(getEntity(packet->playerId)); + std::shared_ptr from = getEntity(packet->itemId); + std::shared_ptr to = std::dynamic_pointer_cast(getEntity(packet->playerId)); // 4J - the original game could assume that if getEntity didn't find the player, it must be the local player. We // need to search all local players @@ -1234,7 +1234,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac // "from" reference if we've already removed the item for an earlier processed connection if( isLocalPlayer ) { - shared_ptr player = dynamic_pointer_cast(to); + std::shared_ptr player = std::dynamic_pointer_cast(to); // 4J Stu - Fix for #10213 - UI: Local clients cannot progress through the tutorial normally. // We only send this packet once if many local players can see the event, so make sure we update @@ -1255,7 +1255,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f); } - minecraft->particleEngine->add( shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); + minecraft->particleEngine->add( std::shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); level->removeEntity(packet->itemId); } else @@ -1268,21 +1268,21 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac else { level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f); - minecraft->particleEngine->add( shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); + minecraft->particleEngine->add( std::shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); level->removeEntity(packet->itemId); } } } -void ClientConnection::handleChat(shared_ptr packet) +void ClientConnection::handleChat(std::shared_ptr packet) { - wstring message; + std::wstring message; int iPos; bool displayOnGui = true; - wstring playerDisplayName = L""; - wstring sourceDisplayName = L""; + std::wstring playerDisplayName = L""; + std::wstring sourceDisplayName = L""; // On platforms other than Xbox One this just sets display name to gamertag if (packet->m_stringArgs.size() >= 1) playerDisplayName = GetDisplayNameByGamertag(packet->m_stringArgs[0]); @@ -1559,13 +1559,13 @@ void ClientConnection::handleChat(shared_ptr packet) if( displayOnGui ) minecraft->gui->addMessage(message,m_userIndex, bIsDeathMessage); } -void ClientConnection::handleAnimate(shared_ptr packet) +void ClientConnection::handleAnimate(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; if (packet->action == AnimatePacket::SWING) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = std::dynamic_pointer_cast(e); if(player != NULL) player->swing(); } else if (packet->action == AnimatePacket::HURT) @@ -1574,7 +1574,7 @@ void ClientConnection::handleAnimate(shared_ptr packet) } else if (packet->action == AnimatePacket::WAKE_UP) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = std::dynamic_pointer_cast(e); if(player != NULL) player->stopSleepInBed(false, false, false); } else if (packet->action == AnimatePacket::RESPAWN) @@ -1582,29 +1582,29 @@ void ClientConnection::handleAnimate(shared_ptr packet) } else if (packet->action == AnimatePacket::CRITICAL_HIT) { - shared_ptr critParticle = shared_ptr( new CritParticle(minecraft->level, e) ); + std::shared_ptr critParticle = std::shared_ptr( new CritParticle(minecraft->level, e) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add( critParticle ); } else if (packet->action == AnimatePacket::MAGIC_CRITICAL_HIT) { - shared_ptr critParticle = shared_ptr( new CritParticle(minecraft->level, e, eParticleType_magicCrit) ); + std::shared_ptr critParticle = std::shared_ptr( new CritParticle(minecraft->level, e, eParticleType_magicCrit) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); } - else if (packet->action == AnimatePacket::EAT && dynamic_pointer_cast(e) != NULL) + else if (packet->action == AnimatePacket::EAT && std::dynamic_pointer_cast(e) != NULL) { } } -void ClientConnection::handleEntityActionAtPosition(shared_ptr packet) +void ClientConnection::handleEntityActionAtPosition(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; if (packet->action == EntityActionAtPositionPacket::START_SLEEP) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = std::dynamic_pointer_cast(e); player->startSleepInBed(packet->x, packet->y, packet->z); if( player == minecraft->localplayers[m_userIndex] ) @@ -1614,7 +1614,7 @@ void ClientConnection::handleEntityActionAtPosition(shared_ptr packet) +void ClientConnection::handlePreLogin(std::shared_ptr packet) { fprintf(stderr, "[LOGIN-CLI] handlePreLogin entered, isHost=%d, userIdx=%d\n", (int)g_NetworkManager.IsHost(), m_userIndex); #if 1 @@ -2060,7 +2060,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed); fprintf(stderr, "[LOGIN] Sending LoginPacket: user=%ls netVer=%d userIdx=%d isHost=%d\n", minecraft->user->name.c_str(), SharedConstants::NETWORK_PROTOCOL_VERSION, m_userIndex, (int)g_NetworkManager.IsHost()); - send( shared_ptr( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE), + send( std::shared_ptr( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE), packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex )))); fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); @@ -2102,7 +2102,7 @@ void ClientConnection::close() connection->close(DisconnectPacket::eDisconnect_Closed); } -void ClientConnection::handleAddMob(shared_ptr packet) +void ClientConnection::handleAddMob(std::shared_ptr packet) { double x = packet->x / 32.0; double y = packet->y / 32.0; @@ -2110,7 +2110,7 @@ void ClientConnection::handleAddMob(shared_ptr packet) float yRot = packet->yRot * 360 / 256.0f; float xRot = packet->xRot * 360 / 256.0f; - shared_ptr mob = dynamic_pointer_cast(EntityIO::newById(packet->type, level)); + std::shared_ptr mob = std::dynamic_pointer_cast(EntityIO::newById(packet->type, level)); mob->xp = packet->x; mob->yp = packet->y; mob->zp = packet->z; @@ -2118,7 +2118,7 @@ void ClientConnection::handleAddMob(shared_ptr packet) mob->yRotp = packet->yRot; mob->xRotp = packet->xRot; - vector > *subEntities = mob->getSubEntities(); + std::vector > *subEntities = mob->getSubEntities(); if (subEntities != NULL) { int offs = packet->id - mob->entityId; @@ -2140,7 +2140,7 @@ void ClientConnection::handleAddMob(shared_ptr packet) mob->zd = packet->zd / 8000.0f; level->putEntity(packet->id, mob); - vector > *unpackedData = packet->getUnpackedData(); + std::vector > *unpackedData = packet->getUnpackedData(); if (unpackedData != NULL) { mob->getEntityData()->assignValues(unpackedData); @@ -2150,17 +2150,17 @@ void ClientConnection::handleAddMob(shared_ptr packet) // 4J Stu - Slimes have a different BB depending on their size which is set in the entity data, so update the BB if(mob->GetType() == eTYPE_SLIME || mob->GetType() == eTYPE_LAVASLIME) { - shared_ptr slime = dynamic_pointer_cast(mob); + std::shared_ptr slime = std::dynamic_pointer_cast(mob); slime->setSize( slime->getSize() ); } } -void ClientConnection::handleSetTime(shared_ptr packet) +void ClientConnection::handleSetTime(std::shared_ptr packet) { minecraft->level->setTime(packet->time); } -void ClientConnection::handleSetSpawn(shared_ptr packet) +void ClientConnection::handleSetSpawn(std::shared_ptr packet) { //minecraft->player->setRespawnPosition(new Pos(packet->x, packet->y, packet->z)); minecraft->localplayers[m_userIndex]->setRespawnPosition(new Pos(packet->x, packet->y, packet->z)); @@ -2168,12 +2168,12 @@ void ClientConnection::handleSetSpawn(shared_ptr packet) } -void ClientConnection::handleRidePacket(shared_ptr packet) +void ClientConnection::handleRidePacket(std::shared_ptr packet) { - shared_ptr rider = getEntity(packet->riderId); - shared_ptr ridden = getEntity(packet->riddenId); + std::shared_ptr rider = getEntity(packet->riderId); + std::shared_ptr ridden = getEntity(packet->riddenId); - shared_ptr boat = dynamic_pointer_cast(ridden); + std::shared_ptr boat = std::dynamic_pointer_cast(ridden); //if (packet->riderId == minecraft->player->entityId) rider = minecraft->player; if (packet->riderId == minecraft->localplayers[m_userIndex]->entityId) { @@ -2190,13 +2190,13 @@ void ClientConnection::handleRidePacket(shared_ptr packet) rider->ride(ridden); } -void ClientConnection::handleEntityEvent(shared_ptr packet) +void ClientConnection::handleEntityEvent(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->entityId); + std::shared_ptr e = getEntity(packet->entityId); if (e != NULL) e->handleEntityEvent(packet->eventId); } -shared_ptr ClientConnection::getEntity(int entityId) +std::shared_ptr ClientConnection::getEntity(int entityId) { //if (entityId == minecraft->player->entityId) if(entityId == minecraft->localplayers[m_userIndex]->entityId) @@ -2207,7 +2207,7 @@ shared_ptr ClientConnection::getEntity(int entityId) return level->getEntity(entityId); } -void ClientConnection::handleSetHealth(shared_ptr packet) +void ClientConnection::handleSetHealth(std::shared_ptr packet) { //minecraft->player->hurtTo(packet->health); minecraft->localplayers[m_userIndex]->hurtTo(packet->health,packet->damageSource); @@ -2224,12 +2224,12 @@ void ClientConnection::handleSetHealth(shared_ptr packet) } } -void ClientConnection::handleSetExperience(shared_ptr packet) +void ClientConnection::handleSetExperience(std::shared_ptr packet) { minecraft->localplayers[m_userIndex]->setExperienceValues(packet->experienceProgress, packet->totalExperience, packet->experienceLevel); } -void ClientConnection::handleTexture(shared_ptr packet) +void ClientConnection::handleTexture(std::shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way // Server side also needs to store a list of those clients waiting to get a texture the server doesn't have yet @@ -2247,7 +2247,7 @@ void ClientConnection::handleTexture(shared_ptr packet) if(dwBytes!=0) { - send( shared_ptr( new TexturePacket(packet->textureName,pbData,dwBytes) ) ); + send( std::shared_ptr( new TexturePacket(packet->textureName,pbData,dwBytes) ) ); } } else @@ -2261,7 +2261,7 @@ void ClientConnection::handleTexture(shared_ptr packet) } } -void ClientConnection::handleTextureAndGeometry(shared_ptr packet) +void ClientConnection::handleTextureAndGeometry(std::shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way // Server side also needs to store a list of those clients waiting to get a texture the server doesn't have yet @@ -2284,18 +2284,18 @@ void ClientConnection::handleTextureAndGeometry(shared_ptrgetAdditionalBoxesCount()!=0) { - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,pDLCSkinFile) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,pDLCSkinFile) ) ); } else { - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes) ) ); } } else { unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID); - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,app.GetAdditionalSkinBoxes(packet->dwSkinID),uiAnimOverrideBitmask) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,app.GetAdditionalSkinBoxes(packet->dwSkinID),uiAnimOverrideBitmask) ) ); } } } @@ -2320,11 +2320,11 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr packet) +void ClientConnection::handleTextureChange(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = std::dynamic_pointer_cast(e); if( e == NULL) return; bool isLocalPlayer = false; @@ -2365,7 +2365,7 @@ void ClientConnection::handleTextureChange(shared_ptr packe #ifndef _CONTENT_PACKAGE wprintf(L"handleTextureChange - Client sending texture packet to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str()); #endif - send(shared_ptr( new TexturePacket(packet->path,NULL,0) ) ); + send(std::shared_ptr( new TexturePacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) @@ -2375,11 +2375,11 @@ void ClientConnection::handleTextureChange(shared_ptr packe } } -void ClientConnection::handleTextureAndGeometryChange(shared_ptr packet) +void ClientConnection::handleTextureAndGeometryChange(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->id); + std::shared_ptr e = getEntity(packet->id); if (e == NULL) return; - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = std::dynamic_pointer_cast(e); if( e == NULL) return; bool isLocalPlayer = false; @@ -2410,7 +2410,7 @@ void ClientConnection::handleTextureAndGeometryChange(shared_ptrpath.c_str(), player->name.c_str()); #endif - send(shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); + send(std::shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) @@ -2421,7 +2421,7 @@ void ClientConnection::handleTextureAndGeometryChange(shared_ptr packet) +void ClientConnection::handleRespawn(std::shared_ptr packet) { //if (packet->dimension != minecraft->player->dimension) if( packet->dimension != minecraft->localplayers[m_userIndex]->dimension || packet->mapSeed != minecraft->localplayers[m_userIndex]->level->getSeed() ) @@ -2456,13 +2456,13 @@ void ClientConnection::handleRespawn(shared_ptr packet) } // Remove the player entity from the current level - level->removeEntity( shared_ptr(minecraft->localplayers[m_userIndex]) ); + level->removeEntity( std::shared_ptr(minecraft->localplayers[m_userIndex]) ); level = dimensionLevel; // Whilst calling setLevel, make sure that minecraft::player is set up to be correct for this // connection - shared_ptr lastPlayer = minecraft->player; + std::shared_ptr lastPlayer = minecraft->player; minecraft->player = minecraft->localplayers[m_userIndex]; minecraft->setLevel(dimensionLevel); minecraft->player = lastPlayer; @@ -2534,7 +2534,7 @@ void ClientConnection::handleRespawn(shared_ptr packet) minecraft->setLocalPlayerIdx(oldIndex); } -void ClientConnection::handleExplosion(shared_ptr packet) +void ClientConnection::handleExplosion(std::shared_ptr packet) { if(!packet->m_bKnockbackOnly) { @@ -2566,15 +2566,15 @@ void ClientConnection::handleExplosion(shared_ptr packet) minecraft->localplayers[m_userIndex]->zd += packet->getKnockbackZ(); } -void ClientConnection::handleContainerOpen(shared_ptr packet) +void ClientConnection::handleContainerOpen(std::shared_ptr packet) { bool failed = false; - shared_ptr player = minecraft->localplayers[m_userIndex]; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; switch(packet->type) { case ContainerOpenPacket::CONTAINER: { - if( player->openContainer(shared_ptr( new SimpleContainer(packet->title, packet->size) ))) + if( player->openContainer(std::shared_ptr( new SimpleContainer(packet->title, packet->size) ))) { player->containerMenu->containerId = packet->containerId; } @@ -2586,7 +2586,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::FURNACE: { - if( player->openFurnace(shared_ptr( new FurnaceTileEntity() )) ) + if( player->openFurnace(std::shared_ptr( new FurnaceTileEntity() )) ) { player->containerMenu->containerId = packet->containerId; } @@ -2598,7 +2598,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::BREWING_STAND: { - if( player->openBrewingStand(shared_ptr( new BrewingStandTileEntity() )) ) + if( player->openBrewingStand(std::shared_ptr( new BrewingStandTileEntity() )) ) { player->containerMenu->containerId = packet->containerId; } @@ -2610,7 +2610,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::TRAP: { - if( player->openTrap(shared_ptr( new DispenserTileEntity() )) ) + if( player->openTrap(std::shared_ptr( new DispenserTileEntity() )) ) { player->containerMenu->containerId = packet->containerId; } @@ -2646,7 +2646,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::TRADER_NPC: { - shared_ptr csm = shared_ptr(new ClientSideMerchant(player,packet->title)); + std::shared_ptr csm = std::shared_ptr(new ClientSideMerchant(player,packet->title)); csm->createContainer(); if(player->openTrading(csm)) { @@ -2683,14 +2683,14 @@ void ClientConnection::handleContainerOpen(shared_ptr packe } else { - send(shared_ptr(new ContainerClosePacket(packet->containerId))); + send(std::shared_ptr(new ContainerClosePacket(packet->containerId))); } } } -void ClientConnection::handleContainerSetSlot(shared_ptr packet) +void ClientConnection::handleContainerSetSlot(std::shared_ptr packet) { - shared_ptr player = minecraft->localplayers[m_userIndex]; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_CARRIED ) { player->inventory->setCarried(packet->item); @@ -2702,7 +2702,7 @@ void ClientConnection::handleContainerSetSlot(shared_ptr // 4J Stu - Reworked a bit to fix a bug where things being collected while the creative menu was up replaced items in the creative menu if(packet->slot >= 36 && packet->slot < 36 + 9) { - shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); + std::shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); if (packet->item != NULL) { if (lastItem == NULL || lastItem->count < packet->item->count) @@ -2720,9 +2720,9 @@ void ClientConnection::handleContainerSetSlot(shared_ptr } } -void ClientConnection::handleContainerAck(shared_ptr packet) +void ClientConnection::handleContainerAck(std::shared_ptr packet) { - shared_ptr player = minecraft->localplayers[m_userIndex]; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; AbstractContainerMenu *menu = NULL; if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY) { @@ -2736,14 +2736,14 @@ void ClientConnection::handleContainerAck(shared_ptr packet) { if (!packet->accepted) { - send( shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, true) )); + send( std::shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, true) )); } } } -void ClientConnection::handleContainerContent(shared_ptr packet) +void ClientConnection::handleContainerContent(std::shared_ptr packet) { - shared_ptr player = minecraft->localplayers[m_userIndex]; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY) { player->inventoryMenu->setAll(&packet->items); @@ -2754,17 +2754,17 @@ void ClientConnection::handleContainerContent(shared_ptr packet) +void ClientConnection::handleSignUpdate(std::shared_ptr packet) { app.DebugPrintf("ClientConnection::handleSignUpdate - "); if (minecraft->level->hasChunkAt(packet->x, packet->y, packet->z)) { - shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); + std::shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); // 4J-PB - on a client connecting, the line below fails - if (dynamic_pointer_cast(te) != NULL) + if (std::dynamic_pointer_cast(te) != NULL) { - shared_ptr ste = dynamic_pointer_cast(te); + std::shared_ptr ste = std::dynamic_pointer_cast(te); for (int i = 0; i < MAX_SIGN_LINES; i++) { ste->SetMessage(i,packet->lines[i]); @@ -2778,7 +2778,7 @@ void ClientConnection::handleSignUpdate(shared_ptr packet) } else { - app.DebugPrintf("dynamic_pointer_cast(te) == NULL\n"); + app.DebugPrintf("std::dynamic_pointer_cast(te) == NULL\n"); } } else @@ -2787,17 +2787,17 @@ void ClientConnection::handleSignUpdate(shared_ptr packet) } } -void ClientConnection::handleTileEntityData(shared_ptr packet) +void ClientConnection::handleTileEntityData(std::shared_ptr packet) { if (minecraft->level->hasChunkAt(packet->x, packet->y, packet->z)) { - shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); + std::shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); if (te != NULL) { - if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && dynamic_pointer_cast(te) != NULL) + if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && std::dynamic_pointer_cast(te) != NULL) { - dynamic_pointer_cast(te)->load(packet->tag); + std::dynamic_pointer_cast(te)->load(packet->tag); } //else if (packet.type == TileEntityDataPacket.TYPE_ADV_COMMAND && (te instanceof CommandBlockEntity)) //{ @@ -2807,15 +2807,15 @@ void ClientConnection::handleTileEntityData(shared_ptr pac //{ // ((BeaconTileEntity) te).load(packet.tag); //} - else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast(te) != NULL) + else if (packet->type == TileEntityDataPacket::TYPE_SKULL && std::dynamic_pointer_cast(te) != NULL) { - dynamic_pointer_cast(te)->load(packet->tag); + std::dynamic_pointer_cast(te)->load(packet->tag); } } } } -void ClientConnection::handleContainerSetData(shared_ptr packet) +void ClientConnection::handleContainerSetData(std::shared_ptr packet) { onUnhandledPacket(packet); if (minecraft->localplayers[m_userIndex]->containerMenu != NULL && minecraft->localplayers[m_userIndex]->containerMenu->containerId == packet->containerId) @@ -2824,9 +2824,9 @@ void ClientConnection::handleContainerSetData(shared_ptr } } -void ClientConnection::handleSetEquippedItem(shared_ptr packet) +void ClientConnection::handleSetEquippedItem(std::shared_ptr packet) { - shared_ptr entity = getEntity(packet->entity); + std::shared_ptr entity = getEntity(packet->entity); if (entity != NULL) { // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game @@ -2834,19 +2834,19 @@ void ClientConnection::handleSetEquippedItem(shared_ptr p } } -void ClientConnection::handleContainerClose(shared_ptr packet) +void ClientConnection::handleContainerClose(std::shared_ptr packet) { minecraft->localplayers[m_userIndex]->closeContainer(); } -void ClientConnection::handleTileEvent(shared_ptr packet) +void ClientConnection::handleTileEvent(std::shared_ptr packet) { PIXBeginNamedEvent(0,"Handle tile event\n"); minecraft->level->tileEvent(packet->x, packet->y, packet->z, packet->tile, packet->b0, packet->b1); PIXEndNamedEvent(); } -void ClientConnection::handleTileDestruction(shared_ptr packet) +void ClientConnection::handleTileDestruction(std::shared_ptr packet) { minecraft->level->destroyTileProgress(packet->getEntityId(), packet->getX(), packet->getY(), packet->getZ(), packet->getState()); } @@ -2856,7 +2856,7 @@ bool ClientConnection::canHandleAsyncPackets() return minecraft != NULL && minecraft->level != NULL && minecraft->localplayers[m_userIndex] != NULL && level != NULL; } -void ClientConnection::handleGameEvent(shared_ptr gameEventPacket) +void ClientConnection::handleGameEvent(std::shared_ptr gameEventPacket) { int event = gameEventPacket->_event; int param = gameEventPacket->param; @@ -2922,7 +2922,7 @@ void ClientConnection::handleGameEvent(shared_ptr gameEventPack } } -void ClientConnection::handleComplexItemData(shared_ptr packet) +void ClientConnection::handleComplexItemData(std::shared_ptr packet) { if (packet->itemType == Item::map->id) { @@ -2936,7 +2936,7 @@ void ClientConnection::handleComplexItemData(shared_ptr p -void ClientConnection::handleLevelEvent(shared_ptr packet) +void ClientConnection::handleLevelEvent(std::shared_ptr packet) { switch(packet->type) { @@ -2960,25 +2960,25 @@ void ClientConnection::handleLevelEvent(shared_ptr packet) } } -void ClientConnection::handleAwardStat(shared_ptr packet) +void ClientConnection::handleAwardStat(std::shared_ptr packet) { minecraft->localplayers[m_userIndex]->awardStatFromServer(GenericStats::stat(packet->statId), packet->getParamData()); } -void ClientConnection::handleUpdateMobEffect(shared_ptr packet) +void ClientConnection::handleUpdateMobEffect(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->entityId); - if (e == NULL || dynamic_pointer_cast(e) == NULL) return; + std::shared_ptr e = getEntity(packet->entityId); + if (e == NULL || std::dynamic_pointer_cast(e) == NULL) return; - ( dynamic_pointer_cast(e) )->addEffect(new MobEffectInstance(packet->effectId, packet->effectDurationTicks, packet->effectAmplifier)); + ( std::dynamic_pointer_cast(e) )->addEffect(new MobEffectInstance(packet->effectId, packet->effectDurationTicks, packet->effectAmplifier)); } -void ClientConnection::handleRemoveMobEffect(shared_ptr packet) +void ClientConnection::handleRemoveMobEffect(std::shared_ptr packet) { - shared_ptr e = getEntity(packet->entityId); - if (e == NULL || dynamic_pointer_cast(e) == NULL) return; + std::shared_ptr e = getEntity(packet->entityId); + if (e == NULL || std::dynamic_pointer_cast(e) == NULL) return; - ( dynamic_pointer_cast(e) )->removeEffectNoUpdate(packet->effectId); + ( std::dynamic_pointer_cast(e) )->removeEffectNoUpdate(packet->effectId); } bool ClientConnection::isServerPacketListener() @@ -2986,7 +2986,7 @@ bool ClientConnection::isServerPacketListener() return false; } -void ClientConnection::handlePlayerInfo(shared_ptr packet) +void ClientConnection::handlePlayerInfo(std::shared_ptr packet) { unsigned int startingPrivileges = app.GetPlayerPrivileges(packet->m_networkSmallId); @@ -3002,17 +3002,17 @@ void ClientConnection::handlePlayerInfo(shared_ptr packet) // 4J Stu - Repurposed this packet for player info that we want app.UpdatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, packet->m_playerPrivileges); - shared_ptr entity = getEntity(packet->m_entityId); + std::shared_ptr entity = getEntity(packet->m_entityId); if(entity != NULL && entity->GetType() == eTYPE_PLAYER) { - shared_ptr player = dynamic_pointer_cast(entity); + std::shared_ptr player = std::dynamic_pointer_cast(entity); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_playerPrivileges); } if(networkPlayer != NULL && networkPlayer->IsLocal()) { for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - shared_ptr localPlayer = minecraft->localplayers[i]; + std::shared_ptr localPlayer = minecraft->localplayers[i]; if(localPlayer != NULL && localPlayer->connection != NULL && localPlayer->connection->getNetworkPlayer() == networkPlayer ) { localPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All,packet->m_playerPrivileges); @@ -3041,7 +3041,7 @@ void ClientConnection::handlePlayerInfo(shared_ptr packet) } -void ClientConnection::displayPrivilegeChanges(shared_ptr player, unsigned int oldPrivileges) +void ClientConnection::displayPrivilegeChanges(std::shared_ptr player, unsigned int oldPrivileges) { int userIndex = player->GetXboxPad(); unsigned int newPrivileges = player->getAllPlayerGamePrivileges(); @@ -3053,7 +3053,7 @@ void ClientConnection::displayPrivilegeChanges(shared_ptr packet) +void ClientConnection::handleKeepAlive(std::shared_ptr packet) { - send(shared_ptr(new KeepAlivePacket(packet->id))); + send(std::shared_ptr(new KeepAlivePacket(packet->id))); } -void ClientConnection::handlePlayerAbilities(shared_ptr playerAbilitiesPacket) +void ClientConnection::handlePlayerAbilities(std::shared_ptr playerAbilitiesPacket) { - shared_ptr player = minecraft->localplayers[m_userIndex]; + std::shared_ptr player = minecraft->localplayers[m_userIndex]; player->abilities.flying = playerAbilitiesPacket->isFlying(); player->abilities.instabuild = playerAbilitiesPacket->canInstabuild(); player->abilities.invulnerable = playerAbilitiesPacket->isInvulnerable(); @@ -3153,12 +3153,12 @@ void ClientConnection::handlePlayerAbilities(shared_ptr p player->abilities.setFlyingSpeed(playerAbilitiesPacket->getFlyingSpeed()); } -void ClientConnection::handleSoundEvent(shared_ptr packet) +void ClientConnection::handleSoundEvent(std::shared_ptr packet) { minecraft->level->playLocalSound(packet->getX(), packet->getY(), packet->getZ(), packet->getSound(), packet->getVolume(), packet->getPitch()); } -void ClientConnection::handleCustomPayload(shared_ptr customPayloadPacket) +void ClientConnection::handleCustomPayload(std::shared_ptr customPayloadPacket) { if (CustomPayloadPacket::TRADER_LIST_PACKET.compare(customPayloadPacket->identifier) == 0) { @@ -3167,7 +3167,7 @@ void ClientConnection::handleCustomPayload(shared_ptr custo int containerId = input.readInt(); if (ui.IsSceneInStack(m_userIndex, eUIScene_TradingMenu) && containerId == minecraft->localplayers[m_userIndex]->containerMenu->containerId) { - shared_ptr trader = nullptr; + std::shared_ptr trader = nullptr; #ifdef _XBOX HXUIOBJ scene = app.GetCurrentScene(m_userIndex); @@ -3200,7 +3200,7 @@ Connection *ClientConnection::getConnection() } // 4J Added -void ClientConnection::handleServerSettingsChanged(shared_ptr packet) +void ClientConnection::handleServerSettingsChanged(std::shared_ptr packet) { if(packet->action==ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS) { @@ -3226,7 +3226,7 @@ void ClientConnection::handleServerSettingsChanged(shared_ptr packet) +void ClientConnection::handleXZ(std::shared_ptr packet) { if(packet->action==XZPacket::STRONGHOLD) { @@ -3236,17 +3236,17 @@ void ClientConnection::handleXZ(shared_ptr packet) } } -void ClientConnection::handleUpdateProgress(shared_ptr packet) +void ClientConnection::handleUpdateProgress(std::shared_ptr packet) { if(!g_NetworkManager.IsHost() ) Minecraft::GetInstance()->progressRenderer->progressStagePercentage( packet->m_percentage ); } -void ClientConnection::handleUpdateGameRuleProgressPacket(shared_ptr packet) +void ClientConnection::handleUpdateGameRuleProgressPacket(std::shared_ptr packet) { LPCWSTR string = app.GetGameRulesString(packet->m_messageId); if(string != NULL) { - wstring message(string); + std::wstring message(string); message = GameRuleDefinition::generateDescriptionString(packet->m_definitionType,message,packet->m_data.data,packet->m_data.length); if(minecraft->localgameModes[m_userIndex]!=NULL) { @@ -3348,10 +3348,10 @@ int ClientConnection::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage:: } // -wstring ClientConnection::GetDisplayNameByGamertag(wstring gamertag) +std::wstring ClientConnection::GetDisplayNameByGamertag(std::wstring gamertag) { #ifdef _DURANGO - wstring displayName = g_NetworkManager.GetDisplayNameByGamertag(gamertag); + std::wstring displayName = g_NetworkManager.GetDisplayNameByGamertag(gamertag); return displayName; #else return gamertag; diff --git a/Minecraft.Client/Network/ClientConnection.h b/Minecraft.Client/Network/ClientConnection.h index eced984fa..1f0aae762 100644 --- a/Minecraft.Client/Network/ClientConnection.h +++ b/Minecraft.Client/Network/ClientConnection.h @@ -21,7 +21,7 @@ private: bool done; Connection *connection; public: - wstring message; + std::wstring message; bool createdOk; // 4J added private: Minecraft *minecraft; @@ -44,97 +44,97 @@ private: DWORD m_userIndex; // 4J Added public: SavedDataStorage *savedDataStorage; - ClientConnection(Minecraft *minecraft, const wstring& ip, int port); + ClientConnection(Minecraft *minecraft, const std::wstring& ip, int port); ClientConnection(Minecraft *minecraft, Socket *socket, int iUserIndex = -1); ~ClientConnection(); void tick(); INetworkPlayer *getNetworkPlayer(); - virtual void handleLogin(shared_ptr packet); - virtual void handleAddEntity(shared_ptr packet); - virtual void handleAddExperienceOrb(shared_ptr packet); - virtual void handleAddGlobalEntity(shared_ptr packet); - virtual void handleAddPainting(shared_ptr packet); - virtual void handleSetEntityMotion(shared_ptr packet); - virtual void handleSetEntityData(shared_ptr packet); - virtual void handleAddPlayer(shared_ptr packet); - virtual void handleTeleportEntity(shared_ptr packet); - virtual void handleMoveEntity(shared_ptr packet); - virtual void handleRotateMob(shared_ptr packet); - virtual void handleMoveEntitySmall(shared_ptr packet); - virtual void handleRemoveEntity(shared_ptr packet); - virtual void handleMovePlayer(shared_ptr packet); + virtual void handleLogin(std::shared_ptr packet); + virtual void handleAddEntity(std::shared_ptr packet); + virtual void handleAddExperienceOrb(std::shared_ptr packet); + virtual void handleAddGlobalEntity(std::shared_ptr packet); + virtual void handleAddPainting(std::shared_ptr packet); + virtual void handleSetEntityMotion(std::shared_ptr packet); + virtual void handleSetEntityData(std::shared_ptr packet); + virtual void handleAddPlayer(std::shared_ptr packet); + virtual void handleTeleportEntity(std::shared_ptr packet); + virtual void handleMoveEntity(std::shared_ptr packet); + virtual void handleRotateMob(std::shared_ptr packet); + virtual void handleMoveEntitySmall(std::shared_ptr packet); + virtual void handleRemoveEntity(std::shared_ptr packet); + virtual void handleMovePlayer(std::shared_ptr packet); Random *random; // 4J Added - virtual void handleChunkVisibilityArea(shared_ptr packet); + virtual void handleChunkVisibilityArea(std::shared_ptr packet); - virtual void handleChunkVisibility(shared_ptr packet); - virtual void handleChunkTilesUpdate(shared_ptr packet); - virtual void handleBlockRegionUpdate(shared_ptr packet); - virtual void handleTileUpdate(shared_ptr packet); - virtual void handleDisconnect(shared_ptr packet); + virtual void handleChunkVisibility(std::shared_ptr packet); + virtual void handleChunkTilesUpdate(std::shared_ptr packet); + virtual void handleBlockRegionUpdate(std::shared_ptr packet); + virtual void handleTileUpdate(std::shared_ptr packet); + virtual void handleDisconnect(std::shared_ptr packet); virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects); - void sendAndDisconnect(shared_ptr packet); - void send(shared_ptr packet); - virtual void handleTakeItemEntity(shared_ptr packet); - virtual void handleChat(shared_ptr packet); - virtual void handleAnimate(shared_ptr packet); - virtual void handleEntityActionAtPosition(shared_ptr packet); - virtual void handlePreLogin(shared_ptr packet); + void sendAndDisconnect(std::shared_ptr packet); + void send(std::shared_ptr packet); + virtual void handleTakeItemEntity(std::shared_ptr packet); + virtual void handleChat(std::shared_ptr packet); + virtual void handleAnimate(std::shared_ptr packet); + virtual void handleEntityActionAtPosition(std::shared_ptr packet); + virtual void handlePreLogin(std::shared_ptr packet); void close(); - virtual void handleAddMob(shared_ptr packet); - virtual void handleSetTime(shared_ptr packet); - virtual void handleSetSpawn(shared_ptr packet); - virtual void handleRidePacket(shared_ptr packet); - virtual void handleEntityEvent(shared_ptr packet); + virtual void handleAddMob(std::shared_ptr packet); + virtual void handleSetTime(std::shared_ptr packet); + virtual void handleSetSpawn(std::shared_ptr packet); + virtual void handleRidePacket(std::shared_ptr packet); + virtual void handleEntityEvent(std::shared_ptr packet); private: - shared_ptr getEntity(int entityId); - wstring GetDisplayNameByGamertag(wstring gamertag); + std::shared_ptr getEntity(int entityId); + std::wstring GetDisplayNameByGamertag(std::wstring gamertag); public: - virtual void handleSetHealth(shared_ptr packet); - virtual void handleSetExperience(shared_ptr packet); - virtual void handleRespawn(shared_ptr packet); - virtual void handleExplosion(shared_ptr packet); - virtual void handleContainerOpen(shared_ptr packet); - virtual void handleContainerSetSlot(shared_ptr packet); - virtual void handleContainerAck(shared_ptr packet); - virtual void handleContainerContent(shared_ptr packet); - virtual void handleSignUpdate(shared_ptr packet); - virtual void handleTileEntityData(shared_ptr packet); - virtual void handleContainerSetData(shared_ptr packet); - virtual void handleSetEquippedItem(shared_ptr packet); - virtual void handleContainerClose(shared_ptr packet); - virtual void handleTileEvent(shared_ptr packet); - virtual void handleTileDestruction(shared_ptr packet); + virtual void handleSetHealth(std::shared_ptr packet); + virtual void handleSetExperience(std::shared_ptr packet); + virtual void handleRespawn(std::shared_ptr packet); + virtual void handleExplosion(std::shared_ptr packet); + virtual void handleContainerOpen(std::shared_ptr packet); + virtual void handleContainerSetSlot(std::shared_ptr packet); + virtual void handleContainerAck(std::shared_ptr packet); + virtual void handleContainerContent(std::shared_ptr packet); + virtual void handleSignUpdate(std::shared_ptr packet); + virtual void handleTileEntityData(std::shared_ptr packet); + virtual void handleContainerSetData(std::shared_ptr packet); + virtual void handleSetEquippedItem(std::shared_ptr packet); + virtual void handleContainerClose(std::shared_ptr packet); + virtual void handleTileEvent(std::shared_ptr packet); + virtual void handleTileDestruction(std::shared_ptr packet); virtual bool canHandleAsyncPackets(); - virtual void handleGameEvent(shared_ptr gameEventPacket); - virtual void handleComplexItemData(shared_ptr packet); - virtual void handleLevelEvent(shared_ptr packet); - virtual void handleAwardStat(shared_ptr packet); - virtual void handleUpdateMobEffect(shared_ptr packet); - virtual void handleRemoveMobEffect(shared_ptr packet); + virtual void handleGameEvent(std::shared_ptr gameEventPacket); + virtual void handleComplexItemData(std::shared_ptr packet); + virtual void handleLevelEvent(std::shared_ptr packet); + virtual void handleAwardStat(std::shared_ptr packet); + virtual void handleUpdateMobEffect(std::shared_ptr packet); + virtual void handleRemoveMobEffect(std::shared_ptr packet); virtual bool isServerPacketListener(); - virtual void handlePlayerInfo(shared_ptr packet); - virtual void handleKeepAlive(shared_ptr packet); - virtual void handlePlayerAbilities(shared_ptr playerAbilitiesPacket); - virtual void handleSoundEvent(shared_ptr packet); - virtual void handleCustomPayload(shared_ptr customPayloadPacket); + virtual void handlePlayerInfo(std::shared_ptr packet); + virtual void handleKeepAlive(std::shared_ptr packet); + virtual void handlePlayerAbilities(std::shared_ptr playerAbilitiesPacket); + virtual void handleSoundEvent(std::shared_ptr packet); + virtual void handleCustomPayload(std::shared_ptr customPayloadPacket); virtual Connection *getConnection(); // 4J Added - virtual void handleServerSettingsChanged(shared_ptr packet); - virtual void handleTexture(shared_ptr packet); - virtual void handleTextureAndGeometry(shared_ptr packet); - virtual void handleUpdateProgress(shared_ptr packet); + virtual void handleServerSettingsChanged(std::shared_ptr packet); + virtual void handleTexture(std::shared_ptr packet); + virtual void handleTextureAndGeometry(std::shared_ptr packet); + virtual void handleUpdateProgress(std::shared_ptr packet); // 4J Added static int HostDisconnectReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - virtual void handleTextureChange(shared_ptr packet); - virtual void handleTextureAndGeometryChange(shared_ptr packet); - virtual void handleUpdateGameRuleProgressPacket(shared_ptr packet); - virtual void handleXZ(shared_ptr packet); + virtual void handleTextureChange(std::shared_ptr packet); + virtual void handleTextureAndGeometryChange(std::shared_ptr packet); + virtual void handleUpdateGameRuleProgressPacket(std::shared_ptr packet); + virtual void handleXZ(std::shared_ptr packet); - void displayPrivilegeChanges(shared_ptr player, unsigned int oldPrivileges); + void displayPrivilegeChanges(std::shared_ptr player, unsigned int oldPrivileges); }; \ No newline at end of file diff --git a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp index 93cedcbac..a2d3df880 100644 --- a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp +++ b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp @@ -275,17 +275,17 @@ void MultiPlayerChunkCache::postProcess(ChunkSource *parent, int x, int z) { } -vector *MultiPlayerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) +std::vector *MultiPlayerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { return NULL; } -TilePos *MultiPlayerChunkCache::findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z) +TilePos *MultiPlayerChunkCache::findNearestMapFeature(Level *level, const std::wstring &featureName, int x, int y, int z) { return NULL; } -wstring MultiPlayerChunkCache::gatherStats() +std::wstring MultiPlayerChunkCache::gatherStats() { EnterCriticalSection(&m_csLoadCreate); int size = (int)loadedChunkList.size(); diff --git a/Minecraft.Client/Network/MultiPlayerChunkCache.h b/Minecraft.Client/Network/MultiPlayerChunkCache.h index f18681b63..a9df81eac 100644 --- a/Minecraft.Client/Network/MultiPlayerChunkCache.h +++ b/Minecraft.Client/Network/MultiPlayerChunkCache.h @@ -3,7 +3,7 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.level.chunk.h" #include "../../Minecraft.World/Level/RandomLevelSource.h" -using namespace std; + class ServerChunkCache; // 4J - various alterations here to make this thread safe, and operate as a fixed sized cache @@ -14,7 +14,7 @@ private: LevelChunk *emptyChunk; LevelChunk *waterChunk; - vector loadedChunkList; + std::vector loadedChunkList; LevelChunk **cache; // 4J - added for multithreaded support @@ -38,9 +38,9 @@ public: virtual bool tick(); virtual bool shouldSave(); virtual void postProcess(ChunkSource *parent, int x, int z); - virtual wstring gatherStats(); - virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z); + virtual std::wstring gatherStats(); + virtual std::vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring &featureName, int x, int y, int z); virtual void dataReceived(int x, int z); // 4J added virtual LevelChunk **getCache() { return cache; } // 4J added diff --git a/Minecraft.Client/Network/PendingConnection.cpp b/Minecraft.Client/Network/PendingConnection.cpp index 8cd7b63a0..b0b9e869b 100644 --- a/Minecraft.Client/Network/PendingConnection.cpp +++ b/Minecraft.Client/Network/PendingConnection.cpp @@ -20,7 +20,7 @@ Random *PendingConnection::random = new Random(); -PendingConnection::PendingConnection(MinecraftServer *server, Socket *socket, const wstring& id) +PendingConnection::PendingConnection(MinecraftServer *server, Socket *socket, const std::wstring& id) { // 4J - added initialisers done = false; @@ -62,7 +62,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) // logger.info("Disconnecting " + getName() + ": " + reason); fprintf(stderr, "[PENDING] disconnect called with reason=%d at tick=%d\n", reason, _tick); app.DebugPrintf("Pending connection disconnect: %d\n", reason ); - connection->send( shared_ptr( new DisconnectPacket(reason) ) ); + connection->send( std::shared_ptr( new DisconnectPacket(reason) ) ); connection->sendAndQuit(); done = true; // } catch (Exception e) { @@ -70,7 +70,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) // } } -void PendingConnection::handlePreLogin(shared_ptr packet) +void PendingConnection::handlePreLogin(std::shared_ptr packet) { if (packet->m_netcodeVersion != MINECRAFT_NET_VERSION) { @@ -104,7 +104,7 @@ void PendingConnection::sendPreLoginResponse() PlayerList *playerList = MinecraftServer::getInstance()->getPlayers(); for(AUTO_VAR(it, playerList->players.begin()); it != playerList->players.end(); ++it) { - shared_ptr player = *it; + std::shared_ptr player = *it; // If the offline Xuid is invalid but the online one is not then that's guest which we should ignore // If the online Xuid is invalid but the offline one is not then we are definitely an offline game so dont care about UGC @@ -129,16 +129,16 @@ void PendingConnection::sendPreLoginResponse() if (false)// server->onlineMode) // 4J - removed { loginKey = L"TOIMPLEMENT"; // 4J - todo Long.toHexString(random.nextLong()); - connection->send( shared_ptr( new PreLoginPacket(loginKey, ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion, szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),hostIndex) ) ); + connection->send( std::shared_ptr( new PreLoginPacket(loginKey, ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion, szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),hostIndex) ) ); } else #endif { - connection->send( shared_ptr( new PreLoginPacket(L"-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion,szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),hostIndex, server->m_texturePackId) ) ); + connection->send( std::shared_ptr( new PreLoginPacket(L"-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion,szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),hostIndex, server->m_texturePackId) ) ); } } -void PendingConnection::handleLogin(shared_ptr packet) +void PendingConnection::handleLogin(std::shared_ptr packet) { fprintf(stderr, "[LOGIN-SRV] handleLogin called! clientVersion=%d\n", packet->clientVersion); //name = packet->userName; @@ -199,7 +199,7 @@ void PendingConnection::handleLogin(shared_ptr packet) } -void PendingConnection::handleAcceptedLogin(shared_ptr packet) +void PendingConnection::handleAcceptedLogin(std::shared_ptr packet) { if(packet->m_ugcPlayersVersion != server->m_ugcPlayersVersion) { @@ -212,7 +212,7 @@ void PendingConnection::handleAcceptedLogin(shared_ptr packet) PlayerUID playerXuid = packet->m_offlineXuid; if(playerXuid == INVALID_XUID) playerXuid = packet->m_onlineXuid; - shared_ptr playerEntity = server->getPlayers()->getPlayerForLogin(this, name, playerXuid,packet->m_onlineXuid); + std::shared_ptr playerEntity = server->getPlayers()->getPlayerForLogin(this, name, playerXuid,packet->m_onlineXuid); if (playerEntity != NULL) { server->getPlayers()->placeNewPlayer(connection, playerEntity, packet); @@ -228,12 +228,12 @@ void PendingConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, done = true; } -void PendingConnection::handleGetInfo(shared_ptr packet) +void PendingConnection::handleGetInfo(std::shared_ptr packet) { //try { //String message = server->motd + "§" + server->players->getPlayerCount() + "§" + server->players->getMaxPlayers(); //connection->send(new DisconnectPacket(message)); - connection->send(shared_ptr(new DisconnectPacket(DisconnectPacket::eDisconnect_ServerFull) ) ); + connection->send(std::shared_ptr(new DisconnectPacket(DisconnectPacket::eDisconnect_ServerFull) ) ); connection->sendAndQuit(); server->connection->removeSpamProtection(connection->getSocket()); done = true; @@ -242,22 +242,22 @@ void PendingConnection::handleGetInfo(shared_ptr packet) //} } -void PendingConnection::handleKeepAlive(shared_ptr packet) +void PendingConnection::handleKeepAlive(std::shared_ptr packet) { // Ignore } -void PendingConnection::onUnhandledPacket(shared_ptr packet) +void PendingConnection::onUnhandledPacket(std::shared_ptr packet) { disconnect(DisconnectPacket::eDisconnect_UnexpectedPacket); } -void PendingConnection::send(shared_ptr packet) +void PendingConnection::send(std::shared_ptr packet) { connection->send(packet); } -wstring PendingConnection::getName() +std::wstring PendingConnection::getName() { return L"Unimplemented"; // if (name != null) return name + " [" + connection.getRemoteAddress().toString() + "]"; diff --git a/Minecraft.Client/Network/PendingConnection.h b/Minecraft.Client/Network/PendingConnection.h index 380c7cf39..1f79508ff 100644 --- a/Minecraft.Client/Network/PendingConnection.h +++ b/Minecraft.Client/Network/PendingConnection.h @@ -5,7 +5,7 @@ class Socket; class LoginPacket; class Connection; class Random; -using namespace std; + class PendingConnection : public PacketListener { @@ -23,24 +23,24 @@ public: private: MinecraftServer *server; int _tick; - wstring name; - shared_ptr acceptedLogin; - wstring loginKey; + std::wstring name; + std::shared_ptr acceptedLogin; + std::wstring loginKey; public: - PendingConnection(MinecraftServer *server, Socket *socket, const wstring& id); + PendingConnection(MinecraftServer *server, Socket *socket, const std::wstring& id); ~PendingConnection(); void tick(); void disconnect(DisconnectPacket::eDisconnectReason reason); - virtual void handlePreLogin(shared_ptr packet); - virtual void handleLogin(shared_ptr packet); - virtual void handleAcceptedLogin(shared_ptr packet); + virtual void handlePreLogin(std::shared_ptr packet); + virtual void handleLogin(std::shared_ptr packet); + virtual void handleAcceptedLogin(std::shared_ptr packet); virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects); - virtual void handleGetInfo(shared_ptr packet); - virtual void handleKeepAlive(shared_ptr packet); - virtual void onUnhandledPacket(shared_ptr packet); - void send(shared_ptr packet); - wstring getName(); + virtual void handleGetInfo(std::shared_ptr packet); + virtual void handleKeepAlive(std::shared_ptr packet); + virtual void onUnhandledPacket(std::shared_ptr packet); + void send(std::shared_ptr packet); + std::wstring getName(); virtual bool isServerPacketListener(); private: diff --git a/Minecraft.Client/Network/PlayerChunkMap.cpp b/Minecraft.Client/Network/PlayerChunkMap.cpp index 9849c96bd..b4d85d048 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.cpp +++ b/Minecraft.Client/Network/PlayerChunkMap.cpp @@ -44,12 +44,12 @@ void PlayerChunkMap::flagEntitiesToBeRemoved(unsigned int *flags, bool *flagToBe { for(AUTO_VAR(it,players.begin()); it != players.end(); it++) { - shared_ptr serverPlayer = *it; + std::shared_ptr serverPlayer = *it; serverPlayer->flagEntitiesToBeRemoved(flags, flagToBeRemoved); } } -void PlayerChunkMap::PlayerChunk::add(shared_ptr player, bool sendPacket /*= true*/) +void PlayerChunkMap::PlayerChunk::add(std::shared_ptr player, bool sendPacket /*= true*/) { //app.DebugPrintf("--- Adding player to chunk x=%d\tz=%d\n",x, z); if (find(players.begin(),players.end(),player) != players.end()) @@ -66,7 +66,7 @@ void PlayerChunkMap::PlayerChunk::add(shared_ptr player, bool send player->seenChunks.insert(pos); // 4J Added the sendPacket check. See PlayerChunkMap::add for the usage - if( sendPacket ) player->connection->send( shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, true) ) ); + if( sendPacket ) player->connection->send( std::shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, true) ) ); players.push_back(player); @@ -77,7 +77,7 @@ void PlayerChunkMap::PlayerChunk::add(shared_ptr player, bool send #endif } -void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) +void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { PlayerChunkMap::PlayerChunk *toDelete = NULL; @@ -121,7 +121,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) { for( AUTO_VAR(it, players.begin()); it < players.end(); ++it ) { - shared_ptr currPlayer = *it; + std::shared_ptr currPlayer = *it; INetworkPlayer *currNetPlayer = currPlayer->connection->getNetworkPlayer(); if( currNetPlayer != NULL && currNetPlayer->IsSameSystem( thisNetPlayer ) && currPlayer->seenChunks.find(pos) != currPlayer->seenChunks.end() ) { @@ -132,7 +132,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) if(noOtherPlayersFound) { //wprintf(L"Sending ChunkVisiblity packet false for chunk (%d,%d) to player %ls\n", x, z, player->name.c_str() ); - player->connection->send( shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, false) ) ); + player->connection->send( std::shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, false) ) ); } } else @@ -181,12 +181,12 @@ void PlayerChunkMap::PlayerChunk::prioritiseTileChanges() prioritised = true; } -void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) +void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr packet) { - vector< shared_ptr > sentTo; + std::vector< std::shared_ptr > sentTo; for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; // 4J - don't send to a player we've already sent this data to that shares the same machine. TileUpdatePacket, // ChunkTilesUpdatePacket and SignUpdatePacket all used to limit themselves to sending once to each machine @@ -205,7 +205,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) { for(unsigned int j = 0; j < sentTo.size(); j++ ) { - shared_ptr player2 = sentTo[j]; + std::shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { @@ -244,7 +244,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) for( int i = 0; i < parent->level->getServer()->getPlayers()->players.size(); i++ ) { - shared_ptr player = parent->level->getServer()->getPlayers()->players[i]; + std::shared_ptr player = parent->level->getServer()->getPlayers()->players[i]; // Don't worry about local players, they get all their updates through sharing level with the server anyway if ( player->connection == NULL ) continue; if( player->connection->isLocal() ) continue; @@ -267,7 +267,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) { for(unsigned int j = 0; j < sentTo.size(); j++ ) { - shared_ptr player2 = sentTo[j]; + std::shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { @@ -299,7 +299,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) int x = pos.x * 16 + xChangeMin; int y = yChangeMin; int z = pos.z * 16 + zChangeMin; - broadcast( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + broadcast( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); if (level->isEntityTile(x, y, z)) { broadcast(level->getTileEntity(x, y, z)); @@ -329,8 +329,8 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) // Block region update packets can only encode ys in a range of 1 - 256 if( ys > 256 ) ys = 256; - broadcast( shared_ptr( new BlockRegionUpdatePacket(xp, yp, zp, xs, ys, zs, level) ) ); - vector > *tes = level->getTileEntitiesInRegion(xp, yp, zp, xp + xs, yp + ys, zp + zs); + broadcast( std::shared_ptr( new BlockRegionUpdatePacket(xp, yp, zp, xs, ys, zs, level) ) ); + std::vector > *tes = level->getTileEntitiesInRegion(xp, yp, zp, xp + xs, yp + ys, zp + zs); for (unsigned int i = 0; i < tes->size(); i++) { broadcast(tes->at(i)); @@ -342,7 +342,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) else { // 4J As we only get here if changes is less than MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in the packet - broadcast( shared_ptr( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (uint8_t)changes, level) ) ); + broadcast( std::shared_ptr( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (uint8_t)changes, level) ) ); for (int i = 0; i < changes; i++) { int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15); @@ -361,11 +361,11 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) return didRegionUpdate; } -void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr te) +void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr te) { if (te != NULL) { - shared_ptr p = te->getUpdatePacket(); + std::shared_ptr p = te->getUpdatePacket(); if (p != NULL) { broadcast(p); @@ -458,7 +458,7 @@ PlayerChunkMap::PlayerChunk *PlayerChunkMap::getChunk(int x, int z, bool create) // 4J - added. If a chunk exists, add a player to it straight away. If it doesn't exist, // queue a request for it to be created. -void PlayerChunkMap::getChunkAndAddPlayer(int x, int z, shared_ptr player) +void PlayerChunkMap::getChunkAndAddPlayer(int x, int z, std::shared_ptr player) { __int64 id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); AUTO_VAR(it, chunks.find(id)); @@ -475,7 +475,7 @@ void PlayerChunkMap::getChunkAndAddPlayer(int x, int z, shared_ptr // 4J - added. If the chunk and player are in the queue to be added, remove from there. Otherwise // attempt to remove from main chunk map. -void PlayerChunkMap::getChunkAndRemovePlayer(int x, int z, shared_ptr player) +void PlayerChunkMap::getChunkAndRemovePlayer(int x, int z, std::shared_ptr player) { for( AUTO_VAR(it, addRequests.begin()); it != addRequests.end(); it++ ) { @@ -497,7 +497,7 @@ void PlayerChunkMap::getChunkAndRemovePlayer(int x, int z, shared_ptr player) +void PlayerChunkMap::tickAddRequests(std::shared_ptr player) { if( addRequests.size() ) { @@ -533,7 +533,7 @@ void PlayerChunkMap::tickAddRequests(shared_ptr player) } } -void PlayerChunkMap::broadcastTileUpdate(shared_ptr packet, int x, int y, int z) +void PlayerChunkMap::broadcastTileUpdate(std::shared_ptr packet, int x, int y, int z) { int xc = x >> 4; int zc = z >> 4; @@ -576,7 +576,7 @@ void PlayerChunkMap::prioritiseTileChanges(int x, int y, int z) } } -void PlayerChunkMap::add(shared_ptr player) +void PlayerChunkMap::add(std::shared_ptr player) { static int direction[4][2] = { { 1, 0 }, { 0, 1 }, { -1, 0 }, {0, -1} }; @@ -649,7 +649,7 @@ void PlayerChunkMap::add(shared_ptr player) } // CraftBukkit end - player->connection->send( shared_ptr( new ChunkVisibilityAreaPacket(minX, maxX, minZ, maxZ) ) ); + player->connection->send( std::shared_ptr( new ChunkVisibilityAreaPacket(minX, maxX, minZ, maxZ) ) ); #ifdef _LARGE_WORLDS getLevel()->cache->dontDrop(xc,zc); @@ -659,7 +659,7 @@ void PlayerChunkMap::add(shared_ptr player) } -void PlayerChunkMap::remove(shared_ptr player) +void PlayerChunkMap::remove(std::shared_ptr player) { int xc = ((int) player->lastMoveX) >> 4; int zc = ((int) player->lastMoveZ) >> 4; @@ -702,7 +702,7 @@ bool PlayerChunkMap::chunkInRange(int x, int z, int xc, int zc) // 4J - have changed this so that we queue requests to add the player to chunks if they // need to be created, so that we aren't creating potentially 20 chunks per player per tick -void PlayerChunkMap::move(shared_ptr player) +void PlayerChunkMap::move(std::shared_ptr player) { int xc = ((int) player->x) >> 4; int zc = ((int) player->z) >> 4; @@ -744,7 +744,7 @@ int PlayerChunkMap::getMaxRange() return radius * 16 - 16; } -bool PlayerChunkMap::isPlayerIn(shared_ptr player, int xChunk, int zChunk) +bool PlayerChunkMap::isPlayerIn(std::shared_ptr player, int xChunk, int zChunk) { PlayerChunk *chunk = getChunk(xChunk, zChunk, false); @@ -775,7 +775,7 @@ void PlayerChunkMap::setRadius(int newRadius) PlayerList* players = level->getServer()->getPlayerList(); for( int i = 0;i < players->players.size();i += 1 ) { - shared_ptr player = players->players[i]; + std::shared_ptr player = players->players[i]; if( player->level == level ) { int xc = ((int) player->x) >> 4; diff --git a/Minecraft.Client/Network/PlayerChunkMap.h b/Minecraft.Client/Network/PlayerChunkMap.h index e8673b6b5..9c9df9f0f 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.h +++ b/Minecraft.Client/Network/PlayerChunkMap.h @@ -6,7 +6,7 @@ class ServerLevel; class MinecraftServer; class Packet; class TileEntity; -using namespace std; + class PlayerChunkMap { @@ -25,8 +25,8 @@ public: { public: int x,z; - shared_ptr player; - PlayerChunkAddRequest(int x, int z, shared_ptr player ) : x(x), z(z), player(player) {} + std::shared_ptr player; + PlayerChunkAddRequest(int x, int z, std::shared_ptr player ) : x(x), z(z), player(player) {} }; class PlayerChunk @@ -34,7 +34,7 @@ public: friend class PlayerChunkMap; private: PlayerChunkMap *parent; // 4J added - vector > players; + std::vector > players; //int x, z; ChunkPos pos; @@ -51,25 +51,25 @@ public: ~PlayerChunk(); // 4J Added sendPacket param so we can aggregate the initial send into one much smaller packet - void add(shared_ptr player, bool sendPacket = true); - void remove(shared_ptr player); + void add(std::shared_ptr player, bool sendPacket = true); + void remove(std::shared_ptr player); void tileChanged(int x, int y, int z); void prioritiseTileChanges(); // 4J added - void broadcast(shared_ptr packet); + void broadcast(std::shared_ptr packet); bool broadcastChanges(bool allowRegionUpdate); // 4J - added parm private: - void broadcast(shared_ptr te); + void broadcast(std::shared_ptr te); }; public: - vector > players; + std::vector > players; void flagEntitiesToBeRemoved(unsigned int *flags, bool *removedFound); // 4J added private: - unordered_map<__int64,PlayerChunk *,LongKeyHash,LongKeyEq> chunks; // 4J - was LongHashMap - vector changedChunks; - vector addRequests; // 4J added - void tickAddRequests(shared_ptr player); // 4J added + std::unordered_map<__int64,PlayerChunk *,LongKeyHash,LongKeyEq> chunks; // 4J - was LongHashMap + std::vector changedChunks; + std::vector addRequests; // 4J added + void tickAddRequests(std::shared_ptr player); // 4J added ServerLevel *level; int radius; @@ -83,21 +83,21 @@ public: bool hasChunk(int x, int z); private: PlayerChunk *getChunk(int x, int z, bool create); - void getChunkAndAddPlayer(int x, int z, shared_ptr player); // 4J added - void getChunkAndRemovePlayer(int x, int z, shared_ptr player); // 4J added + void getChunkAndAddPlayer(int x, int z, std::shared_ptr player); // 4J added + void getChunkAndRemovePlayer(int x, int z, std::shared_ptr player); // 4J added public: - void broadcastTileUpdate(shared_ptr packet, int x, int y, int z); + void broadcastTileUpdate(std::shared_ptr packet, int x, int y, int z); void tileChanged(int x, int y, int z); bool isTrackingTile(int x, int y, int z); // 4J added void prioritiseTileChanges(int x, int y, int z); // 4J added - void add(shared_ptr player); - void remove(shared_ptr player); + void add(std::shared_ptr player); + void remove(std::shared_ptr player); private: bool chunkInRange(int x, int z, int xc, int zc); public: - void move(shared_ptr player); + void move(std::shared_ptr player); int getMaxRange(); - bool isPlayerIn(shared_ptr player, int xChunk, int zChunk); + bool isPlayerIn(std::shared_ptr player, int xChunk, int zChunk); static int convertChunkRangeToBlock(int radius); // AP added for Vita diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index 6f696d91c..18511aeec 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -34,7 +34,7 @@ Random PlayerConnection::random; -PlayerConnection::PlayerConnection(MinecraftServer *server, Connection *connection, shared_ptr player) +PlayerConnection::PlayerConnection(MinecraftServer *server, Connection *connection, std::shared_ptr player) { // 4J - added initialisers done = false; @@ -93,7 +93,7 @@ void PlayerConnection::tick() lastKeepAliveTick = tickCount; lastKeepAliveTime = System::nanoTime() / 1000000; lastKeepAliveId = random.nextInt(); - send( shared_ptr( new KeepAlivePacket(lastKeepAliveId) ) ); + send( std::shared_ptr( new KeepAlivePacket(lastKeepAliveId) ) ); } // if (!didTick) { // player->doTick(false); @@ -123,17 +123,17 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) // 4J Stu - Need to remove the player from the receiving list before their socket is NULLed so that we can find another player on their system server->getPlayers()->removePlayerFromReceiving( player ); - send( shared_ptr( new DisconnectPacket(reason) )); + send( std::shared_ptr( new DisconnectPacket(reason) )); connection->sendAndQuit(); // 4J-PB - removed, since it needs to be localised in the language the client is in - //server->players->broadcastAll( shared_ptr( new ChatPacket(L"§e" + player->name + L" left the game.") ) ); + //server->players->broadcastAll( std::shared_ptr( new ChatPacket(L"§e" + player->name + L" left the game.") ) ); if(getWasKicked()) { - server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); } else { - server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) ); } server->getPlayers()->remove(player); @@ -141,12 +141,12 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) LeaveCriticalSection(&done_cs); } -void PlayerConnection::handlePlayerInput(shared_ptr packet) +void PlayerConnection::handlePlayerInput(std::shared_ptr packet) { player->setPlayerInput(packet->getXa(), packet->getYa(), packet->isJumping(), packet->isSneaking(), packet->getXRot(), packet->getYRot()); } -void PlayerConnection::handleMovePlayer(shared_ptr packet) +void PlayerConnection::handleMovePlayer(std::shared_ptr packet) { ServerLevel *level = server->getLevel(player->dimension); @@ -391,10 +391,10 @@ void PlayerConnection::teleport(double x, double y, double z, float yRot, float player->absMoveTo(x, y, z, yRot, xRot); // 4J - note that 1.62 is added to the height here as the client connection that receives this will presume it represents y + heightOffset at that end // This is different to the way that height is sent back to the server, where it represents the bottom of the player bounding volume - if(sendPacket) player->connection->send( shared_ptr( new MovePlayerPacket::PosRot(x, y + 1.62f, y, z, yRot, xRot, false, false) ) ); + if(sendPacket) player->connection->send( std::shared_ptr( new MovePlayerPacket::PosRot(x, y + 1.62f, y, z, yRot, xRot, false, false) ) ); } -void PlayerConnection::handlePlayerAction(shared_ptr packet) +void PlayerConnection::handlePlayerAction(std::shared_ptr packet) { ServerLevel *level = server->getLevel(player->dimension); @@ -442,19 +442,19 @@ void PlayerConnection::handlePlayerAction(shared_ptr packet) if (packet->action == PlayerActionPacket::START_DESTROY_BLOCK) { if (zd > 16 || canEditSpawn) player->gameMode->startDestroyBlock(x, y, z, packet->face); - else player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + else player->connection->send( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } else if (packet->action == PlayerActionPacket::STOP_DESTROY_BLOCK) { player->gameMode->stopDestroyBlock(x, y, z); server->getPlayers()->prioritiseTileChanges(x, y, z, level->dimension->id); // 4J added - make sure that the update packets for this get prioritised over other general world updates - if (level->getTile(x, y, z) != 0) player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + if (level->getTile(x, y, z) != 0) player->connection->send( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } else if (packet->action == PlayerActionPacket::ABORT_DESTROY_BLOCK) { player->gameMode->abortDestroyBlock(x, y, z); - if (level->getTile(x, y, z) != 0) player->connection->send(shared_ptr( new TileUpdatePacket(x, y, z, level))); + if (level->getTile(x, y, z) != 0) player->connection->send(std::shared_ptr( new TileUpdatePacket(x, y, z, level))); } else if (packet->action == PlayerActionPacket::GET_UPDATED_BLOCK) { @@ -464,7 +464,7 @@ void PlayerConnection::handlePlayerAction(shared_ptr packet) double dist = xDist * xDist + yDist * yDist + zDist * zDist; if (dist < 16 * 16) { - player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + player->connection->send( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } } @@ -473,10 +473,10 @@ void PlayerConnection::handlePlayerAction(shared_ptr packet) } -void PlayerConnection::handleUseItem(shared_ptr packet) +void PlayerConnection::handleUseItem(std::shared_ptr packet) { ServerLevel *level = server->getLevel(player->dimension); - shared_ptr item = player->inventory->getSelected(); + std::shared_ptr item = player->inventory->getSelected(); bool informClient = false; int x = packet->getX(); int y = packet->getY(); @@ -509,14 +509,14 @@ void PlayerConnection::handleUseItem(shared_ptr packet) } else { - //player->connection->send(shared_ptr(new ChatPacket("\u00A77Height limit for building is " + server->maxBuildHeight))); + //player->connection->send(std::shared_ptr(new ChatPacket("\u00A77Height limit for building is " + server->maxBuildHeight))); informClient = true; } if (informClient) { - player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + player->connection->send( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); if (face == 0) y--; if (face == 1) y++; @@ -532,7 +532,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) // isn't what it is expecting. if( level->getTile(x,y,z) != Tile::pistonMovingPiece_Id ) { - player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); + player->connection->send( std::shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } } @@ -554,7 +554,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) if (!ItemInstance::matches(player->inventory->getSelected(), packet->getItem())) { - send( shared_ptr( new ContainerSetSlotPacket(player->containerMenu->containerId, s->index, player->inventory->getSelected()) ) ); + send( std::shared_ptr( new ContainerSetSlotPacket(player->containerMenu->containerId, s->index, player->inventory->getSelected()) ) ); } } @@ -569,27 +569,27 @@ void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, if( done ) return; // logger.info(player.name + " lost connection: " + reason); // 4J-PB - removed, since it needs to be localised in the language the client is in - //server->players->broadcastAll( shared_ptr( new ChatPacket(L"§e" + player->name + L" left the game.") ) ); + //server->players->broadcastAll( std::shared_ptr( new ChatPacket(L"§e" + player->name + L" left the game.") ) ); if(getWasKicked()) { - server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); } else { - server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) ); } server->getPlayers()->remove(player); done = true; LeaveCriticalSection(&done_cs); } -void PlayerConnection::onUnhandledPacket(shared_ptr packet) +void PlayerConnection::onUnhandledPacket(std::shared_ptr packet) { // logger.warning(getClass() + " wasn't prepared to deal with a " + packet.getClass()); disconnect(DisconnectPacket::eDisconnect_UnexpectedPacket); } -void PlayerConnection::send(shared_ptr packet) +void PlayerConnection::send(std::shared_ptr packet) { if( connection->getSocket() != NULL ) { @@ -607,7 +607,7 @@ void PlayerConnection::send(shared_ptr packet) } // 4J Added -void PlayerConnection::queueSend(shared_ptr packet) +void PlayerConnection::queueSend(std::shared_ptr packet) { if( connection->getSocket() != NULL ) { @@ -624,7 +624,7 @@ void PlayerConnection::queueSend(shared_ptr packet) } } -void PlayerConnection::handleSetCarriedItem(shared_ptr packet) +void PlayerConnection::handleSetCarriedItem(std::shared_ptr packet) { if (packet->slot < 0 || packet->slot >= Inventory::getSelectionSize()) { @@ -634,11 +634,11 @@ void PlayerConnection::handleSetCarriedItem(shared_ptr pac player->inventory->selected = packet->slot; } -void PlayerConnection::handleChat(shared_ptr packet) +void PlayerConnection::handleChat(std::shared_ptr packet) { // 4J - TODO #if 0 - wstring message = packet->message; + std::wstring message = packet->message; if (message.length() > SharedConstants::maxChatLength) { disconnect(L"Chat message too long"); @@ -670,7 +670,7 @@ void PlayerConnection::handleChat(shared_ptr packet) #endif } -void PlayerConnection::handleCommand(const wstring& message) +void PlayerConnection::handleCommand(const std::wstring& message) { // 4J - TODO #if 0 @@ -678,7 +678,7 @@ void PlayerConnection::handleCommand(const wstring& message) #endif } -void PlayerConnection::handleAnimate(shared_ptr packet) +void PlayerConnection::handleAnimate(std::shared_ptr packet) { if (packet->action == AnimatePacket::SWING) { @@ -686,7 +686,7 @@ void PlayerConnection::handleAnimate(shared_ptr packet) } } -void PlayerConnection::handlePlayerCommand(shared_ptr packet) +void PlayerConnection::handlePlayerCommand(std::shared_ptr packet) { if (packet->action == PlayerCommandPacket::START_SNEAKING) { @@ -725,7 +725,7 @@ void PlayerConnection::setShowOnMaps(bool bVal) player->setShowOnMaps(bVal); } -void PlayerConnection::handleDisconnect(shared_ptr packet) +void PlayerConnection::handleDisconnect(std::shared_ptr packet) { // 4J Stu - Need to remove the player from the receiving list before their socket is NULLed so that we can find another player on their system server->getPlayers()->removePlayerFromReceiving( player ); @@ -737,27 +737,27 @@ int PlayerConnection::countDelayedPackets() return connection->countDelayedPackets(); } -void PlayerConnection::info(const wstring& string) +void PlayerConnection::info(const std::wstring& string) { // 4J-PB - removed, since it needs to be localised in the language the client is in - //send( shared_ptr( new ChatPacket(L"§7" + string) ) ); + //send( std::shared_ptr( new ChatPacket(L"§7" + string) ) ); } -void PlayerConnection::warn(const wstring& string) +void PlayerConnection::warn(const std::wstring& string) { // 4J-PB - removed, since it needs to be localised in the language the client is in - //send( shared_ptr( new ChatPacket(L"§9" + string) ) ); + //send( std::shared_ptr( new ChatPacket(L"§9" + string) ) ); } -wstring PlayerConnection::getConsoleName() +std::wstring PlayerConnection::getConsoleName() { return player->name; } -void PlayerConnection::handleInteract(shared_ptr packet) +void PlayerConnection::handleInteract(std::shared_ptr packet) { ServerLevel *level = server->getLevel(player->dimension); - shared_ptr target = level->getEntity(packet->target); + std::shared_ptr target = level->getEntity(packet->target); // Fix for #8218 - Gameplay: Attacking zombies from a different level often results in no hits being registered // 4J Stu - If the client says that we hit something, then agree with it. The canSee can fail here as it checks @@ -792,7 +792,7 @@ bool PlayerConnection::canHandleAsyncPackets() return true; } -void PlayerConnection::handleTexture(shared_ptr packet) +void PlayerConnection::handleTexture(std::shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way @@ -808,7 +808,7 @@ void PlayerConnection::handleTexture(shared_ptr packet) if(dwBytes!=0) { - send( shared_ptr( new TexturePacket(packet->textureName,pbData,dwBytes) ) ); + send( std::shared_ptr( new TexturePacket(packet->textureName,pbData,dwBytes) ) ); } else { @@ -826,7 +826,7 @@ void PlayerConnection::handleTexture(shared_ptr packet) } } -void PlayerConnection::handleTextureAndGeometry(shared_ptr packet) +void PlayerConnection::handleTextureAndGeometry(std::shared_ptr packet) { // Both PlayerConnection and ClientConnection should handle this mostly the same way @@ -848,20 +848,20 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptrgetAdditionalBoxesCount()!=0) { - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pDLCSkinFile) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pDLCSkinFile) ) ); } else { - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes) ) ); } } else { // we don't have the dlc skin, so retrieve the data from the app store - vector *pvSkinBoxes = app.GetAdditionalSkinBoxes(packet->dwSkinID); + std::vector *pvSkinBoxes = app.GetAdditionalSkinBoxes(packet->dwSkinID); unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID); - send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pvSkinBoxes,uiAnimOverrideBitmask) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pvSkinBoxes,uiAnimOverrideBitmask) ) ); } } else @@ -894,7 +894,7 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptr( new TexturePacket(textureName,pbData,dwBytes) ) ); + send( std::shared_ptr( new TexturePacket(textureName,pbData,dwBytes) ) ); m_texturesRequested.erase(it); } } } -void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureName) +void PlayerConnection::handleTextureAndGeometryReceived(const std::wstring &textureName) { // This sends the server received texture out to any other players waiting for the data AUTO_VAR(it, find( m_texturesRequested.begin(), m_texturesRequested.end(), textureName )); @@ -927,23 +927,23 @@ void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureNa { if(pDLCSkinFile && (pDLCSkinFile->getAdditionalBoxesCount()!=0)) { - send( shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes,pDLCSkinFile) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes,pDLCSkinFile) ) ); } else { // get the data from the app DWORD dwSkinID = app.getSkinIdFromPath(textureName); - vector *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID); + std::vector *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID); unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(dwSkinID); - send( shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask) ) ); + send( std::shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask) ) ); } m_texturesRequested.erase(it); } } } -void PlayerConnection::handleTextureChange(shared_ptr packet) +void PlayerConnection::handleTextureChange(std::shared_ptr packet) { switch(packet->action) { @@ -968,7 +968,7 @@ void PlayerConnection::handleTextureChange(shared_ptr packe #ifndef _CONTENT_PACKAGE wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",packet->path.c_str(), player->name.c_str()); #endif - send(shared_ptr( new TexturePacket(packet->path,NULL,0) ) ); + send(std::shared_ptr( new TexturePacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) @@ -976,10 +976,10 @@ void PlayerConnection::handleTextureChange(shared_ptr packe // Update the ref count on the memory texture data app.AddMemoryTextureFile(packet->path,NULL,0); } - server->getPlayers()->broadcastAll( shared_ptr( new TextureChangePacket(player,packet->action,packet->path) ), player->dimension ); + server->getPlayers()->broadcastAll( std::shared_ptr( new TextureChangePacket(player,packet->action,packet->path) ), player->dimension ); } -void PlayerConnection::handleTextureAndGeometryChange(shared_ptr packet) +void PlayerConnection::handleTextureAndGeometryChange(std::shared_ptr packet) { player->setCustomSkin( app.getSkinIdFromPath( packet->path ) ); @@ -995,7 +995,7 @@ void PlayerConnection::handleTextureAndGeometryChange(shared_ptrpath.c_str(), player->name.c_str()); #endif - send(shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); + send(std::shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) @@ -1009,10 +1009,10 @@ void PlayerConnection::handleTextureAndGeometryChange(shared_ptrdwSkinID,) //DebugBreak(); } - server->getPlayers()->broadcastAll( shared_ptr( new TextureAndGeometryChangePacket(player,packet->path) ), player->dimension ); + server->getPlayers()->broadcastAll( std::shared_ptr( new TextureAndGeometryChangePacket(player,packet->path) ), player->dimension ); } -void PlayerConnection::handleServerSettingsChanged(shared_ptr packet) +void PlayerConnection::handleServerSettingsChanged(std::shared_ptr packet) { if(packet->action==ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS) { @@ -1024,7 +1024,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptrdata,eGameHostOption_FireSpreads)); app.SetGameHostOption(eGameHostOption_TNT, app.GetGameHostOption(packet->data,eGameHostOption_TNT)); - server->getPlayers()->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS,app.GetGameHostOption(eGameHostOption_All) ) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS,app.GetGameHostOption(eGameHostOption_All) ) ) ); // Update the QoS data g_NetworkManager.UpdateAndSetGameSessionData(); @@ -1032,7 +1032,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptr packet) +void PlayerConnection::handleKickPlayer(std::shared_ptr packet) { INetworkPlayer *networkPlayer = getNetworkPlayer(); if( (networkPlayer != NULL && networkPlayer->IsHost()) || player->isModerator()) @@ -1041,12 +1041,12 @@ void PlayerConnection::handleKickPlayer(shared_ptr packet) } } -void PlayerConnection::handleGameCommand(shared_ptr packet) +void PlayerConnection::handleGameCommand(std::shared_ptr packet) { MinecraftServer::getInstance()->getCommandDispatcher()->performCommand(player, packet->command, packet->data); } -void PlayerConnection::handleClientCommand(shared_ptr packet) +void PlayerConnection::handleClientCommand(std::shared_ptr packet) { if (packet->action == ClientCommandPacket::PERFORM_RESPAWN) { @@ -1078,17 +1078,17 @@ void PlayerConnection::handleClientCommand(shared_ptr packe } } -void PlayerConnection::handleRespawn(shared_ptr packet) +void PlayerConnection::handleRespawn(std::shared_ptr packet) { } -void PlayerConnection::handleContainerClose(shared_ptr packet) +void PlayerConnection::handleContainerClose(std::shared_ptr packet) { player->doCloseContainer(); } #ifndef _CONTENT_PACKAGE -void PlayerConnection::handleContainerSetSlot(shared_ptr packet) +void PlayerConnection::handleContainerSetSlot(std::shared_ptr packet) { if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_CARRIED ) { @@ -1098,7 +1098,7 @@ void PlayerConnection::handleContainerSetSlot(shared_ptr { if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY && packet->slot >= 36 && packet->slot < 36 + 9) { - shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); + std::shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); if (packet->item != NULL) { if (lastItem == NULL || lastItem->count < packet->item->count) @@ -1124,16 +1124,16 @@ void PlayerConnection::handleContainerSetSlot(shared_ptr } #endif -void PlayerConnection::handleContainerClick(shared_ptr packet) +void PlayerConnection::handleContainerClick(std::shared_ptr packet) { if (player->containerMenu->containerId == packet->containerId && player->containerMenu->isSynched(player)) { - shared_ptr clicked = player->containerMenu->clicked(packet->slotNum, packet->buttonNum, packet->quickKey?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player); + std::shared_ptr clicked = player->containerMenu->clicked(packet->slotNum, packet->buttonNum, packet->quickKey?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player); if (ItemInstance::matches(packet->item, clicked)) { // Yep, you sure did click what you claimed to click! - player->connection->send( shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, true) ) ); + player->connection->send( std::shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, true) ) ); player->ignoreSlotUpdateHack = true; player->containerMenu->broadcastChanges(); player->broadcastCarriedItem(); @@ -1143,10 +1143,10 @@ void PlayerConnection::handleContainerClick(shared_ptr pac { // No, you clicked the wrong thing! expectedAcks[player->containerMenu->containerId] = packet->uid; - player->connection->send( shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, false) ) ); + player->connection->send( std::shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, false) ) ); player->containerMenu->setSynched(player, false); - vector > items; + std::vector > items; for (unsigned int i = 0; i < player->containerMenu->slots->size(); i++) { items.push_back(player->containerMenu->slots->at(i)->getItem()); @@ -1159,7 +1159,7 @@ void PlayerConnection::handleContainerClick(shared_ptr pac } -void PlayerConnection::handleContainerButtonClick(shared_ptr packet) +void PlayerConnection::handleContainerButtonClick(std::shared_ptr packet) { if (player->containerMenu->containerId == packet->containerId && player->containerMenu->isSynched(player)) { @@ -1168,12 +1168,12 @@ void PlayerConnection::handleContainerButtonClick(shared_ptr packet) +void PlayerConnection::handleSetCreativeModeSlot(std::shared_ptr packet) { if (player->gameMode->isCreative()) { bool drop = packet->slotNum < 0; - shared_ptr item = packet->item; + std::shared_ptr item = packet->item; if(item != NULL && item->id == Item::map_Id) { @@ -1189,17 +1189,17 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrsetAuxValue( player->level->getAuxValueForMap(player->getXuid(), player->dimension, centreXC, centreZC, mapScale) ); - shared_ptr data = MapItem::getSavedData(item->getAuxValue(), player->level); + std::shared_ptr data = MapItem::getSavedData(item->getAuxValue(), player->level); // 4J Stu - We only have one map per player per dimension, so don't reset the one that they have // when a new one is created wchar_t buf[64]; swprintf(buf,64,L"map_%d", item->getAuxValue()); - std::wstring id = wstring(buf); + std::wstring id = std::wstring(buf); if( data == NULL ) { - data = shared_ptr( new MapItemSavedData(id) ); + data = std::shared_ptr( new MapItemSavedData(id) ); } - player->level->setSavedData(id, (shared_ptr ) data); + player->level->setSavedData(id, (std::shared_ptr ) data); data->scale = mapScale; // 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map @@ -1232,7 +1232,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr dropped = player->drop(item); + std::shared_ptr dropped = player->drop(item); if (dropped != NULL) { dropped->setShortLifeTime(); @@ -1244,7 +1244,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr > items; + std::vector > items; for (unsigned int i = 0; i < player->inventoryMenu->slots->size(); i++) { items.push_back(player->inventoryMenu->slots->at(i)->getItem()); @@ -1254,7 +1254,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr packet) +void PlayerConnection::handleContainerAck(std::shared_ptr packet) { AUTO_VAR(it, expectedAcks.find(player->containerMenu->containerId)); @@ -1264,18 +1264,18 @@ void PlayerConnection::handleContainerAck(shared_ptr packet) } } -void PlayerConnection::handleSignUpdate(shared_ptr packet) +void PlayerConnection::handleSignUpdate(std::shared_ptr packet) { app.DebugPrintf("PlayerConnection::handleSignUpdate\n"); ServerLevel *level = server->getLevel(player->dimension); if (level->hasChunkAt(packet->x, packet->y, packet->z)) { - shared_ptr te = level->getTileEntity(packet->x, packet->y, packet->z); + std::shared_ptr te = level->getTileEntity(packet->x, packet->y, packet->z); - if (dynamic_pointer_cast(te) != NULL) + if (std::dynamic_pointer_cast(te) != NULL) { - shared_ptr ste = dynamic_pointer_cast(te); + std::shared_ptr ste = std::dynamic_pointer_cast(te); if (!ste->isEditable()) { server->warn(L"Player " + player->name + L" just tried to change non-editable sign"); @@ -1284,15 +1284,15 @@ void PlayerConnection::handleSignUpdate(shared_ptr packet) } // 4J-JEV: Changed to allow characters to display as a []. - if (dynamic_pointer_cast(te) != NULL) + if (std::dynamic_pointer_cast(te) != NULL) { int x = packet->x; int y = packet->y; int z = packet->z; - shared_ptr ste = dynamic_pointer_cast(te); + std::shared_ptr ste = std::dynamic_pointer_cast(te); for (int i = 0; i < 4; i++) { - wstring lineText = packet->lines[i].substr(0,15); + std::wstring lineText = packet->lines[i].substr(0,15); ste->SetMessage( i, lineText ); } ste->SetVerified(false); @@ -1303,7 +1303,7 @@ void PlayerConnection::handleSignUpdate(shared_ptr packet) } -void PlayerConnection::handleKeepAlive(shared_ptr packet) +void PlayerConnection::handleKeepAlive(std::shared_ptr packet) { if (packet->id == lastKeepAliveId) { @@ -1312,18 +1312,18 @@ void PlayerConnection::handleKeepAlive(shared_ptr packet) } } -void PlayerConnection::handlePlayerInfo(shared_ptr packet) +void PlayerConnection::handlePlayerInfo(std::shared_ptr packet) { // Need to check that this player has permission to change each individual setting? INetworkPlayer *networkPlayer = getNetworkPlayer(); if( (networkPlayer != NULL && networkPlayer->IsHost()) || player->isModerator() ) { - shared_ptr serverPlayer; + std::shared_ptr serverPlayer; // Find the player being edited for(AUTO_VAR(it, server->getPlayers()->players.begin()); it != server->getPlayers()->players.end(); ++it) { - shared_ptr checkingPlayer = *it; + std::shared_ptr checkingPlayer = *it; if(checkingPlayer->connection->getNetworkPlayer() != NULL && checkingPlayer->connection->getNetworkPlayer()->GetSmallId() == packet->m_networkSmallId) { serverPlayer = checkingPlayer; @@ -1348,7 +1348,7 @@ void PlayerConnection::handlePlayerInfo(shared_ptr packet) #endif serverPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_CreativeMode,Player::getPlayerGamePrivilege(packet->m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode) ); serverPlayer->gameMode->setGameModeForPlayer(gameType); - serverPlayer->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, gameType->getId()) )); + serverPlayer->connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, gameType->getId()) )); } else { @@ -1400,7 +1400,7 @@ void PlayerConnection::handlePlayerInfo(shared_ptr packet) } } - server->getPlayers()->broadcastAll( shared_ptr( new PlayerInfoPacket( serverPlayer ) ) ); + server->getPlayers()->broadcastAll( std::shared_ptr( new PlayerInfoPacket( serverPlayer ) ) ); } } } @@ -1410,7 +1410,7 @@ bool PlayerConnection::isServerPacketListener() return true; } -void PlayerConnection::handlePlayerAbilities(shared_ptr playerAbilitiesPacket) +void PlayerConnection::handlePlayerAbilities(std::shared_ptr playerAbilitiesPacket) { player->abilities.flying = playerAbilitiesPacket->isFlying() && player->abilities.mayfly; } @@ -1427,19 +1427,19 @@ void PlayerConnection::handlePlayerAbilities(shared_ptr p // player.connection.send(new ChatAutoCompletePacket(result.toString())); //} -//void handleClientInformation(shared_ptr packet) +//void handleClientInformation(std::shared_ptr packet) //{ // player->updateOptions(packet); //} -void PlayerConnection::handleCustomPayload(shared_ptr customPayloadPacket) +void PlayerConnection::handleCustomPayload(std::shared_ptr customPayloadPacket) { #if 0 if (CustomPayloadPacket.CUSTOM_BOOK_PACKET.equals(customPayloadPacket.identifier)) { ByteArrayInputStream bais(customPayloadPacket->data); DataInputStream input(&bais); - shared_ptr sentItem = Packet::readItem(input); + std::shared_ptr sentItem = Packet::readItem(input); if (!WritingBookItem.makeSureTagIsValid(sentItem.getTag())) { @@ -1498,7 +1498,7 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo { ByteArrayInputStream bais(customPayloadPacket->data); DataInputStream dis(&bais); - wstring name = dis.readUTF(); + std::wstring name = dis.readUTF(); if (name.length() <= 30) { menu->setItemName(name); @@ -1510,13 +1510,13 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo // 4J Added -void PlayerConnection::handleDebugOptions(shared_ptr packet) +void PlayerConnection::handleDebugOptions(std::shared_ptr packet) { - //Player player = dynamic_pointer_cast( player->shared_from_this() ); + //Player player = std::dynamic_pointer_cast( player->shared_from_this() ); player->SetDebugOptions(packet->m_uiVal); } -void PlayerConnection::handleCraftItem(shared_ptr packet) +void PlayerConnection::handleCraftItem(std::shared_ptr packet) { int iRecipe = packet->recipe; @@ -1524,11 +1524,11 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) return; Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); - shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); + std::shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); if(app.DebugSettingsOn() && (player->GetDebugOptions()&(1L<onCraftedBy(player->level, dynamic_pointer_cast( player->shared_from_this() ), pTempItemInst->count ); + pTempItemInst->onCraftedBy(player->level, std::dynamic_pointer_cast( player->shared_from_this() ), pTempItemInst->count ); if(player->inventory->add(pTempItemInst)==false ) { // no room in inventory, so throw it down @@ -1542,14 +1542,14 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) // TODO 4J Stu - Assume at the moment that the client can work this out for us... //if(pRecipeIngredientsRequired[iRecipe].bCanMake) //{ - pTempItemInst->onCraftedBy(player->level, dynamic_pointer_cast( player->shared_from_this() ), pTempItemInst->count ); + pTempItemInst->onCraftedBy(player->level, std::dynamic_pointer_cast( player->shared_from_this() ), pTempItemInst->count ); // and remove those resources from your inventory for(int i=0;i ingItemInst = nullptr; + std::shared_ptr ingItemInst = nullptr; // do we need to remove a specific aux value? if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE) { @@ -1568,7 +1568,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) if (ingItemInst->getItem()->hasCraftingRemainingItem()) { // replace item with remaining result - player->inventory->add( shared_ptr( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) ); + player->inventory->add( std::shared_ptr( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) ); } } @@ -1586,7 +1586,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) { // 4J Stu - Maps need to have their aux value update, so the client should always be assumed to be wrong // This is how the Java works, as the client also incorrectly predicts the auxvalue of the mapItem - vector > items; + std::vector > items; for (unsigned int i = 0; i < player->containerMenu->slots->size(); i++) { items.push_back(player->containerMenu->slots->at(i)->getItem()); @@ -1625,7 +1625,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) } -void PlayerConnection::handleTradeItem(shared_ptr packet) +void PlayerConnection::handleTradeItem(std::shared_ptr packet) { if (player->containerMenu->containerId == packet->containerId) { @@ -1642,8 +1642,8 @@ void PlayerConnection::handleTradeItem(shared_ptr packet) if(!activeRecipe->isDeprecated()) { // Do we have the ingredients? - shared_ptr buyAItem = activeRecipe->getBuyAItem(); - shared_ptr buyBItem = activeRecipe->getBuyBItem(); + std::shared_ptr buyAItem = activeRecipe->getBuyAItem(); + std::shared_ptr buyBItem = activeRecipe->getBuyBItem(); int buyAMatches = player->inventory->countMatches(buyAItem); int buyBMatches = player->inventory->countMatches(buyBItem); @@ -1656,7 +1656,7 @@ void PlayerConnection::handleTradeItem(shared_ptr packet) player->inventory->removeResources(buyBItem); // Add the item we have purchased - shared_ptr result = activeRecipe->getSellItem()->copy(); + std::shared_ptr result = activeRecipe->getSellItem()->copy(); // 4J JEV - Award itemsBought stat. player->awardStat( diff --git a/Minecraft.Client/Network/PlayerConnection.h b/Minecraft.Client/Network/PlayerConnection.h index 83c2729ca..ae8ec4881 100644 --- a/Minecraft.Client/Network/PlayerConnection.h +++ b/Minecraft.Client/Network/PlayerConnection.h @@ -8,7 +8,7 @@ class Connection; class ServerPlayer; class INetworkPlayer; -using namespace std; + class PlayerConnection : public PacketListener, public ConsoleInputSource { @@ -25,7 +25,7 @@ public: private: MinecraftServer *server; - shared_ptr player; + std::shared_ptr player; int tickCount; int aboveGroundTickCount; @@ -40,7 +40,7 @@ private: bool m_bHasClientTickedOnce; public: - PlayerConnection(MinecraftServer *server, Connection *connection, shared_ptr player); + PlayerConnection(MinecraftServer *server, Connection *connection, std::shared_ptr player); ~PlayerConnection(); void tick(); void disconnect(DisconnectPacket::eDisconnectReason reason); @@ -50,78 +50,78 @@ private: bool synched; public: - virtual void handlePlayerInput(shared_ptr packet); - virtual void handleMovePlayer(shared_ptr packet); + virtual void handlePlayerInput(std::shared_ptr packet); + virtual void handleMovePlayer(std::shared_ptr packet); void teleport(double x, double y, double z, float yRot, float xRot, bool sendPacket = true); // 4J Added sendPacket param - virtual void handlePlayerAction(shared_ptr packet); - virtual void handleUseItem(shared_ptr packet); + virtual void handlePlayerAction(std::shared_ptr packet); + virtual void handleUseItem(std::shared_ptr packet); virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects); - virtual void onUnhandledPacket(shared_ptr packet); - void send(shared_ptr packet); - void queueSend(shared_ptr packet); // 4J Added - virtual void handleSetCarriedItem(shared_ptr packet); - virtual void handleChat(shared_ptr packet); + virtual void onUnhandledPacket(std::shared_ptr packet); + void send(std::shared_ptr packet); + void queueSend(std::shared_ptr packet); // 4J Added + virtual void handleSetCarriedItem(std::shared_ptr packet); + virtual void handleChat(std::shared_ptr packet); private: - void handleCommand(const wstring& message); + void handleCommand(const std::wstring& message); public: - virtual void handleAnimate(shared_ptr packet); - virtual void handlePlayerCommand(shared_ptr packet); - virtual void handleDisconnect(shared_ptr packet); + virtual void handleAnimate(std::shared_ptr packet); + virtual void handlePlayerCommand(std::shared_ptr packet); + virtual void handleDisconnect(std::shared_ptr packet); int countDelayedPackets(); - virtual void info(const wstring& string); - virtual void warn(const wstring& string); - virtual wstring getConsoleName(); - virtual void handleInteract(shared_ptr packet); + virtual void info(const std::wstring& string); + virtual void warn(const std::wstring& string); + virtual std::wstring getConsoleName(); + virtual void handleInteract(std::shared_ptr packet); bool canHandleAsyncPackets(); - virtual void handleClientCommand(shared_ptr packet); - virtual void handleRespawn(shared_ptr packet); - virtual void handleContainerClose(shared_ptr packet); + virtual void handleClientCommand(std::shared_ptr packet); + virtual void handleRespawn(std::shared_ptr packet); + virtual void handleContainerClose(std::shared_ptr packet); private: - unordered_map expectedAcks; + std::unordered_map expectedAcks; public: // 4J Stu - Handlers only valid in debug mode #ifndef _CONTENT_PACKAGE - virtual void handleContainerSetSlot(shared_ptr packet); + virtual void handleContainerSetSlot(std::shared_ptr packet); #endif - virtual void handleContainerClick(shared_ptr packet); - virtual void handleContainerButtonClick(shared_ptr packet); - virtual void handleSetCreativeModeSlot(shared_ptr packet); - virtual void handleContainerAck(shared_ptr packet); - virtual void handleSignUpdate(shared_ptr packet); - virtual void handleKeepAlive(shared_ptr packet); - virtual void handlePlayerInfo(shared_ptr packet); // 4J Added + virtual void handleContainerClick(std::shared_ptr packet); + virtual void handleContainerButtonClick(std::shared_ptr packet); + virtual void handleSetCreativeModeSlot(std::shared_ptr packet); + virtual void handleContainerAck(std::shared_ptr packet); + virtual void handleSignUpdate(std::shared_ptr packet); + virtual void handleKeepAlive(std::shared_ptr packet); + virtual void handlePlayerInfo(std::shared_ptr packet); // 4J Added virtual bool isServerPacketListener(); - virtual void handlePlayerAbilities(shared_ptr playerAbilitiesPacket); - virtual void handleCustomPayload(shared_ptr customPayloadPacket); + virtual void handlePlayerAbilities(std::shared_ptr playerAbilitiesPacket); + virtual void handleCustomPayload(std::shared_ptr customPayloadPacket); // 4J Added - virtual void handleCraftItem(shared_ptr packet); - virtual void handleTradeItem(shared_ptr packet); - virtual void handleDebugOptions(shared_ptr packet); - virtual void handleTexture(shared_ptr packet); - virtual void handleTextureAndGeometry(shared_ptr packet); - virtual void handleTextureChange(shared_ptr packet); - virtual void handleTextureAndGeometryChange(shared_ptr packet); - virtual void handleServerSettingsChanged(shared_ptr packet); - virtual void handleKickPlayer(shared_ptr packet); - virtual void handleGameCommand(shared_ptr packet); + virtual void handleCraftItem(std::shared_ptr packet); + virtual void handleTradeItem(std::shared_ptr packet); + virtual void handleDebugOptions(std::shared_ptr packet); + virtual void handleTexture(std::shared_ptr packet); + virtual void handleTextureAndGeometry(std::shared_ptr packet); + virtual void handleTextureChange(std::shared_ptr packet); + virtual void handleTextureAndGeometryChange(std::shared_ptr packet); + virtual void handleServerSettingsChanged(std::shared_ptr packet); + virtual void handleKickPlayer(std::shared_ptr packet); + virtual void handleGameCommand(std::shared_ptr packet); INetworkPlayer *getNetworkPlayer(); bool isLocal(); bool isGuest(); // 4J Added as we need to set this from outside sometimes - void setPlayer(shared_ptr player) { this->player = player; } - shared_ptr getPlayer() { return player; } + void setPlayer(std::shared_ptr player) { this->player = player; } + std::shared_ptr getPlayer() { return player; } // 4J Added to signal a disconnect from another thread void closeOnTick() { m_bCloseOnTick = true; } // 4J Added so that we can send on textures that get received after this connection requested them - void handleTextureReceived(const wstring &textureName); - void handleTextureAndGeometryReceived(const wstring &textureName); + void handleTextureReceived(const std::wstring &textureName); + void handleTextureAndGeometryReceived(const std::wstring &textureName); void setShowOnMaps(bool bVal); @@ -133,7 +133,7 @@ public: private: bool m_bCloseOnTick; - vector m_texturesRequested; + std::vector m_texturesRequested; bool m_bWasKicked; }; diff --git a/Minecraft.Client/Network/PlayerInfo.h b/Minecraft.Client/Network/PlayerInfo.h index 427c78d88..ba0f3413c 100644 --- a/Minecraft.Client/Network/PlayerInfo.h +++ b/Minecraft.Client/Network/PlayerInfo.h @@ -1,13 +1,13 @@ #pragma once -using namespace std; + class PlayerInfo { public: - wstring name; + std::wstring name; int latency; - PlayerInfo(const wstring &name) + PlayerInfo(const std::wstring &name) { this->name = name; latency = 0; diff --git a/Minecraft.Client/Network/PlayerList.cpp b/Minecraft.Client/Network/PlayerList.cpp index 8f0a52f45..265c7103c 100644 --- a/Minecraft.Client/Network/PlayerList.cpp +++ b/Minecraft.Client/Network/PlayerList.cpp @@ -72,7 +72,7 @@ PlayerList::~PlayerList() DeleteCriticalSection(&m_closePlayersCS); } -void PlayerList::placeNewPlayer(Connection *connection, shared_ptr player, shared_ptr packet) +void PlayerList::placeNewPlayer(Connection *connection, std::shared_ptr player, std::shared_ptr packet) { bool newPlayer = load(player); player->setLevel(server->getLevel(player->dimension)); @@ -127,8 +127,8 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr player->setCustomCape( packet->m_playerCapeId ); // 4J-JEV: Moved this here so we can send player-model texture and geometry data. - shared_ptr playerConnection = shared_ptr(new PlayerConnection(server, connection, player)); - //player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use shared_ptr + std::shared_ptr playerConnection = std::shared_ptr(new PlayerConnection(server, connection, player)); + //player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use std::shared_ptr if(newPlayer) { @@ -143,7 +143,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr int centreZC = 0; #endif // 4J Added - Give every player a map the first time they join a server - player->inventory->setItem( 9, shared_ptr( new ItemInstance(Item::map_Id, 1, level->getAuxValueForMap(player->getXuid(),0,centreXC, centreZC, mapScale ) ) ) ); + player->inventory->setItem( 9, std::shared_ptr( new ItemInstance(Item::map_Id, 1, level->getAuxValueForMap(player->getXuid(),0,centreXC, centreZC, mapScale ) ) ) ); if(app.getGameRuleDefinitions() != NULL) { app.getGameRuleDefinitions()->postProcessPlayer(player); @@ -157,7 +157,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr #ifndef _CONTENT_PACKAGE wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",player->customTextureUrl.c_str(), player->name.c_str()); #endif - playerConnection->send(shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) ); + playerConnection->send(std::shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) ); } } else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl)) @@ -173,7 +173,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr #ifndef _CONTENT_PACKAGE wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str()); #endif - playerConnection->send(shared_ptr( new TexturePacket(player->customTextureUrl2,NULL,0) ) ); + playerConnection->send(std::shared_ptr( new TexturePacket(player->customTextureUrl2,NULL,0) ) ); } } else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2)) @@ -196,8 +196,8 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_CreativeMode,player->gameMode->getGameModeForPlayer()->getId() ); } - //shared_ptr playerConnection = shared_ptr(new PlayerConnection(server, connection, player)); - player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use shared_ptr + //std::shared_ptr playerConnection = std::shared_ptr(new PlayerConnection(server, connection, player)); + player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use std::shared_ptr // 4J Added to store UGC settings playerConnection->m_friendsOnlyUGC = packet->m_friendsOnlyUGC; @@ -209,19 +209,19 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr addPlayerToReceiving( player ); - playerConnection->send( shared_ptr( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), + playerConnection->send( std::shared_ptr( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), (uint8_t) level->dimension->id, (uint8_t) level->getMaxBuildHeight(), (uint8_t) getMaxPlayers(), level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) ); - playerConnection->send( shared_ptr( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) ); - playerConnection->send( shared_ptr( new PlayerAbilitiesPacket(&player->abilities)) ); + playerConnection->send( std::shared_ptr( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) ); + playerConnection->send( std::shared_ptr( new PlayerAbilitiesPacket(&player->abilities)) ); delete spawnPos; sendLevelInfo(player, level); // 4J-PB - removed, since it needs to be localised in the language the client is in - //server->players->broadcastAll( shared_ptr( new ChatPacket(L"§e" + playerEntity->name + L" joined the game.") ) ); - broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerJoinedGame) ) ); + //server->players->broadcastAll( std::shared_ptr( new ChatPacket(L"§e" + playerEntity->name + L" joined the game.") ) ); + broadcastAll( std::shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerJoinedGame) ) ); MemSect(14); add(player); @@ -231,13 +231,13 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr playerConnection->teleport(player->x, player->y, player->z, player->yRot, player->xRot); server->getConnection()->addPlayerConnection(playerConnection); - playerConnection->send( shared_ptr( new SetTimePacket(level->getTime()) ) ); + playerConnection->send( std::shared_ptr( new SetTimePacket(level->getTime()) ) ); AUTO_VAR(activeEffects, player->getActiveEffects()); for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) { MobEffectInstance *effect = *it; - playerConnection->send(shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); + playerConnection->send(std::shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); } player->initMenu(); @@ -249,7 +249,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr { for(AUTO_VAR(it, players.begin()); it != players.end(); ++it) { - shared_ptr servPlayer = *it; + std::shared_ptr servPlayer = *it; INetworkPlayer *checkPlayer = servPlayer->connection->getNetworkPlayer(); if(thisPlayer != checkPlayer && checkPlayer != NULL && thisPlayer->IsSameSystem( checkPlayer ) && servPlayer->wonGame ) { @@ -265,7 +265,7 @@ void PlayerList::setLevel(ServerLevelArray levels) playerIo = levels[0]->getLevelStorage()->getPlayerIO(); } -void PlayerList::changeDimension(shared_ptr player, ServerLevel *from) +void PlayerList::changeDimension(std::shared_ptr player, ServerLevel *from) { ServerLevel *to = player->getLevel(); @@ -281,12 +281,12 @@ int PlayerList::getMaxRange() } // 4J Changed return val to bool to check if new player or loaded player -bool PlayerList::load(shared_ptr player) +bool PlayerList::load(std::shared_ptr player) { return playerIo->load(player); } -void PlayerList::save(shared_ptr player) +void PlayerList::save(std::shared_ptr player) { playerIo->save(player); } @@ -295,7 +295,7 @@ void PlayerList::save(shared_ptr player) // Add this function to take some of the code from the PlayerList::add function with the fixes // for checking spawn area, especially in the nether. These needed to be done in a different order from before // Fix for #13150 - When a player loads/joins a game after saving/leaving in the nether, sometimes they are spawned on top of the nether and cannot mine down -void PlayerList::validatePlayerSpawnPosition(shared_ptr player) +void PlayerList::validatePlayerSpawnPosition(std::shared_ptr player) { // 4J Stu - Some adjustments to make sure the current players position is correct // Make sure that the player is on the ground, and in the centre x/z of the current column @@ -359,12 +359,12 @@ void PlayerList::validatePlayerSpawnPosition(shared_ptr player) } } -void PlayerList::add(shared_ptr player) +void PlayerList::add(std::shared_ptr player) { - //broadcastAll(shared_ptr( new PlayerInfoPacket(player->name, true, 1000) ) ); + //broadcastAll(std::shared_ptr( new PlayerInfoPacket(player->name, true, 1000) ) ); if( player->connection->getNetworkPlayer() ) { - broadcastAll(shared_ptr( new PlayerInfoPacket( player ) ) ); + broadcastAll(std::shared_ptr( new PlayerInfoPacket( player ) ) ); } players.push_back(player); @@ -386,36 +386,36 @@ void PlayerList::add(shared_ptr player) for (int i = 0; i < players.size(); i++) { - shared_ptr op = players.at(i); - //player->connection->send(shared_ptr( new PlayerInfoPacket(op->name, true, op->latency) ) ); + std::shared_ptr op = players.at(i); + //player->connection->send(std::shared_ptr( new PlayerInfoPacket(op->name, true, op->latency) ) ); if( op->connection->getNetworkPlayer() ) { - player->connection->send(shared_ptr( new PlayerInfoPacket( op ) ) ); + player->connection->send(std::shared_ptr( new PlayerInfoPacket( op ) ) ); } } if(level->isAtLeastOnePlayerSleeping()) { - shared_ptr firstSleepingPlayer = nullptr; + std::shared_ptr firstSleepingPlayer = nullptr; for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr thisPlayer = players[i]; + std::shared_ptr thisPlayer = players[i]; if(thisPlayer->isSleeping()) { if(firstSleepingPlayer == NULL) firstSleepingPlayer = thisPlayer; - thisPlayer->connection->send(shared_ptr( new ChatPacket(thisPlayer->name, ChatPacket::e_ChatBedMeSleep))); + thisPlayer->connection->send(std::shared_ptr( new ChatPacket(thisPlayer->name, ChatPacket::e_ChatBedMeSleep))); } } - player->connection->send(shared_ptr( new ChatPacket(firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep))); + player->connection->send(std::shared_ptr( new ChatPacket(firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep))); } } -void PlayerList::move(shared_ptr player) +void PlayerList::move(std::shared_ptr player) { player->getLevel()->getChunkMap()->move(player); } -void PlayerList::remove(shared_ptr player) +void PlayerList::remove(std::shared_ptr player) { save(player); //4J Stu - We don't want to save the map data for guests, so when we are sure that the player is gone delete the map @@ -428,7 +428,7 @@ void PlayerList::remove(shared_ptr player) { players.erase(it); } - //broadcastAll(shared_ptr( new PlayerInfoPacket(player->name, false, 9999) ) ); + //broadcastAll(std::shared_ptr( new PlayerInfoPacket(player->name, false, 9999) ) ); removePlayerFromReceiving(player); player->connection = nullptr; // Must remove reference to connection, or else there is a circular dependency @@ -439,15 +439,15 @@ void PlayerList::remove(shared_ptr player) saveAll(NULL,false); } -shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID onlineXuid) +std::shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendingConnection, const std::wstring& userName, PlayerUID xuid, PlayerUID onlineXuid) { if (players.size() >= maxPlayers) { pendingConnection->disconnect(DisconnectPacket::eDisconnect_ServerFull); - return shared_ptr(); + return std::shared_ptr(); } - shared_ptr player = shared_ptr(new ServerPlayer(server, server->getLevel(0), userName, new ServerPlayerGameMode(server->getLevel(0)) )); + std::shared_ptr player = std::shared_ptr(new ServerPlayer(server, server->getLevel(0), userName, new ServerPlayerGameMode(server->getLevel(0)) )); player->gameMode->player = player; // 4J added as had to remove this assignment from ServerPlayer ctor player->setXuid( xuid ); // 4J Added player->setOnlineXuid( onlineXuid ); // 4J Added @@ -469,7 +469,7 @@ shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendin return player; } -shared_ptr PlayerList::respawn(shared_ptr serverPlayer, int targetDimension, bool keepAllPlayerData) +std::shared_ptr PlayerList::respawn(std::shared_ptr serverPlayer, int targetDimension, bool keepAllPlayerData) { // How we handle the entity tracker depends on whether we are the primary player currently, and whether there will be any player in the same system in the same dimension once we finish respawning. bool isPrimary = canReceiveAllPackets(serverPlayer); // Is this the primary player in its current dimension? @@ -483,7 +483,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay for( unsigned int i = 0; i < players.size(); i++ ) { - shared_ptr ep = players[i]; + std::shared_ptr ep = players[i]; if( ep == serverPlayer ) continue; if( ep->dimension != oldDimension ) continue; @@ -540,7 +540,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay PlayerUID playerXuid = serverPlayer->getXuid(); PlayerUID playerOnlineXuid = serverPlayer->getOnlineXuid(); - shared_ptr player = shared_ptr(new ServerPlayer(server, server->getLevel(serverPlayer->dimension), serverPlayer->name, new ServerPlayerGameMode(server->getLevel(serverPlayer->dimension)))); + std::shared_ptr player = std::shared_ptr(new ServerPlayer(server, server->getLevel(serverPlayer->dimension), serverPlayer->name, new ServerPlayerGameMode(server->getLevel(serverPlayer->dimension)))); player->restoreFrom(serverPlayer, keepAllPlayerData); if (keepAllPlayerData) { @@ -598,7 +598,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay } else { - player->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0) ) ); + player->connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0) ) ); } delete bedPosition; } @@ -611,19 +611,19 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay player->setPos(player->x, player->y + 1, player->z); } - player->connection->send( shared_ptr( new RespawnPacket((char) player->dimension, player->level->getSeed(), player->level->getMaxBuildHeight(), + player->connection->send( std::shared_ptr( new RespawnPacket((char) player->dimension, player->level->getSeed(), player->level->getMaxBuildHeight(), player->gameMode->getGameModeForPlayer(), level->difficulty, level->getLevelData()->getGenerator(), player->level->useNewSeaLevel(), player->entityId, level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale()) ) ); player->connection->teleport(player->x, player->y, player->z, player->yRot, player->xRot); if(keepAllPlayerData) { - vector *activeEffects = player->getActiveEffects(); + std::vector *activeEffects = player->getActiveEffects(); for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) { MobEffectInstance *effect = *it; - player->connection->send(shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); + player->connection->send(std::shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); } delete activeEffects; player->getEntityData()->markDirty(Mob::DATA_EFFECT_COLOR_ID); @@ -654,7 +654,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay } -void PlayerList::toggleDimension(shared_ptr player, int targetDimension) +void PlayerList::toggleDimension(std::shared_ptr player, int targetDimension) { int lastDimension = player->dimension; // How we handle the entity tracker depends on whether we are the primary player currently, and whether there will be any player in the same system in the same dimension once we finish respawning. @@ -666,7 +666,7 @@ void PlayerList::toggleDimension(shared_ptr player, int targetDime for( unsigned int i = 0; i < players.size(); i++ ) { - shared_ptr ep = players[i]; + std::shared_ptr ep = players[i]; if( ep == player ) continue; if( ep->dimension != lastDimension ) continue; @@ -728,7 +728,7 @@ void PlayerList::toggleDimension(shared_ptr player, int targetDime // 4J Stu Added so that we remove entities from the correct level, after the respawn packet we will be in the wrong level player->flushEntitiesToRemove(); - player->connection->send( shared_ptr( new RespawnPacket((char) player->dimension, newLevel->getSeed(), newLevel->getMaxBuildHeight(), + player->connection->send( std::shared_ptr( new RespawnPacket((char) player->dimension, newLevel->getSeed(), newLevel->getMaxBuildHeight(), player->gameMode->getGameModeForPlayer(), newLevel->difficulty, newLevel->getLevelData()->getGenerator(), newLevel->useNewSeaLevel(), player->entityId, newLevel->getLevelData()->getXZSize(), newLevel->getLevelData()->getHellScale()) ) ); @@ -811,12 +811,12 @@ void PlayerList::toggleDimension(shared_ptr player, int targetDime player->connection->teleport(player->x, player->y, player->z, player->yRot, player->xRot); // 4J Stu - Fix for #64683 - Customer Encountered: TU7: Content: Gameplay: Potion effects are removed after using the Nether Portal - vector *activeEffects = player->getActiveEffects(); + std::vector *activeEffects = player->getActiveEffects(); for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) { MobEffectInstance *effect = *it; - player->connection->send(shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); + player->connection->send(std::shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); } delete activeEffects; player->getEntityData()->markDirty(Mob::DATA_EFFECT_COLOR_ID); @@ -835,11 +835,11 @@ void PlayerList::tick() if (sendAllPlayerInfoIn < players.size()) { - shared_ptr op = players[sendAllPlayerInfoIn]; - //broadcastAll(shared_ptr( new PlayerInfoPacket(op->name, true, op->latency) ) ); + std::shared_ptr op = players[sendAllPlayerInfoIn]; + //broadcastAll(std::shared_ptr( new PlayerInfoPacket(op->name, true, op->latency) ) ); if( op->connection->getNetworkPlayer() ) { - broadcastAll(shared_ptr( new PlayerInfoPacket( op ) ) ); + broadcastAll(std::shared_ptr( new PlayerInfoPacket( op ) ) ); } } @@ -849,11 +849,11 @@ void PlayerList::tick() BYTE smallId = m_smallIdsToClose.front(); m_smallIdsToClose.pop_front(); - shared_ptr player = nullptr; + std::shared_ptr player = nullptr; for(unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players.at(i); + std::shared_ptr p = players.at(i); // 4J Stu - May be being a bit overprotective with all the NULL checks, but adding late in TU7 so want to be safe if (p != NULL && p->connection != NULL && p->connection->connection != NULL && p->connection->connection->getSocket() != NULL && p->connection->connection->getSocket()->getSmallId() == smallId ) { @@ -882,11 +882,11 @@ void PlayerList::tick() //#ifdef _XBOX PlayerUID xuid = selectedPlayer->GetUID(); // Kick this player from the game - shared_ptr player = nullptr; + std::shared_ptr player = nullptr; for(unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players.at(i); + std::shared_ptr p = players.at(i); PlayerUID playersXuid = p->getOnlineXuid(); if (p != NULL && ProfileManager.AreXUIDSEqual(playersXuid, xuid ) ) { @@ -901,7 +901,7 @@ void PlayerList::tick() // 4J Stu - If we have kicked a player, make sure that they have no privileges if they later try to join the world when trust players is off player->enableAllPlayerPrivileges( false ); player->connection->setWasKicked(); - player->connection->send( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Kicked) )); + player->connection->send( std::shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Kicked) )); } //#endif } @@ -914,10 +914,10 @@ void PlayerList::tick() { for(unsigned int i = 0; i < receiveAllPlayers[dim].size(); ++i) { - shared_ptr currentPlayer = receiveAllPlayers[dim][i]; + std::shared_ptr currentPlayer = receiveAllPlayers[dim][i]; if(currentPlayer->removed) { - shared_ptr newPlayer = findAlivePlayerOnSystem(currentPlayer); + std::shared_ptr newPlayer = findAlivePlayerOnSystem(currentPlayer); if(newPlayer != NULL) { receiveAllPlayers[dim][i] = newPlayer; @@ -939,27 +939,27 @@ void PlayerList::prioritiseTileChanges(int x, int y, int z, int dimension) server->getLevel(dimension)->getChunkMap()->prioritiseTileChanges(x, y, z); } -void PlayerList::broadcastAll(shared_ptr packet) +void PlayerList::broadcastAll(std::shared_ptr packet) { for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; player->connection->send(packet); } } -void PlayerList::broadcastAll(shared_ptr packet, int dimension) +void PlayerList::broadcastAll(std::shared_ptr packet, int dimension) { for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; if (player->dimension == dimension) player->connection->send(packet); } } -wstring PlayerList::getPlayerNames() +std::wstring PlayerList::getPlayerNames() { - wstring msg; + std::wstring msg; for (unsigned int i = 0; i < players.size(); i++) { if (i > 0) msg += L", "; @@ -968,17 +968,17 @@ wstring PlayerList::getPlayerNames() return msg; } -bool PlayerList::isWhiteListed(const wstring& name) +bool PlayerList::isWhiteListed(const std::wstring& name) { return true; } -bool PlayerList::isOp(const wstring& name) +bool PlayerList::isOp(const std::wstring& name) { return false; } -bool PlayerList::isOp(shared_ptr player) +bool PlayerList::isOp(std::shared_ptr player) { bool cheatsEnabled = app.GetGameHostOption(eGameHostOption_CheatsEnabled); #ifdef _DEBUG_MENUS_ENABLED @@ -989,11 +989,11 @@ bool PlayerList::isOp(shared_ptr player) return isOp; } -shared_ptr PlayerList::getPlayer(const wstring& name) +std::shared_ptr PlayerList::getPlayer(const std::wstring& name) { for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players[i]; + std::shared_ptr p = players[i]; if (p->name == name) // 4J - used to be case insensitive (using equalsIgnoreCase) - imagine we'll be shifting to XUIDs anyway { return p; @@ -1003,11 +1003,11 @@ shared_ptr PlayerList::getPlayer(const wstring& name) } // 4J Added -shared_ptr PlayerList::getPlayer(PlayerUID uid) +std::shared_ptr PlayerList::getPlayer(PlayerUID uid) { for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players[i]; + std::shared_ptr p = players[i]; if (p->getXuid() == uid || p->getOnlineXuid() == uid) // 4J - used to be case insensitive (using equalsIgnoreCase) - imagine we'll be shifting to XUIDs anyway { return p; @@ -1016,33 +1016,33 @@ shared_ptr PlayerList::getPlayer(PlayerUID uid) return nullptr; } -void PlayerList::sendMessage(const wstring& name, const wstring& message) +void PlayerList::sendMessage(const std::wstring& name, const std::wstring& message) { - shared_ptr player = getPlayer(name); + std::shared_ptr player = getPlayer(name); if (player != NULL) { - player->connection->send( shared_ptr( new ChatPacket(message) ) ); + player->connection->send( std::shared_ptr( new ChatPacket(message) ) ); } } -void PlayerList::broadcast(double x, double y, double z, double range, int dimension, shared_ptr packet) +void PlayerList::broadcast(double x, double y, double z, double range, int dimension, std::shared_ptr packet) { broadcast(nullptr, x, y, z, range, dimension, packet); } -void PlayerList::broadcast(shared_ptr except, double x, double y, double z, double range, int dimension, shared_ptr packet) +void PlayerList::broadcast(std::shared_ptr except, double x, double y, double z, double range, int dimension, std::shared_ptr packet) { // 4J - altered so that we don't send to the same machine more than once. Add the source player to the machines we have "sent" to as it doesn't need to go to that // machine either - vector< shared_ptr > sentTo; + std::vector< std::shared_ptr > sentTo; if( except != NULL ) { - sentTo.push_back(dynamic_pointer_cast(except)); + sentTo.push_back(std::dynamic_pointer_cast(except)); } for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players[i]; + std::shared_ptr p = players[i]; if (p == except) continue; if (p->dimension != dimension) continue; @@ -1059,7 +1059,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double { for(unsigned int j = 0; j < sentTo.size(); j++ ) { - shared_ptr player2 = sentTo[j]; + std::shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { @@ -1080,7 +1080,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double if (xd * xd + yd * yd + zd * zd < range * range) { #if 0 // _DEBUG - shared_ptr SoundPacket= dynamic_pointer_cast(packet); + std::shared_ptr SoundPacket= std::dynamic_pointer_cast(packet); if(SoundPacket) { @@ -1097,12 +1097,12 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double } -void PlayerList::broadcastToAllOps(const wstring& message) +void PlayerList::broadcastToAllOps(const std::wstring& message) { - shared_ptr chatPacket = shared_ptr( new ChatPacket(message) ); + std::shared_ptr chatPacket = std::shared_ptr( new ChatPacket(message) ); for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr p = players[i]; + std::shared_ptr p = players[i]; if (isOp(p->name)) { p->connection->send(chatPacket); @@ -1110,9 +1110,9 @@ void PlayerList::broadcastToAllOps(const wstring& message) } } -bool PlayerList::sendTo(const wstring& name, shared_ptr packet) +bool PlayerList::sendTo(const std::wstring& name, std::shared_ptr packet) { - shared_ptr player = getPlayer(name); + std::shared_ptr player = getPlayer(name); if (player != NULL) { player->connection->send(packet); @@ -1142,11 +1142,11 @@ void PlayerList::saveAll(ProgressListener *progressListener, bool bDeleteGuestMa } } -void PlayerList::whiteList(const wstring& playerName) +void PlayerList::whiteList(const std::wstring& playerName) { } -void PlayerList::blackList(const wstring& playerName) +void PlayerList::blackList(const std::wstring& playerName) { } @@ -1154,28 +1154,28 @@ void PlayerList::reloadWhitelist() { } -void PlayerList::sendLevelInfo(shared_ptr player, ServerLevel *level) +void PlayerList::sendLevelInfo(std::shared_ptr player, ServerLevel *level) { - player->connection->send( shared_ptr( new SetTimePacket(level->getTime()) ) ); + player->connection->send( std::shared_ptr( new SetTimePacket(level->getTime()) ) ); if (level->isRaining()) { - player->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) ); + player->connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) ); } else { // 4J Stu - Fix for #44836 - Customer Encountered: Out of Sync Weather [A-10] // If it was raining when the player left the level, and is now not raining we need to make sure that state is updated - player->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) ); + player->connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) ); } // send the stronghold position if there is one if((level->dimension->id==0) && level->getLevelData()->getHasStronghold()) { - player->connection->send( shared_ptr( new XZPacket(XZPacket::STRONGHOLD,level->getLevelData()->getXStronghold(),level->getLevelData()->getZStronghold()) ) ); + player->connection->send( std::shared_ptr( new XZPacket(XZPacket::STRONGHOLD,level->getLevelData()->getXStronghold(),level->getLevelData()->getZStronghold()) ) ); } } -void PlayerList::sendAllPlayerInfo(shared_ptr player) +void PlayerList::sendAllPlayerInfo(std::shared_ptr player) { player->refreshContainer(player->inventoryMenu); player->resetSentInfo(); @@ -1218,7 +1218,7 @@ void PlayerList::setOverrideGameMode(GameType *gameMode) this->overrideGameMode = gameMode; } -void PlayerList::updatePlayerGameMode(shared_ptr newPlayer, shared_ptr oldPlayer, Level *level) +void PlayerList::updatePlayerGameMode(std::shared_ptr newPlayer, std::shared_ptr oldPlayer, Level *level) { // reset the player's game mode (first pick from old, then copy level if @@ -1239,7 +1239,7 @@ void PlayerList::setAllowCheatsForAllPlayers(bool allowCommands) this->allowCheatsForAllPlayers = allowCommands; } -shared_ptr PlayerList::findAlivePlayerOnSystem(shared_ptr player) +std::shared_ptr PlayerList::findAlivePlayerOnSystem(std::shared_ptr player) { int dimIndex, playerDim; dimIndex = playerDim = player->dimension; @@ -1251,7 +1251,7 @@ shared_ptr PlayerList::findAlivePlayerOnSystem(shared_ptr newPlayer = *itP; + std::shared_ptr newPlayer = *itP; INetworkPlayer *otherPlayer = newPlayer->connection->getNetworkPlayer(); @@ -1270,7 +1270,7 @@ shared_ptr PlayerList::findAlivePlayerOnSystem(shared_ptr player, bool usePlayerDimension /*= true*/, int dimension /*= 0*/) +void PlayerList::removePlayerFromReceiving(std::shared_ptr player, bool usePlayerDimension /*= true*/, int dimension /*= 0*/) { int dimIndex, playerDim; dimIndex = playerDim = usePlayerDimension ? player->dimension : dimension; @@ -1297,7 +1297,7 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool { for(AUTO_VAR(itP, players.begin()); itP != players.end(); ++itP) { - shared_ptr newPlayer = *itP; + std::shared_ptr newPlayer = *itP; INetworkPlayer *otherPlayer = newPlayer->connection->getNetworkPlayer(); @@ -1324,7 +1324,7 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool // Re-check all active players and make sure they have someone on their system to receive all packets for(AUTO_VAR(itP, players.begin()); itP != players.end(); ++itP) { - shared_ptr newPlayer = *itP; + std::shared_ptr newPlayer = *itP; INetworkPlayer *checkingPlayer = newPlayer->connection->getNetworkPlayer(); if( checkingPlayer != NULL ) @@ -1335,7 +1335,7 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool bool foundPrimary = false; for(AUTO_VAR(it, receiveAllPlayers[newPlayerDim].begin()); it != receiveAllPlayers[newPlayerDim].end(); ++it) { - shared_ptr primaryPlayer = *it; + std::shared_ptr primaryPlayer = *it; INetworkPlayer *primPlayer = primaryPlayer->connection->getNetworkPlayer(); if(primPlayer != NULL && checkingPlayer->IsSameSystem( primPlayer ) ) { @@ -1355,7 +1355,7 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool } } -void PlayerList::addPlayerToReceiving(shared_ptr player) +void PlayerList::addPlayerToReceiving(std::shared_ptr player) { int playerDim = 0; if( player->dimension == -1 ) playerDim = 1; @@ -1380,7 +1380,7 @@ void PlayerList::addPlayerToReceiving(shared_ptr player) { for(AUTO_VAR(it, receiveAllPlayers[playerDim].begin()); it != receiveAllPlayers[playerDim].end(); ++it) { - shared_ptr oldPlayer = *it; + std::shared_ptr oldPlayer = *it; INetworkPlayer *checkingPlayer = oldPlayer->connection->getNetworkPlayer(); if(checkingPlayer != NULL && checkingPlayer->IsSameSystem( thisPlayer ) ) { @@ -1399,14 +1399,14 @@ void PlayerList::addPlayerToReceiving(shared_ptr player) } } -bool PlayerList::canReceiveAllPackets(shared_ptr player) +bool PlayerList::canReceiveAllPackets(std::shared_ptr player) { int playerDim = 0; if( player->dimension == -1 ) playerDim = 1; else if( player->dimension == 1) playerDim = 2; for(AUTO_VAR(it, receiveAllPlayers[playerDim].begin()); it != receiveAllPlayers[playerDim].end(); ++it) { - shared_ptr newPlayer = *it; + std::shared_ptr newPlayer = *it; if(newPlayer == player) { return true; diff --git a/Minecraft.Client/Network/PlayerList.h b/Minecraft.Client/Network/PlayerList.h index 7bab169f0..1c5bebfc5 100644 --- a/Minecraft.Client/Network/PlayerList.h +++ b/Minecraft.Client/Network/PlayerList.h @@ -14,7 +14,7 @@ class ProgressListener; class GameType; class LoginPacket; -using namespace std; + class PlayerList { @@ -22,17 +22,17 @@ private: static const int SEND_PLAYER_INFO_INTERVAL = 20 * 10; // 4J - brought forward from 1.2.3 // public static Logger logger = Logger.getLogger("Minecraft"); public: - vector > players; + std::vector > players; private: MinecraftServer *server; unsigned int maxPlayers; // 4J Added - vector m_bannedXuids; - deque m_smallIdsToKick; + std::vector m_bannedXuids; + std::deque m_smallIdsToKick; CRITICAL_SECTION m_kickPlayersCS; - deque m_smallIdsToClose; + std::deque m_smallIdsToClose; CRITICAL_SECTION m_closePlayersCS; /* 4J - removed Set bans = new HashSet(); @@ -51,60 +51,60 @@ private: int sendAllPlayerInfoIn; // 4J Added to maintain which players in which dimensions can receive all packet types - vector > receiveAllPlayers[3]; + std::vector > receiveAllPlayers[3]; private: - shared_ptr findAlivePlayerOnSystem(shared_ptr currentPlayer); + std::shared_ptr findAlivePlayerOnSystem(std::shared_ptr currentPlayer); public: - void removePlayerFromReceiving(shared_ptr player, bool usePlayerDimension = true, int dimension = 0); - void addPlayerToReceiving(shared_ptr player); - bool canReceiveAllPackets(shared_ptr player); + void removePlayerFromReceiving(std::shared_ptr player, bool usePlayerDimension = true, int dimension = 0); + void addPlayerToReceiving(std::shared_ptr player); + bool canReceiveAllPackets(std::shared_ptr player); public: PlayerList(MinecraftServer *server); ~PlayerList(); - void placeNewPlayer(Connection *connection, shared_ptr player, shared_ptr packet); + void placeNewPlayer(Connection *connection, std::shared_ptr player, std::shared_ptr packet); void setLevel(ServerLevelArray levels); - void changeDimension(shared_ptr player, ServerLevel *from); + void changeDimension(std::shared_ptr player, ServerLevel *from); int getMaxRange(); - bool load(shared_ptr player); // 4J Changed return val to bool to check if new player or loaded player + bool load(std::shared_ptr player); // 4J Changed return val to bool to check if new player or loaded player protected: - void save(shared_ptr player); + void save(std::shared_ptr player); public: - void validatePlayerSpawnPosition(shared_ptr player); // 4J Added - void add(shared_ptr player); - void move(shared_ptr player); - void remove(shared_ptr player); - shared_ptr getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID OnlineXuid); - shared_ptr respawn(shared_ptr serverPlayer, int targetDimension, bool keepAllPlayerData); - void toggleDimension(shared_ptr player, int targetDimension); + void validatePlayerSpawnPosition(std::shared_ptr player); // 4J Added + void add(std::shared_ptr player); + void move(std::shared_ptr player); + void remove(std::shared_ptr player); + std::shared_ptr getPlayerForLogin(PendingConnection *pendingConnection, const std::wstring& userName, PlayerUID xuid, PlayerUID OnlineXuid); + std::shared_ptr respawn(std::shared_ptr serverPlayer, int targetDimension, bool keepAllPlayerData); + void toggleDimension(std::shared_ptr player, int targetDimension); void tick(); bool isTrackingTile(int x, int y, int z, int dimension); // 4J added void prioritiseTileChanges(int x, int y, int z, int dimension); // 4J added - void broadcastAll(shared_ptr packet); - void broadcastAll(shared_ptr packet, int dimension); + void broadcastAll(std::shared_ptr packet); + void broadcastAll(std::shared_ptr packet, int dimension); - wstring getPlayerNames(); + std::wstring getPlayerNames(); public: - bool isWhiteListed(const wstring& name); - bool isOp(const wstring& name); - bool isOp(shared_ptr player); // 4J Added - shared_ptr getPlayer(const wstring& name); - shared_ptr getPlayer(PlayerUID uid); - void sendMessage(const wstring& name, const wstring& message); - void broadcast(double x, double y, double z, double range, int dimension, shared_ptr packet); - void broadcast(shared_ptr except, double x, double y, double z, double range, int dimension, shared_ptr packet); - void broadcastToAllOps(const wstring& message); - bool sendTo(const wstring& name, shared_ptr packet); + bool isWhiteListed(const std::wstring& name); + bool isOp(const std::wstring& name); + bool isOp(std::shared_ptr player); // 4J Added + std::shared_ptr getPlayer(const std::wstring& name); + std::shared_ptr getPlayer(PlayerUID uid); + void sendMessage(const std::wstring& name, const std::wstring& message); + void broadcast(double x, double y, double z, double range, int dimension, std::shared_ptr packet); + void broadcast(std::shared_ptr except, double x, double y, double z, double range, int dimension, std::shared_ptr packet); + void broadcastToAllOps(const std::wstring& message); + bool sendTo(const std::wstring& name, std::shared_ptr packet); // 4J Added ProgressListener *progressListener param and bDeleteGuestMaps param void saveAll(ProgressListener *progressListener, bool bDeleteGuestMaps = false); - void whiteList(const wstring& playerName); - void blackList(const wstring& playerName); + void whiteList(const std::wstring& playerName); + void blackList(const std::wstring& playerName); // Set getWhiteList(); / 4J removed void reloadWhitelist(); - void sendLevelInfo(shared_ptr player, ServerLevel *level); - void sendAllPlayerInfo(shared_ptr player); + void sendLevelInfo(std::shared_ptr player, ServerLevel *level); + void sendAllPlayerInfo(std::shared_ptr player); int getPlayerCount(); int getPlayerCount(ServerLevel *level); // 4J Added int getMaxPlayers(); @@ -113,7 +113,7 @@ public: void setOverrideGameMode(GameType *gameMode); private: - void updatePlayerGameMode(shared_ptr newPlayer, shared_ptr oldPlayer, Level *level); + void updatePlayerGameMode(std::shared_ptr newPlayer, std::shared_ptr oldPlayer, Level *level); public: void setAllowCheatsForAllPlayers(bool allowCommands); diff --git a/Minecraft.Client/Network/ServerChunkCache.cpp b/Minecraft.Client/Network/ServerChunkCache.cpp index 7dcfd5ae7..c4543545c 100644 --- a/Minecraft.Client/Network/ServerChunkCache.cpp +++ b/Minecraft.Client/Network/ServerChunkCache.cpp @@ -74,7 +74,7 @@ bool ServerChunkCache::hasChunk(int x, int z) return true; } -vector *ServerChunkCache::getLoadedChunkList() +std::vector *ServerChunkCache::getLoadedChunkList() { return &m_loadedChunkList; } @@ -608,7 +608,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) // Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage. // This is to minimise the amount of data that needs to be moved round when creating a new level. - vector sortedChunkList; + std::vector sortedChunkList; for( int i = 0; i < m_loadedChunkList.size(); i++ ) { @@ -693,7 +693,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) // Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage. // This is to minimise the amount of data that needs to be moved round when creating a new level. - vector sortedChunkList; + std::vector sortedChunkList; for( int i = 0; i < m_loadedChunkList.size(); i++ ) { @@ -897,17 +897,17 @@ bool ServerChunkCache::shouldSave() return !level->noSave; } -wstring ServerChunkCache::gatherStats() +std::wstring ServerChunkCache::gatherStats() { return L"ServerChunkCache: ";// + _toString(loadedChunks.size()) + L" Drop: " + _toString(toDrop.size()); } -vector *ServerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) +std::vector *ServerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { return source->getMobsAt(mobCategory, x, y, z); } -TilePos *ServerChunkCache::findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z) +TilePos *ServerChunkCache::findNearestMapFeature(Level *level, const std::wstring &featureName, int x, int y, int z) { return source->findNearestMapFeature(level, featureName, x, y, z); } diff --git a/Minecraft.Client/Network/ServerChunkCache.h b/Minecraft.Client/Network/ServerChunkCache.h index d054050d1..e5350771b 100644 --- a/Minecraft.Client/Network/ServerChunkCache.h +++ b/Minecraft.Client/Network/ServerChunkCache.h @@ -5,14 +5,14 @@ #include "../../Minecraft.World/Util/JavaIntHash.h" #include "../../Minecraft.World/Level/RandomLevelSource.h" #include "../../Minecraft.World/Util/C4JThread.h" -using namespace std; + class ServerLevel; class ServerChunkCache : public ChunkSource { private: -// unordered_set toDrop; +// std::unordered_set toDrop; private: LevelChunk *emptyChunk; ChunkSource *source; @@ -21,11 +21,11 @@ public: bool autoCreate; private: LevelChunk **cache; - vector m_loadedChunkList; + std::vector m_loadedChunkList; ServerLevel *level; #ifdef _LARGE_WORLDS - deque m_toDrop; + std::deque m_toDrop; LevelChunk **m_unloadedCache; #endif @@ -39,7 +39,7 @@ public: ServerChunkCache(ServerLevel *level, ChunkStorage *storage, ChunkSource *source); virtual ~ServerChunkCache(); virtual bool hasChunk(int x, int z); - vector *getLoadedChunkList(); + std::vector *getLoadedChunkList(); void drop(int x, int z); void dropAll(); virtual LevelChunk *create(int x, int z); @@ -80,10 +80,10 @@ public: virtual bool save(bool force, ProgressListener *progressListener); virtual bool tick(); virtual bool shouldSave(); - virtual wstring gatherStats(); + virtual std::wstring gatherStats(); - virtual vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); - virtual TilePos *findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z); + virtual std::vector *getMobsAt(MobCategory *mobCategory, int x, int y, int z); + virtual TilePos *findNearestMapFeature(Level *level, const std::wstring &featureName, int x, int y, int z); private: typedef struct _SaveThreadData diff --git a/Minecraft.Client/Network/ServerCommandDispatcher.cpp b/Minecraft.Client/Network/ServerCommandDispatcher.cpp index 389633925..b9da8662d 100644 --- a/Minecraft.Client/Network/ServerCommandDispatcher.cpp +++ b/Minecraft.Client/Network/ServerCommandDispatcher.cpp @@ -52,13 +52,13 @@ ServerCommandDispatcher::ServerCommandDispatcher() Command::setLogger(this); } -void ServerCommandDispatcher::logAdminCommand(shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) +void ServerCommandDispatcher::logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const std::wstring& message, int customData, const std::wstring& additionalMessage) { PlayerList *playerList = MinecraftServer::getInstance()->getPlayers(); //for (Player player : MinecraftServer.getInstance().getPlayers().players) for(AUTO_VAR(it, playerList->players.begin()); it != playerList->players.end(); ++it) { - shared_ptr player = *it; + std::shared_ptr player = *it; if (player != source && playerList->isOp(player)) { // TODO: Change chat packet to be able to send more bits of data diff --git a/Minecraft.Client/Network/ServerCommandDispatcher.h b/Minecraft.Client/Network/ServerCommandDispatcher.h index d0b1c2e4e..8f5261914 100644 --- a/Minecraft.Client/Network/ServerCommandDispatcher.h +++ b/Minecraft.Client/Network/ServerCommandDispatcher.h @@ -7,5 +7,5 @@ class ServerCommandDispatcher : public CommandDispatcher, public AdminLogCommand { public: ServerCommandDispatcher(); - void logAdminCommand(shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message = L"", int customData = -1, const wstring& additionalMessage = L""); + void logAdminCommand(std::shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const std::wstring& message = L"", int customData = -1, const std::wstring& additionalMessage = L""); }; \ No newline at end of file diff --git a/Minecraft.Client/Network/ServerConnection.cpp b/Minecraft.Client/Network/ServerConnection.cpp index 31a4b498e..6b7c2fa01 100644 --- a/Minecraft.Client/Network/ServerConnection.cpp +++ b/Minecraft.Client/Network/ServerConnection.cpp @@ -26,16 +26,16 @@ ServerConnection::~ServerConnection() // 4J - added to handle incoming connections, to replace thread that original used to have void ServerConnection::NewIncomingSocket(Socket *socket) { - shared_ptr unconnectedClient = shared_ptr(new PendingConnection(server, socket, L"Connection #" + _toString(connectionCounter++))); + std::shared_ptr unconnectedClient = std::shared_ptr(new PendingConnection(server, socket, L"Connection #" + _toString(connectionCounter++))); handleConnection(unconnectedClient); } -void ServerConnection::addPlayerConnection(shared_ptr uc) +void ServerConnection::addPlayerConnection(std::shared_ptr uc) { players.push_back(uc); } -void ServerConnection::handleConnection(shared_ptr uc) +void ServerConnection::handleConnection(std::shared_ptr uc) { EnterCriticalSection(&pending_cs); pending.push_back(uc); @@ -47,14 +47,14 @@ void ServerConnection::stop() EnterCriticalSection(&pending_cs); for (unsigned int i = 0; i < pending.size(); i++) { - shared_ptr uc = pending[i]; + std::shared_ptr uc = pending[i]; uc->connection->close(DisconnectPacket::eDisconnect_Closed); } LeaveCriticalSection(&pending_cs); for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; player->connection->close(DisconnectPacket::eDisconnect_Closed); } } @@ -64,12 +64,12 @@ void ServerConnection::tick() { // MGH - changed this so that the the CS lock doesn't cover the tick (was causing a lockup when 2 players tried to join) EnterCriticalSection(&pending_cs); - vector< shared_ptr > tempPending = pending; + std::vector< std::shared_ptr > tempPending = pending; LeaveCriticalSection(&pending_cs); for (unsigned int i = 0; i < tempPending.size(); i++) { - shared_ptr uc = tempPending[i]; + std::shared_ptr uc = tempPending[i]; // try { // 4J - removed try/catch uc->tick(); // } catch (Exception e) { @@ -92,8 +92,8 @@ void ServerConnection::tick() for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; - shared_ptr serverPlayer = player->getPlayer(); + std::shared_ptr player = players[i]; + std::shared_ptr serverPlayer = player->getPlayer(); if( serverPlayer ) { serverPlayer->doChunkSendingTick(false); @@ -114,7 +114,7 @@ void ServerConnection::tick() } -bool ServerConnection::addPendingTextureRequest(const wstring &textureName) +bool ServerConnection::addPendingTextureRequest(const std::wstring &textureName) { AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); if( it == m_pendingTextureRequests.end() ) @@ -129,7 +129,7 @@ bool ServerConnection::addPendingTextureRequest(const wstring &textureName) return true; } -void ServerConnection::handleTextureReceived(const wstring &textureName) +void ServerConnection::handleTextureReceived(const std::wstring &textureName) { AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); if( it != m_pendingTextureRequests.end() ) @@ -138,7 +138,7 @@ void ServerConnection::handleTextureReceived(const wstring &textureName) } for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; if (!player->done) { player->handleTextureReceived(textureName); @@ -146,7 +146,7 @@ void ServerConnection::handleTextureReceived(const wstring &textureName) } } -void ServerConnection::handleTextureAndGeometryReceived(const wstring &textureName) +void ServerConnection::handleTextureAndGeometryReceived(const std::wstring &textureName) { AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); if( it != m_pendingTextureRequests.end() ) @@ -155,7 +155,7 @@ void ServerConnection::handleTextureAndGeometryReceived(const wstring &textureNa } for (unsigned int i = 0; i < players.size(); i++) { - shared_ptr player = players[i]; + std::shared_ptr player = players[i]; if (!player->done) { player->handleTextureAndGeometryReceived(textureName); @@ -163,7 +163,7 @@ void ServerConnection::handleTextureAndGeometryReceived(const wstring &textureNa } } -void ServerConnection::handleServerSettingsChanged(shared_ptr packet) +void ServerConnection::handleServerSettingsChanged(std::shared_ptr packet) { Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -197,7 +197,7 @@ void ServerConnection::handleServerSettingsChanged(shared_ptr playerconnection = players[i]; +// std::shared_ptr playerconnection = players[i]; // playerconnection->setShowOnMaps(pMinecraft->options->GetGamertagSetting()); // } // } diff --git a/Minecraft.Client/Network/ServerConnection.h b/Minecraft.Client/Network/ServerConnection.h index 56c5d39e5..501315756 100644 --- a/Minecraft.Client/Network/ServerConnection.h +++ b/Minecraft.Client/Network/ServerConnection.h @@ -5,7 +5,7 @@ class MinecraftServer; class Socket; class ServerSettingsChangedPacket; -using namespace std; + class ServerConnection { @@ -20,11 +20,11 @@ private: int connectionCounter; private: CRITICAL_SECTION pending_cs; // 4J added - vector< shared_ptr > pending; - vector< shared_ptr > players; + std::vector< std::shared_ptr > pending; + std::vector< std::shared_ptr > players; // 4J - When the server requests a texture, it should add it to here while we are waiting for it - vector m_pendingTextureRequests; + std::vector m_pendingTextureRequests; public: MinecraftServer *server; @@ -34,16 +34,16 @@ public: void NewIncomingSocket(Socket *socket); // 4J - added void removeSpamProtection(Socket *socket) { }// 4J Stu - Not implemented as not required - void addPlayerConnection(shared_ptr uc); + void addPlayerConnection(std::shared_ptr uc); private: - void handleConnection(shared_ptr uc); + void handleConnection(std::shared_ptr uc); public: void stop(); void tick(); // 4J Added - bool addPendingTextureRequest(const wstring &textureName); - void handleTextureReceived(const wstring &textureName); - void handleTextureAndGeometryReceived(const wstring &textureName); - void handleServerSettingsChanged(shared_ptr packet); + bool addPendingTextureRequest(const std::wstring &textureName); + void handleTextureReceived(const std::wstring &textureName); + void handleTextureAndGeometryReceived(const std::wstring &textureName); + void handleServerSettingsChanged(std::shared_ptr packet); }; diff --git a/Minecraft.Client/Network/ServerInterface.h b/Minecraft.Client/Network/ServerInterface.h index b504b3952..883b2106d 100644 --- a/Minecraft.Client/Network/ServerInterface.h +++ b/Minecraft.Client/Network/ServerInterface.h @@ -1,29 +1,29 @@ #pragma once -using namespace std; + class ServerInterface { - virtual int getConfigInt(const wstring &name, int defaultValue) = 0; - virtual wstring getConfigString(const wstring &name, const wstring &defaultValue) = 0; - virtual bool getConfigBoolean(const wstring &name, bool defaultValue) = 0; - virtual void setProperty(wstring &propertyName, void *value) = 0; + virtual int getConfigInt(const std::wstring &name, int defaultValue) = 0; + virtual std::wstring getConfigString(const std::wstring &name, const std::wstring &defaultValue) = 0; + virtual bool getConfigBoolean(const std::wstring &name, bool defaultValue) = 0; + virtual void setProperty(std::wstring &propertyName, void *value) = 0; virtual void configSave() = 0; - virtual wstring getConfigPath() = 0; - virtual wstring getServerIp() = 0; + virtual std::wstring getConfigPath() = 0; + virtual std::wstring getServerIp() = 0; virtual int getServerPort() = 0; - virtual wstring getServerName() = 0; - virtual wstring getServerVersion() = 0; + virtual std::wstring getServerName() = 0; + virtual std::wstring getServerVersion() = 0; virtual int getPlayerCount() = 0; virtual int getMaxPlayers() = 0; - virtual wstring[] getPlayerNames() = 0; - virtual wstring getWorldName() = 0; - virtual wstring getPluginNames() = 0; + virtual std::wstring[] getPlayerNames() = 0; + virtual std::wstring getWorldName() = 0; + virtual std::wstring getPluginNames() = 0; virtual void disablePlugin() = 0; - virtual wstring runCommand(const wstring &command) = 0; + virtual std::wstring runCommand(const std::wstring &command) = 0; virtual bool isDebugging() = 0; // Logging - virtual void info(const wstring &string) = 0; - virtual void warn(const wstring &string) = 0; - virtual void error(const wstring &string) = 0; - virtual void debug(const wstring &string) = 0; + virtual void info(const std::wstring &string) = 0; + virtual void warn(const std::wstring &string) = 0; + virtual void error(const std::wstring &string) = 0; + virtual void debug(const std::wstring &string) = 0; }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Storage.h index be5d57fd7..4d97a6eac 100644 --- a/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/Durango/4JLibs/inc/4J_Storage.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #define MAX_DISPLAYNAME_LENGTH 128 // SCE_SAVE_DATA_SUBTITLE_MAXSIZE on PS4 #define MAX_SAVEFILENAME_LENGTH 32 // SCE_SAVE_DATA_DIRNAME_DATA_MAXSIZE @@ -474,7 +474,7 @@ public: eTitleStorageState TMSPP_ReadFile(int iQuadrant,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPWSTR wszFilename,int( *Func)(LPVOID,int,int,LPVOID, WCHAR *),LPVOID lpParam, int iUserData); eTitleStorageState TMSPP_DeleteFile(int iQuadrant,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPWSTR wszFilename,int( *Func)(LPVOID,int,int),LPVOID lpParam, int iUserData); eTitleStorageState TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,int( *Func)(LPVOID,int,int,LPVOID,WCHAR *)=NULL,LPVOID lpParam=NULL, int iUserData=0); - bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); + bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::wstring &Filename); eTitleStorageState TMSPP_GetTitleStorageState(int iPad); void TMSPP_ClearTitleStorageState(int iPad); diff --git a/Minecraft.Client/Platform/Durango/ApplicationView.cpp b/Minecraft.Client/Platform/Durango/ApplicationView.cpp index 073d7ba90..2442abb91 100644 --- a/Minecraft.Client/Platform/Durango/ApplicationView.cpp +++ b/Minecraft.Client/Platform/Durango/ApplicationView.cpp @@ -27,7 +27,7 @@ XALLOC_ATTRIBUTES ExpandAllocAttributes( _In_ LONGLONG dwAttributes ) } SIZE_T totalTracked = 0; -unordered_map tracker; +std::unordered_map tracker; static volatile bool memDump = false; static volatile bool memReset = false; static bool memDumpInit = false; diff --git a/Minecraft.Client/Platform/Durango/Durango_App.cpp b/Minecraft.Client/Platform/Durango/Durango_App.cpp index aa81ef0b0..14e27c42c 100644 --- a/Minecraft.Client/Platform/Durango/Durango_App.cpp +++ b/Minecraft.Client/Platform/Durango/Durango_App.cpp @@ -169,7 +169,7 @@ void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) int CConsoleMinecraftApp::LoadLocalDLCImages() { - unordered_map *pDLCInfoA=app.GetDLCInfo(); + std::unordered_map *pDLCInfoA=app.GetDLCInfo(); // 4J-PB - Any local graphic files for the Minecraft Store? for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { @@ -183,7 +183,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages() void CConsoleMinecraftApp::FreeLocalDLCImages() { // 4J-PB - Any local graphic files for the Minecraft Store? - unordered_map *pDLCInfoA=app.GetDLCInfo(); + std::unordered_map *pDLCInfoA=app.GetDLCInfo(); for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { @@ -263,7 +263,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); - wstring wWorldName = L"TestWorld"; + std::wstring wWorldName = L"TestWorld"; StorageManager.ResetSaveData(); StorageManager.SetSaveTitle(wWorldName.c_str()); @@ -559,7 +559,7 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad, app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList\n"); if(lpvData!=NULL) { - vector *pvTmsFileDetails=(vector *)lpvData; + std::vector *pvTmsFileDetails=(std::vector *)lpvData; if(pvTmsFileDetails->size()>0) { diff --git a/Minecraft.Client/Platform/Durango/Durango_Minecraft.cpp b/Minecraft.Client/Platform/Durango/Durango_Minecraft.cpp index cdebb44a3..f3e4888f3 100644 --- a/Minecraft.Client/Platform/Durango/Durango_Minecraft.cpp +++ b/Minecraft.Client/Platform/Durango/Durango_Minecraft.cpp @@ -984,7 +984,7 @@ void oldWinMainTick() #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp index f4d4978b8..8e6b48c41 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.cpp @@ -408,7 +408,7 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperation(); m_statNames->Clear(); - for(wstring name : m_leaderboardStatNames[difficulty][type]) + for(std::wstring name : m_leaderboardStatNames[difficulty][type]) { m_statNames->Append(ref new P::String(name.c_str())); } @@ -490,7 +490,7 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperation 0) { - vector xuids = vector(); + std::vector xuids = std::vector(); for(int i = 0; i < lastResult->Rows->Size; i++) { xuids.push_back(PlayerUID(lastResult->Rows->GetAt(i)->XboxUserId->Data())); @@ -548,7 +548,7 @@ void DurangoLeaderboardManager::updateStatsInfo(int userIndex, int difficulty, E } int statIndex = 0, sumScores = 0; - for(wstring statName : m_leaderboardStatNames[difficulty][type]) + for(std::wstring statName : m_leaderboardStatNames[difficulty][type]) { bool found = false; for(auto result : statsResult) @@ -585,7 +585,7 @@ void DurangoLeaderboardManager::GetProfilesCallback(LPVOID param, std::vector 0) { - dlm->m_displayNames = vector(); + dlm->m_displayNames = std::vector(); for (int i = 0; i < profiles.size(); i++) { dlm->m_displayNames.push_back(profiles[i]->GameDisplayName->Data()); @@ -699,7 +699,7 @@ void DurangoLeaderboardManager::setState(EStatsState newState) LeaveCriticalSection(&m_csStatsState); } -wstring DurangoLeaderboardManager::stateToString(EStatsState eState) +std::wstring DurangoLeaderboardManager::stateToString(EStatsState eState) { switch (eState) { diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.h b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.h index 3b0c005f6..b04fc6dae 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.h +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoLeaderboardManager.h @@ -35,12 +35,12 @@ private: unsigned int m_maxRank; MXS::XboxLiveContext^ m_xboxLiveContext; - wstring m_leaderboardNames[4][eStatsType_MAX]; - wstring m_socialLeaderboardNames[4][eStatsType_MAX]; - std::vector m_leaderboardStatNames[4][eStatsType_MAX]; + std::wstring m_leaderboardNames[4][eStatsType_MAX]; + std::wstring m_socialLeaderboardNames[4][eStatsType_MAX]; + std::vector m_leaderboardStatNames[4][eStatsType_MAX]; // Display names for the current scores - std::vector m_displayNames; + std::vector m_displayNames; bool m_waitingForProfiles; int m_difficulty; @@ -90,5 +90,5 @@ private: EStatsState getState(); void setState(EStatsState newState); - wstring stateToString(EStatsState eState); + std::wstring stateToString(EStatsState eState); }; diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp index 03e37e037..c3fc72b63 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.cpp @@ -16,15 +16,15 @@ namespace WFC = Windows::Foundation::Collections; namespace CC = concurrency; -StatParam::StatParam(const wstring &base) +StatParam::StatParam(const std::wstring &base) { m_base = base; //m_numArgs = numArgs; - m_args = vector(); + m_args = std::vector(); unsigned int count=0; - wstring::size_type pos =base.find(L"*"); - while(pos!=string::npos) + std::wstring::size_type pos =base.find(L"*"); + while(pos!=std::string::npos) { count++; pos=base.find(L"*",pos+1); @@ -46,14 +46,14 @@ void StatParam::addArgs(int v1, ...) va_end(argptr); } -vector *StatParam::getStats() +std::vector *StatParam::getStats() { - vector *out = new vector(); + std::vector *out = new std::vector(); static const int MAXSIZE = 256; - static const wstring SUBSTR = L"*"; + static const std::wstring SUBSTR = L"*"; - wstring wstr_itr, wstr_num; + std::wstring wstr_itr, wstr_num; if (m_args.size() <= 0 || m_numArgs <= 0) { @@ -69,10 +69,10 @@ vector *StatParam::getStats() { for (int j=0; j *DurangoStatsDebugger::getStats() +std::vector *DurangoStatsDebugger::getStats() { - vector *out = new vector(); + std::vector *out = new std::vector(); for (auto it = m_stats.begin(); it!=m_stats.end(); it++) { - vector *sublist = (*it)->getStats(); + std::vector *sublist = (*it)->getStats(); out->insert(out->end(), sublist->begin(), sublist->end()); } @@ -322,11 +322,11 @@ void DurangoStatsDebugger::PrintStats(int iPad) { if (instance == NULL) instance = Initialize(); - vector *tmp = instance->getStats(); + std::vector *tmp = instance->getStats(); instance->m_printQueue.insert(instance->m_printQueue.end(), tmp->begin(), tmp->end()); // app.DebugPrintf("[DEBUG] START\n"); - // for (wstring t : *tmp) app.DebugPrintf("[DEBUG] %s\n", wstringtofilename(t)); + // for (std::wstring t : *tmp) app.DebugPrintf("[DEBUG] %s\n", wstringtofilename(t)); // app.DebugPrintf("[DEBUG] END\n"); instance->retrieveStats(iPad); @@ -407,7 +407,7 @@ void DurangoStatsDebugger::retrieveStats(int iPad) // Create Stat retrieval threads until there is no long any stats to start retrieving. while ( !instance->m_printQueue.empty() ) { - vector *printing = new vector(); + std::vector *printing = new std::vector(); if (m_printQueue.size() > R_SIZE) { diff --git a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h index 80218c9d2..189cf28bd 100644 --- a/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h +++ b/Minecraft.Client/Platform/Durango/Leaderboards/DurangoStatsDebugger.h @@ -11,17 +11,17 @@ namespace MXSL = Microsoft::Xbox::Services::Leaderboard; class StatParam { private: - wstring m_base; + std::wstring m_base; int m_numArgs; - vector m_args; + std::vector m_args; public: - StatParam(const wstring &base); + StatParam(const std::wstring &base); void addArgs(int v1, ...); - vector *getStats(); + std::vector *getStats(); }; @@ -65,9 +65,9 @@ protected: DurangoStatsDebugger(); - vector m_stats; + std::vector m_stats; - vector *getStats(); + std::vector *getStats(); public: static DurangoStatsDebugger *Initialize(); @@ -75,20 +75,20 @@ public: static void PrintStats(int iPad); private: - vector m_printQueue; + std::vector m_printQueue; void retrieveStats(int iPad); typedef struct { int m_iPad; - wstring m_statName; - wstring m_score; + std::wstring m_statName; + std::wstring m_score; } StatResult; CRITICAL_SECTION m_retrievedStatsLock; - vector m_retrievedStats; + std::vector m_retrievedStats; void addRetrievedStat(StatResult result); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.cpp b/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.cpp index 598a60459..95d353875 100644 --- a/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.cpp +++ b/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.cpp @@ -74,7 +74,7 @@ void ChatIntegrationLayer::InitializeChatManager( m_tokenResourceAvailabilityChanged = Windows::ApplicationModel::Core::CoreApplication::ResourceAvailabilityChanged += ref new EventHandler< Platform::Object^ >( [weakPtrToThis] (Platform::Object^, Platform::Object^ ) { - // Using a std::weak_ptr instead of 'this' to avoid dangling pointer if caller class is released. + // Using a std:: instead of 'this' to avoid dangling pointer if caller class is released. // Simply unregistering the callback in the destructor isn't enough to prevent a dangling pointer std::shared_ptr sharedPtrToThis(weakPtrToThis.lock()); if( sharedPtrToThis != nullptr ) @@ -103,7 +103,7 @@ void ChatIntegrationLayer::InitializeChatManager( ref new Windows::Foundation::EventHandler( [weakPtrToThis] ( Platform::Object^, Microsoft::Xbox::GameChat::DebugMessageEventArgs^ args ) { - // Using a std::weak_ptr instead of 'this' to avoid dangling pointer if caller class is released. + // Using a std:: instead of 'this' to avoid dangling pointer if caller class is released. // Simply unregistering the callback in the destructor isn't enough to prevent a dangling pointer std::shared_ptr sharedPtrToThis(weakPtrToThis.lock()); if( sharedPtrToThis != nullptr ) @@ -116,7 +116,7 @@ void ChatIntegrationLayer::InitializeChatManager( ref new Windows::Foundation::EventHandler( [weakPtrToThis] ( Platform::Object^, Microsoft::Xbox::GameChat::ChatPacketEventArgs^ args ) { - // Using a std::weak_ptr instead of 'this' to avoid dangling pointer if caller class is released. + // Using a std:: instead of 'this' to avoid dangling pointer if caller class is released. // Simply unregistering the callback in the destructor isn't enough to prevent a dangling pointer std::shared_ptr sharedPtrToThis(weakPtrToThis.lock()); if( sharedPtrToThis != nullptr ) @@ -129,7 +129,7 @@ void ChatIntegrationLayer::InitializeChatManager( ref new Microsoft::Xbox::GameChat::CompareUniqueConsoleIdentifiersHandler( [weakPtrToThis] ( Platform::Object^ obj1, Platform::Object^ obj2 ) { - // Using a std::weak_ptr instead of 'this' to avoid dangling pointer if caller class is released. + // Using a std:: instead of 'this' to avoid dangling pointer if caller class is released. // Simply unregistering the callback in the destructor isn't enough to prevent a dangling pointer std::shared_ptr sharedPtrToThis(weakPtrToThis.lock()); if( sharedPtrToThis != nullptr ) diff --git a/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.h b/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.h index 2a852245c..78ad92b9f 100644 --- a/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.h +++ b/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.h @@ -51,7 +51,7 @@ public: void RemoveLocalUser( __in Windows::Xbox::System::IUser^ user ); void EvaluateDevicesForUser(__in Windows::Xbox::System::IUser^ user ); - vector m_addedUsers; + std::vector m_addedUsers; CRITICAL_SECTION m_csAddedUsers; private: diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp index 75226c7c5..42411528a 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.cpp @@ -22,14 +22,14 @@ DQRNetworkManager::ePartyProcessType DQRNetworkManager::m_partyProcess = DQRNetw bool DQRNetworkManager::m_inviteReceived = false; int DQRNetworkManager::m_bootUserIndex; -wstring DQRNetworkManager::m_bootSessionName; -wstring DQRNetworkManager::m_bootServiceConfig; -wstring DQRNetworkManager::m_bootSessionTemplate; +std::wstring DQRNetworkManager::m_bootSessionName; +std::wstring DQRNetworkManager::m_bootServiceConfig; +std::wstring DQRNetworkManager::m_bootSessionTemplate; DQRNetworkManager * DQRNetworkManager::s_pDQRManager = NULL; //using namespace Windows::Xbox::Networking; -DQRNetworkManager::SessionInfo::SessionInfo(wstring& sessionName, wstring& serviceConfig, wstring& sessionTemplate) +DQRNetworkManager::SessionInfo::SessionInfo(std::wstring& sessionName, std::wstring& serviceConfig, std::wstring& sessionTemplate) { m_detailsValid = true; m_sessionName = sessionName; @@ -782,7 +782,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid) } // Retrieve player display name by gamertag -wstring DQRNetworkManager::GetDisplayNameByGamertag(wstring gamertag) +std::wstring DQRNetworkManager::GetDisplayNameByGamertag(std::wstring gamertag) { if (m_displayNames.find(gamertag) != m_displayNames.end()) { @@ -1440,8 +1440,8 @@ MXSM::MultiplayerSessionReference^ DQRNetworkManager::ConvertToMicrosoftXboxServ // this method is able to work out who has been added or removed from the game session, and notify the game of these events. void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData) { - vector tempPlayers; - vector newPlayers; + std::vector tempPlayers; + std::vector newPlayers; EnterCriticalSection(&m_csRoomSyncData); @@ -1574,7 +1574,7 @@ bool DQRNetworkManager::AddRoomSyncPlayer(DQRNetworkPlayer *pPlayer, unsigned in void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int sessionAddress) { EnterCriticalSection(&m_csRoomSyncData); - vector removedPlayers; + std::vector removedPlayers; int iWriteIdx = 0; for( int i = 0; i < m_roomSyncData.playerCount; i++ ) { @@ -1605,7 +1605,7 @@ void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int ses // This is called from the host a remove player from the room sync data that is sent out to the clients. void DQRNetworkManager::RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer) { - vector removedPlayers; + std::vector removedPlayers; int iWriteIdx = 0; for( int i = 0; i < m_roomSyncData.playerCount; i++ ) { @@ -2184,7 +2184,7 @@ int DQRNetworkManager::HostGameThreadProc() if( m_currentUserMask & ( 1 << i ) && ProfileManager.IsSignedIn(i)) { auto user = ProfileManager.GetUser(i); - wstring displayName = ProfileManager.GetDisplayName(i); + std::wstring displayName = ProfileManager.GetDisplayName(i); DQRNetworkPlayer* pPlayer = new DQRNetworkPlayer(this, ( ( smallId == m_hostSmallId ) ? DQRNetworkPlayer::DNP_TYPE_HOST : DQRNetworkPlayer::DNP_TYPE_LOCAL ), true, i, localSessionAddress); pPlayer->SetSmallId(smallId); @@ -3031,7 +3031,7 @@ void DQRNetworkManager::GetProfileCallback(LPVOID pParam, Microsoft::Xbox::Servi } // Set player display name -void DQRNetworkManager::SetDisplayName(PlayerUID xuid, wstring displayName) +void DQRNetworkManager::SetDisplayName(PlayerUID xuid, std::wstring displayName) { EnterCriticalSection(&m_csRoomSyncData); for (int i = 0; i < m_roomSyncData.playerCount; i++) diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h index 9daa7322a..df3d3b611 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager.h @@ -21,7 +21,7 @@ namespace WFC = Windows::Foundation::Collections; #define MATCH_SESSION_TEMPLATE_NAME L"PeerToHostTemplate" #define MAX_PLAYERS_IN_TEMPLATE 8 -using namespace std; + ref class DQRNetworkManagerEventHandlers sealed { @@ -119,12 +119,12 @@ public: class SessionInfo { public: - SessionInfo(wstring& sessionName, wstring& serviceConfig, wstring& sessionTemplate); + SessionInfo(std::wstring& sessionName, std::wstring& serviceConfig, std::wstring& sessionTemplate); SessionInfo(); bool m_detailsValid; - wstring m_sessionName; - wstring m_serviceConfig; - wstring m_sessionTemplate; + std::wstring m_sessionName; + std::wstring m_serviceConfig; + std::wstring m_sessionTemplate; }; static const int MAX_LOCAL_PLAYER_COUNT = 4; @@ -153,7 +153,7 @@ public: { public:; DQRNetworkPlayer* m_pPlayer; - wstring m_name; + std::wstring m_name; unsigned int m_sessionAddress; int m_channel; bool m_sync; @@ -181,7 +181,7 @@ public: DQRNetworkPlayer *GetPlayerByIndex(int idx); DQRNetworkPlayer *GetPlayerBySmallId(int idx); DQRNetworkPlayer *GetPlayerByXuid(PlayerUID xuid); - wstring GetDisplayNameByGamertag(wstring gamertag); + std::wstring GetDisplayNameByGamertag(std::wstring gamertag); DQRNetworkPlayer *GetLocalPlayerByUserIndex(int idx); DQRNetworkPlayer *GetHostPlayer(); int GetSessionIndex(DQRNetworkPlayer *player); @@ -223,16 +223,16 @@ public: public: SessionSearchResult() { m_extData = NULL; } ~SessionSearchResult() { free(m_extData); } - wstring m_partyId; - wstring m_sessionName; + std::wstring m_partyId; + std::wstring m_sessionName; // These names/xuids reflect the server controlled list of who is actually in the game - wstring m_playerNames[MAX_ONLINE_PLAYER_COUNT]; + std::wstring m_playerNames[MAX_ONLINE_PLAYER_COUNT]; PlayerUID m_playerXuids[MAX_ONLINE_PLAYER_COUNT]; int m_playerCount; // This count & set of xuids reflects the session document list of who is in the game - wstring m_sessionXuids[MAX_ONLINE_PLAYER_COUNT]; + std::wstring m_sessionXuids[MAX_ONLINE_PLAYER_COUNT]; int m_usedSlotCount; void *m_extData; @@ -397,14 +397,14 @@ private: bool m_notifyForFullParty; - unordered_map m_sessionAddressToConnectionInfoMapHost; // For host - there may be more than one remote session attached to this listening session + std::unordered_map m_sessionAddressToConnectionInfoMapHost; // For host - there may be more than one remote session attached to this listening session unsigned int m_sessionAddressFromSmallId[256]; // For host - for mapping back from small Id, to session address unsigned char m_channelFromSmallId[256]; // For host and client, for mapping back from small Id, to channel DQRConnectionInfo m_connectionInfoClient; // For client unsigned int m_hostSessionAddress; // For client CRITICAL_SECTION m_csHostGamertagResolveResults; - queue m_hostGamertagResolveResults; + std::queue m_hostGamertagResolveResults; void AddPlayerFailed(Platform::String ^xuid); Platform::String^ RemoveBracesFromGuidString(__in Platform::String^ guid ); @@ -461,7 +461,7 @@ private: int RTSDoWorkThread(); CRITICAL_SECTION m_csVecChatPlayers; - vector m_vecChatPlayersJoined; + std::vector m_vecChatPlayersJoined; public: void HandleNewPartyFoundForPlayer(); void HandlePlayerRemovedFromParty(int playerMask); @@ -488,7 +488,7 @@ public: bool JoinPartyFromSearchResult(SessionSearchResult *searchResult, int playerMask); void CancelJoinPartyFromSearchResult(); void RequestDisplayName(DQRNetworkPlayer *player); - void SetDisplayName(PlayerUID xuid, wstring displayName); + void SetDisplayName(PlayerUID xuid, std::wstring displayName); private: __int64 m_playersLeftPartyTime; @@ -509,7 +509,7 @@ private: int m_sessionResultCount; bool m_cancelJoinFromSearchResult; - map m_displayNames; // Player display names by gamertag + std::map m_displayNames; // Player display names by gamertag @@ -521,9 +521,9 @@ private: } ePartyProcessType; static int m_bootUserIndex; static ePartyProcessType m_partyProcess; - static wstring m_bootSessionName; - static wstring m_bootServiceConfig; - static wstring m_bootSessionTemplate; + static std::wstring m_bootSessionName; + static std::wstring m_bootServiceConfig; + static std::wstring m_bootSessionTemplate; static bool m_inviteReceived; static DQRNetworkManager *s_pDQRManager; diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp index a78ed8853..556e1c744 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkManager_FriendSessions.cpp @@ -169,10 +169,10 @@ int DQRNetworkManager::GetFriendsThreadProc() // Get party views for each of the user party associations that we have. These seem to be able to (individually) raise errors, so // accumulate results into 2 matched vectors declared below so that we can ignore any broken UserPartyAssociations from now - vector partyViewVector; - vector partyResultsVector; + std::vector partyViewVector; + std::vector partyResultsVector; - vector> taskVector; + std::vector> taskVector; for each(WXM::UserPartyAssociation^ remoteParty in partyResults) { auto asyncOp = WXM::Party::GetPartyViewByPartyIdAsync( primaryUser, remoteParty->PartyId ); @@ -210,8 +210,8 @@ int DQRNetworkManager::GetFriendsThreadProc() } // Filter the party view, and party results vector (partyResultsVector) this is matched to, to remove any that don't have game sessions - or game sessions that aren't this game - vector partyViewVectorFiltered; - vector partyResultsFiltered; + std::vector partyViewVectorFiltered; + std::vector partyResultsFiltered; for( int i = 0; i < partyViewVector.size(); i++ ) { @@ -237,9 +237,9 @@ int DQRNetworkManager::GetFriendsThreadProc() // // and, from the party views, we can now attempt to get game sessions - vector sessionVector; - vector partyViewVectorValid; - vector partyResultsValid; + std::vector sessionVector; + std::vector partyViewVectorValid; + std::vector partyResultsValid; for( int i = 0; i < partyViewVectorFiltered.size(); i++ ) { @@ -284,10 +284,10 @@ int DQRNetworkManager::GetFriendsThreadProc() // a session won't have any XUIDs to resolve, which would make GetUserProfilesAsync unhappy, so we'll only be creating a task // when there are members. Creating new matching arrays for party results and sessions, to match the results (we don't care about the party view anymore) - vector^>> nameResolveTaskVector; - vector^> nameResolveVector; - vector newSessionVector; - vector newPartyVector; + std::vector^>> nameResolveTaskVector; + std::vector^> nameResolveVector; + std::vector newSessionVector; + std::vector newPartyVector; for( int j = 0; j < sessionVector.size(); j++ ) { @@ -383,7 +383,7 @@ int DQRNetworkManager::GetFriendsThreadProc() try { - auto joinTask = when_all(begin(nameResolveTaskVector), end(nameResolveTaskVector) ).then([this, &nameResolveVector](vector^> results) + auto joinTask = when_all(begin(nameResolveTaskVector), end(nameResolveTaskVector) ).then([this, &nameResolveVector](std::vector^> results) { nameResolveVector = results; }) @@ -421,7 +421,7 @@ int DQRNetworkManager::GetFriendsThreadProc() } for( int j = 0; j < m_sessionSearchResults[i].m_usedSlotCount; j++ ) { - m_sessionSearchResults[i].m_sessionXuids[j] = wstring( newSessionVector[i]->Members->GetAt(j)->XboxUserId->Data() ); + m_sessionSearchResults[i].m_sessionXuids[j] = std::wstring( newSessionVector[i]->Members->GetAt(j)->XboxUserId->Data() ); } m_sessionSearchResults[i].m_extData = malloc( sizeof(GameSessionData) ); diff --git a/Minecraft.Client/Platform/Durango/Network/DQRNetworkPlayer.cpp b/Minecraft.Client/Platform/Durango/Network/DQRNetworkPlayer.cpp index 404c872c2..e25f09aa5 100644 --- a/Minecraft.Client/Platform/Durango/Network/DQRNetworkPlayer.cpp +++ b/Minecraft.Client/Platform/Durango/Network/DQRNetworkPlayer.cpp @@ -192,13 +192,13 @@ void DQRNetworkPlayer::SetName(const wchar_t *name) } // Return display name (if display name is not set, return name instead) -wstring DQRNetworkPlayer::GetDisplayName() +std::wstring DQRNetworkPlayer::GetDisplayName() { return (m_displayName == L"") ? m_name : m_displayName; } // Set display name -void DQRNetworkPlayer::SetDisplayName(wstring displayName) +void DQRNetworkPlayer::SetDisplayName(std::wstring displayName) { m_displayName = displayName; } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.cpp b/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.cpp index 304ad988a..5a2e2a01b 100644 --- a/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.cpp +++ b/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.cpp @@ -97,7 +97,7 @@ const wchar_t *NetworkPlayerDurango::GetOnlineName() return m_dqrPlayer->GetName(); } -wstring NetworkPlayerDurango::GetDisplayName() +std::wstring NetworkPlayerDurango::GetDisplayName() { return m_dqrPlayer->GetDisplayName(); } diff --git a/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.h b/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.h index e4051b1ed..e78d8a973 100644 --- a/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.h +++ b/Minecraft.Client/Platform/Durango/Network/NetworkPlayerDurango.h @@ -28,7 +28,7 @@ public: virtual void SetSocket(Socket *pSocket); virtual Socket *GetSocket(); virtual const wchar_t *GetOnlineName(); - virtual wstring GetDisplayName(); + virtual std::wstring GetDisplayName(); virtual PlayerUID GetUID(); void SetUID(PlayerUID UID); diff --git a/Minecraft.Client/Platform/Durango/Network/PartyController.cpp b/Minecraft.Client/Platform/Durango/Network/PartyController.cpp index 84b54b99d..df7a849b8 100644 --- a/Minecraft.Client/Platform/Durango/Network/PartyController.cpp +++ b/Minecraft.Client/Platform/Durango/Network/PartyController.cpp @@ -781,7 +781,7 @@ void PartyController::OnGameSessionReady( GameSessionReadyEventArgs^ eventArgs ) Microsoft::Xbox::Services::Multiplayer::MultiplayerSessionReference^ sessionRef = m_pDQRNet->ConvertToMicrosoftXboxServicesMultiplayerSessionReference(eventArgs->GameSession); - vector localAdhocAdditions; + std::vector localAdhocAdditions; // Use context from any user at all for this, since this might happen before we are in a game and won't have anything set up in the network manager itself. We are only // using it to read the session so there shouldn't be any requirements to use a particular live context diff --git a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp index 74445a433..f0f5f0cba 100644 --- a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp +++ b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.cpp @@ -744,12 +744,12 @@ bool CPlatformNetworkManagerDurango::SystemFlagGet(INetworkPlayer *pNetworkPlaye return false; } -wstring CPlatformNetworkManagerDurango::GatherStats() +std::wstring CPlatformNetworkManagerDurango::GatherStats() { return L""; } -wstring CPlatformNetworkManagerDurango::GatherRTTStats() +std::wstring CPlatformNetworkManagerDurango::GatherRTTStats() { return L""; } @@ -790,9 +790,9 @@ void CPlatformNetworkManagerDurango::TickSearch() } } -vector *CPlatformNetworkManagerDurango::GetSessionList(int iPad, int localPlayers, bool partyOnly) +std::vector *CPlatformNetworkManagerDurango::GetSessionList(int iPad, int localPlayers, bool partyOnly) { - vector *filteredList = new vector(); + std::vector *filteredList = new std::vector(); for( int i = 0; i < m_searchResultsCount; i++ ) { GameSessionData *gameSessionData = (GameSessionData *)m_pSearchResults[i].m_extData; @@ -883,7 +883,7 @@ INetworkPlayer * CPlatformNetworkManagerDurango::GetPlayerBySmallId(unsigned cha return getNetworkPlayer(m_pDQRNet->GetPlayerBySmallId(smallId)); } -wstring CPlatformNetworkManagerDurango::GetDisplayNameByGamertag(wstring gamertag) +std::wstring CPlatformNetworkManagerDurango::GetDisplayNameByGamertag(std::wstring gamertag) { return m_pDQRNet->GetDisplayNameByGamertag(gamertag); } diff --git a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h index 40d662f00..87301283f 100644 --- a/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h +++ b/Minecraft.Client/Platform/Durango/Network/PlatformNetworkManagerDurango.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include #include "../../../../Minecraft.World/Util/C4JThread.h" #include "../../../Build/Common/Network/NetworkPlayerInterface.h" @@ -28,7 +28,7 @@ public: virtual INetworkPlayer *GetPlayerByIndex(int playerIndex); virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid); virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId); - virtual wstring GetDisplayNameByGamertag(wstring gamertag); + virtual std::wstring GetDisplayNameByGamertag(std::wstring gamertag); virtual bool ShouldMessageForFullSession(); virtual INetworkPlayer *GetHostPlayer(); @@ -71,7 +71,7 @@ private: HANDLE m_notificationListener; - vector m_machineDQRPrimaryPlayers; // collection of players that we deem to be the main one for that system + std::vector m_machineDQRPrimaryPlayers; // collection of players that we deem to be the main one for that system bool m_bLeavingGame; bool m_bLeaveGameOnTick; @@ -107,7 +107,7 @@ private: PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count); ~PlayerFlags(); }; - vector m_playerFlags; + std::vector m_playerFlags; void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagReset(); @@ -120,11 +120,11 @@ private: float m_lastPlayerEventTimeStart; public: - wstring GatherStats(); - wstring GatherRTTStats(); + std::wstring GatherStats(); + std::wstring GatherRTTStats(); private: - vector friendsSessions[XUSER_MAX_COUNT]; + std::vector friendsSessions[XUSER_MAX_COUNT]; int m_searchResultsCount; int m_lastSearchStartTime; @@ -139,7 +139,7 @@ private: void TickSearch(); - vectorcurrentNetworkPlayers; + std::vectorcurrentNetworkPlayers; INetworkPlayer *addNetworkPlayer(DQRNetworkPlayer *pDQRPlayer); void removeNetworkPlayer(DQRNetworkPlayer *pDQRPlayer); static INetworkPlayer *getNetworkPlayer(DQRNetworkPlayer *pDQRPlayer); @@ -149,7 +149,7 @@ private: virtual void Notify(int ID, ULONG_PTR Param); public: - virtual vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); + virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); diff --git a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp index bfe8ea271..c692fe0f5 100644 --- a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp +++ b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.cpp @@ -57,7 +57,7 @@ bool CDurangoTelemetryManager::RecordPlayerSessionStart(int iPad) bool CDurangoTelemetryManager::RecordPlayerSessionExit(int iPad, int exitStatus) { - PlayerUID puid; shared_ptr plr; + PlayerUID puid; std::shared_ptr plr; ProfileManager.GetXUID(iPad, &puid, true); plr = Minecraft::GetInstance()->localplayers[iPad]; @@ -127,7 +127,7 @@ bool CDurangoTelemetryManager::RecordLevelStart(int iPad, ESen_FriendOrMatch fri ULONG hr = 0; // Grab player info. - PlayerUID puid; shared_ptr plr; + PlayerUID puid; std::shared_ptr plr; ProfileManager.GetXUID(iPad, &puid, true); plr = Minecraft::GetInstance()->localplayers[iPad]; @@ -971,9 +971,9 @@ DurangoStats *CDurangoTelemetryManager::durangoStats() return (DurangoStats*) GenericStats::getInstance(); } -wstring CDurangoTelemetryManager::guid2str(LPCGUID guid) +std::wstring CDurangoTelemetryManager::guid2str(LPCGUID guid) { - wstring out = L"GUID<"; + std::wstring out = L"GUID<"; out += _toString(guid->Data1); out += L":"; out += _toString(guid->Data2); diff --git a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h index 57421e991..2e78162b9 100644 --- a/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h +++ b/Minecraft.Client/Platform/Durango/Sentient/DurangoTelemetry.h @@ -9,7 +9,7 @@ class CDurangoTelemetryManager : public CTelemetryManager public: static GUID ZERO_GUID; - unordered_map m_multiplayerRoundStartTimes; + std::unordered_map m_multiplayerRoundStartTimes; CDurangoTelemetryManager(); @@ -46,5 +46,5 @@ public: protected: DurangoStats *durangoStats(); - wstring guid2str(LPCGUID guid); + std::wstring guid2str(LPCGUID guid); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Linux/Linux_App.cpp b/Minecraft.Client/Platform/Linux/Linux_App.cpp index 5c94c4fc8..85421ed0e 100644 --- a/Minecraft.Client/Platform/Linux/Linux_App.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_App.cpp @@ -71,7 +71,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); - wstring wWorldName = L"TestWorld"; + std::wstring wWorldName = L"TestWorld"; StorageManager.ResetSaveData(); StorageManager.SetSaveTitle(wWorldName.c_str()); diff --git a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp index 730c4fb87..a9722780b 100644 --- a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp @@ -567,7 +567,7 @@ int StartMinecraftThreadProc( void* lpParameter ) AABB::UseDefaultThreadStorage(); Tesselator::CreateNewThreadStorage(1024*1024); RenderManager.InitialiseContext(); - Minecraft::start(wstring(),wstring()); + Minecraft::start(std::wstring(),std::wstring()); delete Tesselator::getInstance(); return 0; } @@ -988,9 +988,9 @@ Vec3::resetPool(); // g_pd3dDevice->Release(); -vector vRichPresenceStrings; +std::vector vRichPresenceStrings; -// convert wstring to UTF-8 string +// convert std::wstring to UTF-8 string std::string wstring_to_utf8 (const std::wstring& str) { std::wstring_convert> myconv; @@ -1037,7 +1037,7 @@ void FreeRichPresenceStrings() #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.inl b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.inl index 1e6990083..ab8b68396 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.inl +++ b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.inl @@ -2596,9 +2596,9 @@ inline bool XM_CALLCONV BoundingOrientedBox::Intersects(FXMVECTOR Origin, FXMVEC // t_min.x = maximum( t_min.x, t_min.y, t_min.z ); // t_max.x = minimum( t_max.x, t_max.y, t_max.z ); t_min = XMVectorMax(t_min, XMVectorSplatY(t_min)); // x = max(x,y) - t_min = XMVectorMax(t_min, XMVectorSplatZ(t_min)); // x = max(max(x,y),z) + t_min = XMVectorMax(t_min, XMVectorSplatZ(t_min)); // x = max(std::max(x,y),z) t_max = XMVectorMin(t_max, XMVectorSplatY(t_max)); // x = min(x,y) - t_max = XMVectorMin(t_max, XMVectorSplatZ(t_max)); // x = min(min(x,y),z) + t_max = XMVectorMin(t_max, XMVectorSplatZ(t_max)); // x = min(std::min(x,y),z) // if ( t_min > t_max ) return false; XMVECTOR NoIntersection = XMVectorGreater(XMVectorSplatX(t_min), XMVectorSplatX(t_max)); diff --git a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h index 03651b8fe..cfa964266 100644 --- a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h @@ -88,7 +88,7 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); char* GetGamertag(int iPad); - wstring GetDisplayName(int iPad); + std::wstring GetDisplayName(int iPad); bool IsFullVersion(); void SetFullVersion(bool bFull); void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); diff --git a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h index d4d845dfa..c62e4948d 100644 --- a/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Storage.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include @@ -405,7 +405,7 @@ public: void SetDLCProductCode(const char* szProductCode); void SetProductUpgradeKey(const char* szKey); bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam); - void SetDLCInfoMap(unordered_map* pSONYDLCMap); + void SetDLCInfoMap(std::unordered_map* pSONYDLCMap); }; extern C4JStorage StorageManager; diff --git a/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.cpp b/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.cpp index 858c85d20..f7556b5d0 100644 --- a/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.cpp +++ b/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.cpp @@ -1005,8 +1005,8 @@ void OrbisLeaderboardManager::initReadScoreStruct(ReadScore &out, SceNpScoreRank out.m_uid.setOnlineID( rankData.npId.handle, true ); out.m_rank = rankData.rank; - // Convert to wstring and copy name. - wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str(); + // Convert to std::wstring and copy name. + std::wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str(); //memcpy(&out.m_name, wstrName.c_str(), XUSER_NAME_SIZE); out.m_name=wstrName; } diff --git a/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.h b/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.h index 4d682d463..be5b326a4 100644 --- a/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.h +++ b/Minecraft.Client/Platform/Orbis/Leaderboards/OrbisLeaderboardManager.h @@ -38,7 +38,7 @@ private: bool getScoreByRange(); bool setScore(); - queue m_views; + std::queue m_views; CRITICAL_SECTION m_csViewsLock; diff --git a/Minecraft.Client/Platform/Orbis/Network/SQRNetworkManager_Orbis.cpp b/Minecraft.Client/Platform/Orbis/Network/SQRNetworkManager_Orbis.cpp index 4ceb4e1ed..7130b9129 100644 --- a/Minecraft.Client/Platform/Orbis/Network/SQRNetworkManager_Orbis.cpp +++ b/Minecraft.Client/Platform/Orbis/Network/SQRNetworkManager_Orbis.cpp @@ -716,7 +716,7 @@ bool SQRNetworkManager_Orbis::FriendRoomManagerSearch2() if( m_aFriendSearchResults.size() > 0 ) { // If we have some results, then we also want to make sure that we don't have any duplicate rooms here if more than one friend is playing in the same room. - unordered_set uniqueRooms; + std::unordered_set uniqueRooms; for( unsigned int i = 0; i < m_aFriendSearchResults.size(); i++ ) { if(m_aFriendSearchResults[i].m_RoomFound) diff --git a/Minecraft.Client/Platform/Orbis/Orbis_App.cpp b/Minecraft.Client/Platform/Orbis/Orbis_App.cpp index 0b3e29495..2335af057 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_App.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_App.cpp @@ -99,7 +99,7 @@ bool CConsoleMinecraftApp::IsAmericanSKU() SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle) { - wstring wstrTemp=convStringToWstring(pchTitle); + std::wstring wstrTemp=convStringToWstring(pchTitle); AUTO_VAR(it, m_SONYDLCMap.find(wstrTemp)); if(it == m_SONYDLCMap.end()) @@ -191,7 +191,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() // push this into a vector - wstring wstrTemp=convStringToWstring(chDLCTitle); + std::wstring wstrTemp=convStringToWstring(chDLCTitle); m_SONYDLCMap[wstrTemp]=pDLCInfo; } CloseHandle(file); @@ -288,7 +288,7 @@ int CConsoleMinecraftApp::GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameI int CConsoleMinecraftApp::LoadLocalDLCImages() { // 4J-PB - Any local graphic files for the Minecraft Store? - unordered_map*pDLCInfoA=app.GetSonyDLCMap(); + std::unordered_map*pDLCInfoA=app.GetSonyDLCMap(); for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { SONYDLC * pDLCInfo=(*it).second; @@ -301,7 +301,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages() void CConsoleMinecraftApp::FreeLocalDLCImages() { // 4J-PB - Any local graphic files for the Minecraft Store? - unordered_map*pDLCInfoA=app.GetSonyDLCMap(); + std::unordered_map*pDLCInfoA=app.GetSonyDLCMap(); for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) { SONYDLC * pDLCInfo=(*it).second; @@ -394,7 +394,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); - wstring wWorldName = L"TestWorld"; + std::wstring wWorldName = L"TestWorld"; StorageManager.ResetSaveData(); StorageManager.SetSaveTitle(wWorldName.c_str()); diff --git a/Minecraft.Client/Platform/Orbis/Orbis_App.h b/Minecraft.Client/Platform/Orbis/Orbis_App.h index 6c0bac012..d7f395533 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_App.h +++ b/Minecraft.Client/Platform/Orbis/Orbis_App.h @@ -161,7 +161,7 @@ public: bool DLCAlreadyPurchased(char *pchTitle); char *GetSkuIDFromProductList(); void GetDLCSkuIDFromProductList(char *,char *); - unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } + std::unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } static void CommerceInitCallback(LPVOID lpParam,int err); static void CommerceGetCategoriesCallback(LPVOID lpParam,int err); static void CommerceGetProductListCallback(LPVOID lpParam,int err); @@ -210,7 +210,7 @@ private: // SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed; PRODUCTCODES ProductCodes; - unordered_map m_SONYDLCMap; + std::unordered_map m_SONYDLCMap; bool m_bVoiceChatAndUGCRestricted; diff --git a/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp b/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp index 9c8cf469c..e03585349 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp @@ -757,7 +757,7 @@ int StartMinecraftThreadProc( void* lpParameter ) AABB::UseDefaultThreadStorage(); Tesselator::CreateNewThreadStorage(1024*1024); RenderManager.InitialiseContext(); - Minecraft::start(wstring(),wstring()); + Minecraft::start(std::wstring(),std::wstring()); delete Tesselator::getInstance(); return 0; } @@ -1460,10 +1460,10 @@ int main(int argc, const char *argv[] ) } -vector vRichPresenceStrings; +std::vector vRichPresenceStrings; -// convert wstring to UTF-8 string -std::string wstring_to_utf8 (const std::wstring& str) +// convert std::wstring to UTF-8 string +std::string std::wstring_to_utf8 (const std::wstring& str) { std::wstring_convert> myconv; return myconv.to_bytes(str); @@ -1475,7 +1475,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) LPCWSTR wchString=app.GetString(iID); std::wstring srcString = wchString; - std::string dstString = wstring_to_utf8(srcString); + std::string dstString = std::wstring_to_utf8(srcString); int dst_len = dstString.size()+1; uint8_t *strUtf8=(uint8_t *)malloc(dst_len); @@ -1509,7 +1509,7 @@ void FreeRichPresenceStrings() #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/Orbis/Orbis_PlayerUID.cpp b/Minecraft.Client/Platform/Orbis/Orbis_PlayerUID.cpp index 79a0ce409..633c43187 100644 --- a/Minecraft.Client/Platform/Orbis/Orbis_PlayerUID.cpp +++ b/Minecraft.Client/Platform/Orbis/Orbis_PlayerUID.cpp @@ -41,7 +41,7 @@ PlayerUID::PlayerUID(SceUserServiceUserId userID, SceNpOnlineId& onlineID, bool setOnlineID(onlineID, bSignedInPSN); } -PlayerUID::PlayerUID(wstring fromString) +PlayerUID::PlayerUID(std::wstring fromString) { // create for the format P_5e7ff8372ea9_00000004_Mark_4J @@ -53,14 +53,14 @@ PlayerUID::PlayerUID(wstring fromString) // parse the mac address next for(int i=0;i<6;i++) { - wstring macDigit = fromString.substr(2+(i*2),2); + std::wstring macDigit = fromString.substr(2+(i*2),2); m_macAddress[i] = _fromHEXString(macDigit); } int userIdLen = 0; // parse the userID - wstring userIDDigits = L""; + std::wstring userIDDigits = L""; while(fromString.at(15 + userIdLen) != L'_') { @@ -71,7 +71,7 @@ PlayerUID::PlayerUID(wstring fromString) m_userID = _fromString(userIDDigits); // finally, the onlineID, if there is one - wstring onlineID = fromString.substr(15 + userIdLen + 1); + std::wstring onlineID = fromString.substr(15 + userIdLen + 1); if(onlineID.size() > 0) { wcstombs(m_onlineID, onlineID.c_str(), 16); diff --git a/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Profile.h index 888c38cc5..288c8cb9e 100644 --- a/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Profile.h @@ -78,7 +78,7 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); char* GetGamertag(int iPad); - wstring GetDisplayName(int iPad); + std::wstring GetDisplayName(int iPad); bool IsFullVersion(); void SetFullVersion(bool bFull); void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); diff --git a/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Storage.h index 3950bbad6..c827a8688 100644 --- a/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/PS3/4JLibs/inc/4J_Storage.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include #include #include diff --git a/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.cpp b/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.cpp index a00908f7d..1ea484de9 100644 --- a/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.cpp +++ b/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.cpp @@ -990,8 +990,8 @@ void PS3LeaderboardManager::initReadScoreStruct(ReadScore &out, SceNpScoreRankDa out.m_uid.setOnlineID( rankData.npId.handle, true ); out.m_rank = rankData.rank; - // Convert to wstring and copy name. - wstring wstrName = convStringToWstring( string(rankData.onlineName.data) ).c_str(); + // Convert to std::wstring and copy name. + std::wstring wstrName = convStringToWstring( string(rankData.onlineName.data) ).c_str(); //memcpy(&out.m_name, wstrName.c_str(), XUSER_NAME_SIZE); out.m_name=wstrName; } diff --git a/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.h b/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.h index 3b109ac95..61e98ecc7 100644 --- a/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.h +++ b/Minecraft.Client/Platform/PS3/Leaderboards/PS3LeaderboardManager.h @@ -5,7 +5,7 @@ #include "../Passphrase/ps3__np_conf.h" -using namespace std; + class PS3LeaderboardManager : public LeaderboardManager { @@ -43,7 +43,7 @@ private: bool getScoreByRange(); bool setScore(); - queue m_views; + std::queue m_views; CRITICAL_SECTION m_csViewsLock; diff --git a/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.cpp b/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.cpp index 5ca3129af..de803b0c8 100644 --- a/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.cpp +++ b/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.cpp @@ -592,7 +592,7 @@ bool SQRNetworkManager_PS3::FriendRoomManagerSearch2() if( m_searchResultCount ) { // If we have some results, then we also want to make sure that we don't have any duplicate rooms here if more than one friend is playing in the same room. - unordered_set uniqueRooms; + std::unordered_set uniqueRooms; for( unsigned int i = 0; i < m_searchResultCount; i++ ) { if(m_aSearchResultRoomFound[ i ]) diff --git a/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.h b/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.h index 0e17d249f..53edbe27d 100644 --- a/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.h +++ b/Minecraft.Client/Platform/PS3/Network/SQRNetworkManager_PS3.h @@ -205,7 +205,7 @@ private: unsigned int m_searchResultCount; // Rudp management and local players - unordered_map m_RudpCtxToPlayerMap; + std::unordered_map m_RudpCtxToPlayerMap; bool CreateRudpConnections(SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId peerMemberId, int playerMask, SceNpMatching2RoomMemberId playersPeerMemberId); SQRNetworkPlayer *GetPlayerFromRudpCtx(int rudpCtx); SQRNetworkPlayer *GetPlayerFromRoomMemberAndLocalIdx(int roomMember, int localIdx); diff --git a/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.cpp b/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.cpp index 27011ac06..93cc0d5b3 100644 --- a/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.cpp +++ b/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.cpp @@ -37,7 +37,7 @@ bool SonyVoiceChat::sm_bEnabled = true; uint8_t SonyVoiceChat::sm_micStatus = CELL_AVC2_MIC_STATUS_UNKNOWN; bool SonyVoiceChat::sm_bLoaded = false; bool SonyVoiceChat::sm_bUnloading = false; -unordered_map SonyVoiceChat::sm_bTalkingMap; +std::unordered_map SonyVoiceChat::sm_bTalkingMap; bool SonyVoiceChat::sm_bCanStart = false; bool SonyVoiceChat::sm_isChatRestricted = false; int SonyVoiceChat::sm_currentBitrate = 28000; diff --git a/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.h b/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.h index ae68b55d1..e07d109f1 100644 --- a/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.h +++ b/Minecraft.Client/Platform/PS3/Network/SonyVoiceChat.h @@ -117,7 +117,7 @@ private: static uint8_t sm_micStatus; static bool sm_bLoaded; static bool sm_bUnloading; - static unordered_map sm_bTalkingMap; + static std::unordered_map sm_bTalkingMap; static bool sm_bCanStart; // set to true on init, false on disconnect, used to see if we should start after a re-enable static bool sm_isChatRestricted; // true if the parental controls have been set on the main users account static int sm_currentBitrate; diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Stubs.cpp b/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Stubs.cpp index d72d3591a..4d543e156 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Stubs.cpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Stubs.cpp @@ -26,7 +26,7 @@ static char usrdirPathBDPatch[CELL_GAME_PATH_MAX]; //static char sc_loadPath[] = {"/app_home/"}; //static char sc_loadPath[CELL_GAME_PATH_MAX]; static int iFilesOpen=0; -vector vOpenFileHandles; +std::vector vOpenFileHandles; namespace boost { diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h b/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h index 92d288138..f63513122 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h +++ b/Minecraft.Client/Platform/PS3/PS3Extras/Ps3Types.h @@ -10,7 +10,7 @@ #include #include #include -#include "boost_1_53_0/boost/tr1/unordered_map.hpp" +#include "boost_1_53_0/boost/tr1/std::unordered_map.hpp" #include "boost_1_53_0/boost/tr1/unordered_set.hpp" #include "boost_1_53_0/boost/pool/pool_alloc.hpp" #include @@ -20,27 +20,27 @@ //#include "winerror.h" -using std::tr1::bad_weak_ptr; +using std::tr1::bad_std::; using std::tr1::const_pointer_cast; -using std::tr1::dynamic_pointer_cast; +using std::tr1::std::dynamic_pointer_cast; using std::tr1::enable_shared_from_this; using std::tr1::get_deleter; -using std::tr1::shared_ptr; +using std::tr1::std::shared_ptr; using std::tr1::static_pointer_cast; using std::tr1::swap; -using std::tr1::weak_ptr; -using std::tr1::unordered_map; +using std::tr1::std::; +using std::tr1::std::unordered_map; using std::tr1::unordered_set; using boost::hash; -// user the pool_allocator for all unordered_set and unordered_map instances +// user the pool_allocator for all unordered_set and std::unordered_map instances // template < class T, class H = hash, class P = std::equal_to, class A = boost::pool_allocator > // class unordered_set : public std::tr1::unordered_set // {}; // // template , class P = std::equal_to, class A = boost::pool_allocator > > -// class unordered_map : public std::tr1::unordered_map +// class std::unordered_map : public std::tr1::std::unordered_map // {}; @@ -50,7 +50,7 @@ using boost::hash; // {}; // // template , class P = std::equal_to, class A = C4JPoolAllocator > > -// class unordered_map : public std::tr1::unordered_map +// class std::unordered_map : public std::tr1::std::unordered_map // {}; @@ -62,7 +62,7 @@ using boost::hash; class Cnullptr{ public: template - operator shared_ptr() { return shared_ptr(); } + operator std::shared_ptr() { return std::shared_ptr(); } }; extern Cnullptr nullptr; diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/detail/intersegment_ptr.hpp b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/detail/intersegment_ptr.hpp index ca2ff4acf..ff50267e6 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/detail/intersegment_ptr.hpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/detail/intersegment_ptr.hpp @@ -886,7 +886,7 @@ boost::interprocess::intersegment_ptr const_pointer_cast(const boost::interpr //!Simulation of dynamic_cast between pointers. //!Never throws. template inline -boost::interprocess::intersegment_ptr dynamic_pointer_cast(const boost::interprocess::intersegment_ptr &r) +boost::interprocess::intersegment_ptr std::dynamic_pointer_cast(const boost::interprocess::intersegment_ptr &r) { return boost::interprocess::intersegment_ptr(r, boost::interprocess::ipcdetail::dynamic_cast_tag()); } //!Simulation of reinterpret_cast between pointers. diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/offset_ptr.hpp b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/offset_ptr.hpp index 752c43586..d2bec7179 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/offset_ptr.hpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/offset_ptr.hpp @@ -602,7 +602,7 @@ inline boost::interprocess::offset_ptr //!Simulation of dynamic_cast between pointers. Never throws. template inline boost::interprocess::offset_ptr - dynamic_pointer_cast(const boost::interprocess::offset_ptr & r) + std::dynamic_pointer_cast(const boost::interprocess::offset_ptr & r) { return boost::interprocess::offset_ptr (r, boost::interprocess::ipcdetail::dynamic_cast_tag()); diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/smart_ptr/intrusive_ptr.hpp b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/smart_ptr/intrusive_ptr.hpp index 897c5da4e..c366ef729 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/smart_ptr/intrusive_ptr.hpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/smart_ptr/intrusive_ptr.hpp @@ -262,7 +262,7 @@ inline boost::interprocess::intrusive_ptr const_pointer_cast /*Emulates dynamic cast operator. Does not throw*/ /* template -inline boost::interprocess::intrusive_ptr dynamic_pointer_cast +inline boost::interprocess::intrusive_ptr std::dynamic_pointer_cast (boost::interprocess::intrusive_ptr const & p) { return do_dynamic_cast(p.get()); } */ diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/smart_ptr/shared_ptr.hpp b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/smart_ptr/shared_ptr.hpp index 302eb149f..db4a78fec 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/smart_ptr/shared_ptr.hpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/interprocess/smart_ptr/shared_ptr.hpp @@ -341,7 +341,7 @@ shared_ptr const_pointer_cast(shared_ptr(r, ipcdetail::const_cast_tag()); } template inline -shared_ptr dynamic_pointer_cast(shared_ptr const & r) +shared_ptr std::dynamic_pointer_cast(shared_ptr const & r) { return shared_ptr(r, ipcdetail::dynamic_cast_tag()); } // to_raw_pointer() enables boost::mem_fn to recognize shared_ptr diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/pointer_cast.hpp b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/pointer_cast.hpp index 6e532ebdd..79ca37587 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/pointer_cast.hpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/pointer_cast.hpp @@ -19,9 +19,9 @@ inline T* static_pointer_cast(U *ptr) return static_cast(ptr); } -//dynamic_pointer_cast overload for raw pointers +//std::dynamic_pointer_cast overload for raw pointers template -inline T* dynamic_pointer_cast(U *ptr) +inline T* std::dynamic_pointer_cast(U *ptr) { return dynamic_cast(ptr); } diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/serialization/detail/shared_ptr_132.hpp b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/serialization/detail/shared_ptr_132.hpp index b5f2b2156..a5b70f0a6 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/serialization/detail/shared_ptr_132.hpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/serialization/detail/shared_ptr_132.hpp @@ -384,7 +384,7 @@ template shared_ptr< T > const_pointer_cast(shared_ptr cons return shared_ptr< T >(r, detail::const_cast_tag()); } -template shared_ptr< T > dynamic_pointer_cast(shared_ptr const & r) +template shared_ptr< T > std::dynamic_pointer_cast(shared_ptr const & r) { return shared_ptr< T >(r, detail::dynamic_cast_tag()); } diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/smart_ptr/intrusive_ptr.hpp b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/smart_ptr/intrusive_ptr.hpp index b6f5bcd53..83a3221d6 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/smart_ptr/intrusive_ptr.hpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/smart_ptr/intrusive_ptr.hpp @@ -270,7 +270,7 @@ template intrusive_ptr const_pointer_cast(intrusive_ptr return const_cast(p.get()); } -template intrusive_ptr dynamic_pointer_cast(intrusive_ptr const & p) +template intrusive_ptr std::dynamic_pointer_cast(intrusive_ptr const & p) { return dynamic_cast(p.get()); } diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/smart_ptr/shared_ptr.hpp b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/smart_ptr/shared_ptr.hpp index 2f0ce7bcd..45e0c8597 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/smart_ptr/shared_ptr.hpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/smart_ptr/shared_ptr.hpp @@ -805,7 +805,7 @@ template shared_ptr const_pointer_cast( shared_ptr const return shared_ptr( r, p ); } -template shared_ptr dynamic_pointer_cast( shared_ptr const & r ) BOOST_NOEXCEPT +template shared_ptr std::dynamic_pointer_cast( shared_ptr const & r ) BOOST_NOEXCEPT { //(void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); // // MGH - TODO - FIX - removed this check, as it was breaking the PS3 compile, and I've no idea why :-s diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/tr1/memory.hpp b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/tr1/memory.hpp index 169087746..3ec021348 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/tr1/memory.hpp +++ b/Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/tr1/memory.hpp @@ -26,7 +26,7 @@ template class shared_ptr; template void swap(weak_ptr & a, weak_ptr & b) BOOST_NOEXCEPT; template void swap(shared_ptr & a, shared_ptr & b) BOOST_NOEXCEPT; template shared_ptr static_pointer_cast(shared_ptr const & r) BOOST_NOEXCEPT; -template shared_ptr dynamic_pointer_cast(shared_ptr const & r) BOOST_NOEXCEPT; +template shared_ptr std::dynamic_pointer_cast(shared_ptr const & r) BOOST_NOEXCEPT; template shared_ptr const_pointer_cast(shared_ptr const & r) BOOST_NOEXCEPT; template D * get_deleter(shared_ptr const & p) BOOST_NOEXCEPT; template class enable_shared_from_this; @@ -46,7 +46,7 @@ namespace std{ namespace tr1{ using ::boost::swap; #endif using ::boost::static_pointer_cast; - using ::boost::dynamic_pointer_cast; + using ::boost::std::dynamic_pointer_cast; using ::boost::const_pointer_cast; using ::boost::get_deleter; using ::boost::weak_ptr; diff --git a/Minecraft.Client/Platform/PS3/PS3_App.cpp b/Minecraft.Client/Platform/PS3/PS3_App.cpp index 575336597..80e64602b 100644 --- a/Minecraft.Client/Platform/PS3/PS3_App.cpp +++ b/Minecraft.Client/Platform/PS3/PS3_App.cpp @@ -105,7 +105,7 @@ bool CConsoleMinecraftApp::IsAmericanSKU() SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle) { - wstring wstrTemp=convStringToWstring(pchTitle); + std::wstring wstrTemp=convStringToWstring(pchTitle); SONYDLC *pTemp=m_SONYDLCMap.at(wstrTemp); return pTemp; @@ -174,7 +174,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() // push this into a vector - wstring wstrTemp=convStringToWstring(chDLCTitle); + std::wstring wstrTemp=convStringToWstring(chDLCTitle); m_SONYDLCMap[wstrTemp]=pDLCInfo; } CloseHandle(file); @@ -466,7 +466,7 @@ void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) } -LoadSaveDataThreadParam* LoadSaveFromDisk(const wstring& pathName) +LoadSaveDataThreadParam* LoadSaveFromDisk(const std::wstring& pathName) { File saveFile(pathName); __int64 fileSize = saveFile.length(); @@ -501,7 +501,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame - app.ClearTerrainFeaturePosition(); wstring wWorldName = L"TestWorld"; + app.ClearTerrainFeaturePosition(); std::wstring wWorldName = L"TestWorld"; StorageManager.ResetSaveData(); StorageManager.SetSaveTitle(wWorldName.c_str()); @@ -519,7 +519,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; #ifdef SAVE_GAME_TO_LOAD - param->saveData = LoadSaveFromDisk(wstring(SAVE_GAME_TO_LOAD)); + param->saveData = LoadSaveFromDisk(std::wstring(SAVE_GAME_TO_LOAD)); #else param->saveData = NULL; #endif diff --git a/Minecraft.Client/Platform/PS3/PS3_App.h b/Minecraft.Client/Platform/PS3/PS3_App.h index bfd699700..aba7bbaf4 100644 --- a/Minecraft.Client/Platform/PS3/PS3_App.h +++ b/Minecraft.Client/Platform/PS3/PS3_App.h @@ -202,7 +202,7 @@ private: // SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed; PRODUCTCODES ProductCodes; - unordered_map m_SONYDLCMap; + std::unordered_map m_SONYDLCMap; bool m_bVoiceChatAndUGCRestricted; diff --git a/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp b/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp index 956c038e9..95482c7a4 100644 --- a/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp +++ b/Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp @@ -951,7 +951,7 @@ int main() // 4J-PB - TRC that we need to be able to see the BD in a different titled save from the digital game if(StorageManager.GetBootTypeDisc()) { - wstring wsTemp = app.GetString(IDS_GAMENAME); + std::wstring wsTemp = app.GetString(IDS_GAMENAME); WCHAR wchTemp[64]; wsTemp.append(L" ("); mbstowcs(wchTemp,app.GetDiscProductCode(),64); @@ -991,7 +991,7 @@ int main() delete [] baSaveImage.data; } - wstring wsName=L"Graphics\\SaveChest.png"; + std::wstring wsName=L"Graphics\\SaveChest.png"; byteArray baSaveLoadIcon = app.getArchiveFile(wsName); if(baSaveLoadIcon.data!=NULL) { @@ -1362,7 +1362,7 @@ int main() ShutdownManager::MainThreadHandleShutdown(); } -vector vRichPresenceStrings; +std::vector vRichPresenceStrings; uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); @@ -1388,7 +1388,7 @@ void FreeRichPresenceStrings() #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/PS3/PS3_PlayerUID.cpp b/Minecraft.Client/Platform/PS3/PS3_PlayerUID.cpp index ed5790c56..8a2d75961 100644 --- a/Minecraft.Client/Platform/PS3/PS3_PlayerUID.cpp +++ b/Minecraft.Client/Platform/PS3/PS3_PlayerUID.cpp @@ -30,7 +30,7 @@ PlayerUID::PlayerUID(CellSysutilUserId userID, SceNpOnlineId& onlineID, bool bSi setOnlineID(onlineID, bSignedInPSN); } -PlayerUID::PlayerUID(wstring fromString) +PlayerUID::PlayerUID(std::wstring fromString) { // create for the format P_5e7ff8372ea9_00000004_Mark_4J @@ -42,16 +42,16 @@ PlayerUID::PlayerUID(wstring fromString) // parse the mac address next for(int i=0;i<6;i++) { - wstring macDigit = fromString.substr(2+(i*2),2); + std::wstring macDigit = fromString.substr(2+(i*2),2); m_macAddress[i] = _fromHEXString(macDigit); } // parse the userID - wstring userIDDigits = fromString.substr(15,8); + std::wstring userIDDigits = fromString.substr(15,8); m_userID = _fromString(userIDDigits); // finally, the onlineID, if there is one - wstring onlineID = fromString.substr(24); + std::wstring onlineID = fromString.substr(24); if(onlineID.size() > 0) { wcstombs(m_onlineID, onlineID.c_str(), 16); diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp index c1000a9b8..739cc5f61 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp @@ -647,7 +647,7 @@ void ChunkRebuildData::tesselateAllTiles(TileRenderer_SPU* pTileRenderer) { // if (m_currentLayer == 0 && m_tileData.isEntityTile[tileId]) // { -// shared_ptr et = region->getTileEntity(x, y, z); +// std::shared_ptr et = region->getTileEntity(x, y, z); // if (TileEntityRenderDispatcher::instance->hasRenderer(et)) // { // renderableTileEntities.push_back(et); diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/HugeMushroomTile_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/HugeMushroomTile_SPU.h index 89aad1aa5..5ad1027cd 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/HugeMushroomTile_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/HugeMushroomTile_SPU.h @@ -4,8 +4,8 @@ class HugeMushroomTile_SPU : public Tile_SPU { public: -// static const wstring TEXTURE_STEM; -// static const wstring TEXTURE_INSIDE; +// static const std::wstring TEXTURE_STEM; +// static const std::wstring TEXTURE_INSIDE; private: static const int HUGE_MUSHROOM_TEXTURE_COUNT = 2; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h index f4ba6ccfa..b40a2b50b 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h @@ -49,7 +49,7 @@ public: return getV0() + (diff * ((float) offset / 16)); //SharedConstants::WORLD_RESOLUTION)); } -// virtual wstring getName() const = 0; +// virtual std::wstring getName() const = 0; // virtual int getSourceWidth() const = 0; // virtual int getSourceHeight() const = 0; }; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp index 673732652..be7c1d3c1 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeafTile_SPU.cpp @@ -8,7 +8,7 @@ // IDS_TILE_LEAVES_BIRCH, // }; // -// const wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle"}, {L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque"},}; +// const std::wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle"}, {L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque"},}; // from TransparentTile, since we're no longer inheriting diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h index 06dda5bbb..53c9f3ec8 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LeverTile_SPU.h @@ -8,5 +8,5 @@ public: virtual bool blocksLight() { return false; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } virtual int getRenderShape() { return Tile_SPU::SHAPE_LEVER; } -// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param +// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param }; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp index 41a6b0764..19d27230e 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp @@ -7,10 +7,10 @@ #include "../Common/spu_assert.h" #endif -// const wstring LiquidTile::TEXTURE_LAVA_STILL = L"lava"; -// const wstring LiquidTile::TEXTURE_WATER_STILL = L"water"; -// const wstring LiquidTile::TEXTURE_WATER_FLOW = L"water_flow"; -// const wstring LiquidTile::TEXTURE_LAVA_FLOW = L"lava_flow"; +// const std::wstring LiquidTile::TEXTURE_LAVA_STILL = L"lava"; +// const std::wstring LiquidTile::TEXTURE_WATER_STILL = L"water"; +// const std::wstring LiquidTile::TEXTURE_WATER_FLOW = L"water_flow"; +// const std::wstring LiquidTile::TEXTURE_LAVA_FLOW = L"lava_flow"; #define MATH_PI (3.141592654f) diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h index e8411c885..a8c6851c2 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h @@ -12,7 +12,7 @@ public: virtual int getRenderShape() { return SHAPE_PISTON_BASE; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } - // virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + // virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param // virtual void updateDefaultShape(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h index d5460492e..3323cfd00 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h @@ -9,5 +9,5 @@ public: virtual Icon_SPU *getTexture(int face, int data) { return NULL; } virtual int getRenderShape() { return SHAPE_PISTON_EXTENSION; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } -// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param +// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp index cf849e993..98f356ef4 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TallGrass_SPU.cpp @@ -11,7 +11,7 @@ const int TallGrass_SPU::DEAD_SHRUB = 0; const int TallGrass_SPU::TALL_GRASS = 1; const int TallGrass_SPU::FERN = 2; -// const wstring TallGrass::TEXTURE_NAMES[] = {L"deadbush", L"tallgrass", L"fern"}; +// const std::wstring TallGrass::TEXTURE_NAMES[] = {L"deadbush", L"tallgrass", L"fern"}; Icon_SPU *TallGrass_SPU::getTexture(int face, int data) diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TheEndPortal_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TheEndPortal_SPU.h index f6e3b3e76..b8bed9a88 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TheEndPortal_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TheEndPortal_SPU.h @@ -6,7 +6,7 @@ class TheEndPortal_SPU : public EntityTile_SPU public: TheEndPortal_SPU(int id) : EntityTile_SPU(id) {} -// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param +// virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, std::shared_ptr forceEntity = std::shared_ptr()); // 4J added forceData, forceEntity param virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face) { if (face != 0) return false; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp index 77886f911..eb768ac4c 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp @@ -288,7 +288,7 @@ Icon_SPU *Tile_SPU::getTexture(int face) // return id; // } // -// float Tile_SPU::getDestroyProgress(shared_ptr player) +// float Tile_SPU::getDestroyProgress(std::shared_ptr player) // { // if (destroySpeed < 0) return 0; // if (!player->canDestroy(this)) return 1 / destroySpeed / 100.0f; @@ -310,11 +310,11 @@ Icon_SPU *Tile_SPU::getTexture(int face) // int type = getResource(data, level->random, playerBonusLevel); // if (type <= 0) continue; // -// popResource(level, x, y, z, shared_ptr( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data) ) ) ); +// popResource(level, x, y, z, std::shared_ptr( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data) ) ) ); // } // } // -// void Tile_SPU::popResource(Level *level, int x, int y, int z, shared_ptr itemInstance) +// void Tile_SPU::popResource(Level *level, int x, int y, int z, std::shared_ptr itemInstance) // { // if( level->isClientSide ) return; // @@ -322,7 +322,7 @@ Icon_SPU *Tile_SPU::getTexture(int face) // double xo = level->random->nextFloat() * s + (1 - s) * 0.5; // double yo = level->random->nextFloat() * s + (1 - s) * 0.5; // double zo = level->random->nextFloat() * s + (1 - s) * 0.5; -// shared_ptr item = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) ); +// std::shared_ptr item = std::shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) ); // item->throwTime = 10; // level->addEntity(item); // } @@ -336,7 +336,7 @@ Icon_SPU *Tile_SPU::getTexture(int face) // { // int newCount = ExperienceOrb::getExperienceValue(amount); // amount -= newCount; -// level->addEntity(shared_ptr( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount))); +// level->addEntity(std::shared_ptr( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount))); // } // } // } @@ -346,7 +346,7 @@ Icon_SPU *Tile_SPU::getTexture(int face) // return 0; // } // -// float Tile_SPU::getExplosionResistance(shared_ptr source) +// float Tile_SPU::getExplosionResistance(std::shared_ptr source) // { // return explosionResistance / 5.0f; // } @@ -437,17 +437,17 @@ int Tile_SPU::getRenderLayer() // return false; // } // -// bool Tile_SPU::TestUse(Level *level, int x, int y, int z, shared_ptr player) +// bool Tile_SPU::TestUse(Level *level, int x, int y, int z, std::shared_ptr player) // { // return false; // } // -// bool Tile_SPU::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +// bool Tile_SPU::use(Level *level, int x, int y, int z, std::shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param // { // return false; // } // -// void Tile_SPU::stepOn(Level *level, int x, int y, int z, shared_ptr entity) +// void Tile_SPU::stepOn(Level *level, int x, int y, int z, std::shared_ptr entity) // { // } // @@ -459,11 +459,11 @@ int Tile_SPU::getRenderLayer() // { // } // -// void Tile_SPU::attack(Level *level, int x, int y, int z, shared_ptr player) +// void Tile_SPU::attack(Level *level, int x, int y, int z, std::shared_ptr player) // { // } // -// void Tile_SPU::handleEntityInside(Level *level, int x, int y, int z, shared_ptr e, Vec3 *current) +// void Tile_SPU::handleEntityInside(Level *level, int x, int y, int z, std::shared_ptr e, Vec3 *current) // { // } // @@ -498,7 +498,7 @@ int Tile_SPU::getColor(ChunkRebuildData *level, int x, int y, int z) // return false; // } // -// void Tile_SPU::entityInside(Level *level, int x, int y, int z, shared_ptr entity) +// void Tile_SPU::entityInside(Level *level, int x, int y, int z, std::shared_ptr entity) // { // } // @@ -511,7 +511,7 @@ void Tile_SPU::updateDefaultShape() { } // -// void Tile_SPU::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) +// void Tile_SPU::playerDestroy(Level *level, std::shared_ptr player, int x, int y, int z, int data) // { // // 4J Stu - Special case - only record a crop destroy if is fully grown // if(id==Tile_SPU::crops_Id) @@ -532,7 +532,7 @@ void Tile_SPU::updateDefaultShape() // // if (isCubeShaped() && !isEntityTile[id] && EnchantmentHelper::hasSilkTouch(player->inventory)) // { -// shared_ptr item = getSilkTouchItemInstance(data); +// std::shared_ptr item = getSilkTouchItemInstance(data); // if (item != NULL) // { // popResource(level, x, y, z, item); @@ -545,14 +545,14 @@ void Tile_SPU::updateDefaultShape() // } // } // -// shared_ptr Tile_SPU::getSilkTouchItemInstance(int data) +// std::shared_ptr Tile_SPU::getSilkTouchItemInstance(int data) // { // int popData = 0; // if (id >= 0 && id < Item::items.length && Item::items[id]->isStackedByData()) // { // popData = data; // } -// return shared_ptr(new ItemInstance(id, 1, popData)); +// return std::shared_ptr(new ItemInstance(id, 1, popData)); // } // // int Tile_SPU::getResourceCountForLootBonus(int bonusLevel, Random *random) @@ -565,7 +565,7 @@ void Tile_SPU::updateDefaultShape() // return true; // } // -// void Tile_SPU::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by) +// void Tile_SPU::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr by) // { // } // @@ -575,7 +575,7 @@ void Tile_SPU::updateDefaultShape() // return this; // } // -// wstring Tile_SPU::getName() +// std::wstring Tile_SPU::getName() // { // return I18n::get(getDescriptionId() + L".name"); // } @@ -646,7 +646,7 @@ Material_SPU* Tile_SPU::getMaterial() } // -// void Tile_SPU::fallOn(Level *level, int x, int y, int z, shared_ptr entity, float fallDistance) +// void Tile_SPU::fallOn(Level *level, int x, int y, int z, std::shared_ptr entity, float fallDistance) // { // } // @@ -655,12 +655,12 @@ Material_SPU* Tile_SPU::getMaterial() // icon = iconRegister->registerIcon(m_textureName); // } // -// wstring Tile_SPU::getTileItemIconName() +// std::wstring Tile_SPU::getTileItemIconName() // { // return L""; // } // -// Tile *Tile_SPU::setTextureName(const wstring &name) +// Tile *Tile_SPU::setTextureName(const std::wstring &name) // { // m_textureName = name; // return this; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h index f5c9793ea..938ebb07f 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h @@ -3,7 +3,7 @@ // #include "../../../../../Minecraft.World/Util/Vec3.h" // #include "../../../../../Minecraft.World/Util/Definitions.h" // #include "../../../../../Minecraft.World/Util/SoundTypes.h" -// using namespace std; +// #include "Icon_SPU.h" #include "Material_SPU.h" #include @@ -223,7 +223,7 @@ private: // unsigned int descriptionId; // unsigned int useDescriptionId; // 4J Added // -// wstring m_textureName; +// std::wstring m_textureName; protected: // Icon *icon; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h index e298ae2dc..e24f293dc 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h @@ -173,7 +173,7 @@ public: // public: // ZipFile(File *file) {} // InputStream *getInputStream(ZipEntry *entry) { return NULL; } -// ZipEntry *getEntry(const wstring& name) {return NULL;} +// ZipEntry *getEntry(const std::wstring& name) {return NULL;} // void close() {} // }; // @@ -189,7 +189,7 @@ public: // static void create() {} // static void destroy() {} // static bool isKeyDown(int) {return false;} -// static wstring getKeyName(int) { return L"KEYNAME"; } +// static std::wstring getKeyName(int) { return L"KEYNAME"; } // static void enableRepeatEvents(bool) {} // static const int KEY_A = 0; // static const int KEY_B = 1; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.cpp b/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.cpp index 093b1a0d6..17e5cfdd2 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.cpp +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.cpp @@ -172,7 +172,7 @@ void LevelRenderer_FindNearestChunk_DataIn::findNearestChunk() for( int p = 0; p < 4; p++ ) { // It's possible that the localplayers member can be set to NULL on the main thread when a player chooses to exit the game - // So take a reference to the player object now. As it is a shared_ptr it should live as long as we need it + // So take a reference to the player object now. As it is a std::shared_ptr it should live as long as we need it PlayerData* player = &playerData[p]; if( player->bValid == NULL ) continue; if( chunks[p] == NULL ) continue; diff --git a/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h b/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h index 55ffcabd3..a47788d33 100644 --- a/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h +++ b/Minecraft.Client/Platform/PS3/SPU_Tasks/LevelRenderer_FindNearestChunk/LevelRenderer_FindNearestChunk.h @@ -64,7 +64,7 @@ public: int id; int padding[1]; //public: - // vector > renderableTileEntities; // 4J - removed + // std::vector > renderableTileEntities; // 4J - removed private: void *globalRenderableTileEntities; diff --git a/Minecraft.Client/Platform/PS3/Xbox_Minecraft.cpp b/Minecraft.Client/Platform/PS3/Xbox_Minecraft.cpp index 2771976ad..f891676d8 100644 --- a/Minecraft.Client/Platform/PS3/Xbox_Minecraft.cpp +++ b/Minecraft.Client/Platform/PS3/Xbox_Minecraft.cpp @@ -1002,7 +1002,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Profile.h index 2fc9385a1..244783786 100644 --- a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Profile.h @@ -101,7 +101,7 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); char* GetGamertag(int iPad); - wstring GetDisplayName(int iPad); + std::wstring GetDisplayName(int iPad); bool IsFullVersion(); void SetFullVersion(bool bFull); diff --git a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h index ecd4dbc3b..3a1e7a029 100644 --- a/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include @@ -381,7 +381,7 @@ public: void SetDLCProductCode(const char* szProductCode); void SetProductUpgradeKey(const char* szKey); bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam); - void SetDLCInfoMap(unordered_map* pSONYDLCMap); + void SetDLCInfoMap(std::unordered_map* pSONYDLCMap); void EntitlementsCallback(bool bFoundEntitlements); }; diff --git a/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp b/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp index e4db28b58..7e3ddf9a7 100644 --- a/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp +++ b/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp @@ -1012,8 +1012,8 @@ void PSVitaLeaderboardManager::initReadScoreStruct(ReadScore &out, SceNpScoreRan out.m_uid.setOnlineID( rankData.npId.handle, true ); out.m_rank = rankData.rank; - // Convert to wstring and copy name. - wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str(); + // Convert to std::wstring and copy name. + std::wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str(); //memcpy(&out.m_name, wstrName.c_str(), XUSER_NAME_SIZE); out.m_name=wstrName; } diff --git a/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.h b/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.h index 34029b0ec..a5f011027 100644 --- a/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.h +++ b/Minecraft.Client/Platform/PSVita/Leaderboards/PSVitaLeaderboardManager.h @@ -39,7 +39,7 @@ private: bool getScoreByRange(); bool setScore(); - queue m_views; + std::queue m_views; CRITICAL_SECTION m_csViewsLock; diff --git a/Minecraft.Client/Platform/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp b/Minecraft.Client/Platform/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp index 1cc1b63d1..8f11ec8e3 100644 --- a/Minecraft.Client/Platform/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp +++ b/Minecraft.Client/Platform/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp @@ -723,7 +723,7 @@ bool SQRNetworkManager_AdHoc_Vita::FriendRoomManagerSearch2() // if( m_aFriendSearchResults.size() > 0 ) // { // // If we have some results, then we also want to make sure that we don't have any duplicate rooms here if more than one friend is playing in the same room. -// unordered_set uniqueRooms; +// std::unordered_set uniqueRooms; // for( unsigned int i = 0; i < m_aFriendSearchResults.size(); i++ ) // { // if(m_aFriendSearchResults[i].m_RoomFound) diff --git a/Minecraft.Client/Platform/PSVita/Network/SQRNetworkManager_Vita.cpp b/Minecraft.Client/Platform/PSVita/Network/SQRNetworkManager_Vita.cpp index 3cb16bfd8..794d57b09 100644 --- a/Minecraft.Client/Platform/PSVita/Network/SQRNetworkManager_Vita.cpp +++ b/Minecraft.Client/Platform/PSVita/Network/SQRNetworkManager_Vita.cpp @@ -631,7 +631,7 @@ bool SQRNetworkManager_Vita::FriendRoomManagerSearch2() if( m_aFriendSearchResults.size() > 0 ) { // If we have some results, then we also want to make sure that we don't have any duplicate rooms here if more than one friend is playing in the same room. - unordered_set uniqueRooms; + std::unordered_set uniqueRooms; for( unsigned int i = 0; i < m_aFriendSearchResults.size(); i++ ) { if(m_aFriendSearchResults[i].m_RoomFound) diff --git a/Minecraft.Client/Platform/PSVita/PSVita_App.cpp b/Minecraft.Client/Platform/PSVita/PSVita_App.cpp index 3696778f3..8d2fecb37 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_App.cpp +++ b/Minecraft.Client/Platform/PSVita/PSVita_App.cpp @@ -94,7 +94,7 @@ bool CConsoleMinecraftApp::IsAmericanSKU() SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle) { - wstring wstrTemp=convStringToWstring(pchTitle); + std::wstring wstrTemp=convStringToWstring(pchTitle); AUTO_VAR(it, m_SONYDLCMap.find(wstrTemp)); if(it == m_SONYDLCMap.end()) @@ -105,7 +105,7 @@ SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle) } return it->second; - /*wstring wstrTemp=convStringToWstring(pchTitle); + /*std::wstring wstrTemp=convStringToWstring(pchTitle); SONYDLC *pTemp=m_SONYDLCMap.at(wstrTemp); return pTemp;*/ @@ -172,7 +172,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() // push this into a vector - wstring wstrTemp=convStringToWstring(chDLCTitle); + std::wstring wstrTemp=convStringToWstring(chDLCTitle); m_SONYDLCMap[wstrTemp]=pDLCInfo; } CloseHandle(file); @@ -304,7 +304,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); - wstring wWorldName = L"TestWorld"; + std::wstring wWorldName = L"TestWorld"; bool isFlat = false; __int64 seedValue = 0;//BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements @@ -1566,7 +1566,7 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * ZeroMemory(&listParam, sizeof(SceSaveDataDialogListParam)); { - vector slots; + std::vector slots; for (unsigned int i = 2; i < SCE_APPUTIL_SAVEDATA_SLOT_MAX; i++) { SceAppUtilSaveDataSlotParam slotParam; @@ -1589,7 +1589,7 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * int slotIndex = 0; - vector::iterator itr; + std::vector::iterator itr; for (itr = slots.begin(); itr != slots.end(); itr++) { pSavesList[slotIndex] = *itr; diff --git a/Minecraft.Client/Platform/PSVita/PSVita_App.h b/Minecraft.Client/Platform/PSVita/PSVita_App.h index 29612614b..ce204842c 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_App.h +++ b/Minecraft.Client/Platform/PSVita/PSVita_App.h @@ -159,7 +159,7 @@ public: bool DLCAlreadyPurchased(char *pchTitle); char *GetSkuIDFromProductList(); void GetDLCSkuIDFromProductList(char *,char *); - unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } + std::unordered_map* GetSonyDLCMap() { return &m_SONYDLCMap; } static void CommerceInitCallback(LPVOID lpParam,int err); static void CommerceGetCategoriesCallback(LPVOID lpParam,int err); static void CommerceGetProductListCallback(LPVOID lpParam,int err); @@ -230,7 +230,7 @@ private: // SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed; PRODUCTCODES ProductCodes; - unordered_map m_SONYDLCMap; + std::unordered_map m_SONYDLCMap; bool m_bVoiceChatAndUGCRestricted; diff --git a/Minecraft.Client/Platform/PSVita/PSVita_Minecraft.cpp b/Minecraft.Client/Platform/PSVita/PSVita_Minecraft.cpp index 4d25c6aa7..7939d875f 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_Minecraft.cpp +++ b/Minecraft.Client/Platform/PSVita/PSVita_Minecraft.cpp @@ -1061,7 +1061,7 @@ int main() ShutdownManager::MainThreadHandleShutdown(); } -vector vRichPresenceStrings; +std::vector vRichPresenceStrings; uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); diff --git a/Minecraft.Client/Platform/PSVita/PSVita_PlayerUID.cpp b/Minecraft.Client/Platform/PSVita/PSVita_PlayerUID.cpp index db7f8ebfe..5ab8cfa04 100644 --- a/Minecraft.Client/Platform/PSVita/PSVita_PlayerUID.cpp +++ b/Minecraft.Client/Platform/PSVita/PSVita_PlayerUID.cpp @@ -35,7 +35,7 @@ PlayerUID::PlayerUID(int userID, SceNpOnlineId& onlineID, bool bSignedInPSN, int setOnlineID(onlineID, bSignedInPSN); } -PlayerUID::PlayerUID(wstring fromString) +PlayerUID::PlayerUID(std::wstring fromString) { // create for the format P_5e7ff8372ea9_00000004_Mark_4J @@ -47,16 +47,16 @@ PlayerUID::PlayerUID(wstring fromString) // parse the mac address next for(int i=0;i<6;i++) { - wstring macDigit = fromString.substr(2+(i*2),2); + std::wstring macDigit = fromString.substr(2+(i*2),2); m_macAddress[i] = _fromHEXString(macDigit); } // parse the userID - wstring userIDDigits = fromString.substr(15,8); + std::wstring userIDDigits = fromString.substr(15,8); m_userID = _fromString(userIDDigits); // finally, the onlineID, if there is one - wstring onlineID = fromString.substr(24); + std::wstring onlineID = fromString.substr(24); if(onlineID.size() > 0) { wcstombs(m_onlineID, onlineID.c_str(), 16); diff --git a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h index f1bd85bbe..4e6fc606c 100644 --- a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h @@ -76,7 +76,7 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); char* GetGamertag(int iPad); - wstring GetDisplayName(int iPad); + std::wstring GetDisplayName(int iPad); bool IsFullVersion(); void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); void SetNotificationsCallback(void ( *Func)(LPVOID, DWORD, unsigned int),LPVOID lpParam); diff --git a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h index 896f730a7..2b8df12de 100644 --- a/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h @@ -319,7 +319,7 @@ public: C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,LPVOID lpParam=NULL, int iUserData=0); // C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0); // C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0); - // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); + // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::wstring &Filename); // unsigned int CRC(unsigned char *buf, int len); // enum eXBLWS diff --git a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp index 9ce653fb9..2b10b4ac0 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp @@ -71,7 +71,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); - wstring wWorldName = L"TestWorld"; + std::wstring wWorldName = L"TestWorld"; StorageManager.ResetSaveData(); StorageManager.SetSaveTitle(wWorldName.c_str()); diff --git a/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp index 75c36cbce..f50047929 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp @@ -1168,7 +1168,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Storage.h index 2988dc2c1..284d093c2 100644 --- a/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Platform/Xbox/4JLibs/inc/4J_Storage.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include @@ -287,7 +287,7 @@ public: C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,LPVOID lpParam=NULL, int iUserData=0); C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0); C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0); - bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); + bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::wstring &Filename); unsigned int CRC(unsigned char *buf, int len); C4JStorage::ETMSStatus TMSPP_WriteFileWithProgress(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0, diff --git a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp index 38f84e5d9..cbb527ceb 100644 --- a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.cpp @@ -25,7 +25,7 @@ IXACT3SoundBank *SoundEngine::m_pSoundBank2 = NULL; CRITICAL_SECTION SoundEngine::m_CS; X3DAUDIO_HANDLE SoundEngine::m_xact3dInstance; -vector SoundEngine::currentSounds; +std::vector SoundEngine::currentSounds; X3DAUDIO_DSP_SETTINGS SoundEngine::m_DSPSettings; X3DAUDIO_EMITTER SoundEngine::m_emitter; X3DAUDIO_LISTENER SoundEngine::m_listeners[4]; @@ -438,7 +438,7 @@ void SoundEngine::XACTNotificationCallback( const XACT_NOTIFICATION* pNotificati } } -char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) +char *SoundEngine::ConvertSoundPathToName(const std::wstring& name, bool bConvertSpaces) { static char buf[256]; assert(name.length()<256); @@ -468,7 +468,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa { return; } - wstring name = wchSoundNames[iSound]; + std::wstring name = wchSoundNames[iSound]; //const unsigned char *name=ucSoundNames[iSound]; char *xboxName = ConvertSoundPathToName(name); @@ -576,7 +576,7 @@ void SoundEngine::playUI(int iSound, float, float) { return; } - wstring name = wchSoundNames[iSound]; + std::wstring name = wchSoundNames[iSound]; char *xboxName = (char *)ConvertSoundPathToName(name); @@ -635,7 +635,7 @@ void SoundEngine::playUI(int iSound, float, float) cueInstance->Play(); } -void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, float vol, float pitch, bool bMusicDelay) +void SoundEngine::playStreaming(const std::wstring& name, float x, float y, float z, float vol, float pitch, bool bMusicDelay) { IXACT3SoundBank *pSoundBank=NULL; @@ -984,7 +984,7 @@ void SoundEngine::update3DPosition(SoundEngine::soundInfo *pInfo, bool bPlaceEmi XACT3DApply( &m_DSPSettings, pInfo->pCue); } -void SoundEngine::tick(shared_ptr *players, float a) +void SoundEngine::tick(std::shared_ptr *players, float a) { if( m_pXACT3Engine == NULL ) return; @@ -1065,14 +1065,14 @@ void SoundEngine::tick(shared_ptr *players, float a) m_pXACT3Engine->DoWork(); } -void SoundEngine::add(const wstring& name, File *file) +void SoundEngine::add(const std::wstring& name, File *file) { } -void SoundEngine::addMusic(const wstring& name, File *file) +void SoundEngine::addMusic(const std::wstring& name, File *file) { } -void SoundEngine::addStreaming(const wstring& name, File *file) +void SoundEngine::addStreaming(const std::wstring& name, File *file) { } diff --git a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h index c698b17e6..06cc8119d 100644 --- a/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h +++ b/Minecraft.Client/Platform/Xbox/Audio/SoundEngine.h @@ -1,7 +1,7 @@ #pragma once class Mob; class Options; -using namespace std; + #include "../../../../Minecraft.World/Util/SoundTypes.h" #ifdef _XBOX @@ -54,7 +54,7 @@ class SoundEngine : public ConsoleSoundEngine }; void update3DPosition( soundInfo *pInfo, bool bPlaceEmitterAtListener = false, bool bIsCDMusic = false); - static vectorcurrentSounds; + static std::vectorcurrentSounds; int noMusicDelay; Random *random; @@ -79,24 +79,24 @@ public: SoundEngine(); virtual void destroy(); virtual void play(int iSound, float x, float y, float z, float volume, float pitch); - virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true); + virtual void playStreaming(const std::wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true); virtual void playUI(int iSound, float volume, float pitch); virtual void playMusicTick(); virtual void updateMusicVolume(float fVal); virtual void updateSystemMusicPlaying(bool isPlaying); virtual void updateSoundEffectVolume(float fVal); virtual void init(Options *); - virtual void tick(shared_ptr *players, float a); // 4J - updated to take array of local players rather than single one - virtual void add(const wstring& name, File *file); - virtual void addMusic(const wstring& name, File *file); - virtual void addStreaming(const wstring& name, File *file); + virtual void tick(std::shared_ptr *players, float a); // 4J - updated to take array of local players rather than single one + virtual void add(const std::wstring& name, File *file); + virtual void addMusic(const std::wstring& name, File *file); + virtual void addStreaming(const std::wstring& name, File *file); #ifndef __PS3__ static void setXACTEngine( IXACT3Engine *pXACT3Engine); void CreateStreamingWavebank(const char *pchName, IXACT3WaveBank **ppStreamedWaveBank); void CreateSoundbank(const char *pchName, IXACT3SoundBank **ppSoundBank); #endif // __PS3__ - virtual char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false); + virtual char *ConvertSoundPathToName(const std::wstring& name, bool bConvertSpaces=false); bool isStreamingWavebankReady(); // 4J Added #ifdef _XBOX bool isStreamingWavebankReady(IXACT3WaveBank *pWaveBank); diff --git a/Minecraft.Client/Platform/Xbox/Font/XUI_Font.h b/Minecraft.Client/Platform/Xbox/Font/XUI_Font.h index 1b6278e3c..b0b797f90 100644 --- a/Minecraft.Client/Platform/Xbox/Font/XUI_Font.h +++ b/Minecraft.Client/Platform/Xbox/Font/XUI_Font.h @@ -36,8 +36,8 @@ public: DWORD m_dwNestedBeginCount; - wstring m_fontName; - wstring m_fallbackFont; + std::wstring m_fontName; + std::wstring m_fallbackFont; DWORD refCount; public: float getScaleFactor() { return m_fScaleFactor; } @@ -53,7 +53,7 @@ public: // m_fXScaleFactor = m_fYScaleFactor = m_fScaleFactor; } - void SetFallbackFont(const wstring &fallbackFont) { m_fallbackFont = fallbackFont; } + void SetFallbackFont(const std::wstring &fallbackFont) { m_fallbackFont = fallbackFont; } void IncRefCount() { ++refCount; } void DecRefCount() { --refCount; } diff --git a/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.cpp b/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.cpp index fd2cf1175..dc95f4968 100644 --- a/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.cpp +++ b/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.cpp @@ -321,7 +321,7 @@ HRESULT XUI_FontData::Create( int iFontTexture, const VOID* pFontData ) for( unsigned short i = 0; i < m_cMaxGlyph + 1; ++i ) { if( translatorTable[i] == 0 ) continue; - m_TranslatorMap.insert( unordered_map::value_type(i, translatorTable[i]) ); + m_TranslatorMap.insert( std::unordered_map::value_type(i, translatorTable[i]) ); } pData += ATGCALCFONTFILEHEADERSIZE( m_cMaxGlyph + 1 ); diff --git a/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.h b/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.h index f094db171..d09b1f7ac 100644 --- a/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.h +++ b/Minecraft.Client/Platform/Xbox/Font/XUI_FontData.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include #include "../../../Build/Common/UI/UIFontData.h" @@ -106,7 +106,7 @@ public: int m_iFontTexture; private: - unordered_map m_TranslatorMap; + std::unordered_map m_TranslatorMap; CharMetrics *m_characterMetrics; diff --git a/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.cpp b/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.cpp index 2745a2b5b..f2b172f8e 100644 --- a/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.cpp +++ b/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.cpp @@ -239,7 +239,7 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat #if 1 for( int i = 0; i < dwCount; i++ ) { - wstring string; + std::wstring string; string.push_back(pCharData[i].wch); lineYPos = pCharData[i].y; lineXPos = pCharData[i].x; @@ -257,7 +257,7 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat DWORD i = 0; while( i < dwCount ) { - wstring string; + std::wstring string; lineYPos = pCharData[i].y; lineXPos = pCharData[i].x; colour = pCharData[i].dwColor; diff --git a/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.h b/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.h index cffe2ed1a..9ca088ffc 100644 --- a/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.h +++ b/Minecraft.Client/Platform/Xbox/Font/XUI_FontRenderer.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + class XUI_FontData; class XUI_Font; @@ -24,7 +24,7 @@ protected: // The XUI_Font is a temporary instance that is around as long as XUI needs it, but does the actual rendering // These can be chained - unordered_map m_loadedFonts[eFontData_MAX]; + std::unordered_map m_loadedFonts[eFontData_MAX]; public: XUI_FontRenderer(); diff --git a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp index 3d9b0f561..b2a52ff73 100644 --- a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp +++ b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp @@ -1097,15 +1097,15 @@ bool CPlatformNetworkManagerXbox::SystemFlagGet(INetworkPlayer *pNetworkPlayer, return false; } -wstring CPlatformNetworkManagerXbox::GatherStats() +std::wstring CPlatformNetworkManagerXbox::GatherStats() { return L"Queue messages: " + _toString(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) + L" Queue bytes: " + _toString( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) ); } -wstring CPlatformNetworkManagerXbox::GatherRTTStats() +std::wstring CPlatformNetworkManagerXbox::GatherRTTStats() { - wstring stats(L"Rtt: "); + std::wstring stats(L"Rtt: "); wchar_t stat[32]; @@ -1298,7 +1298,7 @@ void CPlatformNetworkManagerXbox::SearchForGames() return; } - DWORD sessionIDCount = min( XSESSION_SEARCH_MAX_IDS, friendsSessions[m_lastSearchPad].size() ); + DWORD sessionIDCount = std::min( XSESSION_SEARCH_MAX_IDS, friendsSessions[m_lastSearchPad].size() ); SessionID *sessionIDList = new SessionID[sessionIDCount]; for(DWORD i = 0; i < sessionIDCount; ++i) @@ -1474,9 +1474,9 @@ void CPlatformNetworkManagerXbox::SetSearchResultsReady(int resultCount ) m_searchResultsCount[m_lastSearchPad] = resultCount; } -vector *CPlatformNetworkManagerXbox::GetSessionList(int iPad, int localPlayers, bool partyOnly) +std::vector *CPlatformNetworkManagerXbox::GetSessionList(int iPad, int localPlayers, bool partyOnly) { - vector *filteredList = new vector();; + std::vector *filteredList = new std::vector();; const XSESSION_SEARCHRESULT *pSearchResult; const XNQOSINFO * pxnqi; @@ -1529,7 +1529,7 @@ vector *CPlatformNetworkManagerXbox::GetSessionList(int iPa { sessionInfo->data = *(GameSessionData *)pxnqi->pbData; - wstring gamerName = convStringToWstring(sessionInfo->data.hostName); + std::wstring gamerName = convStringToWstring(sessionInfo->data.hostName); #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<data = *(GameSessionData *)pxnqi->pbData; - wstring gamerName = convStringToWstring(sessionInfo->data.hostName); + std::wstring gamerName = convStringToWstring(sessionInfo->data.hostName); swprintf(sessionInfo->displayLabel,app.GetString(IDS_GAME_HOST_NAME),L"MWWWWWWWWWWWWWWM");// gamerName.c_str() ); } else diff --git a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h index 5c9dd0c92..b8da250bb 100644 --- a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h +++ b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include #include #include "../../../../Minecraft.World/Util/C4JThread.h" @@ -73,7 +73,7 @@ private: HANDLE m_notificationListener; - vector m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system + std::vector m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system bool m_bLeavingGame; bool m_bLeaveGameOnTick; @@ -108,7 +108,7 @@ private: PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count); ~PlayerFlags(); }; - vector m_playerFlags; + std::vector m_playerFlags; void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagReset(); @@ -121,11 +121,11 @@ private: float m_lastPlayerEventTimeStart; public: - wstring GatherStats(); - wstring GatherRTTStats(); + std::wstring GatherStats(); + std::wstring GatherRTTStats(); private: - vector friendsSessions[XUSER_MAX_COUNT]; + std::vector friendsSessions[XUSER_MAX_COUNT]; int m_searchResultsCount[XUSER_MAX_COUNT]; int m_lastSearchStartTime[XUSER_MAX_COUNT]; @@ -152,7 +152,7 @@ private: void SetSearchResultsReady(int resultCount = 0); - vectorcurrentNetworkPlayers; + std::vectorcurrentNetworkPlayers; INetworkPlayer *addNetworkPlayer(IQNetPlayer *pQNetPlayer); void removeNetworkPlayer(IQNetPlayer *pQNetPlayer); static INetworkPlayer *getNetworkPlayer(IQNetPlayer *pQNetPlayer); @@ -162,7 +162,7 @@ private: virtual void Notify(int ID, ULONG_PTR Param); public: - virtual vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); + virtual std::vector *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); diff --git a/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp b/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp index 60b593fc4..8217cf0ba 100644 --- a/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp +++ b/Minecraft.Client/Platform/Xbox/Social/SocialManager.cpp @@ -316,7 +316,7 @@ void CSocialManager::DestroyPreviewPostImage() void CSocialManager::SetSocialPostText(LPCWSTR pwchTitle, LPCWSTR pwchCaption, LPCWSTR pwchDesc) { - wstring wTemp; + std::wstring wTemp; ZeroMemory(m_wchTitleA,sizeof(WCHAR)*(MAX_SOCIALPOST_CAPTION+1)); ZeroMemory(m_wchCaptionA,sizeof(WCHAR)*(MAX_SOCIALPOST_CAPTION+1)); diff --git a/Minecraft.Client/Platform/Xbox/Xbox_Minecraft.cpp b/Minecraft.Client/Platform/Xbox/Xbox_Minecraft.cpp index c59e677f7..6ac986975 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_Minecraft.cpp +++ b/Minecraft.Client/Platform/Xbox/Xbox_Minecraft.cpp @@ -888,7 +888,7 @@ void SetRenderAndSamplerStates(IDirect3DDevice9 *pDevice,DWORD *RenderStateA,DWO #ifdef MEMORY_TRACKING int totalAllocGen = 0; -unordered_map allocCounts; +std::unordered_map allocCounts; bool trackEnable = false; bool trackStarted = false; volatile size_t sizeCheckMin = 1160; diff --git a/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp b/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp index 32d84617a..d00147e06 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp +++ b/Minecraft.Client/Platform/Xbox/Xbox_UIController.cpp @@ -141,7 +141,7 @@ void ConsoleUIController::DisplayGamertag(unsigned int iPad, bool show) CXuiSceneBase::DisplayGamertag(iPad, show?TRUE:FALSE); } -void ConsoleUIController::SetSelectedItem(unsigned int iPad, const wstring &name) +void ConsoleUIController::SetSelectedItem(unsigned int iPad, const std::wstring &name) { CXuiSceneBase::SetSelectedItem(iPad, name); } diff --git a/Minecraft.Client/Platform/Xbox/Xbox_UIController.h b/Minecraft.Client/Platform/Xbox/Xbox_UIController.h index 5ec996554..f7fb90844 100644 --- a/Minecraft.Client/Platform/Xbox/Xbox_UIController.h +++ b/Minecraft.Client/Platform/Xbox/Xbox_UIController.h @@ -37,7 +37,7 @@ public: virtual void PlayUISFX(ESoundEffect eSound); virtual void DisplayGamertag(unsigned int iPad, bool show); - virtual void SetSelectedItem(unsigned int iPad, const wstring &name); + virtual void SetSelectedItem(unsigned int iPad, const std::wstring &name); virtual void UpdateSelectedItemPos(unsigned int iPad); virtual void HandleDLCMountingComplete(); diff --git a/Minecraft.Client/Player/EntityTracker.cpp b/Minecraft.Client/Player/EntityTracker.cpp index 88e85feb8..0d219a34e 100644 --- a/Minecraft.Client/Player/EntityTracker.cpp +++ b/Minecraft.Client/Player/EntityTracker.cpp @@ -26,12 +26,12 @@ EntityTracker::EntityTracker(ServerLevel *level) maxRange = level->getServer()->getPlayers()->getMaxRange(); } -void EntityTracker::addEntity(shared_ptr e) +void EntityTracker::addEntity(std::shared_ptr e) { if (e->GetType() == eTYPE_SERVERPLAYER) { addEntity(e, 32 * 16, 2); - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = std::dynamic_pointer_cast(e); for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { if( (*it)->e != player ) @@ -55,7 +55,7 @@ void EntityTracker::addEntity(shared_ptr e) else if (e->GetType() == eTYPE_MINECART) addEntity(e, 16 * 5, 3, true); else if (e->GetType() == eTYPE_BOAT) addEntity(e, 16 * 5, 3, true); else if (e->GetType() == eTYPE_SQUID) addEntity(e, 16 * 4, 3, true); - else if (dynamic_pointer_cast(e)!=NULL) addEntity(e, 16 * 5, 3, true); + else if (std::dynamic_pointer_cast(e)!=NULL) addEntity(e, 16 * 5, 3, true); else if (e->GetType() == eTYPE_ENDERDRAGON ) addEntity(e, 16 * 10, 3, true); else if (e->GetType() == eTYPE_PRIMEDTNT) addEntity(e, 16 * 10, 10, true); else if (e->GetType() == eTYPE_FALLINGTILE) addEntity(e, 16 * 10, 20, true); @@ -65,12 +65,12 @@ void EntityTracker::addEntity(shared_ptr e) else if (e->GetType() == eTYPE_ITEM_FRAME) addEntity(e, 16 * 10, INT_MAX, false); } -void EntityTracker::addEntity(shared_ptr e, int range, int updateInterval) +void EntityTracker::addEntity(std::shared_ptr e, int range, int updateInterval) { addEntity(e, range, updateInterval, false); } -void EntityTracker::addEntity(shared_ptr e, int range, int updateInterval, bool trackDeltas) +void EntityTracker::addEntity(std::shared_ptr e, int range, int updateInterval, bool trackDeltas) { if (range > maxRange) range = maxRange; if (entityMap.find(e->entityId) != entityMap.end()) @@ -81,7 +81,7 @@ void EntityTracker::addEntity(shared_ptr e, int range, int updateInterva { __debugbreak(); } - shared_ptr te = shared_ptr( new TrackedEntity(e, range, updateInterval, trackDeltas) ); + std::shared_ptr te = std::shared_ptr( new TrackedEntity(e, range, updateInterval, trackDeltas) ); entities.insert(te); entityMap[e->entityId] = te; te->updatePlayers(this, &level->players); @@ -89,23 +89,23 @@ void EntityTracker::addEntity(shared_ptr e, int range, int updateInterva // 4J - have split removeEntity into two bits - it used to do the equivalent of EntityTracker::removePlayer followed by EntityTracker::removeEntity. // This is to allow us to now choose to remove the player as a "seenBy" only when the player has actually been removed from the level's own player array -void EntityTracker::removeEntity(shared_ptr e) +void EntityTracker::removeEntity(std::shared_ptr e) { AUTO_VAR(it, entityMap.find(e->entityId)); if( it != entityMap.end() ) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; entityMap.erase(it); entities.erase(te); te->broadcastRemoved(); } } -void EntityTracker::removePlayer(shared_ptr e) +void EntityTracker::removePlayer(std::shared_ptr e) { if (e->GetType() == eTYPE_SERVERPLAYER) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = std::dynamic_pointer_cast(e); for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { (*it)->removePlayer(player); @@ -115,14 +115,14 @@ void EntityTracker::removePlayer(shared_ptr e) void EntityTracker::tick() { - vector > movedPlayers; + std::vector > movedPlayers; for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { - shared_ptr te = *it; + std::shared_ptr te = *it; te->tick(this, &level->players); if (te->moved && te->e->GetType() == eTYPE_SERVERPLAYER) { - movedPlayers.push_back(dynamic_pointer_cast(te->e)); + movedPlayers.push_back(std::dynamic_pointer_cast(te->e)); } } @@ -132,7 +132,7 @@ void EntityTracker::tick() MinecraftServer *server = MinecraftServer::getInstance(); for( unsigned int i = 0; i < server->getPlayers()->players.size(); i++ ) { - shared_ptr ep = server->getPlayers()->players[i]; + std::shared_ptr ep = server->getPlayers()->players[i]; if( ep->dimension != level->dimension->id ) continue; if( ep->connection == NULL ) continue; @@ -142,7 +142,7 @@ void EntityTracker::tick() bool addPlayer = false; for (unsigned int j = 0; j < movedPlayers.size(); j++) { - shared_ptr sp = movedPlayers[j]; + std::shared_ptr sp = movedPlayers[j]; if( sp == ep ) break; @@ -159,11 +159,11 @@ void EntityTracker::tick() for (unsigned int i = 0; i < movedPlayers.size(); i++) { - shared_ptr player = movedPlayers[i]; + std::shared_ptr player = movedPlayers[i]; if(player->connection == NULL) continue; for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { - shared_ptr te = *it; + std::shared_ptr te = *it; if (te->e != player) { te->updatePlayer(this, player); @@ -174,7 +174,7 @@ void EntityTracker::tick() // 4J Stu - We want to do this for dead players as they don't tick normally for(AUTO_VAR(it, level->players.begin()); it != level->players.end(); ++it) { - shared_ptr player = dynamic_pointer_cast(*it); + std::shared_ptr player = std::dynamic_pointer_cast(*it); if(!player->isAlive()) { player->flushEntitiesToRemove(); @@ -182,31 +182,31 @@ void EntityTracker::tick() } } -void EntityTracker::broadcast(shared_ptr e, shared_ptr packet) +void EntityTracker::broadcast(std::shared_ptr e, std::shared_ptr packet) { AUTO_VAR(it, entityMap.find( e->entityId )); if( it != entityMap.end() ) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; te->broadcast(packet); } } -void EntityTracker::broadcastAndSend(shared_ptr e, shared_ptr packet) +void EntityTracker::broadcastAndSend(std::shared_ptr e, std::shared_ptr packet) { AUTO_VAR(it, entityMap.find( e->entityId )); if( it != entityMap.end() ) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; te->broadcastAndSend(packet); } } -void EntityTracker::clear(shared_ptr serverPlayer) +void EntityTracker::clear(std::shared_ptr serverPlayer) { for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) { - shared_ptr te = *it; + std::shared_ptr te = *it; te->clear(serverPlayer); } } @@ -218,7 +218,7 @@ void EntityTracker::updateMaxRange() } -shared_ptr EntityTracker::getTracker(shared_ptr e) +std::shared_ptr EntityTracker::getTracker(std::shared_ptr e) { AUTO_VAR(it, entityMap.find(e->entityId)); if( it != entityMap.end() ) diff --git a/Minecraft.Client/Player/EntityTracker.h b/Minecraft.Client/Player/EntityTracker.h index ac905b108..d3d9a32fe 100644 --- a/Minecraft.Client/Player/EntityTracker.h +++ b/Minecraft.Client/Player/EntityTracker.h @@ -7,30 +7,30 @@ class TrackedEntity; class MinecraftServer; class Packet; -using namespace std; + class EntityTracker { private: ServerLevel *level; - unordered_set > entities; - unordered_map , IntKeyHash2, IntKeyEq> entityMap; // was IntHashMap + std::unordered_set > entities; + std::unordered_map , IntKeyHash2, IntKeyEq> entityMap; // was IntHashMap int maxRange; public: EntityTracker(ServerLevel *level); - void addEntity(shared_ptr e); - void addEntity(shared_ptr e, int range, int updateInterval); - void addEntity(shared_ptr e, int range, int updateInterval, bool trackDeltas); - void removeEntity(shared_ptr e); - void removePlayer(shared_ptr e); // 4J added + void addEntity(std::shared_ptr e); + void addEntity(std::shared_ptr e, int range, int updateInterval); + void addEntity(std::shared_ptr e, int range, int updateInterval, bool trackDeltas); + void removeEntity(std::shared_ptr e); + void removePlayer(std::shared_ptr e); // 4J added void tick(); - void broadcast(shared_ptr e, shared_ptr packet); - void broadcastAndSend(shared_ptr e, shared_ptr packet); - void clear(shared_ptr serverPlayer); + void broadcast(std::shared_ptr e, std::shared_ptr packet); + void broadcastAndSend(std::shared_ptr e, std::shared_ptr packet); + void clear(std::shared_ptr serverPlayer); void updateMaxRange(); // AP added for Vita // 4J-JEV: Added, needed access to tracked entity of a riders mount. - shared_ptr getTracker(shared_ptr entity); + std::shared_ptr getTracker(std::shared_ptr entity); }; diff --git a/Minecraft.Client/Player/LocalPlayer.cpp b/Minecraft.Client/Player/LocalPlayer.cpp index ae3182639..11665ff0c 100644 --- a/Minecraft.Client/Player/LocalPlayer.cpp +++ b/Minecraft.Client/Player/LocalPlayer.cpp @@ -276,7 +276,7 @@ void LocalPlayer::aiStep() float runTreshold = 0.8f; bool wasRunning = input->ya >= runTreshold; - //input->tick( dynamic_pointer_cast( shared_from_this() ) ); + //input->tick( std::dynamic_pointer_cast( shared_from_this() ) ); // 4J-PB - make it a localplayer input->tick( this ); if (isUsingItem()) @@ -583,14 +583,14 @@ void LocalPlayer::closeContainer() ui.CloseUIScenes( m_iPad ); } -void LocalPlayer::openTextEdit(shared_ptr sign) +void LocalPlayer::openTextEdit(std::shared_ptr sign) { bool success = app.LoadSignEntryMenu(GetXboxPad(), sign ); if( success ) ui.PlayUISFX(eSFX_Press); //minecraft->setScreen(new TextEditScreen(sign)); } -bool LocalPlayer::openContainer(shared_ptr container) +bool LocalPlayer::openContainer(std::shared_ptr container) { bool success = app.LoadContainerMenu(GetXboxPad(), inventory, container ); if( success ) ui.PlayUISFX(eSFX_Press); @@ -600,7 +600,7 @@ bool LocalPlayer::openContainer(shared_ptr container) bool LocalPlayer::startCrafting(int x, int y, int z) { - bool success = app.LoadCrafting3x3Menu(GetXboxPad(), dynamic_pointer_cast( shared_from_this() ), x, y, z ); + bool success = app.LoadCrafting3x3Menu(GetXboxPad(), std::dynamic_pointer_cast( shared_from_this() ), x, y, z ); if( success ) ui.PlayUISFX(eSFX_Press); //app.LoadXuiCraftMenu(0,inventory, level, x, y, z); //minecraft->setScreen(new CraftingScreen(inventory, level, x, y, z)); @@ -623,7 +623,7 @@ bool LocalPlayer::startRepairing(int x, int y, int z) return success; } -bool LocalPlayer::openFurnace(shared_ptr furnace) +bool LocalPlayer::openFurnace(std::shared_ptr furnace) { bool success = app.LoadFurnaceMenu(GetXboxPad(),inventory, furnace); if( success ) ui.PlayUISFX(eSFX_Press); @@ -631,7 +631,7 @@ bool LocalPlayer::openFurnace(shared_ptr furnace) return success; } -bool LocalPlayer::openBrewingStand(shared_ptr brewingStand) +bool LocalPlayer::openBrewingStand(std::shared_ptr brewingStand) { bool success = app.LoadBrewingStandMenu(GetXboxPad(),inventory, brewingStand); if( success ) ui.PlayUISFX(eSFX_Press); @@ -639,7 +639,7 @@ bool LocalPlayer::openBrewingStand(shared_ptr brewingSta return success; } -bool LocalPlayer::openTrap(shared_ptr trap) +bool LocalPlayer::openTrap(std::shared_ptr trap) { bool success = app.LoadTrapMenu(GetXboxPad(),inventory, trap); if( success ) ui.PlayUISFX(eSFX_Press); @@ -647,7 +647,7 @@ bool LocalPlayer::openTrap(shared_ptr trap) return success; } -bool LocalPlayer::openTrading(shared_ptr traderTarget) +bool LocalPlayer::openTrading(std::shared_ptr traderTarget) { bool success = app.LoadTradingMenu(GetXboxPad(),inventory, traderTarget, level); if( success ) ui.PlayUISFX(eSFX_Press); @@ -655,26 +655,26 @@ bool LocalPlayer::openTrading(shared_ptr traderTarget) return success; } -void LocalPlayer::crit(shared_ptr e) +void LocalPlayer::crit(std::shared_ptr e) { - shared_ptr critParticle = shared_ptr( new CritParticle((Level *)minecraft->level, e) ); + std::shared_ptr critParticle = std::shared_ptr( new CritParticle((Level *)minecraft->level, e) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); } -void LocalPlayer::magicCrit(shared_ptr e) +void LocalPlayer::magicCrit(std::shared_ptr e) { - shared_ptr critParticle = shared_ptr( new CritParticle((Level *)minecraft->level, e, eParticleType_magicCrit) ); + std::shared_ptr critParticle = std::shared_ptr( new CritParticle((Level *)minecraft->level, e, eParticleType_magicCrit) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); } -void LocalPlayer::take(shared_ptr e, int orgCount) +void LocalPlayer::take(std::shared_ptr e, int orgCount) { - minecraft->particleEngine->add( shared_ptr( new TakeAnimationParticle((Level *)minecraft->level, e, shared_from_this(), -0.5f) ) ); + minecraft->particleEngine->add( std::shared_ptr( new TakeAnimationParticle((Level *)minecraft->level, e, shared_from_this(), -0.5f) ) ); } -void LocalPlayer::chat(const wstring& message) +void LocalPlayer::chat(const std::wstring& message) { } @@ -744,7 +744,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) && ProfileManager.IsFullVersion() ) { - stat->handleParamBlob(dynamic_pointer_cast(shared_from_this()), param); + stat->handleParamBlob(std::dynamic_pointer_cast(shared_from_this()), param); } delete [] param.data; #else @@ -1130,7 +1130,7 @@ bool LocalPlayer::hasPermission(EGameCommand command) return level->getLevelData()->getAllowCommands(); } -void LocalPlayer::onCrafted(shared_ptr item) +void LocalPlayer::onCrafted(std::shared_ptr item) { if( minecraft->localgameModes[m_iPad] != NULL ) { @@ -1159,7 +1159,7 @@ void LocalPlayer::mapPlayerChunk(const unsigned int flagTileType) int pZ = ((int) floor(this->z)) %16; int pX = ((int) floor(this->x)) %16; - cout<<"player in chunk ("<x<<","<y<<","<z<<")\n"; for (int v = -1; v < 2; v++) @@ -1170,19 +1170,19 @@ void LocalPlayer::mapPlayerChunk(const unsigned int flagTileType) { LevelChunk *cc = level->getChunk(cx+u, cz+v); if ( x==pX && z==pZ && u==0 && v==0) - cout << "O"; + std::cout << "O"; else for (unsigned int y = 127; y > 0; y--) { int t = cc->getTile(x,y,z); - if (flagTileType != 0 && t == flagTileType) { cout << "@"; break; } - else if (t != 0 && t < 10) { cout << t; break; } - else if (t > 0) { cout << "#"; break; } + if (flagTileType != 0 && t == flagTileType) { std::cout << "@"; break; } + else if (t != 0 && t < 10) { std::cout << t; break; } + else if (t > 0) { std::cout << "#"; break; } } } - cout << "\n"; + std::cout << "\n"; } - cout << "\n"; + std::cout << "\n"; } @@ -1408,7 +1408,7 @@ bool LocalPlayer::handleMouseClick(int button) if(lastClickState == lastClick_oldRepeat) return false; - shared_ptr mplp = dynamic_pointer_cast( shared_from_this() ); + std::shared_ptr mplp = std::dynamic_pointer_cast( shared_from_this() ); if(mplp && mplp->connection) mplp->StopSleeping(); @@ -1419,7 +1419,7 @@ bool LocalPlayer::handleMouseClick(int button) return false; } - shared_ptr oldItem = inventory->getSelected(); + std::shared_ptr oldItem = inventory->getSelected(); if (minecraft->hitResult == NULL) { @@ -1441,7 +1441,7 @@ bool LocalPlayer::handleMouseClick(int button) if(minecraft->hitResult->entity->GetType()==eTYPE_COW) { // If I have an empty bucket in my hand, it's going to be filled with milk, so turn off mayUse - shared_ptr item = inventory->getSelected(); + std::shared_ptr item = inventory->getSelected(); if(item && (item->id==Item::bucket_empty_Id)) { mayUse=false; @@ -1471,7 +1471,7 @@ bool LocalPlayer::handleMouseClick(int button) } else { - shared_ptr item = oldItem; + std::shared_ptr item = oldItem; int oldCount = item != NULL ? item->count : 0; bool usedItem = false; if (minecraft->gameMode->useItemOn(minecraft->localplayers[GetXboxPad()], level, item, x, y, z, face, minecraft->hitResult->pos, false, &usedItem)) @@ -1503,7 +1503,7 @@ bool LocalPlayer::handleMouseClick(int button) if (mayUse && button == 1) { - shared_ptr item = inventory->getSelected(); + std::shared_ptr item = inventory->getSelected(); if (item != NULL) { if (minecraft->gameMode->useItem(minecraft->localplayers[GetXboxPad()], level, item)) @@ -1519,7 +1519,7 @@ void LocalPlayer::updateRichPresence() { if((m_iPad!=-1)/* && !ui.GetMenuDisplayed(m_iPad)*/ ) { - shared_ptr selectedItem = inventory->getSelected(); + std::shared_ptr selectedItem = inventory->getSelected(); if(selectedItem != NULL && selectedItem->id == Item::fishingRod_Id) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_FISHING); @@ -1528,15 +1528,15 @@ void LocalPlayer::updateRichPresence() { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_MAP); } - else if(riding != NULL && dynamic_pointer_cast(riding) != NULL) + else if(riding != NULL && std::dynamic_pointer_cast(riding) != NULL) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_RIDING_MINECART); } - else if(riding != NULL && dynamic_pointer_cast(riding) != NULL) + else if(riding != NULL && std::dynamic_pointer_cast(riding) != NULL) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_BOATING); } - else if(riding != NULL && dynamic_pointer_cast(riding) != NULL) + else if(riding != NULL && std::dynamic_pointer_cast(riding) != NULL) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_RIDING_PIG); } @@ -1575,7 +1575,7 @@ float LocalPlayer::getAndResetChangeDimensionTimer() return returnVal; } -void LocalPlayer::handleCollectItem(shared_ptr item) +void LocalPlayer::handleCollectItem(std::shared_ptr item) { if(item != NULL) { @@ -1609,7 +1609,7 @@ void LocalPlayer::handleCollectItem(shared_ptr item) } } -void LocalPlayer::SetPlayerAdditionalModelParts(vectorpAdditionalModelParts) +void LocalPlayer::SetPlayerAdditionalModelParts(std::vectorpAdditionalModelParts) { m_pAdditionalModelParts=pAdditionalModelParts; } diff --git a/Minecraft.Client/Player/LocalPlayer.h b/Minecraft.Client/Player/LocalPlayer.h index 9b9c77578..3a70bd4b6 100644 --- a/Minecraft.Client/Player/LocalPlayer.h +++ b/Minecraft.Client/Player/LocalPlayer.h @@ -13,7 +13,7 @@ class Input; class Stat; class Minecraft; -using namespace std; + // Time in seconds before the players presence is update to Idle #define PLAYER_IDLE_TIME 300 @@ -99,19 +99,19 @@ public: virtual void addAdditonalSaveData(CompoundTag *entityTag); virtual void readAdditionalSaveData(CompoundTag *entityTag); virtual void closeContainer(); - virtual void openTextEdit(shared_ptr sign); - virtual bool openContainer(shared_ptr container); // 4J added bool return + virtual void openTextEdit(std::shared_ptr sign); + virtual bool openContainer(std::shared_ptr container); // 4J added bool return virtual bool startCrafting(int x, int y, int z); // 4J added bool return virtual bool startEnchanting(int x, int y, int z); // 4J added bool return virtual bool startRepairing(int x, int y, int z); - virtual bool openFurnace(shared_ptr furnace); // 4J added bool return - virtual bool openBrewingStand(shared_ptr brewingStand); // 4J added bool return - virtual bool openTrap(shared_ptr trap); // 4J added bool return - virtual bool openTrading(shared_ptr traderTarget); - virtual void crit(shared_ptr e); - virtual void magicCrit(shared_ptr e); - virtual void take(shared_ptr e, int orgCount); - virtual void chat(const wstring& message); + virtual bool openFurnace(std::shared_ptr furnace); // 4J added bool return + virtual bool openBrewingStand(std::shared_ptr brewingStand); // 4J added bool return + virtual bool openTrap(std::shared_ptr trap); // 4J added bool return + virtual bool openTrading(std::shared_ptr traderTarget); + virtual void crit(std::shared_ptr e); + virtual void magicCrit(std::shared_ptr e); + virtual void take(std::shared_ptr e, int orgCount); + virtual void chat(const std::wstring& message); virtual bool isSneaking(); //virtual bool isIdle(); virtual void hurtTo(int newHealth, ETelemetryChallenges damageSource); @@ -159,7 +159,7 @@ public: int lastClickState; // 4J Stu - Added to allow callback to tutorial to stay within Minecraft.Client - virtual void onCrafted(shared_ptr item); + virtual void onCrafted(std::shared_ptr item); virtual void setAndBroadcastCustomSkin(DWORD skinId); virtual void setAndBroadcastCustomCape(DWORD capeId); @@ -189,11 +189,11 @@ public: float getAndResetChangeDimensionTimer(); - virtual void handleCollectItem(shared_ptr item); - void SetPlayerAdditionalModelParts(vectorpAdditionalModelParts); + virtual void handleCollectItem(std::shared_ptr item); + void SetPlayerAdditionalModelParts(std::vectorpAdditionalModelParts); private: - vector m_pAdditionalModelParts; + std::vector m_pAdditionalModelParts; }; diff --git a/Minecraft.Client/Player/MultiPlayerGameMode.cpp b/Minecraft.Client/Player/MultiPlayerGameMode.cpp index 1f0c43445..c54695e6d 100644 --- a/Minecraft.Client/Player/MultiPlayerGameMode.cpp +++ b/Minecraft.Client/Player/MultiPlayerGameMode.cpp @@ -38,7 +38,7 @@ void MultiPlayerGameMode::creativeDestroyBlock(Minecraft *minecraft, MultiPlayer } } -void MultiPlayerGameMode::adjustPlayer(shared_ptr player) +void MultiPlayerGameMode::adjustPlayer(std::shared_ptr player) { localPlayerMode->updatePlayerAbilities(&player->abilities); } @@ -54,7 +54,7 @@ void MultiPlayerGameMode::setLocalMode(GameType *mode) localPlayerMode->updatePlayerAbilities(&minecraft->player->abilities); } -void MultiPlayerGameMode::initPlayer(shared_ptr player) +void MultiPlayerGameMode::initPlayer(std::shared_ptr player) { player->yRot = -180; } @@ -87,7 +87,7 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face) if (!localPlayerMode->isCreative()) { - shared_ptr item = minecraft->player->getSelectedItem(); + std::shared_ptr item = minecraft->player->getSelectedItem(); if (item != NULL) { item->mineBlock(level, oldTile->id, x, y, z, minecraft->player); @@ -111,13 +111,13 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) if (localPlayerMode->isCreative()) { - connection->send(shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) )); + connection->send(std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) )); creativeDestroyBlock(minecraft, this, x, y, z, face); destroyDelay = 5; } else if (!isDestroying || x != xDestroyBlock || y != yDestroyBlock || z != zDestroyBlock) { - connection->send( shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) ); + connection->send( std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) ); int t = minecraft->level->getTile(x, y, z); if (t > 0 && destroyProgress == 0) Tile::tiles[t]->attack(minecraft->level, x, y, z, minecraft->player); if (t > 0 && @@ -147,7 +147,7 @@ void MultiPlayerGameMode::stopDestroyBlock() { if (isDestroying) { - connection->send(shared_ptr(new PlayerActionPacket(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1))); + connection->send(std::shared_ptr(new PlayerActionPacket(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1))); } isDestroying = false; @@ -170,7 +170,7 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) if (localPlayerMode->isCreative()) { destroyDelay = 5; - connection->send(shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) ); + connection->send(std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) ); creativeDestroyBlock(minecraft, this, x, y, z, face); return; } @@ -202,7 +202,7 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) if (destroyProgress >= 1) { isDestroying = false; - connection->send( shared_ptr( new PlayerActionPacket(PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face) ) ); + connection->send( std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face) ) ); destroyBlock(x, y, z, face); destroyProgress = 0; oDestroyProgress = 0; @@ -241,11 +241,11 @@ void MultiPlayerGameMode::ensureHasSentCarriedItem() if (newItem != carriedItem) { carriedItem = newItem; - connection->send( shared_ptr( new SetCarriedItemPacket(carriedItem) ) ); + connection->send( std::shared_ptr( new SetCarriedItemPacket(carriedItem) ) ); } } -bool MultiPlayerGameMode::useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem) +bool MultiPlayerGameMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem) { if( pbUsedItem ) *pbUsedItem = false; // Did we actually use the held item? @@ -338,12 +338,12 @@ bool MultiPlayerGameMode::useItemOn(shared_ptr player, Level *level, sha // Fix for #7904 - Gameplay: Players can dupe torches by throwing them repeatedly into water. if(!bTestUseOnly) { - connection->send( shared_ptr( new UseItemPacket(x, y, z, face, player->inventory->getSelected(), clickX, clickY, clickZ) ) ); + connection->send( std::shared_ptr( new UseItemPacket(x, y, z, face, player->inventory->getSelected(), clickX, clickY, clickZ) ) ); } return didSomething; } -bool MultiPlayerGameMode::useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly) +bool MultiPlayerGameMode::useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly) { if(!player->isAllowedToUse(item)) return false; @@ -366,7 +366,7 @@ bool MultiPlayerGameMode::useItem(shared_ptr player, Level *level, share else { int oldCount = item->count; - shared_ptr itemInstance = item->use(level, player); + std::shared_ptr itemInstance = item->use(level, player); if ((itemInstance != NULL && itemInstance != item) || (itemInstance != NULL && itemInstance->count != oldCount)) { player->inventory->items[player->inventory->selected] = itemInstance; @@ -380,65 +380,65 @@ bool MultiPlayerGameMode::useItem(shared_ptr player, Level *level, share if(!bTestUseOnly) { - connection->send( shared_ptr( new UseItemPacket(-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0) ) ); + connection->send( std::shared_ptr( new UseItemPacket(-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0) ) ); } return result; } -shared_ptr MultiPlayerGameMode::createPlayer(Level *level) +std::shared_ptr MultiPlayerGameMode::createPlayer(Level *level) { - return shared_ptr( new MultiplayerLocalPlayer(minecraft, level, minecraft->user, connection) ); + return std::shared_ptr( new MultiplayerLocalPlayer(minecraft, level, minecraft->user, connection) ); } -void MultiPlayerGameMode::attack(shared_ptr player, shared_ptr entity) +void MultiPlayerGameMode::attack(std::shared_ptr player, std::shared_ptr entity) { ensureHasSentCarriedItem(); - connection->send( shared_ptr( new InteractPacket(player->entityId, entity->entityId, InteractPacket::ATTACK) ) ); + connection->send( std::shared_ptr( new InteractPacket(player->entityId, entity->entityId, InteractPacket::ATTACK) ) ); player->attack(entity); } -bool MultiPlayerGameMode::interact(shared_ptr player, shared_ptr entity) +bool MultiPlayerGameMode::interact(std::shared_ptr player, std::shared_ptr entity) { ensureHasSentCarriedItem(); - connection->send(shared_ptr( new InteractPacket(player->entityId, entity->entityId, InteractPacket::INTERACT) ) ); + connection->send(std::shared_ptr( new InteractPacket(player->entityId, entity->entityId, InteractPacket::INTERACT) ) ); return player->interact(entity); } -shared_ptr MultiPlayerGameMode::handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, shared_ptr player) +std::shared_ptr MultiPlayerGameMode::handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, std::shared_ptr player) { short changeUid = player->containerMenu->backup(player->inventory); - shared_ptr clicked = player->containerMenu->clicked(slotNum, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player); - connection->send( shared_ptr( new ContainerClickPacket(containerId, slotNum, buttonNum, quickKeyHeld, clicked, changeUid) ) ); + std::shared_ptr clicked = player->containerMenu->clicked(slotNum, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player); + connection->send( std::shared_ptr( new ContainerClickPacket(containerId, slotNum, buttonNum, quickKeyHeld, clicked, changeUid) ) ); return clicked; } void MultiPlayerGameMode::handleInventoryButtonClick(int containerId, int buttonId) { - connection->send(shared_ptr( new ContainerButtonClickPacket(containerId, buttonId) )); + connection->send(std::shared_ptr( new ContainerButtonClickPacket(containerId, buttonId) )); } -void MultiPlayerGameMode::handleCreativeModeItemAdd(shared_ptr clicked, int slot) +void MultiPlayerGameMode::handleCreativeModeItemAdd(std::shared_ptr clicked, int slot) { if (localPlayerMode->isCreative()) { - connection->send(shared_ptr( new SetCreativeModeSlotPacket(slot, clicked) ) ); + connection->send(std::shared_ptr( new SetCreativeModeSlotPacket(slot, clicked) ) ); } } -void MultiPlayerGameMode::handleCreativeModeItemDrop(shared_ptr clicked) +void MultiPlayerGameMode::handleCreativeModeItemDrop(std::shared_ptr clicked) { if (localPlayerMode->isCreative() && clicked != NULL) { - connection->send(shared_ptr( new SetCreativeModeSlotPacket(-1, clicked) ) ); + connection->send(std::shared_ptr( new SetCreativeModeSlotPacket(-1, clicked) ) ); } } -void MultiPlayerGameMode::releaseUsingItem(shared_ptr player) +void MultiPlayerGameMode::releaseUsingItem(std::shared_ptr player) { ensureHasSentCarriedItem(); - connection->send(shared_ptr( new PlayerActionPacket(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255) ) ); + connection->send(std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255) ) ); player->releaseUsingItem(); } @@ -462,17 +462,17 @@ bool MultiPlayerGameMode::hasFarPickRange() return localPlayerMode->isCreative(); } -bool MultiPlayerGameMode::handleCraftItem(int recipe, shared_ptr player) +bool MultiPlayerGameMode::handleCraftItem(int recipe, std::shared_ptr player) { short changeUid = player->containerMenu->backup(player->inventory); - connection->send( shared_ptr( new CraftItemPacket(recipe, changeUid) ) ); + connection->send( std::shared_ptr( new CraftItemPacket(recipe, changeUid) ) ); return true; } -void MultiPlayerGameMode::handleDebugOptions(unsigned int uiVal, shared_ptr player) +void MultiPlayerGameMode::handleDebugOptions(unsigned int uiVal, std::shared_ptr player) { player->SetDebugOptions(uiVal); - connection->send( shared_ptr( new DebugOptionsPacket(uiVal) ) ); + connection->send( std::shared_ptr( new DebugOptionsPacket(uiVal) ) ); } diff --git a/Minecraft.Client/Player/MultiPlayerGameMode.h b/Minecraft.Client/Player/MultiPlayerGameMode.h index 29326c698..19ef46af6 100644 --- a/Minecraft.Client/Player/MultiPlayerGameMode.h +++ b/Minecraft.Client/Player/MultiPlayerGameMode.h @@ -24,10 +24,10 @@ protected: public: MultiPlayerGameMode(Minecraft *minecraft, ClientConnection *connection); static void creativeDestroyBlock(Minecraft *minecraft, MultiPlayerGameMode *gameMode, int x, int y, int z, int face); - void adjustPlayer(shared_ptr player); + void adjustPlayer(std::shared_ptr player); bool isCutScene(); void setLocalMode(GameType *mode); - virtual void initPlayer(shared_ptr player); + virtual void initPlayer(std::shared_ptr player); virtual bool canHurtPlayer(); virtual bool destroyBlock(int x, int y, int z, int face); virtual void startDestroyBlock(int x, int y, int z, int face); @@ -41,24 +41,24 @@ private: private: void ensureHasSentCarriedItem(); public: - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); - virtual bool useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly=false); - virtual shared_ptr createPlayer(Level *level); - virtual void attack(shared_ptr player, shared_ptr entity); - virtual bool interact(shared_ptr player, shared_ptr entity); - virtual shared_ptr handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, shared_ptr player); + virtual bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); + virtual bool useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly=false); + virtual std::shared_ptr createPlayer(Level *level); + virtual void attack(std::shared_ptr player, std::shared_ptr entity); + virtual bool interact(std::shared_ptr player, std::shared_ptr entity); + virtual std::shared_ptr handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, std::shared_ptr player); virtual void handleInventoryButtonClick(int containerId, int buttonId); - virtual void handleCreativeModeItemAdd(shared_ptr clicked, int slot); - virtual void handleCreativeModeItemDrop(shared_ptr clicked); - virtual void releaseUsingItem(shared_ptr player); + virtual void handleCreativeModeItemAdd(std::shared_ptr clicked, int slot); + virtual void handleCreativeModeItemDrop(std::shared_ptr clicked); + virtual void releaseUsingItem(std::shared_ptr player); virtual bool hasExperience(); virtual bool hasMissTime(); virtual bool hasInfiniteItems(); virtual bool hasFarPickRange(); // 4J Stu - Added so we can send packets for this in the network game - virtual bool handleCraftItem(int recipe, shared_ptr player); - virtual void handleDebugOptions(unsigned int uiVal, shared_ptr player); + virtual bool handleCraftItem(int recipe, std::shared_ptr player); + virtual void handleDebugOptions(unsigned int uiVal, std::shared_ptr player); // 4J Stu - Added for tutorial checks virtual bool isInputAllowed(int mapping) { return true; } diff --git a/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp b/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp index d36e7c827..d62ff2ae6 100644 --- a/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp +++ b/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp @@ -49,8 +49,8 @@ void MultiplayerLocalPlayer::tick() /*if((app.GetGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != m_bShownOnMaps) { m_bShownOnMaps = (app.GetGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); - if (m_bShownOnMaps) connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) ) ); - else connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::HIDE_ON_MAPS) ) ); + if (m_bShownOnMaps) connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) ) ); + else connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::HIDE_ON_MAPS) ) ); }*/ if (!level->hasChunkAt(Mth::floor(x), 0, Mth::floor(z))) return; @@ -75,8 +75,8 @@ void MultiplayerLocalPlayer::sendPosition() bool sprinting = isSprinting(); if (sprinting != lastSprinting) { - if (sprinting) connection->send(shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SPRINTING))); - else connection->send(shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SPRINTING))); + if (sprinting) connection->send(std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SPRINTING))); + else connection->send(std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SPRINTING))); lastSprinting = sprinting; } @@ -84,8 +84,8 @@ void MultiplayerLocalPlayer::sendPosition() bool sneaking = isSneaking(); if (sneaking != lastSneaked) { - if (sneaking) connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SNEAKING) ) ); - else connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SNEAKING) ) ); + if (sneaking) connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SNEAKING) ) ); + else connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SNEAKING) ) ); lastSneaked = sneaking; } @@ -93,8 +93,8 @@ void MultiplayerLocalPlayer::sendPosition() bool idle = isIdle(); if (idle != lastIdle) { - if (idle) connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_IDLEANIM) ) ); - else connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM) ) ); + if (idle) connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_IDLEANIM) ) ); + else connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM) ) ); lastIdle = idle; } @@ -110,26 +110,26 @@ void MultiplayerLocalPlayer::sendPosition() bool rot = rydd != 0 || rxdd != 0; if (riding != NULL) { - connection->send( shared_ptr( new MovePlayerPacket::PosRot(xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying) ) ); + connection->send( std::shared_ptr( new MovePlayerPacket::PosRot(xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying) ) ); move = false; } else { if (move && rot) { - connection->send( shared_ptr( new MovePlayerPacket::PosRot(x, bb->y0, y, z, yRot, xRot, onGround, abilities.flying) ) ); + connection->send( std::shared_ptr( new MovePlayerPacket::PosRot(x, bb->y0, y, z, yRot, xRot, onGround, abilities.flying) ) ); } else if (move) { - connection->send( shared_ptr( new MovePlayerPacket::Pos(x, bb->y0, y, z, onGround, abilities.flying) ) ); + connection->send( std::shared_ptr( new MovePlayerPacket::Pos(x, bb->y0, y, z, onGround, abilities.flying) ) ); } else if (rot) { - connection->send( shared_ptr( new MovePlayerPacket::Rot(yRot, xRot, onGround, abilities.flying) ) ); + connection->send( std::shared_ptr( new MovePlayerPacket::Rot(yRot, xRot, onGround, abilities.flying) ) ); } else { - connection->send( shared_ptr( new MovePlayerPacket(onGround, abilities.flying) ) ); + connection->send( std::shared_ptr( new MovePlayerPacket(onGround, abilities.flying) ) ); } } @@ -152,31 +152,31 @@ void MultiplayerLocalPlayer::sendPosition() } -shared_ptr MultiplayerLocalPlayer::drop() +std::shared_ptr MultiplayerLocalPlayer::drop() { - connection->send( shared_ptr( new PlayerActionPacket(PlayerActionPacket::DROP_ITEM, 0, 0, 0, 0) ) ); + connection->send( std::shared_ptr( new PlayerActionPacket(PlayerActionPacket::DROP_ITEM, 0, 0, 0, 0) ) ); return nullptr; } -void MultiplayerLocalPlayer::reallyDrop(shared_ptr itemEntity) +void MultiplayerLocalPlayer::reallyDrop(std::shared_ptr itemEntity) { } -void MultiplayerLocalPlayer::chat(const wstring& message) +void MultiplayerLocalPlayer::chat(const std::wstring& message) { - connection->send( shared_ptr( new ChatPacket(message) ) ); + connection->send( std::shared_ptr( new ChatPacket(message) ) ); } void MultiplayerLocalPlayer::swing() { LocalPlayer::swing(); - connection->send( shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING) ) ); + connection->send( std::shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING) ) ); } void MultiplayerLocalPlayer::respawn() { - connection->send( shared_ptr( new ClientCommandPacket(ClientCommandPacket::PERFORM_RESPAWN))); + connection->send( std::shared_ptr( new ClientCommandPacket(ClientCommandPacket::PERFORM_RESPAWN))); } @@ -238,7 +238,7 @@ void MultiplayerLocalPlayer::onEffectRemoved(MobEffectInstance *effect) void MultiplayerLocalPlayer::closeContainer() { - connection->send( shared_ptr( new ContainerClosePacket(containerMenu->containerId) ) ); + connection->send( std::shared_ptr( new ContainerClosePacket(containerMenu->containerId) ) ); inventory->setCarried(nullptr); LocalPlayer::closeContainer(); } @@ -286,7 +286,7 @@ void MultiplayerLocalPlayer::awardStatFromServer(Stat *stat, byteArray param) void MultiplayerLocalPlayer::onUpdateAbilities() { - connection->send(shared_ptr(new PlayerAbilitiesPacket(&abilities))); + connection->send(std::shared_ptr(new PlayerAbilitiesPacket(&abilities))); } bool MultiplayerLocalPlayer::isLocalPlayer() @@ -294,7 +294,7 @@ bool MultiplayerLocalPlayer::isLocalPlayer() return true; } -void MultiplayerLocalPlayer::ride(shared_ptr e) +void MultiplayerLocalPlayer::ride(std::shared_ptr e) { bool wasRiding = riding != NULL; LocalPlayer::ride(e); @@ -334,9 +334,9 @@ void MultiplayerLocalPlayer::ride(shared_ptr e) } else if (!wasRiding && isRiding) { - if(dynamic_pointer_cast(e) != NULL) + if(std::dynamic_pointer_cast(e) != NULL) gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Riding_Minecart); - else if(dynamic_pointer_cast(e) != NULL) + else if(std::dynamic_pointer_cast(e) != NULL) gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Riding_Boat); } } @@ -344,7 +344,7 @@ void MultiplayerLocalPlayer::ride(shared_ptr e) void MultiplayerLocalPlayer::StopSleeping() { - connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SLEEPING) ) ); + connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SLEEPING) ) ); } // 4J Added @@ -355,7 +355,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(DWORD skinId) #ifndef _CONTENT_PACKAGE wprintf(L"Skin for local player %ls has changed to %ls (%d)\n", name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin() ); #endif - if(getCustomSkin() != oldSkinIndex) connection->send( shared_ptr( new TextureAndGeometryChangePacket( shared_from_this(), app.GetPlayerSkinName(GetXboxPad()) ) ) ); + if(getCustomSkin() != oldSkinIndex) connection->send( std::shared_ptr( new TextureAndGeometryChangePacket( shared_from_this(), app.GetPlayerSkinName(GetXboxPad()) ) ) ); } void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId) @@ -365,5 +365,5 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId) #ifndef _CONTENT_PACKAGE wprintf(L"Cape for local player %ls has changed to %ls\n", name.c_str(), customTextureUrl2.c_str()); #endif - if(getCustomCape() != oldCapeIndex) connection->send( shared_ptr( new TextureChangePacket( shared_from_this(), TextureChangePacket::e_TextureChange_Cape, app.GetPlayerCapeName(GetXboxPad()) ) ) ); + if(getCustomCape() != oldCapeIndex) connection->send( std::shared_ptr( new TextureChangePacket( shared_from_this(), TextureChangePacket::e_TextureChange_Cape, app.GetPlayerCapeName(GetXboxPad()) ) ) ); } diff --git a/Minecraft.Client/Player/MultiPlayerLocalPlayer.h b/Minecraft.Client/Player/MultiPlayerLocalPlayer.h index cc7dc3ae1..54c6001da 100644 --- a/Minecraft.Client/Player/MultiPlayerLocalPlayer.h +++ b/Minecraft.Client/Player/MultiPlayerLocalPlayer.h @@ -33,11 +33,11 @@ public: void sendPosition(); using Player::drop; - virtual shared_ptr drop(); + virtual std::shared_ptr drop(); protected: - virtual void reallyDrop(shared_ptr itemEntity); + virtual void reallyDrop(std::shared_ptr itemEntity); public: - virtual void chat(const wstring& message); + virtual void chat(const std::wstring& message); virtual void swing(); virtual void respawn(); protected: @@ -62,7 +62,7 @@ public: //void CustomSkin(PBYTE pbData, DWORD dwBytes); // 4J Overriding this so we can flag an event for the tutorial - virtual void ride(shared_ptr e); + virtual void ride(std::shared_ptr e); // 4J - added for the Stop Sleeping virtual void StopSleeping(); diff --git a/Minecraft.Client/Player/RemotePlayer.cpp b/Minecraft.Client/Player/RemotePlayer.cpp index d798a7513..0d9a6e977 100644 --- a/Minecraft.Client/Player/RemotePlayer.cpp +++ b/Minecraft.Client/Player/RemotePlayer.cpp @@ -3,7 +3,7 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.item.h" #include "../../Minecraft.World/Util/Mth.h" -RemotePlayer::RemotePlayer(Level *level, const wstring& name) : Player(level) +RemotePlayer::RemotePlayer(Level *level, const std::wstring& name) : Player(level) { // 4J - added initialisers hasStartedUsingItem = false; @@ -66,7 +66,7 @@ void RemotePlayer::tick() if (!hasStartedUsingItem && isUsingItemFlag() && inventory->items[inventory->selected] != NULL) { - shared_ptr item = inventory->items[inventory->selected]; + std::shared_ptr item = inventory->items[inventory->selected]; startUsingItem(inventory->items[inventory->selected], Item::items[item->id]->getUseDuration(item)); hasStartedUsingItem = true; } @@ -129,7 +129,7 @@ void RemotePlayer::aiStep() } // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game -void RemotePlayer::setEquippedSlot(int slot, shared_ptr item) +void RemotePlayer::setEquippedSlot(int slot, std::shared_ptr item) { if (slot == 0) { diff --git a/Minecraft.Client/Player/RemotePlayer.h b/Minecraft.Client/Player/RemotePlayer.h index 6a78bab63..7082a10c0 100644 --- a/Minecraft.Client/Player/RemotePlayer.h +++ b/Minecraft.Client/Player/RemotePlayer.h @@ -10,7 +10,7 @@ private: bool hasStartedUsingItem; public: Input *input; - RemotePlayer(Level *level, const wstring& name); + RemotePlayer(Level *level, const std::wstring& name); protected: virtual void setDefaultHeadHeight(); public: @@ -26,7 +26,7 @@ public: virtual void tick(); virtual float getShadowHeightOffs(); virtual void aiStep(); - virtual void setEquippedSlot(int slot, shared_ptr item);// 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game + virtual void setEquippedSlot(int slot, std::shared_ptr item);// 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game virtual void animateRespawn(); virtual float getHeadHeight(); bool hasPermission(EGameCommand command) { return false; } diff --git a/Minecraft.Client/Player/ServerPlayer.cpp b/Minecraft.Client/Player/ServerPlayer.cpp index fc5921d5e..0ac82bf3d 100644 --- a/Minecraft.Client/Player/ServerPlayer.cpp +++ b/Minecraft.Client/Player/ServerPlayer.cpp @@ -27,7 +27,7 @@ #include "../../Minecraft.World/Level/LevelChunk.h" #include "../Rendering/LevelRenderer.h" -ServerPlayer::ServerPlayer(MinecraftServer *server, Level *level, const wstring& name, ServerPlayerGameMode *gameMode) : Player(level) +ServerPlayer::ServerPlayer(MinecraftServer *server, Level *level, const std::wstring& name, ServerPlayerGameMode *gameMode) : Player(level) { // 4J - added initialisers connection = nullptr; @@ -236,10 +236,10 @@ void ServerPlayer::tick() for (int i = 0; i < 5; i++) { - shared_ptr currentCarried = getCarried(i); + std::shared_ptr currentCarried = getCarried(i); if (currentCarried != lastCarried[i]) { - getLevel()->getTracker()->broadcast(shared_from_this(), shared_ptr( new SetEquippedItemPacket(this->entityId, i, currentCarried) ) ); + getLevel()->getTracker()->broadcast(shared_from_this(), std::shared_ptr( new SetEquippedItemPacket(this->entityId, i, currentCarried) ) ); lastCarried[i] = currentCarried; } } @@ -253,7 +253,7 @@ void ServerPlayer::flushEntitiesToRemove() if (!entitiesToRemove.empty()) { int sz = entitiesToRemove.size(); - int amount = min(sz, RemoveEntitiesPacket::MAX_PER_PACKET); + int amount = std::min(sz, RemoveEntitiesPacket::MAX_PER_PACKET); intArray ids(amount); int pos = 0; @@ -264,7 +264,7 @@ void ServerPlayer::flushEntitiesToRemove() it = entitiesToRemove.erase(it); } - connection->send(shared_ptr(new RemoveEntitiesPacket(ids))); + connection->send(std::shared_ptr(new RemoveEntitiesPacket(ids))); } } @@ -286,14 +286,14 @@ void ServerPlayer::doTickA() for (unsigned int i = 0; i < inventory->getContainerSize(); i++) { - shared_ptr ie = inventory->getItem(i); + std::shared_ptr ie = inventory->getItem(i); if (ie != NULL) { // 4J - removed condition. These were getting lower priority than tile update packets etc. on the slow outbound queue, and so were extremely slow to send sometimes, // particularly at the start of a game. They don't typically seem to be massive and shouldn't be send when there isn't actually any updating to do. if (Item::items[ie->id]->isComplex() ) // && connection->countDelayedPackets() <= 2) { - shared_ptr packet = (dynamic_cast(Item::items[ie->id])->getUpdatePacket(ie, level, dynamic_pointer_cast( shared_from_this() ) ) ); + std::shared_ptr packet = (dynamic_cast(Item::items[ie->id])->getUpdatePacket(ie, level, std::dynamic_pointer_cast( shared_from_this() ) ) ); if (packet != NULL) { connection->send(packet); @@ -369,7 +369,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) okToSend = true; MinecraftServer::s_slowQueuePacketSent = true; -// static unordered_map mapLastTime; +// static std::unordered_map mapLastTime; // __int64 thisTime = System::currentTimeMillis(); // __int64 lastTime = mapLastTime[connection->getNetworkPlayer()->GetUID().toString()]; // app.DebugPrintf(" - OK to send (%d ms since last)\n", thisTime - lastTime); @@ -402,7 +402,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { // app.DebugPrintf("Creating BRUP for %d %d\n",nearest.x, nearest.z); PIXBeginNamedEvent(0,"Creation BRUP for sending\n"); - shared_ptr packet = shared_ptr( new BlockRegionUpdatePacket(nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level) ); + std::shared_ptr packet = std::shared_ptr( new BlockRegionUpdatePacket(nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level) ); PIXEndNamedEvent(); if( dontDelayChunks ) packet->shouldDelay = false; @@ -441,7 +441,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) // Don't send TileEntity data until we have sent the block data if( connection->isLocal() || chunkDataSent) { - vector > *tes = level->getTileEntitiesInRegion(nearest.x * 16, 0, nearest.z * 16, nearest.x * 16 + 16, Level::maxBuildHeight, nearest.z * 16 + 16); + std::vector > *tes = level->getTileEntitiesInRegion(nearest.x * 16, 0, nearest.z * 16, nearest.x * 16 + 16, Level::maxBuildHeight, nearest.z * 16 + 16); for (unsigned int i = 0; i < tes->size(); i++) { // 4J Stu - Added delay param to ensure that these arrive after the BRUPs from above @@ -474,7 +474,7 @@ void ServerPlayer::doTickB(bool ignorePortal) // { // if(level->dimension->id == 0 ) // { -// server->players->toggleDimension( dynamic_pointer_cast( shared_from_this() ), 1 ); +// server->players->toggleDimension( std::dynamic_pointer_cast( shared_from_this() ), 1 ); // } // unsigned int uiVal=app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()); // app.SetGameSettingsDebugMask(ProfileManager.GetPrimaryPad(),uiVal&~(1L<getPlayers()->toggleDimension( dynamic_pointer_cast( shared_from_this() ), targetDimension ); + server->getPlayers()->toggleDimension( std::dynamic_pointer_cast( shared_from_this() ), targetDimension ); lastSentExp = -1; lastSentHealth = -1; lastSentFood = -1; @@ -541,7 +541,7 @@ void ServerPlayer::doTickB(bool ignorePortal) if (getHealth() != lastSentHealth || lastSentFood != foodData.getFoodLevel() || ((foodData.getSaturationLevel() == 0) != lastFoodSaturationZero)) { // 4J Stu - Added m_lastDamageSource for telemetry - connection->send( shared_ptr( new SetHealthPacket(getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), m_lastDamageSource) ) ); + connection->send( std::shared_ptr( new SetHealthPacket(getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), m_lastDamageSource) ) ); lastSentHealth = getHealth(); lastSentFood = foodData.getFoodLevel(); lastFoodSaturationZero = foodData.getSaturationLevel() == 0; @@ -550,12 +550,12 @@ void ServerPlayer::doTickB(bool ignorePortal) if (totalExperience != lastSentExp) { lastSentExp = totalExperience; - connection->send( shared_ptr( new SetExperiencePacket(experienceProgress, totalExperience, experienceLevel) ) ); + connection->send( std::shared_ptr( new SetExperiencePacket(experienceProgress, totalExperience, experienceLevel) ) ); } } -shared_ptr ServerPlayer::getCarried(int slot) +std::shared_ptr ServerPlayer::getCarried(int slot) { if (slot == 0) return inventory->getSelected(); return inventory->armor[slot - 1]; @@ -563,7 +563,7 @@ shared_ptr ServerPlayer::getCarried(int slot) void ServerPlayer::die(DamageSource *source) { - server->getPlayers()->broadcastAll(source->getDeathMessagePacket(dynamic_pointer_cast(shared_from_this()))); + server->getPlayers()->broadcastAll(source->getDeathMessagePacket(std::dynamic_pointer_cast(shared_from_this()))); inventory->dropAll(); } @@ -575,18 +575,18 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, int dmg) { // 4J Stu - Fix for #46422 - TU5: Crash: Gameplay: Crash when being hit by a trap using a dispenser // getEntity returns the owner of projectiles, and this would never be the arrow. The owner is sometimes NULL. - shared_ptr source = dmgSource->getDirectEntity(); + std::shared_ptr source = dmgSource->getDirectEntity(); - if (dynamic_pointer_cast(source) != NULL && (!server->pvp || !dynamic_pointer_cast(source)->isAllowedToAttackPlayers()) ) + if (std::dynamic_pointer_cast(source) != NULL && (!server->pvp || !std::dynamic_pointer_cast(source)->isAllowedToAttackPlayers()) ) { return false; } if (source != NULL && source->GetType() == eTYPE_ARROW) { - shared_ptr arrow = dynamic_pointer_cast(source); - if (dynamic_pointer_cast(arrow->owner) != NULL && (!server->pvp || !dynamic_pointer_cast(arrow->owner)->isAllowedToAttackPlayers()) ) + std::shared_ptr arrow = std::dynamic_pointer_cast(source); + if (std::dynamic_pointer_cast(arrow->owner) != NULL && (!server->pvp || !std::dynamic_pointer_cast(arrow->owner)->isAllowedToAttackPlayers()) ) { return false; } @@ -608,7 +608,7 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, int dmg) else if(dmgSource == DamageSource::cactus) m_lastDamageSource = eTelemetryPlayerDeathSource_Cactus; else { - shared_ptr source = dmgSource->getEntity(); + std::shared_ptr source = dmgSource->getEntity(); if( source != NULL ) { switch(source->GetType()) @@ -645,9 +645,9 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, int dmg) m_lastDamageSource = eTelemetryPlayerDeathSource_Explosion_Tnt; break; case eTYPE_ARROW: - if ((dynamic_pointer_cast(source))->owner != NULL) + if ((std::dynamic_pointer_cast(source))->owner != NULL) { - shared_ptr attacker = (dynamic_pointer_cast(source))->owner; + std::shared_ptr attacker = (std::dynamic_pointer_cast(source))->owner; if (attacker != NULL) { switch(attacker->GetType()) @@ -696,19 +696,19 @@ void ServerPlayer::changeDimension(int i) level->removeEntity(shared_from_this()); wonGame = true; m_enteredEndExitPortal = true; // We only flag this for the player in the portal - connection->send( shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()) ) ); + connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()) ) ); app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex()); } if(thisPlayer != NULL) { for(AUTO_VAR(it, MinecraftServer::getInstance()->getPlayers()->players.begin()); it != MinecraftServer::getInstance()->getPlayers()->players.end(); ++it) { - shared_ptr servPlayer = *it; + std::shared_ptr servPlayer = *it; INetworkPlayer *checkPlayer = servPlayer->connection->getNetworkPlayer(); if(thisPlayer != checkPlayer && checkPlayer != NULL && thisPlayer->IsSameSystem( checkPlayer ) && !servPlayer->wonGame ) { servPlayer->wonGame = true; - servPlayer->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex() ) ) ); + servPlayer->connection->send( std::shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex() ) ) ); app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex()); } } @@ -725,7 +725,7 @@ void ServerPlayer::changeDimension(int i) connection->teleport(pos->x, pos->y, pos->z, 0, 0); delete pos; } - server->getPlayers()->toggleDimension( dynamic_pointer_cast(shared_from_this()), 1); + server->getPlayers()->toggleDimension( std::dynamic_pointer_cast(shared_from_this()), 1); lastSentExp = -1; lastSentHealth = -1; lastSentFood = -1; @@ -733,11 +733,11 @@ void ServerPlayer::changeDimension(int i) } // 4J Added delay param -void ServerPlayer::broadcast(shared_ptr te, bool delay /*= false*/) +void ServerPlayer::broadcast(std::shared_ptr te, bool delay /*= false*/) { if (te != NULL) { - shared_ptr p = te->getUpdatePacket(); + std::shared_ptr p = te->getUpdatePacket(); if (p != NULL) { p->shouldDelay = delay; @@ -747,22 +747,22 @@ void ServerPlayer::broadcast(shared_ptr te, bool delay /*= false*/) } } -void ServerPlayer::take(shared_ptr e, int orgCount) +void ServerPlayer::take(std::shared_ptr e, int orgCount) { if (!e->removed) { EntityTracker *entityTracker = getLevel()->getTracker(); if (e->GetType() == eTYPE_ITEMENTITY) { - entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); + entityTracker->broadcast(e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); } if (e->GetType() == eTYPE_ARROW) { - entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); + entityTracker->broadcast(e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); } if (e->GetType() == eTYPE_EXPERIENCEORB) { - entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); + entityTracker->broadcast(e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId) ) ); } } Player::take(e, orgCount); @@ -775,7 +775,7 @@ void ServerPlayer::swing() { swingTime = -1; swinging = true; - getLevel()->getTracker()->broadcast(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING) ) ); + getLevel()->getTracker()->broadcast(shared_from_this(), std::shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING) ) ); } } @@ -784,7 +784,7 @@ Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, boo BedSleepingResult result = Player::startSleepInBed(x, y, z, bTestUse); if (result == OK) { - shared_ptr p = shared_ptr( new EntityActionAtPositionPacket(shared_from_this(), EntityActionAtPositionPacket::START_SLEEP, x, y, z) ); + std::shared_ptr p = std::shared_ptr( new EntityActionAtPositionPacket(shared_from_this(), EntityActionAtPositionPacket::START_SLEEP, x, y, z) ); getLevel()->getTracker()->broadcast(shared_from_this(), p); connection->teleport(this->x, this->y, this->z, yRot, xRot); connection->send(p); @@ -796,16 +796,16 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo { if (isSleeping()) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::WAKE_UP) ) ); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::WAKE_UP) ) ); } Player::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint); if (connection != NULL) connection->teleport(x, y, z, yRot, xRot); } -void ServerPlayer::ride(shared_ptr e) +void ServerPlayer::ride(std::shared_ptr e) { Player::ride(e); - connection->send( shared_ptr( new SetRidingPacket(shared_from_this(), riding) ) ); + connection->send( std::shared_ptr( new SetRidingPacket(shared_from_this(), riding) ) ); // 4J Removed this - The act of riding will be handled on the client and will change the position // of the player. If we also teleport it then we can end up with a repeating movements, e.g. bouncing @@ -832,7 +832,7 @@ bool ServerPlayer::startCrafting(int x, int y, int z) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::WORKBENCH, 0, 9) ) ); + connection->send( std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::WORKBENCH, 0, 9) ) ); containerMenu = new CraftingMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -850,7 +850,7 @@ bool ServerPlayer::startEnchanting(int x, int y, int z) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::ENCHANTMENT, 0, 9) )); + connection->send(std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::ENCHANTMENT, 0, 9) )); containerMenu = new EnchantmentMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -868,8 +868,8 @@ bool ServerPlayer::startRepairing(int x, int y, int z) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(shared_ptr ( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::REPAIR_TABLE, 0, 9)) ); - containerMenu = new RepairMenu(inventory, level, x, y, z, dynamic_pointer_cast(shared_from_this())); + connection->send(std::shared_ptr ( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::REPAIR_TABLE, 0, 9)) ); + containerMenu = new RepairMenu(inventory, level, x, y, z, std::dynamic_pointer_cast(shared_from_this())); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } @@ -881,12 +881,12 @@ bool ServerPlayer::startRepairing(int x, int y, int z) return true; } -bool ServerPlayer::openContainer(shared_ptr container) +bool ServerPlayer::openContainer(std::shared_ptr container) { if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::CONTAINER, container->getName(), container->getContainerSize()) ) ); + connection->send( std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::CONTAINER, container->getName(), container->getContainerSize()) ) ); containerMenu = new ContainerMenu(inventory, container); containerMenu->containerId = containerCounter; @@ -900,12 +900,12 @@ bool ServerPlayer::openContainer(shared_ptr container) return true; } -bool ServerPlayer::openFurnace(shared_ptr furnace) +bool ServerPlayer::openFurnace(std::shared_ptr furnace) { if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FURNACE, 0, furnace->getContainerSize()) ) ); + connection->send( std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FURNACE, 0, furnace->getContainerSize()) ) ); containerMenu = new FurnaceMenu(inventory, furnace); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -918,12 +918,12 @@ bool ServerPlayer::openFurnace(shared_ptr furnace) return true; } -bool ServerPlayer::openTrap(shared_ptr trap) +bool ServerPlayer::openTrap(std::shared_ptr trap) { if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRAP, 0, trap->getContainerSize()) ) ); + connection->send( std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRAP, 0, trap->getContainerSize()) ) ); containerMenu = new TrapMenu(inventory, trap); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -936,12 +936,12 @@ bool ServerPlayer::openTrap(shared_ptr trap) return true; } -bool ServerPlayer::openBrewingStand(shared_ptr brewingStand) +bool ServerPlayer::openBrewingStand(std::shared_ptr brewingStand) { if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::BREWING_STAND, 0, brewingStand->getContainerSize()))); + connection->send(std::shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::BREWING_STAND, 0, brewingStand->getContainerSize()))); containerMenu = new BrewingStandMenu(inventory, brewingStand); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -954,7 +954,7 @@ bool ServerPlayer::openBrewingStand(shared_ptr brewingSt return true; } -bool ServerPlayer::openTrading(shared_ptr traderTarget) +bool ServerPlayer::openTrading(std::shared_ptr traderTarget) { if(containerMenu == inventoryMenu) { @@ -962,11 +962,11 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget) containerMenu = new MerchantMenu(inventory, traderTarget, level); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); - shared_ptr container = ((MerchantMenu *) containerMenu)->getTradeContainer(); + std::shared_ptr container = ((MerchantMenu *) containerMenu)->getTradeContainer(); - connection->send(shared_ptr(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRADER_NPC, container->getName(), container->getContainerSize()))); + connection->send(std::shared_ptr(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRADER_NPC, container->getName(), container->getContainerSize()))); - MerchantRecipeList *offers = traderTarget->getOffers(dynamic_pointer_cast(shared_from_this())); + MerchantRecipeList *offers = traderTarget->getOffers(std::dynamic_pointer_cast(shared_from_this())); if (offers != NULL) { ByteArrayOutputStream rawOutput; @@ -976,7 +976,7 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget) output.writeInt(containerCounter); offers->writeToStream(&output); - connection->send(shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_LIST_PACKET, rawOutput.toByteArray()))); + connection->send(std::shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_LIST_PACKET, rawOutput.toByteArray()))); } } else @@ -987,7 +987,7 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget) return true; } -void ServerPlayer::slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr item) +void ServerPlayer::slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr item) { if (dynamic_cast(container->getSlot(slotIndex))) { @@ -1004,21 +1004,21 @@ void ServerPlayer::slotChanged(AbstractContainerMenu *container, int slotIndex, return; } - connection->send( shared_ptr( new ContainerSetSlotPacket(container->containerId, slotIndex, item) ) ); + connection->send( std::shared_ptr( new ContainerSetSlotPacket(container->containerId, slotIndex, item) ) ); } void ServerPlayer::refreshContainer(AbstractContainerMenu *menu) { - vector > *items = menu->getItems(); + std::vector > *items = menu->getItems(); refreshContainer(menu, items); delete items; } -void ServerPlayer::refreshContainer(AbstractContainerMenu *container, vector > *items) +void ServerPlayer::refreshContainer(AbstractContainerMenu *container, std::vector > *items) { - connection->send( shared_ptr( new ContainerSetContentPacket(container->containerId, items) ) ); - connection->send( shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); + connection->send( std::shared_ptr( new ContainerSetContentPacket(container->containerId, items) ) ); + connection->send( std::shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); } void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, int value) @@ -1033,12 +1033,12 @@ void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, in // client again. return; } - connection->send( shared_ptr( new ContainerSetDataPacket(container->containerId, id, value) ) ); + connection->send( std::shared_ptr( new ContainerSetDataPacket(container->containerId, id, value) ) ); } void ServerPlayer::closeContainer() { - connection->send( shared_ptr( new ContainerClosePacket(containerMenu->containerId) ) ); + connection->send( std::shared_ptr( new ContainerClosePacket(containerMenu->containerId) ) ); doCloseContainer(); } @@ -1052,12 +1052,12 @@ void ServerPlayer::broadcastCarriedItem() // client again. return; } - connection->send( shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); + connection->send( std::shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); } void ServerPlayer::doCloseContainer() { - containerMenu->removed( dynamic_pointer_cast( shared_from_this() ) ); + containerMenu->removed( std::dynamic_pointer_cast( shared_from_this() ) ); containerMenu = inventoryMenu; } @@ -1087,12 +1087,12 @@ void ServerPlayer::awardStat(Stat *stat, byteArray param) while (count > 100) { - connection->send( shared_ptr( new AwardStatPacket(stat->id, 100) ) ); + connection->send( std::shared_ptr( new AwardStatPacket(stat->id, 100) ) ); count -= 100; } - connection->send( shared_ptr( new AwardStatPacket(stat->id, count) ) ); + connection->send( std::shared_ptr( new AwardStatPacket(stat->id, count) ) ); #else - connection->send( shared_ptr( new AwardStatPacket(stat->id, param) ) ); + connection->send( std::shared_ptr( new AwardStatPacket(stat->id, param) ) ); // byteArray deleted in AwardStatPacket destructor. #endif } @@ -1122,33 +1122,33 @@ void ServerPlayer::displayClientMessage(int messageId) { case IDS_TILE_BED_OCCUPIED: messageType = ChatPacket::e_ChatBedOccupied; - connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_NO_SLEEP: messageType = ChatPacket::e_ChatBedNoSleep; - connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_NOT_VALID: messageType = ChatPacket::e_ChatBedNotValid; - connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_NOTSAFE: messageType = ChatPacket::e_ChatBedNotSafe; - connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_PLAYERSLEEP: messageType = ChatPacket::e_ChatBedPlayerSleep; // broadcast to all the other players in the game for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()!=player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatBedPlayerSleep))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatBedPlayerSleep))); } else { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatBedMeSleep))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatBedMeSleep))); } } return; @@ -1156,85 +1156,85 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_PLAYER_ENTERED_END: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()!=player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerEnteredEnd))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerEnteredEnd))); } } break; case IDS_PLAYER_LEFT_END: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()!=player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerLeftEnd))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerLeftEnd))); } } break; case IDS_TILE_BED_MESLEEP: messageType = ChatPacket::e_ChatBedMeSleep; - connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxPigsSheepCows))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxPigsSheepCows))); } } break; case IDS_MAX_CHICKENS_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxChickens))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxChickens))); } } break; case IDS_MAX_SQUID_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxSquid))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxSquid))); } } break; case IDS_MAX_WOLVES_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxWolves))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxWolves))); } } break; case IDS_MAX_MOOSHROOMS_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxMooshrooms))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxMooshrooms))); } } break; case IDS_MAX_ENEMIES_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxEnemies))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxEnemies))); } } break; @@ -1242,40 +1242,40 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_MAX_VILLAGERS_SPAWNED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxVillagers))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxVillagers))); } } break; case IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredPigsSheepCows))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredPigsSheepCows))); } } break; case IDS_MAX_CHICKENS_BRED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredChickens))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredChickens))); } } break; case IDS_MAX_MUSHROOMCOWS_BRED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredMooshrooms))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredMooshrooms))); } } break; @@ -1283,10 +1283,10 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_MAX_WOLVES_BRED: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredWolves))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredWolves))); } } break; @@ -1294,10 +1294,10 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_CANT_SHEAR_MOOSHROOM: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerCantShearMooshroom))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerCantShearMooshroom))); } } break; @@ -1306,20 +1306,20 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_MAX_HANGINGENTITIES: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxHangingEntities))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxHangingEntities))); } } break; case IDS_CANT_SPAWN_IN_PEACEFUL: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerCantSpawnInPeaceful))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerCantSpawnInPeaceful))); } } break; @@ -1327,10 +1327,10 @@ void ServerPlayer::displayClientMessage(int messageId) case IDS_MAX_BOATS: for (unsigned int i = 0; i < server->getPlayers()->players.size(); i++) { - shared_ptr player = server->getPlayers()->players[i]; + std::shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBoats))); + player->connection->send(std::shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBoats))); } } break; @@ -1342,53 +1342,53 @@ void ServerPlayer::displayClientMessage(int messageId) } //Language *language = Language::getInstance(); - //wstring languageString = app.GetString(messageId);//language->getElement(messageId); - //connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); + //std::wstring languageString = app.GetString(messageId);//language->getElement(messageId); + //connection->send( std::shared_ptr( new ChatPacket(L"", messageType) ) ); } void ServerPlayer::completeUsingItem() { - connection->send(shared_ptr( new EntityEventPacket(entityId, EntityEvent::USE_ITEM_COMPLETE) ) ); + connection->send(std::shared_ptr( new EntityEventPacket(entityId, EntityEvent::USE_ITEM_COMPLETE) ) ); Player::completeUsingItem(); } -void ServerPlayer::startUsingItem(shared_ptr instance, int duration) +void ServerPlayer::startUsingItem(std::shared_ptr instance, int duration) { Player::startUsingItem(instance, duration); if (instance != NULL && instance->getItem() != NULL && instance->getItem()->getUseAnimation(instance) == UseAnim_eat) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::EAT) ) ); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::EAT) ) ); } } -void ServerPlayer::restoreFrom(shared_ptr oldPlayer, bool restoreAll) +void ServerPlayer::restoreFrom(std::shared_ptr oldPlayer, bool restoreAll) { Player::restoreFrom(oldPlayer, restoreAll); lastSentExp = -1; lastSentHealth = -1; lastSentFood = -1; - entitiesToRemove = dynamic_pointer_cast(oldPlayer)->entitiesToRemove; + entitiesToRemove = std::dynamic_pointer_cast(oldPlayer)->entitiesToRemove; } void ServerPlayer::onEffectAdded(MobEffectInstance *effect) { Player::onEffectAdded(effect); - connection->send(shared_ptr( new UpdateMobEffectPacket(entityId, effect) ) ); + connection->send(std::shared_ptr( new UpdateMobEffectPacket(entityId, effect) ) ); } void ServerPlayer::onEffectUpdated(MobEffectInstance *effect) { Player::onEffectUpdated(effect); - connection->send(shared_ptr( new UpdateMobEffectPacket(entityId, effect) ) ); + connection->send(std::shared_ptr( new UpdateMobEffectPacket(entityId, effect) ) ); } void ServerPlayer::onEffectRemoved(MobEffectInstance *effect) { Player::onEffectRemoved(effect); - connection->send(shared_ptr( new RemoveMobEffectPacket(entityId, effect) ) ); + connection->send(std::shared_ptr( new RemoveMobEffectPacket(entityId, effect) ) ); } void ServerPlayer::teleportTo(double x, double y, double z) @@ -1396,20 +1396,20 @@ void ServerPlayer::teleportTo(double x, double y, double z) connection->teleport(x, y, z, yRot, xRot); } -void ServerPlayer::crit(shared_ptr entity) +void ServerPlayer::crit(std::shared_ptr entity) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(entity, AnimatePacket::CRITICAL_HIT) )); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::shared_ptr( new AnimatePacket(entity, AnimatePacket::CRITICAL_HIT) )); } -void ServerPlayer::magicCrit(shared_ptr entity) +void ServerPlayer::magicCrit(std::shared_ptr entity) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(entity, AnimatePacket::MAGIC_CRITICAL_HIT) )); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::shared_ptr( new AnimatePacket(entity, AnimatePacket::MAGIC_CRITICAL_HIT) )); } void ServerPlayer::onUpdateAbilities() { if (connection == NULL) return; - connection->send(shared_ptr(new PlayerAbilitiesPacket(&abilities))); + connection->send(std::shared_ptr(new PlayerAbilitiesPacket(&abilities))); } ServerLevel *ServerPlayer::getLevel() @@ -1420,21 +1420,21 @@ ServerLevel *ServerPlayer::getLevel() void ServerPlayer::setGameMode(GameType *mode) { gameMode->setGameModeForPlayer(mode); - connection->send(shared_ptr(new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, mode->getId()))); + connection->send(std::shared_ptr(new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, mode->getId()))); } -void ServerPlayer::sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type /*= e_ChatCustom*/, int customData /*= -1*/, const wstring& additionalMessage /*= L""*/) +void ServerPlayer::sendMessage(const std::wstring& message, ChatPacket::EChatPacketMessage type /*= e_ChatCustom*/, int customData /*= -1*/, const std::wstring& additionalMessage /*= L""*/) { - connection->send(shared_ptr(new ChatPacket(message,type,customData,additionalMessage))); + connection->send(std::shared_ptr(new ChatPacket(message,type,customData,additionalMessage))); } bool ServerPlayer::hasPermission(EGameCommand command) { - return server->getPlayers()->isOp(dynamic_pointer_cast(shared_from_this())); + return server->getPlayers()->isOp(std::dynamic_pointer_cast(shared_from_this())); } // 4J - Don't use -//void ServerPlayer::updateOptions(shared_ptr packet) +//void ServerPlayer::updateOptions(std::shared_ptr packet) //{ // // 4J - Don't need // //if (language.getLanguageList().containsKey(packet.getLanguage())) @@ -1502,7 +1502,7 @@ int ServerPlayer::getPlayerViewDistanceModifier() return value; } -void ServerPlayer::handleCollectItem(shared_ptr item) +void ServerPlayer::handleCollectItem(std::shared_ptr item) { if(gameMode->getGameRules() != NULL) gameMode->getGameRules()->onCollectItem(item); } diff --git a/Minecraft.Client/Player/ServerPlayer.h b/Minecraft.Client/Player/ServerPlayer.h index c01371d9c..378186ebb 100644 --- a/Minecraft.Client/Player/ServerPlayer.h +++ b/Minecraft.Client/Player/ServerPlayer.h @@ -11,19 +11,19 @@ class TileEntity; class Entity; class BrewingStandTileEntity; class Merchant; -using namespace std; + class ServerPlayer : public Player, public net_minecraft_world_inventory::ContainerListener { public: eINSTANCEOF GetType() { return eTYPE_SERVERPLAYER; } - shared_ptr connection; + std::shared_ptr connection; MinecraftServer *server; ServerPlayerGameMode *gameMode; double lastMoveX, lastMoveZ; - list chunksToSend; - vector entitiesToRemove; - unordered_set seenChunks; + std::list chunksToSend; + std::vector entitiesToRemove; + std::unordered_set seenChunks; int spewTimer; // 4J-Added, for 'Adventure Time' achievement. @@ -39,7 +39,7 @@ private: int lastBrupSendTickCount; // 4J Added public: - ServerPlayer(MinecraftServer *server, Level *level, const wstring& name, ServerPlayerGameMode *gameMode); + ServerPlayer(MinecraftServer *server, Level *level, const std::wstring& name, ServerPlayerGameMode *gameMode); ~ServerPlayer(); void flagEntitiesToBeRemoved(unsigned int *flags, bool *removedFound); // 4J added @@ -59,7 +59,7 @@ public: virtual float getHeadHeight(); virtual void tick(); void flushEntitiesToRemove(); - virtual shared_ptr getCarried(int slot); + virtual std::shared_ptr getCarried(int slot); virtual void die(DamageSource *source); virtual bool hurt(DamageSource *dmgSource, int dmg); virtual bool isPlayerVersusPlayer(); @@ -69,15 +69,15 @@ public: void doTickB(bool ignorePortal); virtual void changeDimension(int i); private: - void broadcast(shared_ptr te, bool delay = false); + void broadcast(std::shared_ptr te, bool delay = false); public: - virtual void take(shared_ptr e, int orgCount); + virtual void take(std::shared_ptr e, int orgCount); virtual void swing(); virtual BedSleepingResult startSleepInBed(int x, int y, int z, bool bTestUse = false); public: virtual void stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool saveRespawnPoint); - virtual void ride(shared_ptr e); + virtual void ride(std::shared_ptr e); protected: virtual void checkFallDamage(double ya, bool onGround); public: @@ -97,14 +97,14 @@ public: virtual bool startCrafting(int x, int y, int z); // 4J added bool return virtual bool startEnchanting(int x, int y, int z); // 4J added bool return virtual bool startRepairing(int x, int y, int z); // 4J added bool return - virtual bool openContainer(shared_ptr container); // 4J added bool return - virtual bool openFurnace(shared_ptr furnace); // 4J added bool return - virtual bool openTrap(shared_ptr trap); // 4J added bool return - virtual bool openBrewingStand(shared_ptr brewingStand); // 4J added bool return - virtual bool openTrading(shared_ptr traderTarget); // 4J added bool return - virtual void slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr item); + virtual bool openContainer(std::shared_ptr container); // 4J added bool return + virtual bool openFurnace(std::shared_ptr furnace); // 4J added bool return + virtual bool openTrap(std::shared_ptr trap); // 4J added bool return + virtual bool openBrewingStand(std::shared_ptr brewingStand); // 4J added bool return + virtual bool openTrading(std::shared_ptr traderTarget); // 4J added bool return + virtual void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr item); void refreshContainer(AbstractContainerMenu *menu); - virtual void refreshContainer(AbstractContainerMenu *container, vector > *items); + virtual void refreshContainer(AbstractContainerMenu *container, std::vector > *items); virtual void setContainerData(AbstractContainerMenu *container, int id, int value); virtual void closeContainer(); void broadcastCarriedItem(); @@ -121,8 +121,8 @@ protected: virtual void completeUsingItem(); public: - virtual void startUsingItem(shared_ptr instance, int duration); - virtual void restoreFrom(shared_ptr oldPlayer, bool restoreAll); + virtual void startUsingItem(std::shared_ptr instance, int duration); + virtual void restoreFrom(std::shared_ptr oldPlayer, bool restoreAll); protected: virtual void onEffectAdded(MobEffectInstance *effect); @@ -131,16 +131,16 @@ protected: public: virtual void teleportTo(double x, double y, double z); - virtual void crit(shared_ptr entity); - virtual void magicCrit(shared_ptr entity); + virtual void crit(std::shared_ptr entity); + virtual void magicCrit(std::shared_ptr entity); void onUpdateAbilities(); ServerLevel *getLevel(); void setGameMode(GameType *mode); - void sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom, int customData = -1, const wstring& additionalMessage = L""); + void sendMessage(const std::wstring& message, ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom, int customData = -1, const std::wstring& additionalMessage = L""); bool hasPermission(EGameCommand command); // 4J - Don't use - //void updateOptions(shared_ptr packet); + //void updateOptions(std::shared_ptr packet); int getViewDistance(); //bool canChatInColor(); //int getChatVisibility(); @@ -152,7 +152,7 @@ public: public: // 4J Stu - Added hooks for the game rules - virtual void handleCollectItem(shared_ptr item); + virtual void handleCollectItem(std::shared_ptr item); #ifndef _CONTENT_PACKAGE void debug_setPosition(double,double,double,double,double); diff --git a/Minecraft.Client/Player/ServerPlayerGameMode.cpp b/Minecraft.Client/Player/ServerPlayerGameMode.cpp index 75d5e38b3..eee12430f 100644 --- a/Minecraft.Client/Player/ServerPlayerGameMode.cpp +++ b/Minecraft.Client/Player/ServerPlayerGameMode.cpp @@ -247,7 +247,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) if( isCreative() ) { clientToUpdateRenderer = true; - if( dynamic_pointer_cast(player)->connection->isLocal() ) + if( std::dynamic_pointer_cast(player)->connection->isLocal() ) { // Establish whether we are sharing this chunk between client & server MultiPlayerLevel *clientLevel = Minecraft::GetInstance()->getLevel(level->dimension->id); @@ -272,7 +272,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) if (isCreative()) { - shared_ptr tup = shared_ptr( new TileUpdatePacket(x, y, z, level) ); + std::shared_ptr tup = std::shared_ptr( new TileUpdatePacket(x, y, z, level) ); // 4J - a bit of a hack here, but if we want to tell the client that it needs to inform the renderer of a block being destroyed, then send a block 255 instead of a 0. This is handled in ClientConnection::handleTileUpdate if( tup->block == 0 ) { @@ -282,7 +282,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) } else { - shared_ptr item = player->getSelectedItem(); + std::shared_ptr item = player->getSelectedItem(); bool canDestroy = player->canDestroy(Tile::tiles[t]); if (item != NULL) { @@ -301,13 +301,13 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) } -bool ServerPlayerGameMode::useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly) +bool ServerPlayerGameMode::useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly) { if(!player->isAllowedToUse(item)) return false; int oldCount = item->count; int oldAux = item->getAuxValue(); - shared_ptr itemInstance = item->use(level, player); + std::shared_ptr itemInstance = item->use(level, player); if ((itemInstance != NULL && itemInstance != item) || (itemInstance != NULL && itemInstance->count != oldCount) || (itemInstance != NULL && itemInstance->getUseDuration() > 0)) { player->inventory->items[player->inventory->selected] = itemInstance; @@ -326,7 +326,7 @@ bool ServerPlayerGameMode::useItem(shared_ptr player, Level *level, shar } -bool ServerPlayerGameMode::useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly, bool *pbUsedItem) +bool ServerPlayerGameMode::useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly, bool *pbUsedItem) { // 4J-PB - Adding a test only version to allow tooltips to be displayed int t = level->getTile(x, y, z); diff --git a/Minecraft.Client/Player/ServerPlayerGameMode.h b/Minecraft.Client/Player/ServerPlayerGameMode.h index 89b9e9b44..c590f11e8 100644 --- a/Minecraft.Client/Player/ServerPlayerGameMode.h +++ b/Minecraft.Client/Player/ServerPlayerGameMode.h @@ -10,7 +10,7 @@ class ServerPlayerGameMode { public: Level *level; - shared_ptr player; + std::shared_ptr player; private: GameType *gameModeForPlayer; @@ -53,8 +53,8 @@ private: public: bool destroyBlock(int x, int y, int z); - bool useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly=false); - bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false, bool *pbUsedItem=NULL); + bool useItem(std::shared_ptr player, Level *level, std::shared_ptr item, bool bTestUseOnly=false); + bool useItemOn(std::shared_ptr player, Level *level, std::shared_ptr item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false, bool *pbUsedItem=NULL); void setLevel(ServerLevel *newLevel); }; \ No newline at end of file diff --git a/Minecraft.Client/Player/TrackedEntity.cpp b/Minecraft.Client/Player/TrackedEntity.cpp index 9114eec32..3d456f6b3 100644 --- a/Minecraft.Client/Player/TrackedEntity.cpp +++ b/Minecraft.Client/Player/TrackedEntity.cpp @@ -22,7 +22,7 @@ #include #endif // __linux__ -TrackedEntity::TrackedEntity(shared_ptr e, int range, int updateInterval, bool trackDelta) +TrackedEntity::TrackedEntity(std::shared_ptr e, int range, int updateInterval, bool trackDelta) { // 4J added initialisers xap = yap = zap = 0; @@ -48,7 +48,7 @@ TrackedEntity::TrackedEntity(shared_ptr e, int range, int updateInterval int c0a = 0, c0b = 0, c1a = 0, c1b = 0, c1c = 0, c2a = 0, c2b = 0; -void TrackedEntity::tick(EntityTracker *tracker, vector > *players) +void TrackedEntity::tick(EntityTracker *tracker, std::vector > *players) { moved = false; if (!updatedPlayerVisibility || e->distanceToSqr(xpu, ypu, zpu) > 4 * 4) @@ -64,35 +64,35 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl if (wasRiding != e->riding) { wasRiding = e->riding; - broadcast(shared_ptr(new SetRidingPacket(e, e->riding))); + broadcast(std::shared_ptr(new SetRidingPacket(e, e->riding))); } // Moving forward special case for item frames if (e->GetType()== eTYPE_ITEM_FRAME && tickCount % 10 == 0) { - shared_ptr frame = dynamic_pointer_cast (e); - shared_ptr item = frame->getItem(); + std::shared_ptr frame = std::dynamic_pointer_cast (e); + std::shared_ptr item = frame->getItem(); if (item != NULL && item->getItem()->id == Item::map_Id && !e->removed) { - shared_ptr data = Item::map->getSavedData(item, e->level); + std::shared_ptr data = Item::map->getSavedData(item, e->level); for (AUTO_VAR(it,players->begin() ); it != players->end(); ++it) { - shared_ptr player = dynamic_pointer_cast(*it); + std::shared_ptr player = std::dynamic_pointer_cast(*it); data->tickCarriedBy(player, item); if (!player->removed && player->connection && player->connection->countDelayedPackets() <= 5) { - shared_ptr packet = Item::map->getUpdatePacket(item, e->level, player); + std::shared_ptr packet = Item::map->getUpdatePacket(item, e->level, player); if (packet != NULL) player->connection->send(packet); } } } - shared_ptr entityData = e->getEntityData(); + std::shared_ptr entityData = e->getEntityData(); if (entityData->isDirty()) { - broadcastAndSend( shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); + broadcastAndSend( std::shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); } } else @@ -113,7 +113,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl int ya = yn - yp; int za = zn - zp; - shared_ptr packet = nullptr; + std::shared_ptr packet = nullptr; // 4J - this pos flag used to be set based on abs(xn) etc. but that just seems wrong bool pos = abs(xa) >= TOLERANCE_LEVEL || abs(ya) >= TOLERANCE_LEVEL || abs(za) >= TOLERANCE_LEVEL; @@ -136,7 +136,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ) { teleportDelay = 0; - packet = shared_ptr( new TeleportEntityPacket(e->entityId, xn, yn, zn, (uint8_t) yRotn, (uint8_t) xRotn) ); + packet = std::shared_ptr( new TeleportEntityPacket(e->entityId, xn, yn, zn, (uint8_t) yRotn, (uint8_t) xRotn) ); // printf("%d: New teleport rot %d\n",e->entityId,yRotn); yRotp = yRotn; xRotp = xRotn; @@ -163,12 +163,12 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl yRotn = yRotp + yRota; } // 5 bits each for x & z, and 6 for y - packet = shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, 0 ) ); + packet = std::shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, 0 ) ); c0a++; } else { - packet = shared_ptr( new MoveEntityPacket::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, (char) xRota) ); + packet = std::shared_ptr( new MoveEntityPacket::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, (char) xRota) ); // printf("%d: New posrot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn); c0b++; } @@ -181,7 +181,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ( ya >= -16 ) && ( ya <= 15 ) ) { // 4 bits each for x & z, and 5 for y - packet = shared_ptr( new MoveEntityPacketSmall::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); + packet = std::shared_ptr( new MoveEntityPacketSmall::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); c1a++; } @@ -190,12 +190,12 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ( ya >= -32 ) && ( ya <= 31 ) ) { // use the packet with small packet with rotation if we can - 5 bits each for x & z, and 6 for y - still a byte less than the alternative - packet = shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, 0, 0 )); + packet = std::shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, 0, 0 )); c1b++; } else { - packet = shared_ptr( new MoveEntityPacket::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); + packet = std::shared_ptr( new MoveEntityPacket::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); c1c++; } } @@ -215,13 +215,13 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl yRota = 15; yRotn = yRotp + yRota; } - packet = shared_ptr( new MoveEntityPacketSmall::Rot(e->entityId, (char) yRota, 0) ); + packet = std::shared_ptr( new MoveEntityPacketSmall::Rot(e->entityId, (char) yRota, 0) ); c2a++; } else { // printf("%d: New rot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn); - packet = shared_ptr( new MoveEntityPacket::Rot(e->entityId, (char) yRota, (char) xRota) ); + packet = std::shared_ptr( new MoveEntityPacket::Rot(e->entityId, (char) yRota, (char) xRota) ); c2b++; } } @@ -242,7 +242,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl xap = e->xd; yap = e->yd; zap = e->zd; - broadcast( shared_ptr( new SetEntityMotionPacket(e->entityId, xap, yap, zap) ) ); + broadcast( std::shared_ptr( new SetEntityMotionPacket(e->entityId, xap, yap, zap) ) ); } } @@ -252,17 +252,17 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl broadcast(packet); } - shared_ptr entityData = e->getEntityData(); + std::shared_ptr entityData = e->getEntityData(); if (entityData->isDirty()) { - broadcastAndSend( shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); + broadcastAndSend( std::shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); } int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360); if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL) { - broadcast(shared_ptr(new RotateHeadPacket(e->entityId, (uint8_t) yHeadRot))); + broadcast(std::shared_ptr(new RotateHeadPacket(e->entityId, (uint8_t) yHeadRot))); yHeadRotp = yHeadRot; } @@ -278,7 +278,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl xRotp = xRotn; } - // if( dynamic_pointer_cast(e) != NULL ) + // if( std::dynamic_pointer_cast(e) != NULL ) // { // printf("%d: %d + %d = %d (%f)\n",e->entityId,xRotp,xRota,xRotn,e->xRot); // } @@ -287,9 +287,9 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl } else // 4J-JEV: Added: Mobs in minecarts weren't synching their invisibility. { - shared_ptr entityData = e->getEntityData(); + std::shared_ptr entityData = e->getEntityData(); if (entityData->isDirty()) - broadcastAndSend( shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); + broadcastAndSend( std::shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); } e->hasImpulse = false; } @@ -297,18 +297,18 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl if (e->hurtMarked) { // broadcast(new AnimatePacket(e, AnimatePacket.HURT)); - broadcastAndSend( shared_ptr( new SetEntityMotionPacket(e) ) ); + broadcastAndSend( std::shared_ptr( new SetEntityMotionPacket(e) ) ); e->hurtMarked = false; } } -void TrackedEntity::broadcast(shared_ptr packet) +void TrackedEntity::broadcast(std::shared_ptr packet) { if( Packet::canSendToAnyClient( packet ) ) { // 4J-PB - due to the knockback on a player being hit, we need to send to all players, but limit the network traffic here to players that have not already had it sent to their system - vector< shared_ptr > sentTo; + std::vector< std::shared_ptr > sentTo; // 4J - don't send to a player we've already sent this data to that shares the same machine. // EntityMotionPacket used to limit themselves to sending once to each machine @@ -318,7 +318,7 @@ void TrackedEntity::broadcast(shared_ptr packet) for( AUTO_VAR(it, seenBy.begin()); it != seenBy.end(); it++ ) { - shared_ptr player = *it; + std::shared_ptr player = *it; bool dontSend = false; if( sentTo.size() ) { @@ -331,13 +331,13 @@ void TrackedEntity::broadcast(shared_ptr packet) { for(unsigned int j = 0; j < sentTo.size(); j++ ) { - shared_ptr player2 = sentTo[j]; + std::shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { dontSend = true; // #ifdef _DEBUG - // shared_ptr emp= dynamic_pointer_cast (packet); + // std::shared_ptr emp= std::dynamic_pointer_cast (packet); // if(emp!=NULL) // { // app.DebugPrintf("Not sending this SetEntityMotionPacket to player - it's already been sent to a player on their console\n"); @@ -368,11 +368,11 @@ void TrackedEntity::broadcast(shared_ptr packet) } } -void TrackedEntity::broadcastAndSend(shared_ptr packet) +void TrackedEntity::broadcastAndSend(std::shared_ptr packet) { - vector< shared_ptr > sentTo; + std::vector< std::shared_ptr > sentTo; broadcast(packet); - shared_ptr sp = dynamic_pointer_cast(e); + std::shared_ptr sp = std::dynamic_pointer_cast(e); if (sp != NULL && sp->connection) { sp->connection->send(packet); @@ -387,7 +387,7 @@ void TrackedEntity::broadcastRemoved() } } -void TrackedEntity::removePlayer(shared_ptr sp) +void TrackedEntity::removePlayer(std::shared_ptr sp) { AUTO_VAR(it, seenBy.find( sp )); if( it != seenBy.end() ) @@ -397,7 +397,7 @@ void TrackedEntity::removePlayer(shared_ptr sp) } // 4J-JEV: Added for code reuse. -TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shared_ptr sp, bool forRider) +TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, std::shared_ptr sp, bool forRider) { // 4J Stu - We call update players when the entity has moved more than a certain amount at the start of it's tick // Before this call we set xpu, ypu and zpu to the entities new position, but xp,yp and zp are the old position until later in the tick. @@ -426,7 +426,7 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar for( unsigned int i = 0; i < server->getPlayers()->players.size(); i++ ) { // Consider extra players, but not if they are the entity we are tracking, or the player we've been passed as input, or in another dimension - shared_ptr ep = server->getPlayers()->players[i]; + std::shared_ptr ep = server->getPlayers()->players[i]; if( ep == sp ) continue; if( ep == e ) continue; if( ep->dimension != sp->dimension ) continue; @@ -463,7 +463,7 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar else return eVisibility_NotVisible; } -void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr sp) +void TrackedEntity::updatePlayer(EntityTracker *tracker, std::shared_ptr sp) { if (sp == e) return; @@ -473,14 +473,14 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr packet = getAddEntityPacket(); + std::shared_ptr packet = getAddEntityPacket(); sp->connection->send(packet); xap = e->xd; yap = e->yd; zap = e->zd; - shared_ptr plr = dynamic_pointer_cast(e); + std::shared_ptr plr = std::dynamic_pointer_cast(e); if (plr != NULL) { app.DebugPrintf( "TrackedEntity:: Player '%ls' is now visible to player '%ls', %s.\n", @@ -490,19 +490,19 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptrgetEntityData()->isEmpty() && !(dynamic_pointer_cast(packet))) + if (!e->getEntityData()->isEmpty() && !(std::dynamic_pointer_cast(packet))) { - sp->connection->send(shared_ptr( new SetEntityDataPacket(e->entityId, e->getEntityData(), true))); + sp->connection->send(std::shared_ptr( new SetEntityDataPacket(e->entityId, e->getEntityData(), true))); } if (this->trackDelta) { - sp->connection->send( shared_ptr( new SetEntityMotionPacket(e->entityId, e->xd, e->yd, e->zd) ) ); + sp->connection->send( std::shared_ptr( new SetEntityMotionPacket(e->entityId, e->xd, e->yd, e->zd) ) ); } if (e->riding != NULL) { - sp->connection->send(shared_ptr(new SetRidingPacket(e, e->riding))); + sp->connection->send(std::shared_ptr(new SetRidingPacket(e, e->riding))); } ItemInstanceArray equipped = e->getEquipmentSlots(); @@ -510,28 +510,28 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptrconnection->send( shared_ptr( new SetEquippedItemPacket(e->entityId, i, equipped[i]) ) ); + sp->connection->send( std::shared_ptr( new SetEquippedItemPacket(e->entityId, i, equipped[i]) ) ); } } - if (dynamic_pointer_cast(e) != NULL) + if (std::dynamic_pointer_cast(e) != NULL) { - shared_ptr spe = dynamic_pointer_cast(e); + std::shared_ptr spe = std::dynamic_pointer_cast(e); if (spe->isSleeping()) { - sp->connection->send( shared_ptr( new EntityActionAtPositionPacket(e, EntityActionAtPositionPacket::START_SLEEP, Mth::floor(e->x), Mth::floor(e->y), Mth::floor(e->z)) ) ); + sp->connection->send( std::shared_ptr( new EntityActionAtPositionPacket(e, EntityActionAtPositionPacket::START_SLEEP, Mth::floor(e->x), Mth::floor(e->y), Mth::floor(e->z)) ) ); } } - if (dynamic_pointer_cast(e) != NULL) + if (std::dynamic_pointer_cast(e) != NULL) { - shared_ptr mob = dynamic_pointer_cast(e); - vector *activeEffects = mob->getActiveEffects(); + std::shared_ptr mob = std::dynamic_pointer_cast(e); + std::vector *activeEffects = mob->getActiveEffects(); for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) { MobEffectInstance *effect = *it; - sp->connection->send(shared_ptr( new UpdateMobEffectPacket(e->entityId, effect) ) ); + sp->connection->send(std::shared_ptr( new UpdateMobEffectPacket(e->entityId, effect) ) ); } delete activeEffects; } @@ -548,7 +548,7 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr player) +bool TrackedEntity::canBySeenBy(std::shared_ptr player) { // 4J - for some reason this isn't currently working, and is causing players to not appear until we are really close to them. Not sure // what the conflict is between the java & our version, but removing for now as it is causing issues and we shouldn't *really* need it @@ -558,15 +558,15 @@ bool TrackedEntity::canBySeenBy(shared_ptr player) // return player->getLevel()->getChunkMap()->isPlayerIn(player, e->xChunk, e->zChunk); } -void TrackedEntity::updatePlayers(EntityTracker *tracker, vector > *players) +void TrackedEntity::updatePlayers(EntityTracker *tracker, std::vector > *players) { for (unsigned int i = 0; i < players->size(); i++) { - updatePlayer(tracker, dynamic_pointer_cast( players->at(i) ) ); + updatePlayer(tracker, std::dynamic_pointer_cast( players->at(i) ) ); } } -shared_ptr TrackedEntity::getAddEntityPacket() +std::shared_ptr TrackedEntity::getAddEntityPacket() { if (e->removed) { @@ -574,23 +574,23 @@ shared_ptr TrackedEntity::getAddEntityPacket() } // 4J-PB - replacing with a switch, rather than tons of ifs - if (dynamic_pointer_cast(e) != NULL) + if (std::dynamic_pointer_cast(e) != NULL) { yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); - return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp) ); + return std::shared_ptr( new AddMobPacket(std::dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp) ); } switch(e->GetType()) { case eTYPE_ITEMENTITY: { - shared_ptr packet = shared_ptr( new AddEntityPacket(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr packet = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp) ); return packet; } break; case eTYPE_SERVERPLAYER: { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = std::dynamic_pointer_cast(e); PlayerUID xuid = INVALID_XUID; PlayerUID OnlineXuid = INVALID_XUID; if( player != NULL ) @@ -599,76 +599,76 @@ shared_ptr TrackedEntity::getAddEntityPacket() OnlineXuid = player->getOnlineXuid(); } // 4J Added yHeadRotp param to fix #102563 - TU12: Content: Gameplay: When one of the Players is idle for a few minutes his head turns 180 degrees. - return shared_ptr( new AddPlayerPacket(dynamic_pointer_cast(e), xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp ) ); + return std::shared_ptr( new AddPlayerPacket(std::dynamic_pointer_cast(e), xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp ) ); } break; case eTYPE_MINECART: { - shared_ptr minecart = dynamic_pointer_cast(e); - if (minecart->type == Minecart::RIDEABLE) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_RIDEABLE, yRotp, xRotp, xp, yp, zp) ); - if (minecart->type == Minecart::CHEST) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_CHEST, yRotp, xRotp, xp, yp, zp) ); - if (minecart->type == Minecart::FURNACE) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_FURNACE, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr minecart = std::dynamic_pointer_cast(e); + if (minecart->type == Minecart::RIDEABLE) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_RIDEABLE, yRotp, xRotp, xp, yp, zp) ); + if (minecart->type == Minecart::CHEST) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_CHEST, yRotp, xRotp, xp, yp, zp) ); + if (minecart->type == Minecart::FURNACE) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_FURNACE, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_BOAT: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_ENDERDRAGON: { yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); - return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp ) ); + return std::shared_ptr( new AddMobPacket(std::dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp ) ); } break; case eTYPE_FISHINGHOOK: { - shared_ptr owner = dynamic_pointer_cast(e)->owner; - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr owner = std::dynamic_pointer_cast(e)->owner; + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_ARROW: { - shared_ptr owner = (dynamic_pointer_cast(e))->owner; - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::ARROW, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr owner = (std::dynamic_pointer_cast(e))->owner; + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ARROW, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_SNOWBALL: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_THROWNPOTION: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp)); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((std::dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp)); } break; case eTYPE_THROWNEXPBOTTLE: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_THROWNENDERPEARL: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_EYEOFENDERSIGNAL: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_SMALL_FIREBALL: { - shared_ptr fb = dynamic_pointer_cast(e); - shared_ptr aep = nullptr; + std::shared_ptr fb = std::dynamic_pointer_cast(e); + std::shared_ptr aep = nullptr; if (fb->owner != NULL) { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); } aep->xa = (int) (fb->xPower * 8000); aep->ya = (int) (fb->yPower * 8000); @@ -678,15 +678,15 @@ shared_ptr TrackedEntity::getAddEntityPacket() break; case eTYPE_DRAGON_FIREBALL: { - shared_ptr fb = dynamic_pointer_cast(e); - shared_ptr aep = nullptr; + std::shared_ptr fb = std::dynamic_pointer_cast(e); + std::shared_ptr aep = nullptr; if (fb->owner != NULL) { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::DRAGON_FIRE_BALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::DRAGON_FIRE_BALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::DRAGON_FIRE_BALL, 0, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::DRAGON_FIRE_BALL, 0, yRotp, xRotp, xp, yp, zp) ); } aep->xa = (int) (fb->xPower * 8000); aep->ya = (int) (fb->yPower * 8000); @@ -696,15 +696,15 @@ shared_ptr TrackedEntity::getAddEntityPacket() break; case eTYPE_FIREBALL: { - shared_ptr fb = dynamic_pointer_cast(e); - shared_ptr aep = nullptr; + std::shared_ptr fb = std::dynamic_pointer_cast(e); + std::shared_ptr aep = nullptr; if (fb->owner != NULL) { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); } aep->xa = (int) (fb->xPower * 8000); aep->ya = (int) (fb->yPower * 8000); @@ -714,33 +714,33 @@ shared_ptr TrackedEntity::getAddEntityPacket() break; case eTYPE_THROWNEGG: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_PRIMEDTNT: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_ENDER_CRYSTAL: { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_FALLINGTILE: { - shared_ptr ft = dynamic_pointer_cast(e); - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr ft = std::dynamic_pointer_cast(e); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp) ); } break; case eTYPE_PAINTING: { - return shared_ptr( new AddPaintingPacket(dynamic_pointer_cast(e)) ); + return std::shared_ptr( new AddPaintingPacket(std::dynamic_pointer_cast(e)) ); } break; case eTYPE_ITEM_FRAME: { - shared_ptr frame = dynamic_pointer_cast(e); + std::shared_ptr frame = std::dynamic_pointer_cast(e); { int ix= (int)frame->xTile; @@ -749,7 +749,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() app.DebugPrintf("eTYPE_ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz); } - shared_ptr packet = shared_ptr(new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp)); + std::shared_ptr packet = std::shared_ptr(new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp)); packet->x = Mth::floor(frame->xTile * 32.0f); packet->y = Mth::floor(frame->yTile * 32.0f); packet->z = Mth::floor(frame->zTile * 32.0f); @@ -758,7 +758,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() break; case eTYPE_EXPERIENCEORB: { - return shared_ptr( new AddExperienceOrbPacket(dynamic_pointer_cast(e)) ); + return std::shared_ptr( new AddExperienceOrbPacket(std::dynamic_pointer_cast(e)) ); } break; default: @@ -768,8 +768,8 @@ shared_ptr TrackedEntity::getAddEntityPacket() /* if (e->GetType() == eTYPE_ITEMENTITY) { - shared_ptr itemEntity = dynamic_pointer_cast(e); - shared_ptr packet = shared_ptr( new AddItemEntityPacket(itemEntity, xp, yp, zp) ); + std::shared_ptr itemEntity = std::dynamic_pointer_cast(e); + std::shared_ptr packet = std::shared_ptr( new AddItemEntityPacket(itemEntity, xp, yp, zp) ); itemEntity->x = packet->x / 32.0; itemEntity->y = packet->y / 32.0; itemEntity->z = packet->z / 32.0; @@ -778,7 +778,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() if (e->GetType() == eTYPE_SERVERPLAYER ) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = std::dynamic_pointer_cast(e); XUID xuid = INVALID_XUID; XUID OnlineXuid = INVALID_XUID; if( player != NULL ) @@ -786,68 +786,68 @@ shared_ptr TrackedEntity::getAddEntityPacket() xuid = player->getXuid(); OnlineXuid = player->getOnlineXuid(); } - return shared_ptr( new AddPlayerPacket(dynamic_pointer_cast(e), xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp ) ); + return std::shared_ptr( new AddPlayerPacket(std::dynamic_pointer_cast(e), xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp ) ); } if (e->GetType() == eTYPE_MINECART) { - shared_ptr minecart = dynamic_pointer_cast(e); - if (minecart->type == Minecart::RIDEABLE) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_RIDEABLE, yRotp, xRotp, xp, yp, zp) ); - if (minecart->type == Minecart::CHEST) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_CHEST, yRotp, xRotp, xp, yp, zp) ); - if (minecart->type == Minecart::FURNACE) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_FURNACE, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr minecart = std::dynamic_pointer_cast(e); + if (minecart->type == Minecart::RIDEABLE) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_RIDEABLE, yRotp, xRotp, xp, yp, zp) ); + if (minecart->type == Minecart::CHEST) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_CHEST, yRotp, xRotp, xp, yp, zp) ); + if (minecart->type == Minecart::FURNACE) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART_FURNACE, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_BOAT) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp) ); } - if (dynamic_pointer_cast(e) != NULL) + if (std::dynamic_pointer_cast(e) != NULL) { - return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddMobPacket(std::dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_ENDERDRAGON) { - return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp ) ); + return std::shared_ptr( new AddMobPacket(std::dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp ) ); } if (e->GetType() == eTYPE_FISHINGHOOK) { - shared_ptr owner = dynamic_pointer_cast(e)->owner; - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr owner = std::dynamic_pointer_cast(e)->owner; + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_ARROW) { - shared_ptr owner = (dynamic_pointer_cast(e))->owner; - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::ARROW, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr owner = (std::dynamic_pointer_cast(e))->owner; + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ARROW, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_SNOWBALL) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_THROWNPOTION) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp)); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((std::dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp)); } if (e->GetType() == eTYPE_THROWNEXPBOTTLE) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_THROWNENDERPEARL) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_EYEOFENDERSIGNAL) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_SMALL_FIREBALL) { - shared_ptr fb = dynamic_pointer_cast(e); - shared_ptr aep = NULL; + std::shared_ptr fb = std::dynamic_pointer_cast(e); + std::shared_ptr aep = NULL; if (fb->owner != NULL) { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::SMALL_FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); } aep->xa = (int) (fb->xPower * 8000); aep->ya = (int) (fb->yPower * 8000); @@ -856,15 +856,15 @@ shared_ptr TrackedEntity::getAddEntityPacket() } if (e->GetType() == eTYPE_FIREBALL) { - shared_ptr fb = dynamic_pointer_cast(e); - shared_ptr aep = NULL; + std::shared_ptr fb = std::dynamic_pointer_cast(e); + std::shared_ptr aep = NULL; if (fb->owner != NULL) { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); + aep = std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREBALL, 0, yRotp, xRotp, xp, yp, zp) ); } aep->xa = (int) (fb->xPower * 8000); aep->ya = (int) (fb->yPower * 8000); @@ -873,30 +873,30 @@ shared_ptr TrackedEntity::getAddEntityPacket() } if (e->GetType() == eTYPE_THROWNEGG) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_PRIMEDTNT) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_ENDER_CRYSTAL) { - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp) ); + return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_FALLINGTILE) { - shared_ptr ft = dynamic_pointer_cast(e); - if (ft->tile == Tile::sand_Id) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_SAND, yRotp, xRotp, xp, yp, zp) ); - if (ft->tile == Tile::gravel_Id) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_GRAVEL, yRotp, xRotp, xp, yp, zp) ); - if (ft->tile == Tile::dragonEgg_Id) return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_EGG, yRotp, xRotp, xp, yp, zp) ); + std::shared_ptr ft = std::dynamic_pointer_cast(e); + if (ft->tile == Tile::sand_Id) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_SAND, yRotp, xRotp, xp, yp, zp) ); + if (ft->tile == Tile::gravel_Id) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_GRAVEL, yRotp, xRotp, xp, yp, zp) ); + if (ft->tile == Tile::dragonEgg_Id) return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING_EGG, yRotp, xRotp, xp, yp, zp) ); } if (e->GetType() == eTYPE_PAINTING) { - return shared_ptr( new AddPaintingPacket(dynamic_pointer_cast(e)) ); + return std::shared_ptr( new AddPaintingPacket(std::dynamic_pointer_cast(e)) ); } if (e->GetType() == eTYPE_ITEM_FRAME) { - shared_ptr frame = dynamic_pointer_cast(e); + std::shared_ptr frame = std::dynamic_pointer_cast(e); { int ix= (int)frame->xTile; @@ -905,7 +905,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() app.DebugPrintf("eTYPE_ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz); } - shared_ptr packet = shared_ptr(new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp)); + std::shared_ptr packet = std::shared_ptr(new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp)); packet->x = Mth::floor(frame->xTile * 32.0f); packet->y = Mth::floor(frame->yTile * 32.0f); packet->z = Mth::floor(frame->zTile * 32.0f); @@ -913,14 +913,14 @@ shared_ptr TrackedEntity::getAddEntityPacket() } if (e->GetType() == eTYPE_EXPERIENCEORB) { - return shared_ptr( new AddExperienceOrbPacket(dynamic_pointer_cast(e)) ); + return std::shared_ptr( new AddExperienceOrbPacket(std::dynamic_pointer_cast(e)) ); } assert(false); */ return nullptr; } -void TrackedEntity::clear(shared_ptr sp) +void TrackedEntity::clear(std::shared_ptr sp) { AUTO_VAR(it, seenBy.find(sp)); if (it != seenBy.end()) diff --git a/Minecraft.Client/Player/TrackedEntity.h b/Minecraft.Client/Player/TrackedEntity.h index 9fb564a4d..70df9da3e 100644 --- a/Minecraft.Client/Player/TrackedEntity.h +++ b/Minecraft.Client/Player/TrackedEntity.h @@ -3,7 +3,7 @@ class Entity; //class ServerPlayer; #include "ServerPlayer.h" class Packet; -using namespace std; + class EntityTracker; @@ -15,7 +15,7 @@ private: static const int TOLERANCE_LEVEL = 4; public: - shared_ptr e; + std::shared_ptr e; int range, updateInterval; int xp, yp, zp, yRotp, xRotp, yHeadRotp; @@ -27,23 +27,23 @@ private: bool updatedPlayerVisibility; bool trackDelta; int teleportDelay; - shared_ptr wasRiding; + std::shared_ptr wasRiding; public: bool moved; - unordered_set , PlayerKeyHash, PlayerKeyEq > seenBy; + std::unordered_set , PlayerKeyHash, PlayerKeyEq > seenBy; - TrackedEntity(shared_ptr e, int range, int updateInterval, bool trackDelta); + TrackedEntity(std::shared_ptr e, int range, int updateInterval, bool trackDelta); - void tick(EntityTracker *tracker, vector > *players); - void broadcast(shared_ptr packet); - void broadcastAndSend(shared_ptr packet); + void tick(EntityTracker *tracker, std::vector > *players); + void broadcast(std::shared_ptr packet); + void broadcastAndSend(std::shared_ptr packet); void broadcastRemoved(); - void removePlayer(shared_ptr sp); + void removePlayer(std::shared_ptr sp); private: - bool canBySeenBy(shared_ptr player); + bool canBySeenBy(std::shared_ptr player); enum eVisibility { @@ -52,14 +52,14 @@ private: eVisibility_SeenAndVisible = 2, }; - eVisibility isVisible(EntityTracker *tracker, shared_ptr sp, bool forRider = false); // 4J Added forRider + eVisibility isVisible(EntityTracker *tracker, std::shared_ptr sp, bool forRider = false); // 4J Added forRider public: - void updatePlayer(EntityTracker *tracker, shared_ptr sp); - void updatePlayers(EntityTracker *tracker, vector > *players); + void updatePlayer(EntityTracker *tracker, std::shared_ptr sp); + void updatePlayers(EntityTracker *tracker, std::vector > *players); private: - void sendEntityData(shared_ptr conn); - shared_ptr getAddEntityPacket(); + void sendEntityData(std::shared_ptr conn); + std::shared_ptr getAddEntityPacket(); public: - void clear(shared_ptr sp); + void clear(std::shared_ptr sp); }; diff --git a/Minecraft.Client/Player/User.cpp b/Minecraft.Client/Player/User.cpp index c0355293b..5cdc0162d 100644 --- a/Minecraft.Client/Player/User.cpp +++ b/Minecraft.Client/Player/User.cpp @@ -2,7 +2,7 @@ #include "User.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" -vector User::allowedTiles; +std::vector User::allowedTiles; void User::staticCtor() { @@ -38,7 +38,7 @@ void User::staticCtor() allowedTiles.push_back(Tile::obsidian); } -User::User(const wstring& name, const wstring& sessionId) +User::User(const std::wstring& name, const std::wstring& sessionId) { this->name = name; this->sessionId = sessionId; diff --git a/Minecraft.Client/Player/User.h b/Minecraft.Client/Player/User.h index b888c7d4d..7650b7cc2 100644 --- a/Minecraft.Client/Player/User.h +++ b/Minecraft.Client/Player/User.h @@ -1,14 +1,14 @@ #pragma once -using namespace std; + class User { public: - static vector allowedTiles; + static std::vector allowedTiles; static void staticCtor(); - wstring name; - wstring sessionId; - wstring mpPassword; + std::wstring name; + std::wstring sessionId; + std::wstring mpPassword; - User(const wstring& name, const wstring& sessionId); + User(const std::wstring& name, const std::wstring& sessionId); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Camera.cpp b/Minecraft.Client/Rendering/Camera.cpp index 3951e96fc..312957376 100644 --- a/Minecraft.Client/Rendering/Camera.cpp +++ b/Minecraft.Client/Rendering/Camera.cpp @@ -21,7 +21,7 @@ float Camera::za = 0.0f; float Camera::xa2 = 0.0f; float Camera::za2 = 0.0f; -void Camera::prepare(shared_ptr player, bool mirror) +void Camera::prepare(std::shared_ptr player, bool mirror) { glGetFloat(GL_MODELVIEW_MATRIX, modelview); glGetFloat(GL_PROJECTION_MATRIX, projection); @@ -88,12 +88,12 @@ void Camera::prepare(shared_ptr player, bool mirror) ya = cosf(xRot * PI / 180.0f); } -TilePos *Camera::getCameraTilePos(shared_ptr player, double alpha) +TilePos *Camera::getCameraTilePos(std::shared_ptr player, double alpha) { return new TilePos(getCameraPos(player, alpha)); } -Vec3 *Camera::getCameraPos(shared_ptr player, double alpha) +Vec3 *Camera::getCameraPos(std::shared_ptr player, double alpha) { double xx = player->xo + (player->x - player->xo) * alpha; double yy = player->yo + (player->y - player->yo) * alpha + player->getHeadHeight(); @@ -106,7 +106,7 @@ Vec3 *Camera::getCameraPos(shared_ptr player, double alpha) return Vec3::newTemp(xt, yt, zt); } -int Camera::getBlockAt(Level *level, shared_ptr player, float alpha) +int Camera::getBlockAt(Level *level, std::shared_ptr player, float alpha) { Vec3 *p = Camera::getCameraPos(player, alpha); TilePos tp = TilePos(p); diff --git a/Minecraft.Client/Rendering/Camera.h b/Minecraft.Client/Rendering/Camera.h index b59e7436e..1d42f58fa 100644 --- a/Minecraft.Client/Rendering/Camera.h +++ b/Minecraft.Client/Rendering/Camera.h @@ -24,9 +24,9 @@ private: public: static float xa, ya, za, xa2, za2; - static void prepare(shared_ptr player, bool mirror); + static void prepare(std::shared_ptr player, bool mirror); - static TilePos *getCameraTilePos(shared_ptr player, double alpha); - static Vec3 *getCameraPos(shared_ptr player, double alpha); - static int getBlockAt(Level *level, shared_ptr player, float alpha); + static TilePos *getCameraTilePos(std::shared_ptr player, double alpha); + static Vec3 *getCameraPos(std::shared_ptr player, double alpha); + static int getBlockAt(Level *level, std::shared_ptr player, float alpha); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Chunk.cpp b/Minecraft.Client/Rendering/Chunk.cpp index 79f9dae6f..d077d794a 100644 --- a/Minecraft.Client/Rendering/Chunk.cpp +++ b/Minecraft.Client/Rendering/Chunk.cpp @@ -204,10 +204,10 @@ void Chunk::rebuild() LevelChunk::touchedSky = false; -// unordered_set > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line +// std::unordered_set > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line // renderableTileEntities.clear(); - vector > renderableTileEntities; // 4J - added + std::vector > renderableTileEntities; // 4J - added int r = 1; @@ -402,7 +402,7 @@ void Chunk::rebuild() Tile *tile = Tile::tiles[tileId]; if (currentLayer == 0 && tile->isEntityTile()) { - shared_ptr et = region->getTileEntity(x, y, z); + std::shared_ptr et = region->getTileEntity(x, y, z); if (TileEntityRenderDispatcher::instance->hasRenderer(et)) { renderableTileEntities.push_back(et); @@ -554,10 +554,10 @@ void Chunk::rebuild() */ - unordered_set > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); + std::unordered_set > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); AUTO_VAR(endIt, oldTileEntities.end()); - for( unordered_set >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) + for( std::unordered_set >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) { newTileEntities.erase(*it); } @@ -566,7 +566,7 @@ void Chunk::rebuild() EnterCriticalSection(globalRenderableTileEntities_cs); endIt = newTileEntities.end(); - for( unordered_set >::iterator it = newTileEntities.begin(); it != endIt; it++ ) + for( std::unordered_set >::iterator it = newTileEntities.begin(); it != endIt; it++ ) { globalRenderableTileEntities->push_back(*it); } @@ -574,12 +574,12 @@ void Chunk::rebuild() // 4J - All these new things added to globalRenderableTileEntities AUTO_VAR(endItRTE, renderableTileEntities.end()); - for( vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) + for( std::vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) { oldTileEntities.erase(*it); } // 4J - oldTileEntities is now the removed items - vector >::iterator it = globalRenderableTileEntities->begin(); + std::vector >::iterator it = globalRenderableTileEntities->begin(); while( it != globalRenderableTileEntities->end() ) { if( oldTileEntities.find(*it) != oldTileEntities.end() ) @@ -656,10 +656,10 @@ void Chunk::rebuild_SPU() LevelChunk::touchedSky = false; -// unordered_set > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line +// std::unordered_set > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line // renderableTileEntities.clear(); - vector > renderableTileEntities; // 4J - added + std::vector > renderableTileEntities; // 4J - added // List newTileEntities = new ArrayList(); // newTileEntities.clear(); @@ -750,7 +750,7 @@ void Chunk::rebuild_SPU() { if (currentLayer == 0 && Tile::tiles[tileId]->isEntityTile()) { - shared_ptr et = region.getTileEntity(x, y, z); + std::shared_ptr et = region.getTileEntity(x, y, z); if (TileEntityRenderDispatcher::instance->hasRenderer(et)) { renderableTileEntities.push_back(et); @@ -883,10 +883,10 @@ void Chunk::rebuild_SPU() */ - unordered_set > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); + std::unordered_set > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); AUTO_VAR(endIt, oldTileEntities.end()); - for( unordered_set >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) + for( std::unordered_set >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) { newTileEntities.erase(*it); } @@ -895,7 +895,7 @@ void Chunk::rebuild_SPU() EnterCriticalSection(globalRenderableTileEntities_cs); endIt = newTileEntities.end(); - for( unordered_set >::iterator it = newTileEntities.begin(); it != endIt; it++ ) + for( std::unordered_set >::iterator it = newTileEntities.begin(); it != endIt; it++ ) { globalRenderableTileEntities.push_back(*it); } @@ -903,12 +903,12 @@ void Chunk::rebuild_SPU() // 4J - All these new things added to globalRenderableTileEntities AUTO_VAR(endItRTE, renderableTileEntities.end()); - for( vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) + for( std::vector >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) { oldTileEntities.erase(*it); } // 4J - oldTileEntities is now the removed items - vector >::iterator it = globalRenderableTileEntities->begin(); + std::vector >::iterator it = globalRenderableTileEntities->begin(); while( it != globalRenderableTileEntities->end() ) { if( oldTileEntities.find(*it) != oldTileEntities.end() ) @@ -941,7 +941,7 @@ void Chunk::rebuild_SPU() #endif // _PS3_ -float Chunk::distanceToSqr(shared_ptr player) const +float Chunk::distanceToSqr(std::shared_ptr player) const { float xd = (float) (player->x - xm); float yd = (float) (player->y - ym); @@ -949,7 +949,7 @@ float Chunk::distanceToSqr(shared_ptr player) const return xd * xd + yd * yd + zd * zd; } -float Chunk::squishedDistanceToSqr(shared_ptr player) +float Chunk::squishedDistanceToSqr(std::shared_ptr player) { float xd = (float) (player->x - xm); float yd = (float) (player->y - ym) * 2; diff --git a/Minecraft.Client/Rendering/Chunk.h b/Minecraft.Client/Rendering/Chunk.h index c1687769b..787fae4de 100644 --- a/Minecraft.Client/Rendering/Chunk.h +++ b/Minecraft.Client/Rendering/Chunk.h @@ -7,7 +7,7 @@ class Level; class TileEntity; class Entity; -using namespace std; + class ClipChunk { @@ -52,7 +52,7 @@ public: int id; //public: -// vector > renderableTileEntities; // 4J - removed +// std::vector > renderableTileEntities; // 4J - removed private: LevelRenderer::rteMap *globalRenderableTileEntities; @@ -71,8 +71,8 @@ public: #ifdef __PS3__ void rebuild_SPU(); #endif // __PS3__ - float distanceToSqr(shared_ptr player) const; - float squishedDistanceToSqr(shared_ptr player); + float distanceToSqr(std::shared_ptr player) const; + float squishedDistanceToSqr(std::shared_ptr player); void reset(); void _delete(); diff --git a/Minecraft.Client/Rendering/Cube.cpp b/Minecraft.Client/Rendering/Cube.cpp index 45714e3a7..ee007f111 100644 --- a/Minecraft.Client/Rendering/Cube.cpp +++ b/Minecraft.Client/Rendering/Cube.cpp @@ -106,7 +106,7 @@ void Cube::render(Tesselator *t,float scale) } } -Cube *Cube::setId(const wstring &id) +Cube *Cube::setId(const std::wstring &id) { this->id = id; return this; diff --git a/Minecraft.Client/Rendering/Cube.h b/Minecraft.Client/Rendering/Cube.h index 388910015..eafa57ba5 100644 --- a/Minecraft.Client/Rendering/Cube.h +++ b/Minecraft.Client/Rendering/Cube.h @@ -15,7 +15,7 @@ private: public: const float x0, y0, z0, x1, y1, z1; - wstring id; + std::wstring id; public: Cube(ModelPart *modelPart, int xTexOffs, int yTexOffs, float x0, float y0, float z0, int w, int h, int d, float g, int faceMask = 63, bool bFlipPoly3UVs = false); // 4J - added faceMask @@ -25,5 +25,5 @@ private: public: void render(Tesselator *t,float scale); - Cube *setId(const wstring &id); + Cube *setId(const std::wstring &id); }; diff --git a/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.cpp b/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.cpp index 50eaaec7a..ae702d9a0 100644 --- a/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.cpp +++ b/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.cpp @@ -3,7 +3,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" #include "../Chunk.h" -DirtyChunkSorter::DirtyChunkSorter(shared_ptr cameraEntity, int playerIndex) // 4J - added player index +DirtyChunkSorter::DirtyChunkSorter(std::shared_ptr cameraEntity, int playerIndex) // 4J - added player index { this->cameraEntity = cameraEntity; this->playerIndex = playerIndex; diff --git a/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.h b/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.h index 8148062be..0de6efda3 100644 --- a/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.h +++ b/Minecraft.Client/Rendering/Culling/DirtyChunkSorter.h @@ -5,10 +5,10 @@ class Mob; class DirtyChunkSorter { private: - shared_ptr cameraEntity; + std::shared_ptr cameraEntity; int playerIndex; // 4J added public: - DirtyChunkSorter(shared_ptr cameraEntity, int playerIndex); // 4J - added player index + DirtyChunkSorter(std::shared_ptr cameraEntity, int playerIndex); // 4J - added player index bool operator()(const Chunk *a, const Chunk *b) const; }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.cpp b/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.cpp index a88ef9d7a..9c7804d27 100644 --- a/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.cpp +++ b/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.cpp @@ -3,7 +3,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" #include "../Chunk.h" -DistanceChunkSorter::DistanceChunkSorter(shared_ptr player) +DistanceChunkSorter::DistanceChunkSorter(std::shared_ptr player) { ix = -player->x; iy = -player->y; diff --git a/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.h b/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.h index 224737ab6..461ec79a1 100644 --- a/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.h +++ b/Minecraft.Client/Rendering/Culling/DistanceChunkSorter.h @@ -8,6 +8,6 @@ private: double ix, iy, iz; public: - DistanceChunkSorter(shared_ptr player); + DistanceChunkSorter(std::shared_ptr player); bool operator()(const Chunk *a, const Chunk *b) const; }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Culling/ViewportCuller.cpp b/Minecraft.Client/Rendering/Culling/ViewportCuller.cpp index a443775bd..c5a881b63 100644 --- a/Minecraft.Client/Rendering/Culling/ViewportCuller.cpp +++ b/Minecraft.Client/Rendering/Culling/ViewportCuller.cpp @@ -49,7 +49,7 @@ bool ViewportCuller::Face::fullyInFront(double x0, double y0, double z0, double return true; } -ViewportCuller::ViewportCuller(shared_ptr mob, double fogDistance, float a) +ViewportCuller::ViewportCuller(std::shared_ptr mob, double fogDistance, float a) { float yRot = mob->yRotO+(mob->yRot-mob->yRotO)*a; float xRot = mob->xRotO+(mob->xRot-mob->xRotO)*a; diff --git a/Minecraft.Client/Rendering/Culling/ViewportCuller.h b/Minecraft.Client/Rendering/Culling/ViewportCuller.h index b5035c567..251f17130 100644 --- a/Minecraft.Client/Rendering/Culling/ViewportCuller.h +++ b/Minecraft.Client/Rendering/Culling/ViewportCuller.h @@ -24,7 +24,7 @@ private: Face faces[6]; double xOff, yOff, zOff; public: - ViewportCuller(shared_ptr mob, double fogDistance, float a); + ViewportCuller(std::shared_ptr mob, double fogDistance, float a); virtual bool isVisible(AABB bb); virtual bool cubeInFrustum(double x0, double y0, double z0, double x1, double y1, double z1); virtual bool cubeFullyInFrustum(double x0, double y0, double z0, double x1, double y1, double z1); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.cpp index c01aabf97..408725c24 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.cpp @@ -3,11 +3,11 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.projectile.h" #include "../../../Minecraft.World/Util/Mth.h" -void ArrowRenderer::render(shared_ptr _arrow, double x, double y, double z, float rot, float a) +void ArrowRenderer::render(std::shared_ptr _arrow, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type Arrow rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Arrow rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr arrow = dynamic_pointer_cast(_arrow); + std::shared_ptr arrow = std::dynamic_pointer_cast(_arrow); bindTexture(TN_ITEM_ARROWS); // 4J - was L"/item/arrows.png" glPushMatrix(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.h index 2731f7c2c..3348fc332 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ArrowRenderer.h @@ -4,5 +4,5 @@ class ArrowRenderer : public EntityRenderer { public: - virtual void render(shared_ptr _arrow, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _arrow, double x, double y, double z, float rot, float a); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.cpp index aa563661d..cafe47861 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.cpp @@ -8,11 +8,11 @@ BlazeRenderer::BlazeRenderer() : MobRenderer(new BlazeModel(), 0.5f) this->modelVersion = ((BlazeModel *) model)->modelVersion(); } -void BlazeRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void BlazeRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); int modelVersion = ((BlazeModel *) model)->modelVersion(); if (modelVersion != this->modelVersion) diff --git a/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.h index fc575e9bc..0ee973cab 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/BlazeRenderer.h @@ -10,5 +10,5 @@ private: public: BlazeRenderer(); - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.cpp index da19ef958..2a9fba093 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.cpp @@ -10,11 +10,11 @@ BoatRenderer::BoatRenderer() : EntityRenderer() model = new BoatModel(); } -void BoatRenderer::render(shared_ptr _boat, double x, double y, double z, float rot, float a) +void BoatRenderer::render(std::shared_ptr _boat, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Boat rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr boat = dynamic_pointer_cast(_boat); + std::shared_ptr boat = std::dynamic_pointer_cast(_boat); glPushMatrix(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.h index 1cc9c1d99..c4bb03128 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/BoatRenderer.h @@ -9,5 +9,5 @@ protected: public: BoatRenderer(); - virtual void render(shared_ptr boat, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr boat, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.cpp index 2a51e3edc..ed0a215c4 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.cpp @@ -18,10 +18,10 @@ ChestRenderer::~ChestRenderer() delete largeChestModel; } -void ChestRenderer::render(shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void ChestRenderer::render(std::shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J Convert as we aren't using a templated class - shared_ptr chest = dynamic_pointer_cast(_chest); + std::shared_ptr chest = std::dynamic_pointer_cast(_chest); int data; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.h index 06c6bfff9..ffd4da033 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ChestRenderer.h @@ -14,5 +14,5 @@ public: ChestRenderer(); ~ChestRenderer(); - void render(shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param + void render(std::shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.cpp index 08937ca28..ca795fee8 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.cpp @@ -7,15 +7,15 @@ ChickenRenderer::ChickenRenderer(Model *model, float shadow) : MobRenderer(model { } -void ChickenRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void ChickenRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { MobRenderer::render(_mob, x, y, z, rot, a); } -float ChickenRenderer::getBob(shared_ptr _mob, float a) +float ChickenRenderer::getBob(std::shared_ptr _mob, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); float flap = mob->oFlap+(mob->flap-mob->oFlap)*a; float flapSpeed = mob->oFlapSpeed+(mob->flapSpeed-mob->oFlapSpeed)*a; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.h index b81c91337..2c33176d5 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ChickenRenderer.h @@ -5,7 +5,7 @@ class ChickenRenderer : public MobRenderer { public: ChickenRenderer(Model *model, float shadow); - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - virtual float getBob(shared_ptr _mob, float a); + virtual float getBob(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.cpp index 8b9379673..ce7b9fd06 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.cpp @@ -5,7 +5,7 @@ CowRenderer::CowRenderer(Model *model, float shadow) : MobRenderer(model, shadow { } -void CowRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void CowRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { MobRenderer::render(_mob, x, y, z, rot, a); } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.h index e99e1c124..0dabaf290 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/CowRenderer.h @@ -5,5 +5,5 @@ class CowRenderer : public MobRenderer { public: CowRenderer(Model *model, float shadow); - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.cpp index 7a361e3e4..db02d7bcd 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.cpp @@ -9,9 +9,9 @@ CreeperRenderer::CreeperRenderer() : MobRenderer( new CreeperModel(), 0.5f ) armorModel = new CreeperModel(2); } -void CreeperRenderer::scale(shared_ptr mob, float a) +void CreeperRenderer::scale(std::shared_ptr mob, float a) { - shared_ptr creeper = dynamic_pointer_cast(mob); + std::shared_ptr creeper = std::dynamic_pointer_cast(mob); float g = creeper->getSwelling(a); @@ -25,9 +25,9 @@ void CreeperRenderer::scale(shared_ptr mob, float a) glScalef(s, hs, s); } -int CreeperRenderer::getOverlayColor(shared_ptr mob, float br, float a) +int CreeperRenderer::getOverlayColor(std::shared_ptr mob, float br, float a) { - shared_ptr creeper = dynamic_pointer_cast(mob); + std::shared_ptr creeper = std::dynamic_pointer_cast(mob); float step = creeper->getSwelling(a); @@ -44,10 +44,10 @@ int CreeperRenderer::getOverlayColor(shared_ptr mob, float br, float a) return (_a << 24) | (r << 16) | (g << 8) | b; } -int CreeperRenderer::prepareArmor(shared_ptr _mob, int layer, float a) +int CreeperRenderer::prepareArmor(std::shared_ptr _mob, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); if (mob->isPowered()) { if (mob->isInvisible()) glDepthMask(false); @@ -84,7 +84,7 @@ int CreeperRenderer::prepareArmor(shared_ptr _mob, int layer, float a) } -int CreeperRenderer::prepareArmorOverlay(shared_ptr mob, int layer, float a) +int CreeperRenderer::prepareArmorOverlay(std::shared_ptr mob, int layer, float a) { return -1; } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.h index 4d0fac100..3afd511bc 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/CreeperRenderer.h @@ -9,8 +9,8 @@ private: public: CreeperRenderer(); protected: - virtual void scale(shared_ptr _mob, float a); - virtual int getOverlayColor(shared_ptr mob, float br, float a); - virtual int prepareArmor(shared_ptr mob, int layer, float a); - virtual int prepareArmorOverlay(shared_ptr _mob, int layer, float a); + virtual void scale(std::shared_ptr _mob, float a); + virtual int getOverlayColor(std::shared_ptr mob, float br, float a); + virtual int prepareArmor(std::shared_ptr mob, int layer, float a); + virtual int prepareArmorOverlay(std::shared_ptr _mob, int layer, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.cpp index 0e4203e82..435410b3f 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.cpp @@ -2,7 +2,7 @@ #include "DefaultRenderer.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.h" -void DefaultRenderer::render(shared_ptr entity, double x, double y, double z, float rot, float a) +void DefaultRenderer::render(std::shared_ptr entity, double x, double y, double z, float rot, float a) { glPushMatrix(); // 4J - removed following line as doesn't really make any sense diff --git a/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.h index dcb5a9c3e..651a99c15 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/DefaultRenderer.h @@ -4,5 +4,5 @@ class DefaultRenderer : public EntityRenderer { public: - virtual void render(shared_ptr entity, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr entity, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp index 7a3e56815..92d1d4233 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp @@ -14,10 +14,10 @@ EnchantTableRenderer::~EnchantTableRenderer() delete bookModel; } -void EnchantTableRenderer::render(shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void EnchantTableRenderer::render(std::shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J Convert as we aren't using a templated class - shared_ptr table = dynamic_pointer_cast(_table); + std::shared_ptr table = std::dynamic_pointer_cast(_table); #ifdef __PSVITA__ // AP - the book pages are made with 0 depth so the front and back polys are at the same location. This can cause z-fighting if culling is disabled which can sometimes happen diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.h index 0b738ca97..774857191 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.h @@ -15,5 +15,5 @@ public: EnchantTableRenderer(); ~EnchantTableRenderer(); - virtual void render(shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); + virtual void render(std::shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.cpp index 728417741..7fce13c64 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.cpp @@ -3,10 +3,10 @@ #include "../Models/ModelPart.h" #include "EnderChestRenderer.h" -void EnderChestRenderer::render(shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void EnderChestRenderer::render(std::shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J Convert as we aren't using a templated class - shared_ptr chest = dynamic_pointer_cast(_chest); + std::shared_ptr chest = std::dynamic_pointer_cast(_chest); int data = 0; diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.h index 50cefecfe..ab7b65547 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderChestRenderer.h @@ -9,5 +9,5 @@ private: ChestModel chestModel; public: - void render(shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param + void render(std::shared_ptr _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.cpp index 88181d3c1..3cbdc7aae 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.cpp @@ -9,11 +9,11 @@ EnderCrystalRenderer::EnderCrystalRenderer() this->shadowRadius = 0.5f; } -void EnderCrystalRenderer::render(shared_ptr _crystal, double x, double y, double z, float rot, float a) +void EnderCrystalRenderer::render(std::shared_ptr _crystal, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type EnderCrystal rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type EnderCrystal rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr crystal = dynamic_pointer_cast(_crystal); + std::shared_ptr crystal = std::dynamic_pointer_cast(_crystal); if (currentModel != EnderCrystalModel::MODEL_ID) { model = new EnderCrystalModel(0); diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.h index de5dc820f..5ac644d15 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderCrystalRenderer.h @@ -13,5 +13,5 @@ private: public: EnderCrystalRenderer(); - virtual void render(shared_ptr _crystal, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _crystal, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.cpp index b32ff41ff..a9f067e7f 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.cpp @@ -5,7 +5,7 @@ #include "../Lighting.h" #include "EnderDragonRenderer.h" -shared_ptr EnderDragonRenderer::bossInstance; +std::shared_ptr EnderDragonRenderer::bossInstance; int EnderDragonRenderer::currentModel; EnderDragonRenderer::EnderDragonRenderer() : MobRenderer(new DragonModel(0), 0.5f) @@ -15,10 +15,10 @@ EnderDragonRenderer::EnderDragonRenderer() : MobRenderer(new DragonModel(0), 0.5 this->setArmor(model); } -void EnderDragonRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) +void EnderDragonRenderer::setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); // 4J - reorganised a bit so we can free allocations double lpComponents[3]; @@ -46,10 +46,10 @@ void EnderDragonRenderer::setupRotations(shared_ptr _mob, float bob, float } } -void EnderDragonRenderer::renderModel(shared_ptr _mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale) +void EnderDragonRenderer::renderModel(std::shared_ptr _mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); if (mob->dragonDeathTime > 0) { @@ -87,10 +87,10 @@ void EnderDragonRenderer::renderModel(shared_ptr _mob, float wp, float w } } -void EnderDragonRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void EnderDragonRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); EnderDragonRenderer::bossInstance = mob; if (currentModel != DragonModel::MODEL_ID) { @@ -167,10 +167,10 @@ void EnderDragonRenderer::render(shared_ptr _mob, double x, double y, do } } -void EnderDragonRenderer::additionalRendering(shared_ptr _mob, float a) +void EnderDragonRenderer::additionalRendering(std::shared_ptr _mob, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(mob, a); Tesselator *t = Tesselator::getInstance(); @@ -227,10 +227,10 @@ void EnderDragonRenderer::additionalRendering(shared_ptr _mob, float a) } -int EnderDragonRenderer::prepareArmor(shared_ptr _mob, int layer, float a) +int EnderDragonRenderer::prepareArmor(std::shared_ptr _mob, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); if (layer == 1) { diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.h index ab508d993..095e2cf28 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.h @@ -10,7 +10,7 @@ class DragonModel; class EnderDragonRenderer : public MobRenderer { public: - static shared_ptr bossInstance; + static std::shared_ptr bossInstance; private: static int currentModel; @@ -22,15 +22,15 @@ public: EnderDragonRenderer(); protected: - virtual void setupRotations(shared_ptr _mob, float bob, float bodyRot, float a); + virtual void setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a); protected: - void renderModel(shared_ptr _mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale); + void renderModel(std::shared_ptr _mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale); public: - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - virtual void additionalRendering(shared_ptr _mob, float a); - virtual int prepareArmor(shared_ptr _mob, int layer, float a); + virtual void additionalRendering(std::shared_ptr _mob, float a); + virtual int prepareArmor(std::shared_ptr _mob, int layer, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.cpp index e5334b853..0f5704f77 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.cpp @@ -10,11 +10,11 @@ EndermanRenderer::EndermanRenderer() : MobRenderer(new EndermanModel(), 0.5f) this->setArmor(model); } -void EndermanRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void EndermanRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Boat rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); model->carrying = mob->getCarryingTile() > 0; model->creepy = mob->isCreepy(); @@ -29,11 +29,11 @@ void EndermanRenderer::render(shared_ptr _mob, double x, double y, doubl MobRenderer::render(mob, x, y, z, rot, a); } -void EndermanRenderer::additionalRendering(shared_ptr _mob, float a) +void EndermanRenderer::additionalRendering(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Boat rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(_mob, a); @@ -68,11 +68,11 @@ void EndermanRenderer::additionalRendering(shared_ptr _mob, float a) } } -int EndermanRenderer::prepareArmor(shared_ptr _mob, int layer, float a) +int EndermanRenderer::prepareArmor(std::shared_ptr _mob, int layer, float a) { - // 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Boat rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); if (layer != 0) return -1; diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.h index 6f5126bd1..eaf6393e7 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EnderManRenderer.h @@ -14,9 +14,9 @@ private: public: EndermanRenderer(); - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); - virtual void additionalRendering(shared_ptr _mob, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void additionalRendering(std::shared_ptr _mob, float a); protected: - virtual int prepareArmor(shared_ptr _mob, int layer, float a); + virtual int prepareArmor(std::shared_ptr _mob, int layer, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp index c8275864e..bfb07c214 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp @@ -168,12 +168,12 @@ EntityRenderer *EntityRenderDispatcher::getRenderer(eINSTANCEOF e) return it->second; } -EntityRenderer *EntityRenderDispatcher::getRenderer(shared_ptr e) +EntityRenderer *EntityRenderDispatcher::getRenderer(std::shared_ptr e) { return getRenderer(e->GetType()); } -void EntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *font, shared_ptr player, Options *options, float a) +void EntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *font, std::shared_ptr player, Options *options, float a) { this->level = level; this->textures = textures; @@ -197,7 +197,7 @@ void EntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *fon playerRotX = player->xRotO + (player->xRot - player->xRotO) * a; } - shared_ptr pl = dynamic_pointer_cast(player); + std::shared_ptr pl = std::dynamic_pointer_cast(player); if (pl->ThirdPersonView() == 2) { playerRotY += 180; @@ -209,7 +209,7 @@ void EntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *fon } -void EntityRenderDispatcher::render(shared_ptr entity, float a) +void EntityRenderDispatcher::render(std::shared_ptr entity, float a) { double x = entity->xOld + (entity->x - entity->xOld) * a; double y = entity->yOld + (entity->y - entity->yOld) * a; @@ -244,7 +244,7 @@ void EntityRenderDispatcher::render(shared_ptr entity, float a) render(entity, x - xOff, y - yOff, z - zOff, r, a); } -void EntityRenderDispatcher::render(shared_ptr entity, double x, double y, double z, float rot, float a, bool bItemFrame, bool bRenderPlayerShadow) +void EntityRenderDispatcher::render(std::shared_ptr entity, double x, double y, double z, float rot, float a, bool bItemFrame, bool bRenderPlayerShadow) { EntityRenderer *renderer = getRenderer(entity); if (renderer != NULL) diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h index 275e07ba1..92ac51da6 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.h @@ -3,14 +3,14 @@ #include "../../../Minecraft.World/Entities/Entity.h" #include "../../../Minecraft.World/Util/JavaIntHash.h" class font; -using namespace std; + class EntityRenderDispatcher { public: static void staticCtor(); // 4J added private: - typedef unordered_map classToRendererMap; + typedef std::unordered_map classToRendererMap; classToRendererMap renderers; // 4J - was: // Map, EntityRenderer> renderers = new HashMap, EntityRenderer>(); @@ -26,7 +26,7 @@ public: Textures *textures; ItemInHandRenderer *itemInHandRenderer; Level *level; - shared_ptr cameraEntity; + std::shared_ptr cameraEntity; float playerRotY; float playerRotX; Options *options; @@ -38,10 +38,10 @@ private: EntityRenderDispatcher(); public: EntityRenderer *getRenderer(eINSTANCEOF e); - EntityRenderer *getRenderer(shared_ptr e); - void prepare(Level *level, Textures *textures, Font *font, shared_ptr player, Options *options, float a); - void render(shared_ptr entity, float a); - void render(shared_ptr entity, double x, double y, double z, float rot, float a, bool bItemFrame = false, bool bRenderPlayerShadow = true); + EntityRenderer *getRenderer(std::shared_ptr e); + void prepare(Level *level, Textures *textures, Font *font, std::shared_ptr player, Options *options, float a); + void render(std::shared_ptr entity, float a); + void render(std::shared_ptr entity, double x, double y, double z, float rot, float a, bool bItemFrame = false, bool bRenderPlayerShadow = true); void setLevel(Level *level); double distanceToSqr(double x, double y, double z); Font *getFont(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp index 73529268b..7960e7d4d 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.cpp @@ -31,12 +31,12 @@ void EntityRenderer::bindTexture(int resourceName) entityRenderDispatcher->textures->bindTexture(resourceName); } -void EntityRenderer::bindTexture(const wstring& resourceName) +void EntityRenderer::bindTexture(const std::wstring& resourceName) { entityRenderDispatcher->textures->bindTexture(resourceName); } -bool EntityRenderer::bindTexture(const wstring& urlTexture, int backupTexture) +bool EntityRenderer::bindTexture(const std::wstring& urlTexture, int backupTexture) { Textures *t = entityRenderDispatcher->textures; @@ -57,7 +57,7 @@ bool EntityRenderer::bindTexture(const wstring& urlTexture, int backupTexture) } } -bool EntityRenderer::bindTexture(const wstring& urlTexture, const wstring& backupTexture) +bool EntityRenderer::bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture) { Textures *t = entityRenderDispatcher->textures; @@ -78,7 +78,7 @@ bool EntityRenderer::bindTexture(const wstring& urlTexture, const wstring& backu } } -void EntityRenderer::renderFlame(shared_ptr e, double x, double y, double z, float a) +void EntityRenderer::renderFlame(std::shared_ptr e, double x, double y, double z, float a) { glDisable(GL_LIGHTING); @@ -146,7 +146,7 @@ void EntityRenderer::renderFlame(shared_ptr e, double x, double y, doubl glEnable(GL_LIGHTING); } -void EntityRenderer::renderShadow(shared_ptr e, double x, double y, double z, float pow, float a) +void EntityRenderer::renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a) { glDisable(GL_LIGHTING); glEnable(GL_BLEND); @@ -160,17 +160,17 @@ void EntityRenderer::renderShadow(shared_ptr e, double x, double y, doub glDepthMask(false); float r = shadowRadius; - shared_ptr mob = dynamic_pointer_cast(e); + std::shared_ptr mob = std::dynamic_pointer_cast(e); bool isLocalPlayer = false; float fYLocalPlayerShadowOffset=0.0f; - //if (dynamic_pointer_cast(e) != NULL) + //if (std::dynamic_pointer_cast(e) != NULL) if (mob != NULL) { - //shared_ptr mob = dynamic_pointer_cast(e); + //std::shared_ptr mob = std::dynamic_pointer_cast(e); r *= mob->getSizeScale(); - shared_ptr animal = dynamic_pointer_cast(mob); + std::shared_ptr animal = std::dynamic_pointer_cast(mob); if (animal != NULL) { if (animal->isBaby()) @@ -179,7 +179,7 @@ void EntityRenderer::renderShadow(shared_ptr e, double x, double y, doub } } - if(dynamic_pointer_cast(mob)!=NULL) + if(std::dynamic_pointer_cast(mob)!=NULL) { isLocalPlayer=true; } @@ -383,7 +383,7 @@ void EntityRenderer::init(EntityRenderDispatcher *entityRenderDispatcher) this->entityRenderDispatcher = entityRenderDispatcher; } -void EntityRenderer::postRender(shared_ptr entity, double x, double y, double z, float rot, float a, bool bRenderPlayerShadow) +void EntityRenderer::postRender(std::shared_ptr entity, double x, double y, double z, float rot, float a, bool bRenderPlayerShadow) { if( !entityRenderDispatcher->isGuiRender ) // 4J - added, don't render shadow in gui as it uses its own blending, and we have globally enabled blending for interface opacity { diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h index 44d7d45d0..4337d84d1 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderer.h @@ -11,7 +11,7 @@ class Level; class AABB; class IconRegister; -using namespace std; + class EntityRenderDispatcher; class Font; @@ -36,16 +36,16 @@ public: EntityRenderer(); // 4J - added virtual ~EntityRenderer(); public: - virtual void render(shared_ptr entity, double x, double y, double z, float rot, float a) = 0; + virtual void render(std::shared_ptr entity, double x, double y, double z, float rot, float a) = 0; protected: virtual void bindTexture(int resourceName); // 4J - added - virtual void bindTexture(const wstring& resourceName); + virtual void bindTexture(const std::wstring& resourceName); - virtual bool bindTexture(const wstring& urlTexture, int backupTexture); // 4J added - virtual bool bindTexture(const wstring& urlTexture, const wstring& backupTexture); + virtual bool bindTexture(const std::wstring& urlTexture, int backupTexture); // 4J added + virtual bool bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture); private: - virtual void renderFlame(shared_ptr e, double x, double y, double z, float a); - virtual void renderShadow(shared_ptr e, double x, double y, double z, float pow, float a); + virtual void renderFlame(std::shared_ptr e, double x, double y, double z, float a); + virtual void renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a); virtual Level *getLevel(); virtual void renderTileShadow(Tile *tt, double x, double y, double z, int xt, int yt, int zt, float pow, float r, double xo, double yo, double zo); @@ -54,7 +54,7 @@ public: static void renderFlat(AABB *bb); static void renderFlat(float x0, float y0, float z0, float x1, float y1, float z1); virtual void init(EntityRenderDispatcher *entityRenderDispatcher); - virtual void postRender(shared_ptr entity, double x, double y, double z, float rot, float a, bool bRenderPlayerShadow); + virtual void postRender(std::shared_ptr entity, double x, double y, double z, float rot, float a, bool bRenderPlayerShadow); virtual Font *getFont(); virtual void registerTerrainTextures(IconRegister *iconRegister); diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.cpp index c268dfe19..572d3a6c0 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.cpp @@ -7,8 +7,8 @@ EntityTileRenderer *EntityTileRenderer::instance = new EntityTileRenderer; EntityTileRenderer::EntityTileRenderer() { - chest = shared_ptr(new ChestTileEntity()); - enderChest = shared_ptr(new EnderChestTileEntity()); + chest = std::shared_ptr(new ChestTileEntity()); + enderChest = std::shared_ptr(new EnderChestTileEntity()); } void EntityTileRenderer::render(Tile *tile, int data, float brightness, float alpha, bool setColor, bool useCompiled) diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.h index cc572cadf..14ba6bfc6 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityTileRenderer.h @@ -10,8 +10,8 @@ class EntityTileRenderer static EntityTileRenderer *instance; private: - shared_ptr chest; - shared_ptr enderChest; + std::shared_ptr chest; + std::shared_ptr enderChest; public: EntityTileRenderer(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.cpp index aa150a743..f555bb1f4 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.cpp @@ -19,9 +19,9 @@ ExperienceOrbRenderer::ExperienceOrbRenderer() } -void ExperienceOrbRenderer::render(shared_ptr _orb, double x, double y, double z, float rot, float a) +void ExperienceOrbRenderer::render(std::shared_ptr _orb, double x, double y, double z, float rot, float a) { - shared_ptr orb = dynamic_pointer_cast(_orb); + std::shared_ptr orb = std::dynamic_pointer_cast(_orb); glPushMatrix(); glTranslatef((float) x, (float) y, (float) z); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.h index ebd166f49..5237ecb8d 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ExperienceOrbRenderer.h @@ -12,6 +12,6 @@ public: ExperienceOrbRenderer(); - void render(shared_ptr _orb, double x, double y, double z, float rot, float a); + void render(std::shared_ptr _orb, double x, double y, double z, float rot, float a); void blit(int x, int y, int sx, int sy, int w, int h); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.cpp index 26fc40486..e41010e61 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.cpp @@ -12,10 +12,10 @@ FallingTileRenderer::FallingTileRenderer() : EntityRenderer() this->shadowRadius = 0.5f; } -void FallingTileRenderer::render(shared_ptr _tile, double x, double y, double z, float rot, float a) +void FallingTileRenderer::render(std::shared_ptr _tile, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr tile = dynamic_pointer_cast(_tile); + std::shared_ptr tile = std::dynamic_pointer_cast(_tile); glPushMatrix(); glTranslatef((float) x, (float) y, (float) z); diff --git a/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.h index 0ece60337..c3181c968 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/FallingTileRenderer.h @@ -10,5 +10,5 @@ private: public: FallingTileRenderer(); - virtual void render(shared_ptr _tile, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _tile, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.cpp index 6761196e8..399faee27 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.cpp @@ -12,10 +12,10 @@ FireballRenderer::FireballRenderer(float scale) this->scale = scale; } -void FireballRenderer::render(shared_ptr _fireball, double x, double y, double z, float rot, float a) +void FireballRenderer::render(std::shared_ptr _fireball, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr fireball = dynamic_pointer_cast(_fireball); + std::shared_ptr fireball = std::dynamic_pointer_cast(_fireball); glPushMatrix(); @@ -54,7 +54,7 @@ void FireballRenderer::render(shared_ptr _fireball, double x, double y, } // 4J Added override. Based on EntityRenderer::renderFlame -void FireballRenderer::renderFlame(shared_ptr e, double x, double y, double z, float a) +void FireballRenderer::renderFlame(std::shared_ptr e, double x, double y, double z, float a) { glDisable(GL_LIGHTING); Icon *tex = Tile::fire->getTextureLayer(0); diff --git a/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.h index 9b22e74a4..201e3aad1 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/FireballRenderer.h @@ -9,9 +9,9 @@ private: public: FireballRenderer(float scale); - virtual void render(shared_ptr _fireball, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _fireball, double x, double y, double z, float rot, float a); private: // 4J Added override - virtual void renderFlame(shared_ptr e, double x, double y, double z, float a); + virtual void renderFlame(std::shared_ptr e, double x, double y, double z, float a); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.cpp index c2cf0cb83..95af3d46d 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.cpp @@ -8,10 +8,10 @@ #include "../../../Minecraft.World/Util/Mth.h" #include "../../Player/MultiPlayerLocalPlayer.h" -void FishingHookRenderer::render(shared_ptr _hook, double x, double y, double z, float rot, float a) +void FishingHookRenderer::render(std::shared_ptr _hook, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr hook = dynamic_pointer_cast(_hook); + std::shared_ptr hook = std::dynamic_pointer_cast(_hook); glPushMatrix(); @@ -62,7 +62,7 @@ void FishingHookRenderer::render(shared_ptr _hook, double x, double y, d double xp = hook->owner->xo + (hook->owner->x - hook->owner->xo) * a + vv->x; double yp = hook->owner->yo + (hook->owner->y - hook->owner->yo) * a + vv->y; double zp = hook->owner->zo + (hook->owner->z - hook->owner->zo) * a + vv->z; - double yOffset = hook->owner != dynamic_pointer_cast(Minecraft::GetInstance()->player) ? hook->owner->getHeadHeight() : 0; + double yOffset = hook->owner != std::dynamic_pointer_cast(Minecraft::GetInstance()->player) ? hook->owner->getHeadHeight() : 0; // 4J-PB - changing this to be per player //if (this->entityRenderDispatcher->options->thirdPersonView) diff --git a/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.h index 2683f1871..338bc6046 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/FishingHookRenderer.h @@ -4,5 +4,5 @@ class FishingHookRenderer : public EntityRenderer { public: - virtual void render(shared_ptr _hook, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _hook, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.cpp index 4b8bf54d9..fe373d06d 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.cpp @@ -7,9 +7,9 @@ GhastRenderer::GhastRenderer() : MobRenderer(new GhastModel(), 0.5f) { } -void GhastRenderer::scale(shared_ptr mob, float a) +void GhastRenderer::scale(std::shared_ptr mob, float a) { - shared_ptr ghast = dynamic_pointer_cast(mob); + std::shared_ptr ghast = std::dynamic_pointer_cast(mob); float ss = (ghast->oCharge+(ghast->charge-ghast->oCharge)*a)/20.0f; if (ss<0) ss = 0; diff --git a/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.h index 6778b9a5a..1bd3131f8 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/GhastRenderer.h @@ -7,5 +7,5 @@ public: GhastRenderer(); protected: - virtual void scale(shared_ptr mob, float a); + virtual void scale(std::shared_ptr mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.cpp index 9bcd34459..e674e9d34 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.cpp @@ -6,7 +6,7 @@ GiantMobRenderer::GiantMobRenderer(Model *model, float shadow, float _scale) : M this->_scale = _scale; } -void GiantMobRenderer::scale(shared_ptr mob, float a) +void GiantMobRenderer::scale(std::shared_ptr mob, float a) { glScalef(_scale, _scale, _scale); } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.h index 5b1cce1d3..c40708631 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/GiantMobRenderer.h @@ -10,5 +10,5 @@ public: GiantMobRenderer(Model *model, float shadow, float scale); protected: - virtual void scale(shared_ptr mob, float a); + virtual void scale(std::shared_ptr mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp index 67fd9e71a..7fc66de50 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.cpp @@ -36,12 +36,12 @@ void HumanoidMobRenderer::createArmorParts() armorParts2 = new HumanoidModel(0.5f); } -void HumanoidMobRenderer::additionalRendering(shared_ptr mob, float a) +void HumanoidMobRenderer::additionalRendering(std::shared_ptr mob, float a) { float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : mob->getBrightness(a); glColor3f(brightness, brightness, brightness); - shared_ptr item = mob->getCarriedItem(); - shared_ptr headGear = mob->getArmor(3); + std::shared_ptr item = mob->getCarriedItem(); + std::shared_ptr headGear = mob->getArmor(3); if (headGear != NULL) { @@ -70,7 +70,7 @@ void HumanoidMobRenderer::additionalRendering(shared_ptr mob, float a) float s = 17 / 16.0f; glScalef(s, -s, -s); - wstring extra = L""; + std::wstring extra = L""; if (headGear->hasTag() && headGear->getTag()->contains(L"SkullOwner")) { extra = headGear->getTag()->getString(L"SkullOwner"); @@ -144,7 +144,7 @@ void HumanoidMobRenderer::additionalRendering(shared_ptr mob, float a) } -void HumanoidMobRenderer::scale(shared_ptr mob, float a) +void HumanoidMobRenderer::scale(std::shared_ptr mob, float a) { glScalef(_scale, _scale, _scale); } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.h index 6c718fb92..76c9169b5 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/HumanoidMobRenderer.h @@ -17,6 +17,6 @@ public: HumanoidMobRenderer(HumanoidModel *humanoidModel, float shadow, float scale); protected: virtual void createArmorParts(); - virtual void additionalRendering(shared_ptr mob, float a); - void scale(shared_ptr mob, float a); + virtual void additionalRendering(std::shared_ptr mob, float a); + void scale(std::shared_ptr mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.cpp index 8b3f92499..fdb3d5554 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.cpp @@ -23,11 +23,11 @@ void ItemFrameRenderer::registerTerrainTextures(IconRegister *iconRegister) backTexture = iconRegister->registerIcon(L"itemframe_back"); } -void ItemFrameRenderer::render(shared_ptr _itemframe, double x, double y, double z, float rot, float a) +void ItemFrameRenderer::render(std::shared_ptr _itemframe, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type EnderCrystal rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type EnderCrystal rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr itemFrame = dynamic_pointer_cast(_itemframe); + std::shared_ptr itemFrame = std::dynamic_pointer_cast(_itemframe); glPushMatrix(); float xOffs = (float) (itemFrame->x - x) - 0.5f; @@ -47,7 +47,7 @@ void ItemFrameRenderer::render(shared_ptr _itemframe, double x, double } -void ItemFrameRenderer::drawFrame(shared_ptr itemFrame) +void ItemFrameRenderer::drawFrame(std::shared_ptr itemFrame) { Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -102,14 +102,14 @@ void ItemFrameRenderer::drawFrame(shared_ptr itemFrame) glPopMatrix(); } -void ItemFrameRenderer::drawItem(shared_ptr entity) +void ItemFrameRenderer::drawItem(std::shared_ptr entity) { Minecraft *pMinecraft=Minecraft::GetInstance(); - shared_ptr instance = entity->getItem(); + std::shared_ptr instance = entity->getItem(); if (instance == NULL) return; - shared_ptr itemEntity = shared_ptr(new ItemEntity(entity->level, 0, 0, 0, instance)); + std::shared_ptr itemEntity = std::shared_ptr(new ItemEntity(entity->level, 0, 0, 0, instance)); itemEntity->getItem()->count = 1; itemEntity->bobOffs = 0; @@ -150,7 +150,7 @@ void ItemFrameRenderer::drawItem(shared_ptr entity) t->vertexUV(0 - vo, 0 - vo, 0, 0, 0); t->end(); - shared_ptr data = Item::map->getSavedData(itemEntity->getItem(), entity->level); + std::shared_ptr data = Item::map->getSavedData(itemEntity->getItem(), entity->level); if (data != NULL) { entityRenderDispatcher->itemInHandRenderer->minimap->render(nullptr, entityRenderDispatcher->textures, data, entity->entityId); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.h index 47f2fe90b..263344138 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemFrameRenderer.h @@ -9,9 +9,9 @@ private: //@Override public: void registerTerrainTextures(IconRegister *iconRegister); - virtual void render(shared_ptr _itemframe, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _itemframe, double x, double y, double z, float rot, float a); private: - void drawFrame(shared_ptr itemFrame); - void drawItem(shared_ptr entity); + void drawFrame(std::shared_ptr itemFrame); + void drawItem(std::shared_ptr entity); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp index 48fe302f3..6ed000bb0 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp @@ -158,7 +158,7 @@ ItemInHandRenderer::ItemInHandRenderer(Minecraft *mc, bool optimisedMinimap) } -void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptr item, int layer, bool setColor/* = true*/) +void ItemInHandRenderer::renderItem(std::shared_ptr mob, std::shared_ptr item, int layer, bool setColor/* = true*/) { // 4J - code borrowed from render method below, although not factoring in brightness as that should already be being taken into account // by texture lighting. This is for colourising things held in 3rd person view. @@ -312,14 +312,14 @@ void ItemInHandRenderer::renderItem3D(Tesselator *t, float u0, float v0, float u void ItemInHandRenderer::render(float a) { float h = oHeight + (height - oHeight) * a; - shared_ptr player = mc->player; + std::shared_ptr player = mc->player; // 4J - added so we can adjust the position of the hands for horizontal & vertical split screens float fudgeX = 0.0f; float fudgeY = 0.0f; float fudgeZ = 0.0f; bool splitHoriz = false; - shared_ptr localPlayer = dynamic_pointer_cast(player); + std::shared_ptr localPlayer = std::dynamic_pointer_cast(player); if( localPlayer ) { if( localPlayer->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM || @@ -353,7 +353,7 @@ void ItemInHandRenderer::render(float a) glRotatef((yr - yrr) * 0.1f, 0, 1, 0); } - shared_ptr item = selectedItem; + std::shared_ptr item = selectedItem; float br = mc->level->getBrightness(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); // 4J - change brought forward from 1.8.2 @@ -433,7 +433,7 @@ void ItemInHandRenderer::render(float a) glScalef(ss, ss, ss); // Can't turn off the hand if the player is holding a map - shared_ptr itemInstance = player->inventory->getSelected(); + std::shared_ptr itemInstance = player->inventory->getSelected(); if ((itemInstance && (itemInstance->getItem()->id==Item::map_Id)) || app.GetGameSettings(localPlayer->GetXboxPad(),eGameSetting_DisplayHand)!=0 ) { playerRenderer->renderHand(); @@ -477,7 +477,7 @@ void ItemInHandRenderer::render(float a) t->vertexUV((float)(0 - vo), (float)( 0 - vo), (float)( 0), (float)( 0), (float)( 0)); t->end(); - shared_ptr data = Item::map->getSavedData(item, mc->level); + std::shared_ptr data = Item::map->getSavedData(item, mc->level); PIXBeginNamedEvent(0,"Minimap render"); if(data != NULL) minimap->render(mc->player, mc->textures, data, mc->player->entityId); PIXEndNamedEvent(); @@ -652,7 +652,7 @@ void ItemInHandRenderer::render(float a) glScalef(ss, ss, ss); MemSect(31); // Can't turn off the hand if the player is holding a map - shared_ptr itemInstance = player->inventory->getSelected(); + std::shared_ptr itemInstance = player->inventory->getSelected(); if ( (itemInstance && (itemInstance->getItem()->id==Item::map_Id)) || app.GetGameSettings(localPlayer->GetXboxPad(),eGameSetting_DisplayHand)!=0 ) { @@ -837,8 +837,8 @@ void ItemInHandRenderer::tick() oHeight = height; - shared_ptr player = mc->player; - shared_ptr nextTile = player->inventory->getSelected(); + std::shared_ptr player = mc->player; + std::shared_ptr nextTile = player->inventory->getSelected(); bool matches = lastSlot == player->inventory->selected && nextTile == selectedItem; if (selectedItem == NULL && nextTile == NULL) diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.h index dee51a7f1..975dd3606 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.h @@ -11,7 +11,7 @@ class ItemInHandRenderer { private: Minecraft *mc; - shared_ptr selectedItem; + std::shared_ptr selectedItem; float height; float oHeight; TileRenderer *tileRenderer; @@ -23,7 +23,7 @@ public: public: ItemInHandRenderer(Minecraft *mc, bool optimisedMinimap = true); // 4J Added optimisedMinimap param - void renderItem(shared_ptr mob, shared_ptr item, int layer, bool setColor = true); // 4J added setColor parameter + void renderItem(std::shared_ptr mob, std::shared_ptr item, int layer, bool setColor = true); // 4J added setColor parameter static void renderItem3D(Tesselator *t, float u0, float v0, float u1, float v1, int width, int height, float depth, bool isGlint); // 4J added isGlint parameter public: void render(float a); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp index f8a6e2c54..184484e74 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp @@ -29,13 +29,13 @@ ItemRenderer::~ItemRenderer() delete random; } -void ItemRenderer::render(shared_ptr _itemEntity, double x, double y, double z, float rot, float a) +void ItemRenderer::render(std::shared_ptr _itemEntity, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr itemEntity = dynamic_pointer_cast(_itemEntity); + std::shared_ptr itemEntity = std::dynamic_pointer_cast(_itemEntity); random->setSeed(187); - shared_ptr item = itemEntity->getItem(); + std::shared_ptr item = itemEntity->getItem(); glPushMatrix(); float bob = Mth::sin((itemEntity->age + a) / 10.0f + itemEntity->bobOffs) * 0.1f + 0.1f; @@ -172,7 +172,7 @@ void ItemRenderer::render(shared_ptr _itemEntity, double x, double y, do } } -void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon, int count, float a, float red, float green, float blue) +void ItemRenderer::renderItemBillboard(std::shared_ptr entity, Icon *icon, int count, float a, float red, float green, float blue) { Tesselator *t = Tesselator::getInstance(); @@ -213,7 +213,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon float width = 1 / 16.0f; float margin = 0.35f / 16.0f; - shared_ptr item = entity->getItem(); + std::shared_ptr item = entity->getItem(); int items = item->count; if (items < 2) @@ -315,7 +315,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon } } -void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr item, float x, float y, float fScale, float fAlpha) +void ItemRenderer::renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, float x, float y, float fScale, float fAlpha) { renderGuiItem(font,textures,item,x,y,fScale,fScale,fAlpha, true); } @@ -325,7 +325,7 @@ extern IDirect3DDevice9 *g_pD3DDevice; #endif // 4J - this used to take x and y as ints, and no scale and alpha - but this interface is now implemented as a wrapper round this more fully featured one -void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr item, float x, float y, float fScaleX,float fScaleY, float fAlpha, bool useCompiled) +void ItemRenderer::renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, float x, float y, float fScaleX,float fScaleY, float fAlpha, bool useCompiled) { int itemId = item->id; int itemAuxValue = item->getAuxValue(); @@ -447,13 +447,13 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr item, int x, int y) +void ItemRenderer::renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, int x, int y) { renderGuiItem(font, textures, item, (float)x, (float)y, 1.0f, 1.0f ); } // 4J - this used to take x and y as ints, and no scale, alpha or foil - but this interface is now implemented as a wrapper round this more fully featured one -void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, float x, float y,float fScale,float fAlpha, bool isFoil) +void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, float x, float y,float fScale,float fAlpha, bool isFoil) { if(item==NULL) return; renderAndDecorateItem(font, textures, item, x, y,fScale, fScale, fAlpha, isFoil, true); @@ -461,7 +461,7 @@ void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const s // 4J - added isConstantBlended and blendFactor parameters. This is true if the gui item is being rendered from a context where it already has blending enabled to do general interface fading // (ie from the gui rather than xui). In this case we dno't want to enable/disable blending, and do need to restore the blend state when we are done. -void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, float x, float y,float fScaleX, float fScaleY,float fAlpha, bool isFoil, bool isConstantBlended, bool useCompiled) +void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, float x, float y,float fScaleX, float fScaleY,float fAlpha, bool isFoil, bool isConstantBlended, bool useCompiled) { if (item == NULL) { @@ -507,7 +507,7 @@ void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const s } // 4J - original interface, now just a wrapper for preceding overload -void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, int x, int y) +void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, int x, int y) { renderAndDecorateItem( font, textures, item, (float)x, (float)y, 1.0f, 1.0f, item->isFoil() ); } @@ -560,12 +560,12 @@ void ItemRenderer::blitGlint(int id, float x, float y, float w, float h) } } -void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shared_ptr item, int x, int y, float fAlpha) +void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, float fAlpha) { renderGuiItemDecorations(font, textures, item, x, y, L"", fAlpha); } -void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shared_ptr item, int x, int y, const wstring &countText, float fAlpha) +void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, const std::wstring &countText, float fAlpha) { if (item == NULL) { @@ -578,7 +578,7 @@ void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shar if (item->count > 1 || !countText.empty() || item->GetForceNumberDisplay()) { MemSect(31); - wstring amount = countText; + std::wstring amount = countText; if(amount.empty()) { int count = item->count; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h index 9690f77cc..f2f68a254 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.h @@ -18,20 +18,20 @@ public: ItemRenderer(); virtual ~ItemRenderer(); - virtual void render(shared_ptr _itemEntity, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _itemEntity, double x, double y, double z, float rot, float a); private: - virtual void renderItemBillboard(shared_ptr entity, Icon *icon, int count, float a, float red, float green, float blue); + virtual void renderItemBillboard(std::shared_ptr entity, Icon *icon, int count, float a, float red, float green, float blue); public: // 4J - original 2 interface variants - void renderGuiItem(Font *font, Textures *textures, shared_ptr item, int x, int y); - void renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, int x, int y); + void renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, int x, int y); + void renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, int x, int y); // 4J - new interfaces added - void renderGuiItem(Font *font, Textures *textures, shared_ptr item, float x, float y, float fScale, float fAlpha); - void renderGuiItem(Font *font, Textures *textures, shared_ptr item, float x, float y, float fScaleX,float fScaleY, float fAlpha, bool useCompiled); // 4J Added useCompiled - void renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, float x, float y, float fScale, float fAlpha, bool isFoil); - void renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, float x, float y, float fScaleX, float fScaleY, float fAlpha, bool isFoil, bool isConstantBlended, bool useCompiled = true); // 4J - added isConstantBlended and useCompiled + void renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, float x, float y, float fScale, float fAlpha); + void renderGuiItem(Font *font, Textures *textures, std::shared_ptr item, float x, float y, float fScaleX,float fScaleY, float fAlpha, bool useCompiled); // 4J Added useCompiled + void renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, float x, float y, float fScale, float fAlpha, bool isFoil); + void renderAndDecorateItem(Font *font, Textures *textures, const std::shared_ptr item, float x, float y, float fScaleX, float fScaleY, float fAlpha, bool isFoil, bool isConstantBlended, bool useCompiled = true); // 4J - added isConstantBlended and useCompiled // 4J Added virtual void SetItemFrame(bool bSet) {m_bItemFrame=bSet;} @@ -42,8 +42,8 @@ private: void blitGlint(int id, float x, float y, float w, float h); // 4J - changed x,y,w,h to floats public: - void renderGuiItemDecorations(Font *font, Textures *textures, shared_ptr item, int x, int y, float fAlpha = 1.0f); - void renderGuiItemDecorations(Font *font, Textures *textures, shared_ptr item, int x, int y, const wstring &countText, float fAlpha = 1.0f); + void renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, float fAlpha = 1.0f); + void renderGuiItemDecorations(Font *font, Textures *textures, std::shared_ptr item, int x, int y, const std::wstring &countText, float fAlpha = 1.0f); private: void fillRect(Tesselator *t, int x, int y, int w, int h, int c); public: diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.cpp index e21c6b961..bd8b79ca9 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.cpp @@ -17,7 +17,7 @@ ItemSpriteRenderer::ItemSpriteRenderer(Item *sourceItem, int sourceItemAuxValue // this(sourceItem, 0); //} -void ItemSpriteRenderer::render(shared_ptr e, double x, double y, double z, float rot, float a) +void ItemSpriteRenderer::render(std::shared_ptr e, double x, double y, double z, float rot, float a) { // the icon is already cached in the item object, so there should not be any performance impact by not caching it here Icon *icon = sourceItem->getIcon(sourceItemAuxValue); @@ -37,7 +37,7 @@ void ItemSpriteRenderer::render(shared_ptr e, double x, double y, double if (icon == PotionItem::getTexture(PotionItem::THROWABLE_ICON) ) { - int col = PotionBrewing::getColorValue((dynamic_pointer_cast(e) )->getPotionValue(), false); + int col = PotionBrewing::getColorValue((std::dynamic_pointer_cast(e) )->getPotionValue(), false); float red = ((col >> 16) & 0xff) / 255.0f; float g = ((col >> 8) & 0xff) / 255.0f; float b = ((col) & 0xff) / 255.0f; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.h index e60feece3..e83597839 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemSpriteRenderer.h @@ -11,7 +11,7 @@ private: public: ItemSpriteRenderer(Item *sourceItem, int sourceItemAuxValue = 0); //ItemSpriteRenderer(Item *icon); - virtual void render(shared_ptr e, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr e, double x, double y, double z, float rot, float a); private: void renderIcon(Tesselator *t, Icon *icon); diff --git a/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.cpp index bfa0db720..09ea2c83f 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.cpp @@ -8,11 +8,11 @@ LavaSlimeRenderer::LavaSlimeRenderer() : MobRenderer(new LavaSlimeModel(), .25f) this->modelVersion = ((LavaSlimeModel *) model)->getModelVersion(); } -void LavaSlimeRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void LavaSlimeRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type LavaSlime rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type LavaSlime rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); int modelVersion = ((LavaSlimeModel *) model)->getModelVersion(); if (modelVersion != this->modelVersion) { @@ -23,11 +23,11 @@ void LavaSlimeRenderer::render(shared_ptr _mob, double x, double y, doub MobRenderer::render(mob, x, y, z, rot, a); } -void LavaSlimeRenderer::scale(shared_ptr _slime, float a) +void LavaSlimeRenderer::scale(std::shared_ptr _slime, float a) { - // 4J - original version used generics and thus had an input parameter of type LavaSlime rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type LavaSlime rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr slime = dynamic_pointer_cast(_slime); + std::shared_ptr slime = std::dynamic_pointer_cast(_slime); int size = slime->getSize(); float ss = (slime->oSquish + (slime->squish - slime->oSquish) * a) / (size * 0.5f + 1); float w = 1 / (ss + 1); diff --git a/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.h index b0c44d1e2..29afb390e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/LavaSlimeRenderer.h @@ -10,8 +10,8 @@ private: public: LavaSlimeRenderer(); - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - virtual void scale(shared_ptr _slime, float a); + virtual void scale(std::shared_ptr _slime, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.cpp index 53651c94c..d4d5b8d5d 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.cpp @@ -3,10 +3,10 @@ #include "../Tesselator.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.global.h" -void LightningBoltRenderer::render(shared_ptr _bolt, double x, double y, double z, float rot, float a) +void LightningBoltRenderer::render(std::shared_ptr _bolt, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr bolt = dynamic_pointer_cast(_bolt); + std::shared_ptr bolt = std::dynamic_pointer_cast(_bolt); Tesselator *t = Tesselator::getInstance(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.h index 5a2b33a3e..bf5c7c82c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/LightningBoltRenderer.h @@ -4,5 +4,5 @@ class LightningBoltRenderer : public EntityRenderer { public: - virtual void render(shared_ptr bolt, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr bolt, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.cpp index 1daf1b79e..0b0d7077b 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.cpp @@ -10,10 +10,10 @@ MinecartRenderer::MinecartRenderer() model = new MinecartModel(); } -void MinecartRenderer::render(shared_ptr _cart, double x, double y, double z, float rot, float a) +void MinecartRenderer::render(std::shared_ptr _cart, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr cart = dynamic_pointer_cast(_cart); + std::shared_ptr cart = std::dynamic_pointer_cast(_cart); glPushMatrix(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.h index 0335ba8de..6902a3bf2 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MinecartRenderer.h @@ -8,5 +8,5 @@ protected: public: MinecartRenderer(); - void render(shared_ptr _cart, double x, double y, double z, float rot, float a); + void render(std::shared_ptr _cart, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp index 0f0da4389..5c4ca6a38 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.cpp @@ -31,11 +31,11 @@ float MobRenderer::rotlerp(float from, float to, float a) return from + a * diff; } -void MobRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void MobRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { // 4J - added - this used to use generics so the input parameter could be a mob (or derived type), but we aren't // able to do that so dynamically casting to get the more specific type here. - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); glPushMatrix(); glDisable(GL_CULL_FACE); @@ -52,9 +52,9 @@ void MobRenderer::render(shared_ptr _mob, double x, double y, double z, float bodyRot = rotlerp(mob->yBodyRotO, mob->yBodyRot, a); float headRot = rotlerp(mob->yHeadRotO, mob->yHeadRot, a); - if (mob->isRiding() && dynamic_pointer_cast(mob->riding)) + if (mob->isRiding() && std::dynamic_pointer_cast(mob->riding)) { - shared_ptr riding = dynamic_pointer_cast(mob->riding); + std::shared_ptr riding = std::dynamic_pointer_cast(mob->riding); bodyRot = rotlerp(riding->yBodyRotO, riding->yBodyRot, a); float headDiff = Mth::wrapDegrees(headRot - bodyRot); @@ -233,9 +233,9 @@ void MobRenderer::render(shared_ptr _mob, double x, double y, double z, MemSect(0); } -void MobRenderer::renderModel(shared_ptr mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale) +void MobRenderer::renderModel(std::shared_ptr mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale) { - shared_ptr player = dynamic_pointer_cast(Minecraft::GetInstance()->player); + std::shared_ptr player = std::dynamic_pointer_cast(Minecraft::GetInstance()->player); bindTexture(mob->customTextureUrl, mob->getTexture()); if (!mob->isInvisible()) @@ -262,12 +262,12 @@ void MobRenderer::renderModel(shared_ptr mob, float wp, float ws, float } } -void MobRenderer::setupPosition(shared_ptr mob, double x, double y, double z) +void MobRenderer::setupPosition(std::shared_ptr mob, double x, double y, double z) { glTranslatef((float) x, (float) y, (float) z); } -void MobRenderer::setupRotations(shared_ptr mob, float bob, float bodyRot, float a) +void MobRenderer::setupRotations(std::shared_ptr mob, float bob, float bodyRot, float a) { glRotatef(180 - bodyRot, 0, 1, 0); if (mob->deathTime > 0) @@ -279,49 +279,49 @@ void MobRenderer::setupRotations(shared_ptr mob, float bob, float bodyRot, } } -float MobRenderer::getAttackAnim(shared_ptr mob, float a) +float MobRenderer::getAttackAnim(std::shared_ptr mob, float a) { return mob->getAttackAnim(a); } -float MobRenderer::getBob(shared_ptr mob, float a) +float MobRenderer::getBob(std::shared_ptr mob, float a) { return (mob->tickCount + a); } -void MobRenderer::additionalRendering(shared_ptr mob, float a) +void MobRenderer::additionalRendering(std::shared_ptr mob, float a) { } -int MobRenderer::prepareArmorOverlay(shared_ptr mob, int layer, float a) +int MobRenderer::prepareArmorOverlay(std::shared_ptr mob, int layer, float a) { return prepareArmor(mob, layer, a); } -int MobRenderer::prepareArmor(shared_ptr mob, int layer, float a) +int MobRenderer::prepareArmor(std::shared_ptr mob, int layer, float a) { return -1; } -void MobRenderer::prepareSecondPassArmor(shared_ptr mob, int layer, float a) +void MobRenderer::prepareSecondPassArmor(std::shared_ptr mob, int layer, float a) { } -float MobRenderer::getFlipDegrees(shared_ptr mob) +float MobRenderer::getFlipDegrees(std::shared_ptr mob) { return 90; } -int MobRenderer::getOverlayColor(shared_ptr mob, float br, float a) +int MobRenderer::getOverlayColor(std::shared_ptr mob, float br, float a) { return 0; } -void MobRenderer::scale(shared_ptr mob, float a) +void MobRenderer::scale(std::shared_ptr mob, float a) { } -void MobRenderer::renderName(shared_ptr mob, double x, double y, double z) +void MobRenderer::renderName(std::shared_ptr mob, double x, double y, double z) { if (Minecraft::renderDebug()) { @@ -330,7 +330,7 @@ void MobRenderer::renderName(shared_ptr mob, double x, double y, double z) } // 4J Added parameter for color here so that we can colour players names -void MobRenderer::renderNameTag(shared_ptr mob, const wstring& OriginalName, double x, double y, double z, int maxDist, int color /*= 0xffffffff*/) +void MobRenderer::renderNameTag(std::shared_ptr mob, const std::wstring& OriginalName, double x, double y, double z, int maxDist, int color /*= 0xffffffff*/) { if ( app.GetGameSettings(eGameSetting_DisplayHUD)==0 ) @@ -396,10 +396,10 @@ void MobRenderer::renderNameTag(shared_ptr mob, const wstring& OriginalName Tesselator *t = Tesselator::getInstance(); int offs = 0; - shared_ptr player = dynamic_pointer_cast(mob); + std::shared_ptr player = std::dynamic_pointer_cast(mob); if (player != NULL && app.isXuidDeadmau5( player->getXuid() ) ) offs = -10; - wstring playerName; + std::wstring playerName; WCHAR wchName[2]; #if defined(__PS3__) || defined(__ORBIS__) diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h index a8b2b93e7..7cefa63e7 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MobRenderer.h @@ -1,7 +1,7 @@ #pragma once #include "EntityRenderer.h" class Mob; -using namespace std; + #define PLAYER_NAME_READABLE_FULLSCREEN 16 #define PLAYER_NAME_READABLE_DISTANCE_SPLITSCREEN 8 @@ -23,22 +23,22 @@ public: private: float rotlerp(float from, float to, float a); public: - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); protected: - virtual void renderModel(shared_ptr mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale); - virtual void setupPosition(shared_ptr mob, double x, double y, double z); - virtual void setupRotations(shared_ptr mob, float bob, float bodyRot, float a); - virtual float getAttackAnim(shared_ptr mob, float a); - virtual float getBob(shared_ptr mob, float a); - virtual void additionalRendering(shared_ptr mob, float a); - virtual int prepareArmorOverlay(shared_ptr mob, int layer, float a); - virtual int prepareArmor(shared_ptr mob, int layer, float a); - virtual void prepareSecondPassArmor(shared_ptr mob, int layer, float a); - virtual float getFlipDegrees(shared_ptr mob); - virtual int getOverlayColor(shared_ptr mob, float br, float a); - virtual void scale(shared_ptr mob, float a); - virtual void renderName(shared_ptr mob, double x, double y, double z); - virtual void renderNameTag(shared_ptr mob, const wstring& name, double x, double y, double z, int maxDist, int color = 0xff000000); + virtual void renderModel(std::shared_ptr mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale); + virtual void setupPosition(std::shared_ptr mob, double x, double y, double z); + virtual void setupRotations(std::shared_ptr mob, float bob, float bodyRot, float a); + virtual float getAttackAnim(std::shared_ptr mob, float a); + virtual float getBob(std::shared_ptr mob, float a); + virtual void additionalRendering(std::shared_ptr mob, float a); + virtual int prepareArmorOverlay(std::shared_ptr mob, int layer, float a); + virtual int prepareArmor(std::shared_ptr mob, int layer, float a); + virtual void prepareSecondPassArmor(std::shared_ptr mob, int layer, float a); + virtual float getFlipDegrees(std::shared_ptr mob); + virtual int getOverlayColor(std::shared_ptr mob, float br, float a); + virtual void scale(std::shared_ptr mob, float a); + virtual void renderName(std::shared_ptr mob, double x, double y, double z); + virtual void renderNameTag(std::shared_ptr mob, const std::wstring& name, double x, double y, double z, int maxDist, int color = 0xff000000); public: // 4J Added diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.cpp index 9b8b8225b..6c4f6a928 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.cpp @@ -5,15 +5,15 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.entity.h" -void MobSpawnerRenderer::render(shared_ptr _spawner, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void MobSpawnerRenderer::render(std::shared_ptr _spawner, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr spawner = dynamic_pointer_cast(_spawner); + std::shared_ptr spawner = std::dynamic_pointer_cast(_spawner); glPushMatrix(); glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f); - shared_ptr e = spawner->getDisplayEntity(); + std::shared_ptr e = spawner->getDisplayEntity(); if (e != NULL) { e->setLevel(spawner->level); diff --git a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h index ad7dfe675..1b6b6109e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MobSpawnerRenderer.h @@ -1,11 +1,11 @@ #pragma once #include "TileEntityRenderer.h" -using namespace std; + class MobSpawnerRenderer : public TileEntityRenderer { private: - unordered_map > models; + std::unordered_map > models; public: - virtual void render(shared_ptr _spawner, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param + virtual void render(std::shared_ptr _spawner, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.cpp index 14f66f763..d59fa9036 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.cpp @@ -9,21 +9,21 @@ MushroomCowRenderer::MushroomCowRenderer(Model *model, float shadow) : MobRender { } -void MushroomCowRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void MushroomCowRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { - // 4J - original version used generics and thus had an input parameter of type MushroomCow rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type MushroomCow rather than std::shared_ptr we have here - // do some casting around instead - //shared_ptr mob = dynamic_pointer_cast(_mob); + //std::shared_ptr mob = std::dynamic_pointer_cast(_mob); // 4J Stu - No need to do the cast, just pass through as-is MobRenderer::render(_mob, x, y, z, rot, a); } -void MushroomCowRenderer::additionalRendering(shared_ptr _mob, float a) +void MushroomCowRenderer::additionalRendering(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type MushroomCow rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type MushroomCow rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(mob, a); if (mob->isBaby()) return; bindTexture(TN_TERRAIN); // 4J was "/terrain.png" diff --git a/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.h index c5f6f3c49..8d01ea818 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/MushroomCowRenderer.h @@ -7,8 +7,8 @@ class MushroomCowRenderer : public MobRenderer public: MushroomCowRenderer(Model *model, float shadow); - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - virtual void additionalRendering(shared_ptr _mob, float a); + virtual void additionalRendering(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.cpp index ed3f3ba45..2abb15113 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.cpp @@ -6,16 +6,16 @@ OzelotRenderer::OzelotRenderer(Model *model, float shadow) : MobRenderer(model, { } -void OzelotRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void OzelotRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { MobRenderer::render(_mob, x, y, z, rot, a); } -void OzelotRenderer::scale(shared_ptr _mob, float a) +void OzelotRenderer::scale(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); MobRenderer::scale(mob, a); if (mob->isTame()) { diff --git a/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.h index 9627b4f19..a9fc1223b 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/OcelotRenderer.h @@ -7,8 +7,8 @@ class OzelotRenderer : public MobRenderer public: OzelotRenderer(Model *model, float shadow); - void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - void scale(shared_ptr _mob, float a); + void scale(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.cpp index 146bfa47c..356b76492 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.cpp @@ -11,10 +11,10 @@ PaintingRenderer::PaintingRenderer() random = new Random(); } -void PaintingRenderer::render(shared_ptr _painting, double x, double y, double z, float rot, float a) +void PaintingRenderer::render(std::shared_ptr _painting, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr painting = dynamic_pointer_cast(_painting); + std::shared_ptr painting = std::dynamic_pointer_cast(_painting); random->setSeed(187); @@ -33,7 +33,7 @@ void PaintingRenderer::render(shared_ptr _painting, double x, double y, glPopMatrix(); } -void PaintingRenderer::renderPainting(shared_ptr painting, int w, int h, int uo, int vo) +void PaintingRenderer::renderPainting(std::shared_ptr painting, int w, int h, int uo, int vo) { float xx0 = -w / 2.0f; float yy0 = -h / 2.0f; @@ -113,7 +113,7 @@ void PaintingRenderer::renderPainting(shared_ptr painting, int w, int } -void PaintingRenderer::setBrightness(shared_ptr painting, float ss, float ya) +void PaintingRenderer::setBrightness(std::shared_ptr painting, float ss, float ya) { int x = Mth::floor(painting->x); int y = Mth::floor(painting->y + ya/16.0f); diff --git a/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.h index a750e1287..f940c1694 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/PaintingRenderer.h @@ -11,9 +11,9 @@ private: public: PaintingRenderer(); // 4J -added - virtual void render(shared_ptr _painting, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _painting, double x, double y, double z, float rot, float a); private: - void renderPainting(shared_ptr painting, int w, int h, int uo, int vo); - void setBrightness(shared_ptr painting, float ss, float ya); + void renderPainting(std::shared_ptr painting, int w, int h, int uo, int vo); + void setBrightness(std::shared_ptr painting, float ss, float ya); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.cpp index 6872b0f3d..eb7af5da4 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.cpp @@ -7,10 +7,10 @@ PigRenderer::PigRenderer(Model *model, Model *armor, float shadow) : MobRenderer setArmor(armor); } -int PigRenderer::prepareArmor(shared_ptr _pig, int layer, float a) +int PigRenderer::prepareArmor(std::shared_ptr _pig, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr pig = dynamic_pointer_cast(_pig); + std::shared_ptr pig = std::dynamic_pointer_cast(_pig); MemSect(31); bindTexture(TN_MOB_SADDLE); // 4J was L"/mob/saddle.png" @@ -18,7 +18,7 @@ int PigRenderer::prepareArmor(shared_ptr _pig, int layer, float a) return (layer == 0 && pig->hasSaddle()) ? 1 : -1; } -void PigRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) +void PigRenderer::render(std::shared_ptr mob, double x, double y, double z, float rot, float a) { MobRenderer::render(mob, x, y, z, rot, a); } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.h index e674b5084..9dc3edfac 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/PigRenderer.h @@ -6,8 +6,8 @@ class PigRenderer : public MobRenderer public: PigRenderer(Model *model, Model *armor, float shadow); protected: - virtual int prepareArmor(shared_ptr _pig, int layer, float a); + virtual int prepareArmor(std::shared_ptr _pig, int layer, float a); public: - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.cpp index 6406e2bfe..37cd733aa 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.cpp @@ -12,10 +12,10 @@ PistonPieceRenderer::PistonPieceRenderer() tileRenderer = NULL; } -void PistonPieceRenderer::render(shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void PistonPieceRenderer::render(std::shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr entity = dynamic_pointer_cast(_entity); + std::shared_ptr entity = std::dynamic_pointer_cast(_entity); Tile *tile = Tile::tiles[entity->getId()]; if (tile != NULL && entity->getProgress(a) <= 1) // 4J - changed condition from < to <= as our chunk update is async to main thread and so we can have to render these with progress of 1 diff --git a/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.h index 0588a9730..90061b109 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/PistonPieceRenderer.h @@ -10,6 +10,6 @@ private: public: PistonPieceRenderer(); - virtual void render(shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param + virtual void render(std::shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param virtual void onNewLevel(Level *level); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp index 760a29f61..156b6102b 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp @@ -27,7 +27,7 @@ const unsigned int PlayerRenderer::s_nametagColors[MINECRAFT_NET_MAX_PLAYERS] = #endif }; -const wstring PlayerRenderer::MATERIAL_NAMES[5] = { L"cloth", L"chain", L"iron", L"diamond", L"gold" }; +const std::wstring PlayerRenderer::MATERIAL_NAMES[5] = { L"cloth", L"chain", L"iron", L"diamond", L"gold" }; PlayerRenderer::PlayerRenderer() : MobRenderer( new HumanoidModel(0), 0.5f ) { @@ -46,10 +46,10 @@ unsigned int PlayerRenderer::getNametagColour(int index) return 0xFF000000; } -int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, float a) +int PlayerRenderer::prepareArmor(std::shared_ptr _player, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr player = dynamic_pointer_cast(_player); + std::shared_ptr player = std::dynamic_pointer_cast(_player); // 4J-PB - need to disable rendering armour for some special skins (Daleks) unsigned int uiAnimOverrideBitmask=player->getAnimOverrideBitmask(); @@ -58,7 +58,7 @@ int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, float a) return -1; } - shared_ptr itemInstance = player->inventory->getArmor(3 - layer); + std::shared_ptr itemInstance = player->inventory->getArmor(3 - layer); if (itemInstance != NULL) { Item *item = itemInstance->getItem(); @@ -108,11 +108,11 @@ int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, float a) } -void PlayerRenderer::prepareSecondPassArmor(shared_ptr _player, int layer, float a) +void PlayerRenderer::prepareSecondPassArmor(std::shared_ptr _player, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr player = dynamic_pointer_cast(_player); - shared_ptr itemInstance = player->inventory->getArmor(3 - layer); + std::shared_ptr player = std::dynamic_pointer_cast(_player); + std::shared_ptr itemInstance = player->inventory->getArmor(3 - layer); if (itemInstance != NULL) { Item *item = itemInstance->getItem(); @@ -127,14 +127,14 @@ void PlayerRenderer::prepareSecondPassArmor(shared_ptr _player, int layer, } } -void PlayerRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void PlayerRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); if(mob->hasInvisiblePrivilege()) return; - shared_ptr item = mob->inventory->getSelected(); + std::shared_ptr item = mob->inventory->getSelected(); armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != NULL ? 1 : 0; if (item != NULL) { @@ -169,7 +169,7 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double armorParts1->sneaking = armorParts2->sneaking = humanoidModel->sneaking = mob->isSneaking(); double yp = y - mob->heightOffset; - if (mob->isSneaking() && (dynamic_pointer_cast(mob) == NULL)) + if (mob->isSneaking() && (std::dynamic_pointer_cast(mob) == NULL)) { yp -= 2 / 16.0f; } @@ -198,7 +198,7 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double } // 4J-PB - any additional parts to turn on for this player (skin dependent) - vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); + std::vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); //turn them on if(pAdditionalModelParts!=NULL) { @@ -228,10 +228,10 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double } -void PlayerRenderer::renderName(shared_ptr _mob, double x, double y, double z) +void PlayerRenderer::renderName(std::shared_ptr _mob, double x, double y, double z) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); if (Minecraft::renderNames() && mob != entityRenderDispatcher->cameraEntity && !mob->isInvisibleTo(Minecraft::GetInstance()->player) ) // 4J-JEV: Todo, move to LivingEntityRenderer. @@ -245,7 +245,7 @@ void PlayerRenderer::renderName(shared_ptr _mob, double x, double y, double if (dist < maxDist * maxDist) { // Truncate display names longer than 16 char - wstring msg = mob->getDisplayName(); + std::wstring msg = mob->getDisplayName(); if (msg.length() > 16) { msg.resize(16); @@ -316,14 +316,14 @@ void PlayerRenderer::renderName(shared_ptr _mob, double x, double y, double } -void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) +void PlayerRenderer::additionalRendering(std::shared_ptr _mob, float a) { MobRenderer::additionalRendering(_mob,a); // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); - shared_ptr headGear = mob->inventory->getArmor(3); + std::shared_ptr headGear = mob->inventory->getArmor(3); if (headGear != NULL) { // don't render the pumpkin for the skins @@ -351,7 +351,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) float s = 17 / 16.0f; glScalef(s, -s, -s); - wstring extra = L""; + std::wstring extra = L""; if (headGear->hasTag() && headGear->getTag()->contains(L"SkullOwner")) { extra = headGear->getTag()->getString(L"SkullOwner"); @@ -428,7 +428,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) } - shared_ptr item = mob->inventory->getSelected(); + std::shared_ptr item = mob->inventory->getSelected(); if (item != NULL) { @@ -438,7 +438,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) if (mob->fishing != NULL) { - item = shared_ptr( new ItemInstance(Item::stick) ); + item = std::shared_ptr( new ItemInstance(Item::stick) ); } UseAnim anim = UseAnim_none;//null; @@ -521,7 +521,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) } -void PlayerRenderer::scale(shared_ptr player, float a) +void PlayerRenderer::scale(std::shared_ptr player, float a) { float s = 15 / 16.0f; glScalef(s, s, s); @@ -540,10 +540,10 @@ void PlayerRenderer::renderHand() } } -void PlayerRenderer::setupPosition(shared_ptr _mob, double x, double y, double z) +void PlayerRenderer::setupPosition(std::shared_ptr _mob, double x, double y, double z) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); if (mob->isAlive() && mob->isSleeping()) { @@ -556,10 +556,10 @@ void PlayerRenderer::setupPosition(shared_ptr _mob, double x, double y, dou } } -void PlayerRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) +void PlayerRenderer::setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); if (mob->isAlive() && mob->isSleeping()) { @@ -574,11 +574,11 @@ void PlayerRenderer::setupRotations(shared_ptr _mob, float bob, float bodyR } // 4J Added override to stop rendering shadow if player is invisible -void PlayerRenderer::renderShadow(shared_ptr e, double x, double y, double z, float pow, float a) +void PlayerRenderer::renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a) { if(app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) { - shared_ptr player = dynamic_pointer_cast(e); + std::shared_ptr player = std::dynamic_pointer_cast(e); if(player != NULL && player->hasInvisiblePrivilege()) return; } EntityRenderer::renderShadow(e,x,y,z,pow,a); diff --git a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h index 8e42d97e7..b47d36238 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.h @@ -2,7 +2,7 @@ #include "MobRenderer.h" #include "../../../Minecraft.World/Player/Player.h" class HumanoidModel; -using namespace std; + class PlayerRenderer : public MobRenderer { @@ -20,23 +20,23 @@ public: static unsigned int getNametagColour(int index); private: - static const wstring MATERIAL_NAMES[5]; + static const std::wstring MATERIAL_NAMES[5]; protected: - virtual int prepareArmor(shared_ptr _player, int layer, float a); - virtual void prepareSecondPassArmor(shared_ptr mob, int layer, float a); + virtual int prepareArmor(std::shared_ptr _player, int layer, float a); + virtual void prepareSecondPassArmor(std::shared_ptr mob, int layer, float a); public: - virtual void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - virtual void renderName(shared_ptr _mob, double x, double y, double z); - virtual void additionalRendering(shared_ptr _mob, float a); - virtual void scale(shared_ptr _player, float a); + virtual void renderName(std::shared_ptr _mob, double x, double y, double z); + virtual void additionalRendering(std::shared_ptr _mob, float a); + virtual void scale(std::shared_ptr _player, float a); public: void renderHand(); protected: - virtual void setupPosition(shared_ptr _mob, double x, double y, double z); - virtual void setupRotations(shared_ptr _mob, float bob, float bodyRot, float a); + virtual void setupPosition(std::shared_ptr _mob, double x, double y, double z); + virtual void setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a); private: - virtual void renderShadow(shared_ptr e, double x, double y, double z, float pow, float a); // 4J Added override + virtual void renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a); // 4J Added override }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp index 03befa51e..054df57c2 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp @@ -195,7 +195,7 @@ void ProgressRenderer::setType(eProgressStringType eType) LeaveCriticalSection( &ProgressRenderer::s_progress ); } -void ProgressRenderer::progressStage(wstring &wstrText) +void ProgressRenderer::progressStage(std::wstring &wstrText) { EnterCriticalSection( &ProgressRenderer::s_progress ); m_wstrText=wstrText; @@ -203,10 +203,10 @@ void ProgressRenderer::progressStage(wstring &wstrText) LeaveCriticalSection( &ProgressRenderer::s_progress ); } -wstring& ProgressRenderer::getProgressString(void) +std::wstring& ProgressRenderer::getProgressString(void) { EnterCriticalSection( &ProgressRenderer::s_progress ); - wstring &temp=m_wstrText; + std::wstring &temp=m_wstrText; LeaveCriticalSection( &ProgressRenderer::s_progress ); return temp; } diff --git a/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.h index 1244d3733..bb3446c4c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.h @@ -15,7 +15,7 @@ public: int getCurrentPercent(); int getCurrentTitle(); int getCurrentStatus(); - wstring& getProgressString(void); + std::wstring& getProgressString(void); ProgressRenderer::eProgressStringType getType(); private: @@ -27,7 +27,7 @@ private: int title; __int64 lastTime; bool noAbort; - wstring m_wstrText; + std::wstring m_wstrText; eProgressStringType m_eType; void setType(eProgressStringType eType); @@ -38,6 +38,6 @@ public: virtual void progressStartNoAbort(int string); void _progressStart(int title); virtual void progressStage(int status); - virtual void progressStage(wstring &wstrText); + virtual void progressStage(std::wstring &wstrText); virtual void progressStagePercentage(int i); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.cpp index 8a05bb458..f30a79198 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.cpp @@ -8,10 +8,10 @@ SheepRenderer::SheepRenderer(Model *model, Model *armor, float shadow) : MobRend setArmor(armor); } -int SheepRenderer::prepareArmor(shared_ptr _sheep, int layer, float a) +int SheepRenderer::prepareArmor(std::shared_ptr _sheep, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr sheep = dynamic_pointer_cast(_sheep); + std::shared_ptr sheep = std::dynamic_pointer_cast(_sheep); if (layer == 0 && !sheep->isSheared() && !sheep->isInvisibleTo(Minecraft::GetInstance()->player)) // 4J-JEV: Todo, merge with java fix (for invisible sheep armour) in '1.7.5'. @@ -28,7 +28,7 @@ int SheepRenderer::prepareArmor(shared_ptr _sheep, int layer, float a) return -1; } -void SheepRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) +void SheepRenderer::render(std::shared_ptr mob, double x, double y, double z, float rot, float a) { MobRenderer::render(mob, x, y, z, rot, a); } diff --git a/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.h index c0dea04fe..637c53d04 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SheepRenderer.h @@ -7,8 +7,8 @@ public: SheepRenderer(Model *model, Model *armor, float shadow); protected: - virtual int prepareArmor(shared_ptr _sheep, int layer, float a); + virtual int prepareArmor(std::shared_ptr _sheep, int layer, float a); public: - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp index ce5042eb7..0b7147724 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.cpp @@ -13,10 +13,10 @@ SignRenderer::SignRenderer() signModel = new SignModel(); } -void SignRenderer::render(shared_ptr _sign, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void SignRenderer::render(std::shared_ptr _sign, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr sign = dynamic_pointer_cast(_sign); + std::shared_ptr sign = std::dynamic_pointer_cast(_sign); Tile *tile = sign->getTile(); @@ -60,7 +60,7 @@ void SignRenderer::render(shared_ptr _sign, double x, double y, doub glDepthMask(false); int col = Minecraft::GetInstance()->getColourTable()->getColor(eMinecraftColour_Sign_Text); - wstring msg; + std::wstring msg; // need to send the new data // Get the current language setting from the console DWORD dwLanguage = XGetLanguage( ); diff --git a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.h index 48d4d9542..d7411af43 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SignRenderer.h @@ -8,5 +8,5 @@ private: SignModel *signModel; public: SignRenderer(); // 4J - added - virtual void render(shared_ptr sign, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param + virtual void render(std::shared_ptr sign, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.cpp index 07f0ab431..1356cbdbc 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.cpp @@ -7,17 +7,17 @@ SilverfishRenderer::SilverfishRenderer() : MobRenderer(new SilverfishModel(), 0. { } -float SilverfishRenderer::getFlipDegrees(shared_ptr spider) +float SilverfishRenderer::getFlipDegrees(std::shared_ptr spider) { return 180; } -void SilverfishRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void SilverfishRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { MobRenderer::render(_mob, x, y, z, rot, a); } -int SilverfishRenderer::prepareArmor(shared_ptr _silverfish, int layer, float a) +int SilverfishRenderer::prepareArmor(std::shared_ptr _silverfish, int layer, float a) { return -1; } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.h index c1df4505a..91ff2e456 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SilverfishRenderer.h @@ -13,11 +13,11 @@ public: SilverfishRenderer(); protected: - float getFlipDegrees(shared_ptr spider); + float getFlipDegrees(std::shared_ptr spider); public: - void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - int prepareArmor(shared_ptr _silverfish, int layer, float a); + int prepareArmor(std::shared_ptr _silverfish, int layer, float a); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp index 03d0b332f..b3f19b02d 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.cpp @@ -19,9 +19,9 @@ SkullTileRenderer::~SkullTileRenderer() delete zombieModel; } -void SkullTileRenderer::render(shared_ptr _skull, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void SkullTileRenderer::render(std::shared_ptr _skull, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { - shared_ptr skull = dynamic_pointer_cast(_skull); + std::shared_ptr skull = std::dynamic_pointer_cast(_skull); renderSkull((float) x, (float) y, (float) z, skull->getData() & SkullTile::PLACEMENT_MASK, skull->getRotation() * 360 / 16.0f, skull->getSkullType(), skull->getExtraType()); } @@ -31,7 +31,7 @@ void SkullTileRenderer::init(TileEntityRenderDispatcher *tileEntityRenderDispatc instance = this; } -void SkullTileRenderer::renderSkull(float x, float y, float z, int face, float rot, int type, const wstring &extra) +void SkullTileRenderer::renderSkull(float x, float y, float z, int face, float rot, int type, const std::wstring &extra) { Model *model = skeletonModel; @@ -47,7 +47,7 @@ void SkullTileRenderer::renderSkull(float x, float y, float z, int face, float r case SkullTileEntity::TYPE_CHAR: //if (!extra.empty()) //{ - // wstring url = "http://skins.minecraft.net/MinecraftSkins/" + StringUtil.stripColor(extra) + ".png"; + // std::wstring url = "http://skins.minecraft.net/MinecraftSkins/" + StringUtil.stripColor(extra) + ".png"; // if (!instance->tileEntityRenderDispatcher->textures->hasHttpTexture(url)) // { diff --git a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h index 09c83f9df..e2ef38605 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SkullTileRenderer.h @@ -18,7 +18,7 @@ public: SkullTileRenderer(); ~SkullTileRenderer(); - void render(shared_ptr skull, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled = true); + void render(std::shared_ptr skull, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled = true); void init(TileEntityRenderDispatcher *tileEntityRenderDispatcher); - void renderSkull(float x, float y, float z, int face, float rot, int type, const wstring &extra); + void renderSkull(float x, float y, float z, int face, float rot, int type, const std::wstring &extra); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.cpp index 82f08b7bf..94fdf85ff 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.cpp @@ -7,10 +7,10 @@ SlimeRenderer::SlimeRenderer(Model *model, Model *armor, float shadow) : MobRend this->armor = armor; } -int SlimeRenderer::prepareArmor(shared_ptr _slime, int layer, float a) +int SlimeRenderer::prepareArmor(std::shared_ptr _slime, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr slime = dynamic_pointer_cast(_slime); + std::shared_ptr slime = std::dynamic_pointer_cast(_slime); if (slime->isInvisible()) return 0; @@ -32,10 +32,10 @@ int SlimeRenderer::prepareArmor(shared_ptr _slime, int layer, float a) return -1; } -void SlimeRenderer::scale(shared_ptr _slime, float a) +void SlimeRenderer::scale(std::shared_ptr _slime, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr slime = dynamic_pointer_cast(_slime); + std::shared_ptr slime = std::dynamic_pointer_cast(_slime); float size = (float) slime->getSize(); float ss = (slime->oSquish + (slime->squish - slime->oSquish) * a) / (size * 0.5f + 1); diff --git a/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.h index 58f510aa1..86de3a76e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SlimeRenderer.h @@ -8,6 +8,6 @@ private: public: SlimeRenderer(Model *model, Model *armor, float shadow); protected: - virtual int prepareArmor(shared_ptr _slime, int layer, float a); - virtual void scale(shared_ptr _slime, float a); + virtual int prepareArmor(std::shared_ptr _slime, int layer, float a); + virtual void scale(std::shared_ptr _slime, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.cpp index 164cd8d57..8324b771d 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.cpp @@ -13,14 +13,14 @@ SnowManRenderer::SnowManRenderer() : MobRenderer(new SnowManModel(), 0.5f) this->setArmor(model); } -void SnowManRenderer::additionalRendering(shared_ptr _mob, float a) +void SnowManRenderer::additionalRendering(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type SnowMan rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type SnowMan rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(mob, a); - shared_ptr headGear = shared_ptr( new ItemInstance(Tile::pumpkin, 1) ); + std::shared_ptr headGear = std::shared_ptr( new ItemInstance(Tile::pumpkin, 1) ); if (headGear != NULL && headGear->getItem()->id < 256) { glPushMatrix(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.h index 9bdecb4db..ab003fe68 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SnowManRenderer.h @@ -13,5 +13,5 @@ public: SnowManRenderer(); protected: - virtual void additionalRendering(shared_ptr _mob, float a); + virtual void additionalRendering(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.cpp index fc2ac137c..2055bfa82 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.cpp @@ -8,15 +8,15 @@ SpiderRenderer::SpiderRenderer() : MobRenderer(new SpiderModel(), 1.0f) this->setArmor(new SpiderModel()); } -float SpiderRenderer::getFlipDegrees(shared_ptr spider) +float SpiderRenderer::getFlipDegrees(std::shared_ptr spider) { return 180; } -int SpiderRenderer::prepareArmor(shared_ptr _spider, int layer, float a) +int SpiderRenderer::prepareArmor(std::shared_ptr _spider, int layer, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr spider = dynamic_pointer_cast(_spider); + std::shared_ptr spider = std::dynamic_pointer_cast(_spider); if (layer!=0) return -1; MemSect(31); @@ -52,10 +52,10 @@ int SpiderRenderer::prepareArmor(shared_ptr _spider, int layer, float a) return 1; } -void SpiderRenderer::scale(shared_ptr _mob, float a) +void SpiderRenderer::scale(std::shared_ptr _mob, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); float scale = mob->getModelScale(); glScalef(scale, scale, scale); } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.h index 3b937458b..7946ed467 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SpiderRenderer.h @@ -6,7 +6,7 @@ class SpiderRenderer : public MobRenderer public: SpiderRenderer(); protected: - virtual float getFlipDegrees(shared_ptr spider); - virtual int prepareArmor(shared_ptr _spider, int layer, float a); - void scale(shared_ptr _mob, float a); + virtual float getFlipDegrees(std::shared_ptr spider); + virtual int prepareArmor(std::shared_ptr _spider, int layer, float a); + void scale(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.cpp index 9083e7e41..e7322d3d4 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.cpp @@ -6,15 +6,15 @@ SquidRenderer::SquidRenderer(Model *model, float shadow) : MobRenderer(model, sh { } -void SquidRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) +void SquidRenderer::render(std::shared_ptr mob, double x, double y, double z, float rot, float a) { MobRenderer::render(mob, x, y, z, rot, a); } -void SquidRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) +void SquidRenderer::setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); float bodyXRot = (mob->xBodyRotO + (mob->xBodyRot - mob->xBodyRotO) * a); float bodyZRot = (mob->zBodyRotO + (mob->zBodyRot - mob->zBodyRotO) * a); @@ -26,10 +26,10 @@ void SquidRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRo glTranslatef(0, -1.2f, 0); } -float SquidRenderer::getBob(shared_ptr _mob, float a) +float SquidRenderer::getBob(std::shared_ptr _mob, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); return mob->oldTentacleAngle + (mob->tentacleAngle - mob->oldTentacleAngle) * a; } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.h index ccc81944d..13270b5f1 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/SquidRenderer.h @@ -7,9 +7,9 @@ public: SquidRenderer(Model *model, float shadow); public: - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); protected: - virtual void setupRotations(shared_ptr _mob, float bob, float bodyRot, float a); - virtual float getBob(shared_ptr _mob, float a); + virtual void setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a); + virtual float getBob(std::shared_ptr _mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.cpp index 24cafe83e..beb2effb8 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.cpp @@ -7,10 +7,10 @@ #include "../../../Minecraft.World/IO/Streams/FloatBuffer.h" #include "TheEndPortalRenderer.h" -void TheEndPortalRenderer::render(shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) +void TheEndPortalRenderer::render(std::shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { // 4J Convert as we aren't using a templated class - shared_ptr table = dynamic_pointer_cast(_table); + std::shared_ptr table = std::dynamic_pointer_cast(_table); float xx = (float) (tileEntityRenderDispatcher->xPlayer); float yy = (float) (tileEntityRenderDispatcher->yPlayer); float zz = (float) (tileEntityRenderDispatcher->zPlayer); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.h index 1e4ca546c..fe489275e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TheEndPortalRenderer.h @@ -5,7 +5,7 @@ class TheEndPortalRenderer : public TileEntityRenderer { public: - virtual void render(shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); + virtual void render(std::shared_ptr _table, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); FloatBuffer *lb; diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp index a9ef50899..86032f2ea 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp @@ -80,18 +80,18 @@ TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(eINSTANCEOF e) return it->second; } -bool TileEntityRenderDispatcher::hasRenderer(shared_ptr e) +bool TileEntityRenderDispatcher::hasRenderer(std::shared_ptr e) { return getRenderer(e) != NULL; } -TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(shared_ptr e) +TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(std::shared_ptr e) { if (e == NULL) return NULL; return getRenderer(e->GetType()); } -void TileEntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *font, shared_ptr player, float a) +void TileEntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *font, std::shared_ptr player, float a) { if( this->level != level ) { @@ -109,7 +109,7 @@ void TileEntityRenderDispatcher::prepare(Level *level, Textures *textures, Font zPlayer = player->zOld + (player->z - player->zOld) * a; } -void TileEntityRenderDispatcher::render(shared_ptr e, float a, bool setColor/*=true*/) +void TileEntityRenderDispatcher::render(std::shared_ptr e, float a, bool setColor/*=true*/) { if (e->distanceToSqr(xPlayer, yPlayer, zPlayer) < 64 * 64) { @@ -131,7 +131,7 @@ void TileEntityRenderDispatcher::render(shared_ptr e, float a, bool } } -void TileEntityRenderDispatcher::render(shared_ptr entity, double x, double y, double z, float a, bool setColor/*=true*/, float alpha, bool useCompiled) +void TileEntityRenderDispatcher::render(std::shared_ptr entity, double x, double y, double z, float a, bool setColor/*=true*/, float alpha, bool useCompiled) { TileEntityRenderer *renderer = getRenderer(entity); if (renderer != NULL) diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h index 993228948..01eaa3652 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.h @@ -12,7 +12,7 @@ public: static void staticCtor(); // 4J added private: - typedef unordered_map classToTileRendererMap; + typedef std::unordered_map classToTileRendererMap; classToTileRendererMap renderers; public: @@ -25,7 +25,7 @@ public: Textures *textures; Level *level; - shared_ptr cameraEntity; + std::shared_ptr cameraEntity; float playerRotY; float playerRotX; double xPlayer, yPlayer, zPlayer; @@ -35,11 +35,11 @@ private: public: TileEntityRenderer *getRenderer(eINSTANCEOF e); - bool hasRenderer(shared_ptr e); - TileEntityRenderer * getRenderer(shared_ptr e); - void prepare(Level *level, Textures *textures, Font *font, shared_ptr player, float a); - void render(shared_ptr e, float a, bool setColor = true); - void render(shared_ptr entity, double x, double y, double z, float a, bool setColor = true, float alpha=1.0f, bool useCompiled = true); // 4J Added useCompiled + bool hasRenderer(std::shared_ptr e); + TileEntityRenderer * getRenderer(std::shared_ptr e); + void prepare(Level *level, Textures *textures, Font *font, std::shared_ptr player, float a); + void render(std::shared_ptr e, float a, bool setColor = true); + void render(std::shared_ptr entity, double x, double y, double z, float a, bool setColor = true, float alpha=1.0f, bool useCompiled = true); // 4J Added useCompiled void setLevel(Level *level); double distanceToSqr(double x, double y, double z); Font *getFont(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.cpp index 9a997b6e2..d31ddfd8e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.cpp @@ -8,7 +8,7 @@ void TileEntityRenderer::bindTexture(int resourceName) if(t != NULL) t->bind(t->loadTexture(resourceName)); } -void TileEntityRenderer::bindTexture(const wstring& urlTexture, int backupTexture) +void TileEntityRenderer::bindTexture(const std::wstring& urlTexture, int backupTexture) { Textures *t = tileEntityRenderDispatcher->textures; if(t != NULL) t->bind(t->loadHttpTexture(urlTexture, backupTexture)); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h index 347d6fc46..e9c4c1887 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderer.h @@ -10,11 +10,11 @@ class TileEntityRenderer protected: TileEntityRenderDispatcher *tileEntityRenderDispatcher; public: - virtual void render(shared_ptr entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) = 0; // 4J added setColor param and alpha and useCompiled + virtual void render(std::shared_ptr entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) = 0; // 4J added setColor param and alpha and useCompiled virtual void onNewLevel(Level *level) {} protected: - void bindTexture(int resourceName); // 4J - changed from wstring to int - void bindTexture(const wstring& urlTexture, int backupTexture); // 4J - changed from wstring to int + void bindTexture(int resourceName); // 4J - changed from std::wstring to int + void bindTexture(const std::wstring& urlTexture, int backupTexture); // 4J - changed from std::wstring to int private: Level *getLevel(); public: diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp index 64f126fda..4a908cae5 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp @@ -244,7 +244,7 @@ void TileRenderer::tesselateInWorldFixedTexture( Tile* tile, int x, int y, int z } void TileRenderer::tesselateInWorldNoCulling( Tile* tile, int x, int y, int z, int forceData, - shared_ptr< TileEntity > forceEntity ) // 4J added forceData, forceEntity param + std::shared_ptr< TileEntity > forceEntity ) // 4J added forceData, forceEntity param { noCulling = true; tesselateInWorld( tile, x, y, z, forceData ); @@ -252,7 +252,7 @@ void TileRenderer::tesselateInWorldNoCulling( Tile* tile, int x, int y, int z, i } bool TileRenderer::tesselateInWorld( Tile* tt, int x, int y, int z, int forceData, - shared_ptr< TileEntity > forceEntity ) // 4J added forceData, forceEntity param + std::shared_ptr< TileEntity > forceEntity ) // 4J added forceData, forceEntity param { Tesselator* t = Tesselator::getInstance(); int shape = tt->getRenderShape(); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h index 4045ece24..34f926a7e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h @@ -46,7 +46,7 @@ class TileRenderer bool smoothShapeLighting; Minecraft *minecraft; ///////////////////////////////////////// Data caching - unordered_map getLightColorCount; + std::unordered_map getLightColorCount; int xMin, yMin, zMin; int xMin2, yMin2, zMin2; int getLightColor( Tile *tt, LevelSource *level, int x, int y, int z); @@ -79,9 +79,9 @@ public: void tesselateInWorldFixedTexture( Tile* tile, int x, int y, int z, Icon *fixedTexture ); // 4J renamed to differentiate from tesselateInWorld void tesselateInWorldNoCulling( Tile* tile, int x, int y, int z, int forceData = -1, - shared_ptr< TileEntity > forceEntity = shared_ptr< TileEntity >() ); // 4J added forceData, forceEntity param - bool tesselateInWorld( Tile* tt, int x, int y, int z, int forceData = -1, shared_ptr< TileEntity > forceEntity = - shared_ptr< TileEntity >() ); // 4J added forceData, forceEntity param + std::shared_ptr< TileEntity > forceEntity = std::shared_ptr< TileEntity >() ); // 4J added forceData, forceEntity param + bool tesselateInWorld( Tile* tt, int x, int y, int z, int forceData = -1, std::shared_ptr< TileEntity > forceEntity = + std::shared_ptr< TileEntity >() ); // 4J added forceData, forceEntity param private: bool tesselateAirPortalFrameInWorld(TheEndPortalFrameTile *tt, int x, int y, int z); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.cpp index e78961e41..3f1ae5c8e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.cpp @@ -10,10 +10,10 @@ TntRenderer::TntRenderer() this->shadowRadius = 0.5f; } -void TntRenderer::render(shared_ptr _tnt, double x, double y, double z, float rot, float a) +void TntRenderer::render(std::shared_ptr _tnt, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr tnt = dynamic_pointer_cast(_tnt); + std::shared_ptr tnt = std::dynamic_pointer_cast(_tnt); glPushMatrix(); glTranslatef((float) x, (float) y, (float) z); diff --git a/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.h index 4d9c029cd..1f70c8dae 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TntRenderer.h @@ -8,5 +8,5 @@ private: public: TntRenderer(); - virtual void render(shared_ptr _tnt, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr _tnt, double x, double y, double z, float rot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.cpp index 41f397c8f..1f495b297 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.cpp @@ -15,16 +15,16 @@ int VillagerGolemRenderer::prepareArmor(VillagerGolemModel *villagerGolem, int l return -1; } -void VillagerGolemRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) +void VillagerGolemRenderer::render(std::shared_ptr mob, double x, double y, double z, float rot, float a) { MobRenderer::render(mob, x, y, z, rot, a); } -void VillagerGolemRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) +void VillagerGolemRenderer::setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); MobRenderer::setupRotations(mob, bob, bodyRot, a); if (mob->walkAnimSpeed < 0.01) return; @@ -34,11 +34,11 @@ void VillagerGolemRenderer::setupRotations(shared_ptr _mob, float bob, floa glRotatef(6.5f * triangleWave, 0, 0, 1); } -void VillagerGolemRenderer::additionalRendering(shared_ptr _mob, float a) +void VillagerGolemRenderer::additionalRendering(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(mob, a); if (mob->getOfferFlowerTick() == 0) return; diff --git a/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.h index 4bc3fd9c9..185e38d4c 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/VillagerGolemRenderer.h @@ -16,9 +16,9 @@ protected: int prepareArmor(VillagerGolemModel *villagerGolem, int layer, float a); public: - void render(shared_ptr mob, double x, double y, double z, float rot, float a); + void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); protected: - void setupRotations(shared_ptr _mob, float bob, float bodyRot, float a); - void additionalRendering(shared_ptr mob, float a); + void setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a); + void additionalRendering(std::shared_ptr mob, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.cpp index a62994b31..465d76e13 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.cpp @@ -8,30 +8,30 @@ VillagerRenderer::VillagerRenderer() : MobRenderer(new VillagerModel(0), 0.5f) villagerModel = (VillagerModel *) model; } -int VillagerRenderer::prepareArmor(shared_ptr villager, int layer, float a) +int VillagerRenderer::prepareArmor(std::shared_ptr villager, int layer, float a) { return -1; } -void VillagerRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) +void VillagerRenderer::render(std::shared_ptr mob, double x, double y, double z, float rot, float a) { MobRenderer::render(mob, x, y, z, rot, a); } -void VillagerRenderer::renderName(shared_ptr mob, double x, double y, double z) +void VillagerRenderer::renderName(std::shared_ptr mob, double x, double y, double z) { } -void VillagerRenderer::additionalRendering(shared_ptr mob, float a) +void VillagerRenderer::additionalRendering(std::shared_ptr mob, float a) { MobRenderer::additionalRendering(mob, a); } -void VillagerRenderer::scale(shared_ptr _mob, float a) +void VillagerRenderer::scale(std::shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr we have here - // do some casting around instead - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); float s = 15 / 16.0f; if (mob->getAge() < 0) { diff --git a/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.h index 21c2a6316..1263f4850 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/VillagerRenderer.h @@ -13,13 +13,13 @@ public: VillagerRenderer(); protected: - virtual int prepareArmor(shared_ptr villager, int layer, float a); + virtual int prepareArmor(std::shared_ptr villager, int layer, float a); public: - virtual void render(shared_ptr mob, double x, double y, double z, float rot, float a); + virtual void render(std::shared_ptr mob, double x, double y, double z, float rot, float a); protected: - virtual void renderName(shared_ptr mob, double x, double y, double z); - virtual void additionalRendering(shared_ptr mob, float a); - virtual void scale(shared_ptr player, float a); + virtual void renderName(std::shared_ptr mob, double x, double y, double z); + virtual void additionalRendering(std::shared_ptr mob, float a); + virtual void scale(std::shared_ptr player, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.cpp index 9869bfdda..f886f2db4 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.cpp @@ -8,19 +8,19 @@ WolfRenderer::WolfRenderer(Model *model, Model *armor, float shadow) : MobRender setArmor(armor); } -float WolfRenderer::getBob(shared_ptr _mob, float a) +float WolfRenderer::getBob(std::shared_ptr _mob, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); return mob->getTailAngle(); } -int WolfRenderer::prepareArmor(shared_ptr mob, int layer, float a) +int WolfRenderer::prepareArmor(std::shared_ptr mob, int layer, float a) { if (mob->isInvisibleTo(Minecraft::GetInstance()->player)) return -1; // 4J-JEV: Todo, merge with java fix in '1.7.5'. - shared_ptr wolf = dynamic_pointer_cast(mob); + std::shared_ptr wolf = std::dynamic_pointer_cast(mob); if (layer == 0 && wolf->isWet()) { float brightness = wolf->getBrightness(a) * wolf->getWetShade(a); diff --git a/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.h index 9cdf8caa3..218951c9e 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/WolfRenderer.h @@ -6,6 +6,6 @@ class WolfRenderer : public MobRenderer public: WolfRenderer(Model *model, Model *armor, float shadow); protected: - virtual float getBob(shared_ptr _mob, float a); - virtual int prepareArmor(shared_ptr mob, int layer, float a); + virtual float getBob(std::shared_ptr _mob, float a); + virtual int prepareArmor(std::shared_ptr mob, int layer, float a); }; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.cpp index df65ae872..8e47f334a 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.cpp @@ -34,28 +34,28 @@ void ZombieRenderer::createArmorParts() villagerArmorParts2 = new VillagerZombieModel(0.5f, 0, true); } -int ZombieRenderer::prepareArmor(shared_ptr _mob, int layer, float a) +int ZombieRenderer::prepareArmor(std::shared_ptr _mob, int layer, float a) { - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); swapArmor(mob); return HumanoidMobRenderer::prepareArmor(_mob, layer, a); } -void ZombieRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) +void ZombieRenderer::render(std::shared_ptr _mob, double x, double y, double z, float rot, float a) { - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); swapArmor(mob); HumanoidMobRenderer::render(_mob, x, y, z, rot, a); } -void ZombieRenderer::additionalRendering(shared_ptr _mob, float a) +void ZombieRenderer::additionalRendering(std::shared_ptr _mob, float a) { - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); swapArmor(mob); HumanoidMobRenderer::additionalRendering(_mob, a); } -void ZombieRenderer::swapArmor(shared_ptr mob) +void ZombieRenderer::swapArmor(std::shared_ptr mob) { if (mob->isVillager()) { @@ -80,9 +80,9 @@ void ZombieRenderer::swapArmor(shared_ptr mob) humanoidModel = (HumanoidModel *) model; } -void ZombieRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) +void ZombieRenderer::setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a) { - shared_ptr mob = dynamic_pointer_cast(_mob); + std::shared_ptr mob = std::dynamic_pointer_cast(_mob); if (mob->isConverting()) { bodyRot += (float) (cos(mob->tickCount * 3.25) * PI * .25f); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.h index e070cc7bb..b727659a6 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/ZombieRenderer.h @@ -25,17 +25,17 @@ public: protected: void createArmorParts(); - int prepareArmor(shared_ptr _mob, int layer, float a); + int prepareArmor(std::shared_ptr _mob, int layer, float a); public: - void render(shared_ptr _mob, double x, double y, double z, float rot, float a); + void render(std::shared_ptr _mob, double x, double y, double z, float rot, float a); protected: - void additionalRendering(shared_ptr _mob, float a); + void additionalRendering(std::shared_ptr _mob, float a); private: - void swapArmor(shared_ptr mob); + void swapArmor(std::shared_ptr mob); protected: - void setupRotations(shared_ptr _mob, float bob, float bodyRot, float a); + void setupRotations(std::shared_ptr _mob, float bob, float bodyRot, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/GameRenderer.cpp b/Minecraft.Client/Rendering/GameRenderer.cpp index 6dcf16d98..8dbe880e3 100644 --- a/Minecraft.Client/Rendering/GameRenderer.cpp +++ b/Minecraft.Client/Rendering/GameRenderer.cpp @@ -57,10 +57,10 @@ C4JThread* GameRenderer::m_updateThread; C4JThread::EventArray* GameRenderer::m_updateEvents; bool GameRenderer::nearThingsToDo = false; bool GameRenderer::updateRunning = false; -vector GameRenderer::m_deleteStackByte; -vector GameRenderer::m_deleteStackSparseLightStorage; -vector GameRenderer::m_deleteStackCompressedTileStorage; -vector GameRenderer::m_deleteStackSparseDataStorage; +std::vector GameRenderer::m_deleteStackByte; +std::vector GameRenderer::m_deleteStackSparseLightStorage; +std::vector GameRenderer::m_deleteStackCompressedTileStorage; +std::vector GameRenderer::m_deleteStackSparseDataStorage; #endif CRITICAL_SECTION GameRenderer::m_csDeleteStack; @@ -276,7 +276,7 @@ void GameRenderer::tick(bool first) // 4J - add bFirst if (mc->cameraTargetPlayer == NULL) { - mc->cameraTargetPlayer = dynamic_pointer_cast(mc->player); + mc->cameraTargetPlayer = std::dynamic_pointer_cast(mc->player); } float brr = mc->level->getBrightness(Mth::floor(mc->cameraTargetPlayer->x), Mth::floor(mc->cameraTargetPlayer->y), Mth::floor(mc->cameraTargetPlayer->z)); @@ -352,13 +352,13 @@ void GameRenderer::pick(float a) Vec3 *to = from->add(b->x * range, b->y * range, b->z * range); hovered = nullptr; float overlap = 1; - vector > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); + std::vector > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); double nearest = dist; AUTO_VAR(itEnd, objects->end()); for (AUTO_VAR(it, objects->begin()); it != itEnd; it++) { - shared_ptr e = *it; //objects->at(i); + std::shared_ptr e = *it; //objects->at(i); if (!e->isPickable()) continue; float rr = e->getPickRadius(); @@ -407,7 +407,7 @@ float GameRenderer::GetFovVal() void GameRenderer::tickFov() { - shared_ptrplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptrplayer = std::dynamic_pointer_cast(mc->cameraTargetPlayer); int playerIdx = player ? player->GetXboxPad() : 0; tFov[playerIdx] = player->getFieldOfViewModifier(); @@ -420,7 +420,7 @@ float GameRenderer::getFov(float a, bool applyEffects) { if (cameraFlip > 0 ) return 90; - shared_ptr player = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptr player = std::dynamic_pointer_cast(mc->cameraTargetPlayer); int playerIdx = player ? player->GetXboxPad() : 0; float fov = m_fov;//70; if (applyEffects) @@ -444,7 +444,7 @@ float GameRenderer::getFov(float a, bool applyEffects) void GameRenderer::bobHurt(float a) { - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; float hurt = player->hurtTime - a; @@ -470,12 +470,12 @@ void GameRenderer::bobHurt(float a) void GameRenderer::bobView(float a) { - shared_ptr player = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptr player = std::dynamic_pointer_cast(mc->cameraTargetPlayer); if(player==NULL) { return; } - //shared_ptr player = dynamic_pointer_cast(mc->cameraTargetPlayer); + //std::shared_ptr player = std::dynamic_pointer_cast(mc->cameraTargetPlayer); float wda = player->walkDist - player->walkDistO; float b = -(player->walkDist + wda * a); @@ -489,8 +489,8 @@ void GameRenderer::bobView(float a) void GameRenderer::moveCameraToPlayer(float a) { - shared_ptr player = mc->cameraTargetPlayer; - shared_ptr localplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr localplayer = std::dynamic_pointer_cast(mc->cameraTargetPlayer); float heightOffset = player->heightOffset - 1.62f; double x = player->xo + (player->x - player->xo) * a; @@ -719,12 +719,12 @@ void GameRenderer::renderItemInHand(float a, int eye) { if (cameraFlip > 0) return; - shared_ptr localplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptr localplayer = std::dynamic_pointer_cast(mc->cameraTargetPlayer); // 4J-PB - to turn off the hand for screenshots, but not when the item held is a map if ( localplayer!=NULL) { - shared_ptr item = localplayer->inventory->getSelected(); + std::shared_ptr item = localplayer->inventory->getSelected(); if(!(item && item->getItem()->id==Item::map_Id) && app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_DisplayHand)==0 ) return; } @@ -869,7 +869,7 @@ void GameRenderer::updateLightTexture(float a) for(int j = 0; j < XUSER_MAX_COUNT; j++ ) { // Loop over all the players - shared_ptr player = Minecraft::GetInstance()->localplayers[j]; + std::shared_ptr player = Minecraft::GetInstance()->localplayers[j]; if (player == NULL) continue; Level *level = player->level; // 4J - was mc->level when it was just to update the one light texture @@ -974,7 +974,7 @@ void GameRenderer::updateLightTexture(float a) } } -float GameRenderer::getNightVisionScale(shared_ptr player, float a) +float GameRenderer::getNightVisionScale(std::shared_ptr player, float a) { int duration = player->getEffect(MobEffect::nightVision)->getDuration(); if (duration > (SharedConstants::TICKS_PER_SECOND * 10)) @@ -983,7 +983,7 @@ float GameRenderer::getNightVisionScale(shared_ptr player, float a) } else { - float flash = max(0.0f, (float)duration - a); + float flash = std::max(0.0f, (float)duration - a); return .7f + Mth::sin(flash * PI * .05f) * .3f; // was: .7 + sin(flash*pi*0.2) * .3 } } @@ -1275,7 +1275,7 @@ void GameRenderer::renderLevel(float a, __int64 until) } pick(a); - shared_ptr cameraEntity = mc->cameraTargetPlayer; + std::shared_ptr cameraEntity = mc->cameraTargetPlayer; LevelRenderer *levelRenderer = mc->levelRenderer; ParticleEngine *particleEngine = mc->particleEngine; double xOff = cameraEntity->xOld + (cameraEntity->x - cameraEntity->xOld) * a; @@ -1389,10 +1389,10 @@ void GameRenderer::renderLevel(float a, __int64 until) PIXEndNamedEvent(); turnOffLightLayer(a); // 4J - brought forward from 1.8.2 - shared_ptr player = dynamic_pointer_cast(cameraEntity); + std::shared_ptr player = std::dynamic_pointer_cast(cameraEntity); if (mc->hitResult != NULL && cameraEntity->isUnderLiquid(Material::water) && player!=NULL) //&& !mc->options.hideGui) { - //shared_ptr player = dynamic_pointer_cast(cameraEntity); + //std::shared_ptr player = std::dynamic_pointer_cast(cameraEntity); glDisable(GL_ALPHA_TEST); levelRenderer->renderHit(player, mc->hitResult, 0, player->inventory->getSelected(), a); levelRenderer->renderHitOutline(player, mc->hitResult, 0, player->inventory->getSelected(), a); @@ -1447,11 +1447,11 @@ void GameRenderer::renderLevel(float a, __int64 until) glEnable(GL_CULL_FACE); glDisable(GL_BLEND); - if (zoom == 1 && (dynamic_pointer_cast(cameraEntity)!=NULL)) //&& !mc->options.hideGui) + if (zoom == 1 && (std::dynamic_pointer_cast(cameraEntity)!=NULL)) //&& !mc->options.hideGui) { if (mc->hitResult != NULL && !cameraEntity->isUnderLiquid(Material::water)) { - shared_ptr player = dynamic_pointer_cast(cameraEntity); + std::shared_ptr player = std::dynamic_pointer_cast(cameraEntity); glDisable(GL_ALPHA_TEST); levelRenderer->renderHit(player, mc->hitResult, 0, player->inventory->getSelected(), a); levelRenderer->renderHitOutline(player, mc->hitResult, 0, player->inventory->getSelected(), a); @@ -1468,7 +1468,7 @@ void GameRenderer::renderLevel(float a, __int64 until) glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); - levelRenderer->renderDestroyAnimation(Tesselator::getInstance(), dynamic_pointer_cast(cameraEntity), a); + levelRenderer->renderDestroyAnimation(Tesselator::getInstance(), std::dynamic_pointer_cast(cameraEntity), a); glDisable(GL_BLEND); if (mc->options->isCloudsOn()) @@ -1518,7 +1518,7 @@ void GameRenderer::tickRain() rainLevel /= ( mc->levelRenderer->activePlayers() + 1 ); random->setSeed(_tick * 312987231l); - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; Level *level = mc->level; int x0 = Mth::floor(player->x); @@ -1555,7 +1555,7 @@ void GameRenderer::tickRain() { if (Tile::tiles[t]->material == Material::lava) { - mc->particleEngine->add( shared_ptr( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) ); + mc->particleEngine->add( std::shared_ptr( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) ); } else { @@ -1565,7 +1565,7 @@ void GameRenderer::tickRain() rainPosY = y + 0.1f - Tile::tiles[t]->getShapeY0(); rainPosZ = z + za; } - mc->particleEngine->add( shared_ptr( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) ); + mc->particleEngine->add( std::shared_ptr( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) ); } } } @@ -1618,7 +1618,7 @@ void GameRenderer::renderSnowAndRain(float a) } } - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; Level *level = mc->level; int x0 = Mth::floor(player->x); @@ -1802,7 +1802,7 @@ void GameRenderer::setupGuiScreen(int forceScale /*=-1*/) void GameRenderer::setupClearColor(float a) { Level *level = mc->level; - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; float whiteness = 1.0f / (4 - mc->options->viewDistance); whiteness = 1 - (float) pow((double)whiteness, 0.25); @@ -1959,13 +1959,13 @@ void GameRenderer::setupClearColor(float a) void GameRenderer::setupFog(int i, float alpha) { - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; // 4J - check for creative mode brought forward from 1.2.3 bool creative = false; - if (dynamic_pointer_cast(player) ) + if (std::dynamic_pointer_cast(player) ) { - creative = (dynamic_pointer_cast(player))->abilities.instabuild; + creative = (std::dynamic_pointer_cast(player))->abilities.instabuild; } if (i == 999) @@ -2144,7 +2144,7 @@ void GameRenderer::setupFog(int i, float alpha) if (mc->level->dimension->isFoggyAt((int) player->x, (int) player->z)) { glFogf(GL_FOG_START, distance * 0.05f); - glFogf(GL_FOG_END, min(distance, 16 * 16 * .75f) * .5f); + glFogf(GL_FOG_END, std::min(distance, 16 * 16 * .75f) * .5f); } } diff --git a/Minecraft.Client/Rendering/GameRenderer.h b/Minecraft.Client/Rendering/GameRenderer.h index 6e38161ba..5026704bb 100644 --- a/Minecraft.Client/Rendering/GameRenderer.h +++ b/Minecraft.Client/Rendering/GameRenderer.h @@ -25,7 +25,7 @@ public: ItemInHandRenderer *itemInHandRenderer; private: int _tick; - shared_ptr hovered; + std::shared_ptr hovered; // smooth camera movement SmoothFloat smoothTurnX; @@ -108,7 +108,7 @@ public: private: void tickLightTexture(); void updateLightTexture(float a); - float getNightVisionScale(shared_ptr player, float a); + float getNightVisionScale(std::shared_ptr player, float a); public: void render(float a, bool bFirst); // 4J added bFirst void renderLevel(float a); @@ -156,10 +156,10 @@ public: static bool nearThingsToDo; static bool updateRunning; #endif - static vector m_deleteStackByte; - static vector m_deleteStackSparseLightStorage; - static vector m_deleteStackCompressedTileStorage; - static vector m_deleteStackSparseDataStorage; + static std::vector m_deleteStackByte; + static std::vector m_deleteStackSparseLightStorage; + static std::vector m_deleteStackCompressedTileStorage; + static std::vector m_deleteStackSparseDataStorage; static CRITICAL_SECTION m_csDeleteStack; static void AddForDelete(uint8_t *deleteThis); static void AddForDelete(SparseLightStorage *deleteThis); diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index 92e3df632..9c67dc33a 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -442,7 +442,7 @@ void LevelRenderer::allChanged(int playerIndex) } chunks[playerIndex] = ClipChunkArray(xChunks * yChunks * zChunks); - // sortedChunks[playerIndex] = new vector(xChunks * yChunks * zChunks); // 4J - removed - not sorting our chunks anymore + // sortedChunks[playerIndex] = new std::vector(xChunks * yChunks * zChunks); // 4J - removed - not sorting our chunks anymore int id = 0; int count = 0; @@ -475,7 +475,7 @@ void LevelRenderer::allChanged(int playerIndex) if (level != NULL) { - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; if (player != NULL) { this->resortChunks(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); @@ -509,7 +509,7 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) renderedEntities = 0; culledEntities = 0; - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; EntityRenderDispatcher::xOff = (player->xOld + (player->x - player->xOld) * a); EntityRenderDispatcher::yOff = (player->yOld + (player->y - player->yOld) * a); @@ -520,13 +520,13 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) mc->gameRenderer->turnOnLightLayer(a); // 4J - brought forward from 1.8.2 - vector > entities = level[playerIndex]->getAllEntities(); + std::vector > entities = level[playerIndex]->getAllEntities(); totalEntities = (int)entities.size(); AUTO_VAR(itEndGE, level[playerIndex]->globalEntities.end()); for (AUTO_VAR(it, level[playerIndex]->globalEntities.begin()); it != itEndGE; it++) { - shared_ptr entity = *it; //level->globalEntities[i]; + std::shared_ptr entity = *it; //level->globalEntities[i]; renderedEntities++; if (entity->shouldRender(cam)) EntityRenderDispatcher::instance->render(entity, a); } @@ -534,13 +534,13 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) AUTO_VAR(itEndEnts, entities.end()); for (AUTO_VAR(it, entities.begin()); it != itEndEnts; it++) { - shared_ptr entity = *it; //entities[i]; + std::shared_ptr entity = *it; //entities[i]; if ((entity->shouldRender(cam) && (entity->noCulling || culler->isVisible(entity->bb)))) { // 4J-PB - changing this to be per player //if (entity == mc->cameraTargetPlayer && !mc->options->thirdPersonView && !mc->cameraTargetPlayer->isSleeping()) continue; - shared_ptr localplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); + std::shared_ptr localplayer = std::dynamic_pointer_cast(mc->cameraTargetPlayer); if (localplayer && entity == mc->cameraTargetPlayer && !localplayer->ThirdPersonView() && !mc->cameraTargetPlayer->isSleeping()) continue; @@ -603,12 +603,12 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) mc->gameRenderer->turnOffLightLayer(a); // 4J - brought forward from 1.8.2 } -wstring LevelRenderer::gatherStats1() +std::wstring LevelRenderer::gatherStats1() { return L"C: " + _toString(renderedChunks) + L"/" + _toString(totalChunks) + L". F: " + _toString(offscreenChunks) + L", O: " + _toString(occludedChunks) + L", E: " + _toString(emptyChunks); } -wstring LevelRenderer::gatherStats2() +std::wstring LevelRenderer::gatherStats2() { return L"E: " + _toString(renderedEntities) + L"/" + _toString(totalEntities) + L". B: " + _toString(culledEntities) + L", I: " + _toString((totalEntities - culledEntities) - renderedEntities); } @@ -669,7 +669,7 @@ void LevelRenderer::resortChunks(int xc, int yc, int zc) LeaveCriticalSection(&m_csDirtyChunks); } -int LevelRenderer::render(shared_ptr player, int layer, double alpha, bool updateChunks) +int LevelRenderer::render(std::shared_ptr player, int layer, double alpha, bool updateChunks) { int playerIndex = mc->player->GetXboxPad(); @@ -741,7 +741,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) #if 1 // 4J - cut down version, we're not using offsetted render lists, or a sorted chunk list, anymore mc->gameRenderer->turnOnLightLayer(alpha); // 4J - brought forward from 1.8.2 - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; double xOff = player->xOld + (player->x - player->xOld) * alpha; double yOff = player->yOld + (player->y - player->yOld) * alpha; double zOff = player->zOld + (player->z - player->zOld) * alpha; @@ -864,7 +864,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) } } - shared_ptr player = mc->cameraTargetPlayer; + std::shared_ptr player = mc->cameraTargetPlayer; double xOff = player->xOld + (player->x - player->xOld) * alpha; double yOff = player->yOld + (player->y - player->yOld) * alpha; double zOff = player->zOld + (player->z - player->zOld) * alpha; @@ -1919,8 +1919,8 @@ bool LevelRenderer::updateDirtyChunks() for( int p = 0; p < XUSER_MAX_COUNT; p++ ) { // It's possible that the localplayers member can be set to NULL on the main thread when a player chooses to exit the game - // So take a reference to the player object now. As it is a shared_ptr it should live as long as we need it - shared_ptr player = mc->localplayers[p]; + // So take a reference to the player object now. As it is a std::shared_ptr it should live as long as we need it + std::shared_ptr player = mc->localplayers[p]; if( player == NULL ) continue; if( chunks[p].data == NULL ) continue; if( level[p] == NULL ) continue; @@ -2171,7 +2171,7 @@ bool LevelRenderer::updateDirtyChunks() } -void LevelRenderer::renderHit(shared_ptr player, HitResult *h, int mode, shared_ptr inventoryItem, float a) +void LevelRenderer::renderHit(std::shared_ptr player, HitResult *h, int mode, std::shared_ptr inventoryItem, float a) { Tesselator *t = Tesselator::getInstance(); glEnable(GL_BLEND); @@ -2190,7 +2190,7 @@ void LevelRenderer::renderHit(shared_ptr player, HitResult *h, int mode, glDisable(GL_ALPHA_TEST); } -void LevelRenderer::renderDestroyAnimation(Tesselator *t, shared_ptr player, float a) +void LevelRenderer::renderDestroyAnimation(Tesselator *t, std::shared_ptr player, float a) { double xo = player->xOld + (player->x - player->xOld) * a; double yo = player->yOld + (player->y - player->yOld) * a; @@ -2256,7 +2256,7 @@ void LevelRenderer::renderDestroyAnimation(Tesselator *t, shared_ptr pla } } -void LevelRenderer::renderHitOutline(shared_ptr player, HitResult *h, int mode, shared_ptr inventoryItem, float a) +void LevelRenderer::renderHitOutline(std::shared_ptr player, HitResult *h, int mode, std::shared_ptr inventoryItem, float a) { if (mode == 0 && h->type == HitResult::TILE) @@ -2560,7 +2560,7 @@ void LevelRenderer::cull(Culler *culler, float a) } } -void LevelRenderer::playStreamingMusic(const wstring& name, int x, int y, int z) +void LevelRenderer::playStreamingMusic(const std::wstring& name, int x, int y, int z) { if (name != L"") { @@ -2596,14 +2596,14 @@ void LevelRenderer::playSound(int iSound, double x, double y, double z, float vo } */ } -void LevelRenderer::playSound(shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist) +void LevelRenderer::playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist) { } // 4J-PB - original function. I've changed to an enum instead of string compares // 4J removed - /* -void LevelRenderer::addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za) +void LevelRenderer::addParticle(const std::wstring& name, double x, double y, double z, double xa, double ya, double za) { if (mc == NULL || mc->cameraTargetPlayer == NULL || mc->particleEngine == NULL) return; @@ -2616,21 +2616,21 @@ if (xd * xd + yd * yd + zd * zd > particleDistance * particleDistance) return; int playerIndex = mc->player->GetXboxPad(); // 4J added -if (name== L"bubble") mc->particleEngine->add(shared_ptr( new BubbleParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"smoke") mc->particleEngine->add(shared_ptr( new SmokeParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"note") mc->particleEngine->add(shared_ptr( new NoteParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"portal") mc->particleEngine->add(shared_ptr( new PortalParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"explode") mc->particleEngine->add(shared_ptr( new ExplodeParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"flame") mc->particleEngine->add(shared_ptr( new FlameParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"lava") mc->particleEngine->add(shared_ptr( new LavaParticle(level[playerIndex], x, y, z) ) ); -else if (name== L"footstep") mc->particleEngine->add(shared_ptr( new FootstepParticle(textures, level[playerIndex], x, y, z) ) ); -else if (name== L"splash") mc->particleEngine->add(shared_ptr( new SplashParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"largesmoke") mc->particleEngine->add(shared_ptr( new SmokeParticle(level[playerIndex], x, y, z, xa, ya, za, 2.5f) ) ); -else if (name== L"reddust") mc->particleEngine->add(shared_ptr( new RedDustParticle(level[playerIndex], x, y, z, (float) xa, (float) ya, (float) za) ) ); -else if (name== L"snowballpoof") mc->particleEngine->add(shared_ptr( new BreakingItemParticle(level[playerIndex], x, y, z, Item::snowBall) ) ); -else if (name== L"snowshovel") mc->particleEngine->add(shared_ptr( new SnowShovelParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); -else if (name== L"slime") mc->particleEngine->add(shared_ptr( new BreakingItemParticle(level[playerIndex], x, y, z, Item::slimeBall)) ) ; -else if (name== L"heart") mc->particleEngine->add(shared_ptr( new HeartParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +if (name== L"bubble") mc->particleEngine->add(std::shared_ptr( new BubbleParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"smoke") mc->particleEngine->add(std::shared_ptr( new SmokeParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"note") mc->particleEngine->add(std::shared_ptr( new NoteParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"portal") mc->particleEngine->add(std::shared_ptr( new PortalParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"explode") mc->particleEngine->add(std::shared_ptr( new ExplodeParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"flame") mc->particleEngine->add(std::shared_ptr( new FlameParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"lava") mc->particleEngine->add(std::shared_ptr( new LavaParticle(level[playerIndex], x, y, z) ) ); +else if (name== L"footstep") mc->particleEngine->add(std::shared_ptr( new FootstepParticle(textures, level[playerIndex], x, y, z) ) ); +else if (name== L"splash") mc->particleEngine->add(std::shared_ptr( new SplashParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"largesmoke") mc->particleEngine->add(std::shared_ptr( new SmokeParticle(level[playerIndex], x, y, z, xa, ya, za, 2.5f) ) ); +else if (name== L"reddust") mc->particleEngine->add(std::shared_ptr( new RedDustParticle(level[playerIndex], x, y, z, (float) xa, (float) ya, (float) za) ) ); +else if (name== L"snowballpoof") mc->particleEngine->add(std::shared_ptr( new BreakingItemParticle(level[playerIndex], x, y, z, Item::snowBall) ) ); +else if (name== L"snowshovel") mc->particleEngine->add(std::shared_ptr( new SnowShovelParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); +else if (name== L"slime") mc->particleEngine->add(std::shared_ptr( new BreakingItemParticle(level[playerIndex], x, y, z, Item::slimeBall)) ) ; +else if (name== L"heart") mc->particleEngine->add(std::shared_ptr( new HeartParticle(level[playerIndex], x, y, z, xa, ya, za) ) ); } */ @@ -2639,7 +2639,7 @@ void LevelRenderer::addParticle(ePARTICLE_TYPE eParticleType, double x, double y addParticleInternal( eParticleType, x, y, z, xa, ya, za ); } -shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za) +std::shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za) { if (mc == NULL || mc->cameraTargetPlayer == NULL || mc->particleEngine == NULL) { @@ -2693,7 +2693,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle bool inRange = false; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - shared_ptr thisPlayer = mc->localplayers[i]; + std::shared_ptr thisPlayer = mc->localplayers[i]; if(thisPlayer != NULL && level[i] == lev) { xd = thisPlayer->x - x; @@ -2716,35 +2716,35 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle return nullptr; } - shared_ptr particle; + std::shared_ptr particle; switch(eParticleType) { case eParticleType_hugeexplosion: - particle = shared_ptr(new HugeExplosionSeedParticle(lev, x, y, z, xa, ya, za)); + particle = std::shared_ptr(new HugeExplosionSeedParticle(lev, x, y, z, xa, ya, za)); break; case eParticleType_largeexplode: - particle = shared_ptr(new HugeExplosionParticle(textures, lev, x, y, z, xa, ya, za)); + particle = std::shared_ptr(new HugeExplosionParticle(textures, lev, x, y, z, xa, ya, za)); break; case eParticleType_bubble: - particle = shared_ptr( new BubbleParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new BubbleParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_suspended: - particle = shared_ptr( new SuspendedParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SuspendedParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_depthsuspend: - particle = shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_townaura: - particle = shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_crit: { - shared_ptr critParticle2 = shared_ptr(new CritParticle2(lev, x, y, z, xa, ya, za)); + std::shared_ptr critParticle2 = std::shared_ptr(new CritParticle2(lev, x, y, z, xa, ya, za)); critParticle2->CritParticle2PostConstructor(); - particle = shared_ptr( critParticle2 ); + particle = std::shared_ptr( critParticle2 ); // request from 343 to set pink for the needler in the Halo Texture Pack // Set particle colour from colour-table. unsigned int cStart = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_CritStart ); @@ -2768,15 +2768,15 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle break; case eParticleType_magicCrit: { - shared_ptr critParticle2 = shared_ptr(new CritParticle2(lev, x, y, z, xa, ya, za)); + std::shared_ptr critParticle2 = std::shared_ptr(new CritParticle2(lev, x, y, z, xa, ya, za)); critParticle2->CritParticle2PostConstructor(); - particle = shared_ptr(critParticle2); + particle = std::shared_ptr(critParticle2); particle->setColor(particle->getRedCol() * 0.3f, particle->getGreenCol() * 0.8f, particle->getBlueCol()); particle->setNextMiscAnimTex(); } break; case eParticleType_smoke: - particle = shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_endportal: // 4J - Added. { @@ -2786,94 +2786,94 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle unsigned int col = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_EnderPortal ); tmp->setColor( ( (col>>16)&0xFF )/255.0f, ( (col>>8)&0xFF )/255.0, ( col&0xFF )/255.0 ); - particle = shared_ptr(tmp); + particle = std::shared_ptr(tmp); } break; case eParticleType_mobSpell: - particle = shared_ptr(new SpellParticle(lev, x, y, z, 0, 0, 0)); + particle = std::shared_ptr(new SpellParticle(lev, x, y, z, 0, 0, 0)); particle->setColor((float) xa, (float) ya, (float) za); break; case eParticleType_spell: - particle = shared_ptr( new SpellParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SpellParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_instantSpell: - particle = shared_ptr(new SpellParticle(lev, x, y, z, xa, ya, za)); - dynamic_pointer_cast(particle)->setBaseTex(9 * 16); + particle = std::shared_ptr(new SpellParticle(lev, x, y, z, xa, ya, za)); + std::dynamic_pointer_cast(particle)->setBaseTex(9 * 16); break; case eParticleType_note: - particle = shared_ptr( new NoteParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new NoteParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_netherportal: - particle = shared_ptr( new NetherPortalParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new NetherPortalParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_ender: - particle = shared_ptr( new EnderParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new EnderParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_enchantmenttable: - particle = shared_ptr(new EchantmentTableParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr(new EchantmentTableParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_explode: - particle = shared_ptr( new ExplodeParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new ExplodeParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_flame: - particle = shared_ptr( new FlameParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new FlameParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_lava: - particle = shared_ptr( new LavaParticle(lev, x, y, z) ); + particle = std::shared_ptr( new LavaParticle(lev, x, y, z) ); break; case eParticleType_footstep: - particle = shared_ptr( new FootstepParticle(textures, lev, x, y, z) ); + particle = std::shared_ptr( new FootstepParticle(textures, lev, x, y, z) ); break; case eParticleType_splash: - particle = shared_ptr( new SplashParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SplashParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_largesmoke: - particle = shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za, 2.5f) ); + particle = std::shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za, 2.5f) ); break; case eParticleType_reddust: - particle = shared_ptr( new RedDustParticle(lev, x, y, z, (float) xa, (float) ya, (float) za) ); + particle = std::shared_ptr( new RedDustParticle(lev, x, y, z, (float) xa, (float) ya, (float) za) ); break; case eParticleType_snowballpoof: - particle = shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::snowBall, textures) ); + particle = std::shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::snowBall, textures) ); break; case eParticleType_dripWater: - particle = shared_ptr( new DripParticle(lev, x, y, z, Material::water) ); + particle = std::shared_ptr( new DripParticle(lev, x, y, z, Material::water) ); break; case eParticleType_dripLava: - particle = shared_ptr( new DripParticle(lev, x, y, z, Material::lava) ); + particle = std::shared_ptr( new DripParticle(lev, x, y, z, Material::lava) ); break; case eParticleType_snowshovel: - particle = shared_ptr( new SnowShovelParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SnowShovelParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_slime: - particle = shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::slimeBall, textures)); + particle = std::shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::slimeBall, textures)); break; case eParticleType_heart: - particle = shared_ptr( new HeartParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new HeartParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_angryVillager: - particle = shared_ptr( new HeartParticle(lev, x, y + 0.5f, z, xa, ya, za) ); + particle = std::shared_ptr( new HeartParticle(lev, x, y + 0.5f, z, xa, ya, za) ); particle->setMiscTex(1 + 16 * 5); particle->setColor(1, 1, 1); break; case eParticleType_happyVillager: - particle = shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); particle->setMiscTex(2 + 16 * 5); particle->setColor(1, 1, 1); break; case eParticleType_dragonbreath: - particle = shared_ptr( new DragonBreathParticle(lev, x, y, z, xa, ya, za) ); + particle = std::shared_ptr( new DragonBreathParticle(lev, x, y, z, xa, ya, za) ); break; default: if( ( eParticleType >= eParticleType_iconcrack_base ) && ( eParticleType <= eParticleType_iconcrack_last ) ) { int id = PARTICLE_CRACK_ID(eParticleType), data = PARTICLE_CRACK_DATA(eParticleType); - particle = shared_ptr(new BreakingItemParticle(lev, x, y, z, xa, ya, za, Item::items[id], textures, data)); + particle = std::shared_ptr(new BreakingItemParticle(lev, x, y, z, xa, ya, za, Item::items[id], textures, data)); } else if( ( eParticleType >= eParticleType_tilecrack_base ) && ( eParticleType <= eParticleType_tilecrack_last ) ) { int id = PARTICLE_CRACK_ID(eParticleType), data = PARTICLE_CRACK_DATA(eParticleType); - particle = dynamic_pointer_cast( shared_ptr(new TerrainParticle(lev, x, y, z, xa, ya, za, Tile::tiles[id], 0, data, textures))->init(data) ); + particle = std::dynamic_pointer_cast( std::shared_ptr(new TerrainParticle(lev, x, y, z, xa, ya, za, Tile::tiles[id], 0, data, textures))->init(data) ); } } @@ -2885,7 +2885,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle return particle; } -void LevelRenderer::entityAdded(shared_ptr entity) +void LevelRenderer::entityAdded(std::shared_ptr entity) { entity->prepareCustomTextures(); // 4J - these empty string comparisons used to check for NULL references, but we don't have string pointers (currently) in entities, @@ -2909,7 +2909,7 @@ void LevelRenderer::entityAdded(shared_ptr entity) } -void LevelRenderer::entityRemoved(shared_ptr entity) +void LevelRenderer::entityRemoved(std::shared_ptr entity) { /* 4J - removed temp if (entity->customTextureUrl != L"") textures->removeHttpTexture(entity->customTextureUrl); @@ -2946,7 +2946,7 @@ void LevelRenderer::clear() MemoryTracker::releaseLists(chunkLists); } -void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y, int z, int data) +void LevelRenderer::levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data) { int playerIndex = mc->player->GetXboxPad(); // 4J added Random *random = level[playerIndex]->random; @@ -3058,7 +3058,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y double ys = 0.01 + random->nextDouble() * 0.5; double zs = sin(angle) * dist; - shared_ptr spellParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); + std::shared_ptr spellParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); if (spellParticle != NULL) { float randBrightness = 0.75f + random->nextFloat() * 0.25f; @@ -3085,7 +3085,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y double ys = 0.01 + random->nextDouble() * 0.5; double zs = sin(angle) * dist; - shared_ptr acidParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); + std::shared_ptr acidParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); if (acidParticle != NULL) { float randBrightness = 0.75f + random->nextFloat() * 0.25f; @@ -3212,7 +3212,7 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres if (entry == NULL || entry->getX() != x || entry->getY() != y || entry->getZ() != z) { entry = new BlockDestructionProgress(id, x, y, z); - destroyingBlocks.insert( unordered_map::value_type(id, entry) ); + destroyingBlocks.insert( std::unordered_map::value_type(id, entry) ); } entry->setProgress(progress); diff --git a/Minecraft.Client/Rendering/LevelRenderer.h b/Minecraft.Client/Rendering/LevelRenderer.h index 6e7cf6ed5..32941711d 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.h +++ b/Minecraft.Client/Rendering/LevelRenderer.h @@ -24,7 +24,7 @@ class Particle; class BlockDestructionProgress; class IconRegister; class Tesselator; -using namespace std; + // AP - this is a system that works out which chunks actually need to be grouped together via the deferral system when doing chunk::rebuild. Doing this will reduce the number // of chunks built in a single group and reduce the chance of seeing through the landscape when digging near the edges/corners of a chunk. @@ -68,12 +68,12 @@ public: void AddDLCSkinsToMemTextures(); public: void renderEntities(Vec3 *cam, Culler *culler, float a); - wstring gatherStats1(); - wstring gatherStats2(); + std::wstring gatherStats1(); + std::wstring gatherStats2(); private: void resortChunks(int xc, int yc, int zc); public: - int render(shared_ptr player, int layer, double alpha, bool updateChunks); + int render(std::shared_ptr player, int layer, double alpha, bool updateChunks); private: int renderChunks(int from, int to, int layer, double alpha); public: @@ -89,9 +89,9 @@ public: bool updateDirtyChunks(); public: - void renderHit(shared_ptr player, HitResult *h, int mode, shared_ptr inventoryItem, float a); - void renderDestroyAnimation(Tesselator *t, shared_ptr player, float a); - void renderHitOutline(shared_ptr player, HitResult *h, int mode, shared_ptr inventoryItem, float a); + void renderHit(std::shared_ptr player, HitResult *h, int mode, std::shared_ptr inventoryItem, float a); + void renderDestroyAnimation(Tesselator *t, std::shared_ptr player, float a); + void renderHitOutline(std::shared_ptr player, HitResult *h, int mode, std::shared_ptr inventoryItem, float a); void render(AABB *b); void setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Level *level); // 4J - added level param void tileChanged(int x, int y, int z); @@ -106,32 +106,32 @@ public: bool m_bSPUCullStarted[4]; #endif // __PS3__ void cull(Culler *culler, float a); - void playStreamingMusic(const wstring& name, int x, int y, int z); + void playStreamingMusic(const std::wstring& name, int x, int y, int z); void playSound(int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f); - void playSound(shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f); + void playSound(std::shared_ptr entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f); void addParticle(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za); // 4J added - shared_ptr addParticleInternal(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za); // 4J added - void entityAdded(shared_ptr entity); - void entityRemoved(shared_ptr entity); - void playerRemoved(shared_ptr entity) {} // 4J added - for when a player is removed from the level's player array, not just the entity storage + std::shared_ptr addParticleInternal(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za); // 4J added + void entityAdded(std::shared_ptr entity); + void entityRemoved(std::shared_ptr entity); + void playerRemoved(std::shared_ptr entity) {} // 4J added - for when a player is removed from the level's player array, not just the entity storage void skyColorChanged(); void clear(); - void levelEvent(shared_ptr source, int type, int x, int y, int z, int data); + void levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data); void destroyTileProgress(int id, int x, int y, int z, int progress); void registerTextures(IconRegister *iconRegister); - typedef unordered_map >, IntKeyHash, IntKeyEq> rteMap; + typedef std::unordered_map >, IntKeyHash, IntKeyEq> rteMap; private: // debug int m_freezeticks; // used to freeze the clouds // 4J - this block of declarations was scattered round the code but have gathered everything into one place - rteMap renderableTileEntities; // 4J - changed - was vector, now hashed by chunk so we can find them + rteMap renderableTileEntities; // 4J - changed - was std::vector, now hashed by chunk so we can find them CRITICAL_SECTION m_csRenderableTileEntities; MultiPlayerLevel *level[4]; // 4J - now one per player Textures *textures; - // vector *sortedChunks[4]; // 4J - removed - not sorting our chunks anymore + // std::vector *sortedChunks[4]; // 4J - removed - not sorting our chunks anymore ClipChunkArray chunks[4]; // 4J - now one per player int lastPlayerCount[4]; // 4J - added int xChunks, yChunks, zChunks; @@ -149,7 +149,7 @@ private: int renderedEntities; int culledEntities; int chunkFixOffs; - vector _renderChunks; + std::vector _renderChunks; int frame; int repeatList; double xOld[4]; // 4J - now one per player @@ -160,7 +160,7 @@ private: static const int RENDERLISTS_LENGTH = 4; // 4J - added OffsettedRenderList renderLists[RENDERLISTS_LENGTH]; - unordered_map destroyingBlocks; + std::unordered_map destroyingBlocks; Icon **breakingTextures; public: @@ -189,7 +189,7 @@ public: ~RecentTile(); }; CRITICAL_SECTION m_csDestroyedTiles; - vector m_destroyedTiles; + std::vector m_destroyedTiles; public: void destroyingTileAt( Level *level, int x, int y, int z ); // For game to let this manager know that a tile is about to be destroyed (must be called before it actually is) void updatedChunkAt( Level * level, int x, int y, int z, int veryNearCount ); // For chunk rebuilding to inform the manager that a chunk (a 16x16x16 tile render chunk) has been updated diff --git a/Minecraft.Client/Rendering/Minimap.cpp b/Minecraft.Client/Rendering/Minimap.cpp index ce287b40a..cb337cd83 100644 --- a/Minecraft.Client/Rendering/Minimap.cpp +++ b/Minecraft.Client/Rendering/Minimap.cpp @@ -98,7 +98,7 @@ void Minimap::reloadColours() } // 4J added entityId -void Minimap::render(shared_ptr player, Textures *textures, shared_ptr data, int entityId) +void Minimap::render(std::shared_ptr player, Textures *textures, std::shared_ptr data, int entityId) { // 4J - only update every 8 renders, as an optimisation // We don't want to use this for ItemFrame renders of maps, as then we can't have different maps together @@ -147,12 +147,12 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrdecorations.end()); #ifdef _LARGE_WORLDS - vector m_edgeIcons; + std::vector m_edgeIcons; #endif // 4J-PB - stack the map icons float fIconZ=-0.04f;// 4J - moved to -0.04 (was -0.02) to stop z fighting - for( vector::iterator it = data->decorations.begin(); it != itEnd; it++ ) + for( std::vector::iterator it = data->decorations.begin(); it != itEnd; it++ ) { MapItemSavedData::MapDecoration *dec = *it; diff --git a/Minecraft.Client/Rendering/Minimap.h b/Minecraft.Client/Rendering/Minimap.h index 931e5e562..2743f03d5 100644 --- a/Minecraft.Client/Rendering/Minimap.h +++ b/Minecraft.Client/Rendering/Minimap.h @@ -31,5 +31,5 @@ private: public: Minimap(Font *font, Options *options, Textures *textures, bool optimised = true); // 4J Added optimised param static void reloadColours(); - void render(shared_ptr player, Textures *textures, shared_ptr data, int entityId); // 4J added entityId param + void render(std::shared_ptr player, Textures *textures, std::shared_ptr data, int entityId); // 4J added entityId param }; diff --git a/Minecraft.Client/Rendering/Models/BlazeModel.cpp b/Minecraft.Client/Rendering/Models/BlazeModel.cpp index 497ae6d15..09dfbebaf 100644 --- a/Minecraft.Client/Rendering/Models/BlazeModel.cpp +++ b/Minecraft.Client/Rendering/Models/BlazeModel.cpp @@ -30,7 +30,7 @@ int BlazeModel::modelVersion() return 8; } -void BlazeModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void BlazeModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/BlazeModel.h b/Minecraft.Client/Rendering/Models/BlazeModel.h index 27ee20602..9e702ecb4 100644 --- a/Minecraft.Client/Rendering/Models/BlazeModel.h +++ b/Minecraft.Client/Rendering/Models/BlazeModel.h @@ -11,6 +11,6 @@ private: public: BlazeModel(); int modelVersion(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; diff --git a/Minecraft.Client/Rendering/Models/BoatModel.cpp b/Minecraft.Client/Rendering/Models/BoatModel.cpp index 16a81cd65..bd39f0f8d 100644 --- a/Minecraft.Client/Rendering/Models/BoatModel.cpp +++ b/Minecraft.Client/Rendering/Models/BoatModel.cpp @@ -42,7 +42,7 @@ BoatModel::BoatModel() : Model() cubes[4]->compile(1.0f/16.0f); } -void BoatModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void BoatModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { for (int i = 0; i < 5; i++) { diff --git a/Minecraft.Client/Rendering/Models/BoatModel.h b/Minecraft.Client/Rendering/Models/BoatModel.h index 4298b6437..192e140f3 100644 --- a/Minecraft.Client/Rendering/Models/BoatModel.h +++ b/Minecraft.Client/Rendering/Models/BoatModel.h @@ -7,5 +7,5 @@ class BoatModel : public Model public: ModelPart *cubes[5]; BoatModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/BookModel.cpp b/Minecraft.Client/Rendering/Models/BookModel.cpp index fea92b26a..a10f42ec4 100644 --- a/Minecraft.Client/Rendering/Models/BookModel.cpp +++ b/Minecraft.Client/Rendering/Models/BookModel.cpp @@ -33,7 +33,7 @@ BookModel::BookModel() } -void BookModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void BookModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/BookModel.h b/Minecraft.Client/Rendering/Models/BookModel.h index 8b367a34a..411d2df55 100644 --- a/Minecraft.Client/Rendering/Models/BookModel.h +++ b/Minecraft.Client/Rendering/Models/BookModel.h @@ -11,6 +11,6 @@ public: ModelPart *seam; BookModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; diff --git a/Minecraft.Client/Rendering/Models/ChickenModel.cpp b/Minecraft.Client/Rendering/Models/ChickenModel.cpp index 2abfee485..93ecc5d28 100644 --- a/Minecraft.Client/Rendering/Models/ChickenModel.cpp +++ b/Minecraft.Client/Rendering/Models/ChickenModel.cpp @@ -49,7 +49,7 @@ ChickenModel::ChickenModel() : Model() wing1->compile(1.0f/16.0f); } -void ChickenModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void ChickenModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); if (young) diff --git a/Minecraft.Client/Rendering/Models/ChickenModel.h b/Minecraft.Client/Rendering/Models/ChickenModel.h index 18b9dd335..7ef7e99b4 100644 --- a/Minecraft.Client/Rendering/Models/ChickenModel.h +++ b/Minecraft.Client/Rendering/Models/ChickenModel.h @@ -7,6 +7,6 @@ public: ModelPart *head, *hair, *body, *leg0, *leg1, *wing0,* wing1, *beak, *redThing; ChickenModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; diff --git a/Minecraft.Client/Rendering/Models/CowModel.h b/Minecraft.Client/Rendering/Models/CowModel.h index 617bb94f3..dcd7671c6 100644 --- a/Minecraft.Client/Rendering/Models/CowModel.h +++ b/Minecraft.Client/Rendering/Models/CowModel.h @@ -5,6 +5,6 @@ class CowModel : public QuadrupedModel { public: CowModel(); -// virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); +// virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); // virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale); }; diff --git a/Minecraft.Client/Rendering/Models/CreeperModel.cpp b/Minecraft.Client/Rendering/Models/CreeperModel.cpp index 8e0f9a388..5af5bb088 100644 --- a/Minecraft.Client/Rendering/Models/CreeperModel.cpp +++ b/Minecraft.Client/Rendering/Models/CreeperModel.cpp @@ -56,7 +56,7 @@ CreeperModel::CreeperModel(float g) : Model() _init(g); } -void CreeperModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void CreeperModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/CreeperModel.h b/Minecraft.Client/Rendering/Models/CreeperModel.h index 06231d0ea..0c4e9448e 100644 --- a/Minecraft.Client/Rendering/Models/CreeperModel.h +++ b/Minecraft.Client/Rendering/Models/CreeperModel.h @@ -9,6 +9,6 @@ public: void _init(float g); // 4J added CreeperModel(); CreeperModel(float g); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/DragonModel.cpp b/Minecraft.Client/Rendering/Models/DragonModel.cpp index 944a61f5e..fd189af9d 100644 --- a/Minecraft.Client/Rendering/Models/DragonModel.cpp +++ b/Minecraft.Client/Rendering/Models/DragonModel.cpp @@ -106,15 +106,15 @@ DragonModel::DragonModel(float g) : Model() rearFoot->compile(1.0f/16.0f); } -void DragonModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void DragonModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { this->a = a; } -void DragonModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void DragonModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { glPushMatrix(); - shared_ptr dragon = dynamic_pointer_cast(entity); + std::shared_ptr dragon = std::dynamic_pointer_cast(entity); float ttt = dragon->oFlapTime + (dragon->flapTime - dragon->oFlapTime) * a; jaw->xRot = (float) (Mth::sin(ttt * PI * 2) + 1) * 0.2f; diff --git a/Minecraft.Client/Rendering/Models/DragonModel.h b/Minecraft.Client/Rendering/Models/DragonModel.h index 47c20cba3..baee83dec 100644 --- a/Minecraft.Client/Rendering/Models/DragonModel.h +++ b/Minecraft.Client/Rendering/Models/DragonModel.h @@ -26,8 +26,8 @@ public: ModelPart *cubes[5]; DragonModel(float g); - void prepareMobModel(shared_ptr mob, float time, float r, float a); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void prepareMobModel(std::shared_ptr mob, float time, float r, float a); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); private: float rotWrap(double d); diff --git a/Minecraft.Client/Rendering/Models/EnderCrystalModel.cpp b/Minecraft.Client/Rendering/Models/EnderCrystalModel.cpp index 10769f279..9eb7f1e07 100644 --- a/Minecraft.Client/Rendering/Models/EnderCrystalModel.cpp +++ b/Minecraft.Client/Rendering/Models/EnderCrystalModel.cpp @@ -21,7 +21,7 @@ EnderCrystalModel::EnderCrystalModel(float g) } -void EnderCrystalModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void EnderCrystalModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { glPushMatrix(); glScalef(2, 2, 2); diff --git a/Minecraft.Client/Rendering/Models/EnderCrystalModel.h b/Minecraft.Client/Rendering/Models/EnderCrystalModel.h index 71f1db106..42ae1b3d1 100644 --- a/Minecraft.Client/Rendering/Models/EnderCrystalModel.h +++ b/Minecraft.Client/Rendering/Models/EnderCrystalModel.h @@ -14,5 +14,5 @@ private: public: EnderCrystalModel(float g); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/GhastModel.cpp b/Minecraft.Client/Rendering/Models/GhastModel.cpp index 2b4fad1e6..388cac7f3 100644 --- a/Minecraft.Client/Rendering/Models/GhastModel.cpp +++ b/Minecraft.Client/Rendering/Models/GhastModel.cpp @@ -42,7 +42,7 @@ void GhastModel::setupAnim(float time, float r, float bob, float yRot, float xRo } } -void GhastModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void GhastModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/GhastModel.h b/Minecraft.Client/Rendering/Models/GhastModel.h index 22e9023c7..59ce7b7df 100644 --- a/Minecraft.Client/Rendering/Models/GhastModel.h +++ b/Minecraft.Client/Rendering/Models/GhastModel.h @@ -10,5 +10,5 @@ public: GhastModel(); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/HumanoidModel.cpp b/Minecraft.Client/Rendering/Models/HumanoidModel.cpp index 94b0f022d..2fcf1c7e8 100644 --- a/Minecraft.Client/Rendering/Models/HumanoidModel.cpp +++ b/Minecraft.Client/Rendering/Models/HumanoidModel.cpp @@ -140,7 +140,7 @@ HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight _init(g,yOffset,texWidth,texHeight); } -void HumanoidModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void HumanoidModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { if(entity!=NULL) { diff --git a/Minecraft.Client/Rendering/Models/HumanoidModel.h b/Minecraft.Client/Rendering/Models/HumanoidModel.h index 0ca10f4bf..2f9fcff57 100644 --- a/Minecraft.Client/Rendering/Models/HumanoidModel.h +++ b/Minecraft.Client/Rendering/Models/HumanoidModel.h @@ -53,7 +53,7 @@ public: HumanoidModel(); HumanoidModel(float g); HumanoidModel(float g, float yOffset, int texWidth, int texHeight); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); void renderHair(float scale, bool usecompiled); void renderEars(float scale, bool usecompiled); diff --git a/Minecraft.Client/Rendering/Models/LavaSlimeModel.cpp b/Minecraft.Client/Rendering/Models/LavaSlimeModel.cpp index 1d37a5303..dec013d5d 100644 --- a/Minecraft.Client/Rendering/Models/LavaSlimeModel.cpp +++ b/Minecraft.Client/Rendering/Models/LavaSlimeModel.cpp @@ -41,9 +41,9 @@ int LavaSlimeModel::getModelVersion() return 5; } -void LavaSlimeModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void LavaSlimeModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { - shared_ptr lavaSlime = dynamic_pointer_cast(mob); + std::shared_ptr lavaSlime = std::dynamic_pointer_cast(mob); float slimeSquish = (lavaSlime->oSquish + (lavaSlime->squish - lavaSlime->oSquish) * a); if (slimeSquish < 0) @@ -57,7 +57,7 @@ void LavaSlimeModel::prepareMobModel(shared_ptr mob, float time, float r, f } } -void LavaSlimeModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void LavaSlimeModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/LavaSlimeModel.h b/Minecraft.Client/Rendering/Models/LavaSlimeModel.h index 44bd1663a..4fcce75de 100644 --- a/Minecraft.Client/Rendering/Models/LavaSlimeModel.h +++ b/Minecraft.Client/Rendering/Models/LavaSlimeModel.h @@ -10,6 +10,6 @@ class LavaSlimeModel : public Model public: LavaSlimeModel(); int getModelVersion(); - virtual void prepareMobModel(shared_ptr mob, float time, float r, float a); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void prepareMobModel(std::shared_ptr mob, float time, float r, float a); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; diff --git a/Minecraft.Client/Rendering/Models/MinecartModel.cpp b/Minecraft.Client/Rendering/Models/MinecartModel.cpp index b189d61dd..4cabfb418 100644 --- a/Minecraft.Client/Rendering/Models/MinecartModel.cpp +++ b/Minecraft.Client/Rendering/Models/MinecartModel.cpp @@ -47,7 +47,7 @@ MinecartModel::MinecartModel() : Model() } } -void MinecartModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void MinecartModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { cubes[5]->y = 4 - bob; for (int i = 0; i < MINECART_LENGTH; i++) diff --git a/Minecraft.Client/Rendering/Models/MinecartModel.h b/Minecraft.Client/Rendering/Models/MinecartModel.h index de925566c..2cf6d0efb 100644 --- a/Minecraft.Client/Rendering/Models/MinecartModel.h +++ b/Minecraft.Client/Rendering/Models/MinecartModel.h @@ -9,5 +9,5 @@ public: ModelPart *cubes[MINECART_LENGTH]; MinecartModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; diff --git a/Minecraft.Client/Rendering/Models/Model.cpp b/Minecraft.Client/Rendering/Models/Model.cpp index eebebf763..e3a1f2976 100644 --- a/Minecraft.Client/Rendering/Models/Model.cpp +++ b/Minecraft.Client/Rendering/Models/Model.cpp @@ -11,12 +11,12 @@ Model::Model() texHeight=32; } -void Model::setMapTex(wstring id, int x, int y) +void Model::setMapTex(std::wstring id, int x, int y) { mappedTexOffs[id]=new TexOffs(x, y); } -TexOffs *Model::getMapTex(wstring id) +TexOffs *Model::getMapTex(std::wstring id) { // 4J-PB - assuming there will always be this one return mappedTexOffs[id]; diff --git a/Minecraft.Client/Rendering/Models/Model.h b/Minecraft.Client/Rendering/Models/Model.h index fdcf096d7..104e6ce27 100644 --- a/Minecraft.Client/Rendering/Models/Model.h +++ b/Minecraft.Client/Rendering/Models/Model.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include "../../../Minecraft.World/Util/Random.h" #include "SkinBox.h" class Mob; @@ -12,21 +12,21 @@ class Model public: float attackTime; bool riding; - vector cubes; + std::vector cubes; bool young; - unordered_map mappedTexOffs; + std::unordered_map mappedTexOffs; int texWidth; int texHeight; Model(); // 4J added - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) {} + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) {} virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0) {} - virtual void prepareMobModel(shared_ptr mob, float time, float r, float a) {} + virtual void prepareMobModel(std::shared_ptr mob, float time, float r, float a) {} virtual ModelPart *getRandomCube(Random random) {return cubes.at(random.nextInt((int)cubes.size()));} virtual ModelPart * AddOrRetrievePart(SKIN_BOX *pBox) { return NULL;} - void setMapTex(wstring id, int x, int y); - TexOffs *getMapTex(wstring id); + void setMapTex(std::wstring id, int x, int y); + TexOffs *getMapTex(std::wstring id); protected: float yHeadOffs; diff --git a/Minecraft.Client/Rendering/Models/ModelPart.cpp b/Minecraft.Client/Rendering/Models/ModelPart.cpp index 182dc15cd..a93adfc69 100644 --- a/Minecraft.Client/Rendering/Models/ModelPart.cpp +++ b/Minecraft.Client/Rendering/Models/ModelPart.cpp @@ -23,7 +23,7 @@ ModelPart::ModelPart() _init(); } -ModelPart::ModelPart(Model *model, const wstring& id) +ModelPart::ModelPart(Model *model, const std::wstring& id) { construct(model, id); } @@ -39,7 +39,7 @@ ModelPart::ModelPart(Model *model, int xTexOffs, int yTexOffs) } -void ModelPart::construct(Model *model, const wstring& id) +void ModelPart::construct(Model *model, const std::wstring& id) { _init(); this->model = model; @@ -108,7 +108,7 @@ ModelPart *ModelPart::texOffs(int xTexOffs, int yTexOffs) return this; } -ModelPart *ModelPart::addBox(wstring id, float x0, float y0, float z0, int w, int h, int d) +ModelPart *ModelPart::addBox(std::wstring id, float x0, float y0, float z0, int w, int h, int d) { id = this->id + L"." + id; TexOffs *offs = model->getMapTex(id); diff --git a/Minecraft.Client/Rendering/Models/ModelPart.h b/Minecraft.Client/Rendering/Models/ModelPart.h index 5d22ad3a8..822ed1025 100644 --- a/Minecraft.Client/Rendering/Models/ModelPart.h +++ b/Minecraft.Client/Rendering/Models/ModelPart.h @@ -17,12 +17,12 @@ public: bool bMirror; bool visible; bool neverRender; - vector cubes; - vector children; + std::vector cubes; + std::vector children; static const float RAD; private: - wstring id; + std::wstring id; int xTexOffs, yTexOffs; boolean compiled; int list; @@ -31,12 +31,12 @@ private: public: void _init(); // 4J added ModelPart(); - ModelPart(Model *model, const wstring &id); + ModelPart(Model *model, const std::wstring &id); ModelPart(Model *model); ModelPart(Model *model, int xTexOffs, int yTexOffs); // MGH - had to add these for PS3, as calling constructors from others was only introduced in c++11 - https://en.wikipedia.org/wiki/C++11#Object_construction_improvement - void construct(Model *model, const wstring &id); + void construct(Model *model, const std::wstring &id); void construct(Model *model); void construct(Model *model, int xTexOffs, int yTexOffs); @@ -44,7 +44,7 @@ public: ModelPart * retrieveChild(SKIN_BOX *pBox); ModelPart *mirror(); ModelPart *texOffs(int xTexOffs, int yTexOffs); - ModelPart *addBox(wstring id, float x0, float y0, float z0, int w, int h, int d); + ModelPart *addBox(std::wstring id, float x0, float y0, float z0, int w, int h, int d); ModelPart *addBox(float x0, float y0, float z0, int w, int h, int d); ModelPart *addBoxWithMask(float x0, float y0, float z0, int w, int h, int d, int faceMask); // 4J added void addBox(float x0, float y0, float z0, int w, int h, int d, float g); diff --git a/Minecraft.Client/Rendering/Models/OcelotModel.cpp b/Minecraft.Client/Rendering/Models/OcelotModel.cpp index 1102b7b33..6e7bf6388 100644 --- a/Minecraft.Client/Rendering/Models/OcelotModel.cpp +++ b/Minecraft.Client/Rendering/Models/OcelotModel.cpp @@ -78,7 +78,7 @@ OzelotModel::OzelotModel() backLegR->compile(1.0f/16.0f); } -void OzelotModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void OzelotModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); if (young) @@ -180,9 +180,9 @@ void OzelotModel::setupAnim(float time, float r, float bob, float yRot, float xR } } -void OzelotModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void OzelotModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { - shared_ptr ozelot = dynamic_pointer_cast(mob); + std::shared_ptr ozelot = std::dynamic_pointer_cast(mob); body->y = bodyWalkY; body->z = bodyWalkZ; diff --git a/Minecraft.Client/Rendering/Models/OcelotModel.h b/Minecraft.Client/Rendering/Models/OcelotModel.h index 2c08f3dfb..cdccc8fe8 100644 --- a/Minecraft.Client/Rendering/Models/OcelotModel.h +++ b/Minecraft.Client/Rendering/Models/OcelotModel.h @@ -36,8 +36,8 @@ private: public: OzelotModel(); - void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); void render(OzelotModel *model, float scale, bool usecompiled); void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); - void prepareMobModel(shared_ptr mob, float time, float r, float a); + void prepareMobModel(std::shared_ptr mob, float time, float r, float a); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/QuadrupedModel.cpp b/Minecraft.Client/Rendering/Models/QuadrupedModel.cpp index 093cdf735..9a13a11aa 100644 --- a/Minecraft.Client/Rendering/Models/QuadrupedModel.cpp +++ b/Minecraft.Client/Rendering/Models/QuadrupedModel.cpp @@ -41,7 +41,7 @@ QuadrupedModel::QuadrupedModel(int legSize, float g) : Model() leg3->compile(1.0f/16.0f); } -void QuadrupedModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void QuadrupedModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/QuadrupedModel.h b/Minecraft.Client/Rendering/Models/QuadrupedModel.h index 47c50599f..d1c24de78 100644 --- a/Minecraft.Client/Rendering/Models/QuadrupedModel.h +++ b/Minecraft.Client/Rendering/Models/QuadrupedModel.h @@ -7,7 +7,7 @@ public: ModelPart *head, *body, *leg0, *leg1, *leg2, *leg3; QuadrupedModel(int legSize, float g); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); void render(QuadrupedModel *model, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SheepFurModel.cpp b/Minecraft.Client/Rendering/Models/SheepFurModel.cpp index 2b85fa7cf..4f6498577 100644 --- a/Minecraft.Client/Rendering/Models/SheepFurModel.cpp +++ b/Minecraft.Client/Rendering/Models/SheepFurModel.cpp @@ -41,11 +41,11 @@ SheepFurModel::SheepFurModel() : QuadrupedModel(12, 0) leg3->compile(1.0f/16.0f); } -void SheepFurModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void SheepFurModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { QuadrupedModel::prepareMobModel(mob, time, r, a); - shared_ptr sheep = dynamic_pointer_cast(mob); + std::shared_ptr sheep = std::dynamic_pointer_cast(mob); head->y = 6 + sheep->getHeadEatPositionScale(a) * 9.0f; headXRot = sheep->getHeadEatAngleScale(a); } diff --git a/Minecraft.Client/Rendering/Models/SheepFurModel.h b/Minecraft.Client/Rendering/Models/SheepFurModel.h index c614765eb..65bb913ed 100644 --- a/Minecraft.Client/Rendering/Models/SheepFurModel.h +++ b/Minecraft.Client/Rendering/Models/SheepFurModel.h @@ -8,6 +8,6 @@ private: public: SheepFurModel(); - virtual void prepareMobModel(shared_ptr mob, float time, float r, float a); + virtual void prepareMobModel(std::shared_ptr mob, float time, float r, float a); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SheepModel.cpp b/Minecraft.Client/Rendering/Models/SheepModel.cpp index 21af40739..fdd4eb230 100644 --- a/Minecraft.Client/Rendering/Models/SheepModel.cpp +++ b/Minecraft.Client/Rendering/Models/SheepModel.cpp @@ -20,11 +20,11 @@ SheepModel::SheepModel() : QuadrupedModel(12, 0) body->compile(1.0f/16.0f); } -void SheepModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void SheepModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { QuadrupedModel::prepareMobModel(mob, time, r, a); - shared_ptr sheep = dynamic_pointer_cast(mob); + std::shared_ptr sheep = std::dynamic_pointer_cast(mob); head->y = 6 + sheep->getHeadEatPositionScale(a) * 9.0f; headXRot = sheep->getHeadEatAngleScale(a); } diff --git a/Minecraft.Client/Rendering/Models/SheepModel.h b/Minecraft.Client/Rendering/Models/SheepModel.h index d4136c25c..78c3b7c8b 100644 --- a/Minecraft.Client/Rendering/Models/SheepModel.h +++ b/Minecraft.Client/Rendering/Models/SheepModel.h @@ -8,6 +8,6 @@ private: public: SheepModel(); - virtual void prepareMobModel(shared_ptr mob, float time, float r, float a); + virtual void prepareMobModel(std::shared_ptr mob, float time, float r, float a); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SilverfishModel.cpp b/Minecraft.Client/Rendering/Models/SilverfishModel.cpp index 06b4d3820..e5031a695 100644 --- a/Minecraft.Client/Rendering/Models/SilverfishModel.cpp +++ b/Minecraft.Client/Rendering/Models/SilverfishModel.cpp @@ -82,7 +82,7 @@ int SilverfishModel::modelVersion() return 38; } -void SilverfishModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SilverfishModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SilverfishModel.h b/Minecraft.Client/Rendering/Models/SilverfishModel.h index d6be30590..4ce0e16ee 100644 --- a/Minecraft.Client/Rendering/Models/SilverfishModel.h +++ b/Minecraft.Client/Rendering/Models/SilverfishModel.h @@ -21,6 +21,6 @@ public: SilverfishModel(); int modelVersion(); - void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SkeletonHeadModel.cpp b/Minecraft.Client/Rendering/Models/SkeletonHeadModel.cpp index 3c9733b6a..e2598e809 100644 --- a/Minecraft.Client/Rendering/Models/SkeletonHeadModel.cpp +++ b/Minecraft.Client/Rendering/Models/SkeletonHeadModel.cpp @@ -27,7 +27,7 @@ SkeletonHeadModel::SkeletonHeadModel(int u, int v, int tw, int th) _init(u,v,tw,th); } -void SkeletonHeadModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SkeletonHeadModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SkeletonHeadModel.h b/Minecraft.Client/Rendering/Models/SkeletonHeadModel.h index 6f136c46a..aa045571e 100644 --- a/Minecraft.Client/Rendering/Models/SkeletonHeadModel.h +++ b/Minecraft.Client/Rendering/Models/SkeletonHeadModel.h @@ -14,6 +14,6 @@ public: SkeletonHeadModel(); SkeletonHeadModel(int u, int v, int tw, int th); - void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SlimeModel.cpp b/Minecraft.Client/Rendering/Models/SlimeModel.cpp index 32871d41e..523f9874c 100644 --- a/Minecraft.Client/Rendering/Models/SlimeModel.cpp +++ b/Minecraft.Client/Rendering/Models/SlimeModel.cpp @@ -34,7 +34,7 @@ SlimeModel::SlimeModel(int vOffs) cube->compile(1.0f/16.0f); } -void SlimeModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SlimeModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SlimeModel.h b/Minecraft.Client/Rendering/Models/SlimeModel.h index 9eee5eb1d..fe2a4fc2b 100644 --- a/Minecraft.Client/Rendering/Models/SlimeModel.h +++ b/Minecraft.Client/Rendering/Models/SlimeModel.h @@ -9,5 +9,5 @@ public: SlimeModel(int vOffs); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SnowManModel.cpp b/Minecraft.Client/Rendering/Models/SnowManModel.cpp index 10f69b70a..2923f23e9 100644 --- a/Minecraft.Client/Rendering/Models/SnowManModel.cpp +++ b/Minecraft.Client/Rendering/Models/SnowManModel.cpp @@ -58,7 +58,7 @@ void SnowManModel::setupAnim(float time, float r, float bob, float yRot, float x arm2->z = (s) * 5; } -void SnowManModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SnowManModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SnowManModel.h b/Minecraft.Client/Rendering/Models/SnowManModel.h index eb31e5036..b2d8229ac 100644 --- a/Minecraft.Client/Rendering/Models/SnowManModel.h +++ b/Minecraft.Client/Rendering/Models/SnowManModel.h @@ -9,5 +9,5 @@ public: SnowManModel() ; virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); - void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; diff --git a/Minecraft.Client/Rendering/Models/SpiderModel.cpp b/Minecraft.Client/Rendering/Models/SpiderModel.cpp index 3efc0cc5d..7ceec04df 100644 --- a/Minecraft.Client/Rendering/Models/SpiderModel.cpp +++ b/Minecraft.Client/Rendering/Models/SpiderModel.cpp @@ -68,7 +68,7 @@ SpiderModel::SpiderModel() : Model() leg7->compile(1.0f/16.0f); } -void SpiderModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SpiderModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SpiderModel.h b/Minecraft.Client/Rendering/Models/SpiderModel.h index 616669836..2d9d15273 100644 --- a/Minecraft.Client/Rendering/Models/SpiderModel.h +++ b/Minecraft.Client/Rendering/Models/SpiderModel.h @@ -7,6 +7,6 @@ public: ModelPart *head, *body0, *body1, *leg0, *leg1, *leg2, *leg3, *leg4, *leg5, *leg6, *leg7; SpiderModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/SquidModel.cpp b/Minecraft.Client/Rendering/Models/SquidModel.cpp index d23812d20..56637a8d6 100644 --- a/Minecraft.Client/Rendering/Models/SquidModel.cpp +++ b/Minecraft.Client/Rendering/Models/SquidModel.cpp @@ -43,7 +43,7 @@ void SquidModel::setupAnim(float time, float r, float bob, float yRot, float xRo } } -void SquidModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void SquidModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/SquidModel.h b/Minecraft.Client/Rendering/Models/SquidModel.h index 8f43950fa..0b7948a80 100644 --- a/Minecraft.Client/Rendering/Models/SquidModel.h +++ b/Minecraft.Client/Rendering/Models/SquidModel.h @@ -10,5 +10,5 @@ public: SquidModel(); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Models/VillagerGolemModel.cpp b/Minecraft.Client/Rendering/Models/VillagerGolemModel.cpp index bc4693b18..e8e120b70 100644 --- a/Minecraft.Client/Rendering/Models/VillagerGolemModel.cpp +++ b/Minecraft.Client/Rendering/Models/VillagerGolemModel.cpp @@ -36,7 +36,7 @@ VillagerGolemModel::VillagerGolemModel(float g, float yOffset) leg1->addBox(-3.5f, -3, -3, 6, 16, 5, g); } -void VillagerGolemModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void VillagerGolemModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); @@ -59,9 +59,9 @@ void VillagerGolemModel::setupAnim(float time, float r, float bob, float yRot, f leg1->yRot = 0; } -void VillagerGolemModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void VillagerGolemModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { - shared_ptr vg = dynamic_pointer_cast(mob); + std::shared_ptr vg = std::dynamic_pointer_cast(mob); int attackTick = vg->getAttackAnimationTick(); if (attackTick > 0) { diff --git a/Minecraft.Client/Rendering/Models/VillagerGolemModel.h b/Minecraft.Client/Rendering/Models/VillagerGolemModel.h index 83e736163..80c822d5c 100644 --- a/Minecraft.Client/Rendering/Models/VillagerGolemModel.h +++ b/Minecraft.Client/Rendering/Models/VillagerGolemModel.h @@ -21,9 +21,9 @@ public: VillagerGolemModel(float g = 0.0f, float yOffset = -7.0f); - void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); - void prepareMobModel(shared_ptr mob, float time, float r, float a); + void prepareMobModel(std::shared_ptr mob, float time, float r, float a); private: float triangleWave(float bob, float period); diff --git a/Minecraft.Client/Rendering/Models/VillagerModel.cpp b/Minecraft.Client/Rendering/Models/VillagerModel.cpp index 090907c6e..351efff71 100644 --- a/Minecraft.Client/Rendering/Models/VillagerModel.cpp +++ b/Minecraft.Client/Rendering/Models/VillagerModel.cpp @@ -55,7 +55,7 @@ VillagerModel::VillagerModel(float g, float yOffset) : Model() _init(g,yOffset); } -void VillagerModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void VillagerModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { setupAnim(time, r, bob, yRot, xRot, scale); diff --git a/Minecraft.Client/Rendering/Models/VillagerModel.h b/Minecraft.Client/Rendering/Models/VillagerModel.h index 24c8b858b..cfb4b1d9f 100644 --- a/Minecraft.Client/Rendering/Models/VillagerModel.h +++ b/Minecraft.Client/Rendering/Models/VillagerModel.h @@ -10,6 +10,6 @@ public: void _init(float g, float yOffset); // 4J added VillagerModel(float g, float yOffset); VillagerModel(float g); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) ; + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) ; virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; diff --git a/Minecraft.Client/Rendering/Models/WolfModel.cpp b/Minecraft.Client/Rendering/Models/WolfModel.cpp index 0add0152d..b58344b24 100644 --- a/Minecraft.Client/Rendering/Models/WolfModel.cpp +++ b/Minecraft.Client/Rendering/Models/WolfModel.cpp @@ -57,7 +57,7 @@ WolfModel::WolfModel() tail->compile(1.0f/16.0f); } -void WolfModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +void WolfModel::render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { Model::render(entity, time, r, bob, yRot, xRot, scale, usecompiled); setupAnim(time, r, bob, yRot, xRot, scale); @@ -94,9 +94,9 @@ void WolfModel::render(shared_ptr entity, float time, float r, float bob } } -void WolfModel::prepareMobModel(shared_ptr mob, float time, float r, float a) +void WolfModel::prepareMobModel(std::shared_ptr mob, float time, float r, float a) { - shared_ptr wolf = dynamic_pointer_cast(mob); + std::shared_ptr wolf = std::dynamic_pointer_cast(mob); if (wolf->isAngry()) { diff --git a/Minecraft.Client/Rendering/Models/WolfModel.h b/Minecraft.Client/Rendering/Models/WolfModel.h index 0bf806da0..809259906 100644 --- a/Minecraft.Client/Rendering/Models/WolfModel.h +++ b/Minecraft.Client/Rendering/Models/WolfModel.h @@ -15,7 +15,7 @@ private: static const int legSize = 8; public: WolfModel(); - virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); - void prepareMobModel(shared_ptr mob, float time, float r, float a); + virtual void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); + void prepareMobModel(std::shared_ptr mob, float time, float r, float a); virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Particles/CritParticle.cpp b/Minecraft.Client/Rendering/Particles/CritParticle.cpp index b2d1ac4f5..7a1de6ac6 100644 --- a/Minecraft.Client/Rendering/Particles/CritParticle.cpp +++ b/Minecraft.Client/Rendering/Particles/CritParticle.cpp @@ -5,7 +5,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.phys.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.level.h" -void CritParticle::_init(Level *level, shared_ptr entity, ePARTICLE_TYPE type) +void CritParticle::_init(Level *level, std::shared_ptr entity, ePARTICLE_TYPE type) { life = 0; this->entity = entity; @@ -15,17 +15,17 @@ void CritParticle::_init(Level *level, shared_ptr entity, ePARTICLE_TYPE //tick(); } -CritParticle::CritParticle(Level *level, shared_ptr entity) : Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2, entity->z, entity->xd, entity->yd, entity->zd) +CritParticle::CritParticle(Level *level, std::shared_ptr entity) : Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2, entity->z, entity->xd, entity->yd, entity->zd) { _init(level,entity,eParticleType_crit); } -CritParticle::CritParticle(Level *level, shared_ptr entity, ePARTICLE_TYPE type) : Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2, entity->z, entity->xd, entity->yd, entity->zd) +CritParticle::CritParticle(Level *level, std::shared_ptr entity, ePARTICLE_TYPE type) : Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2, entity->z, entity->xd, entity->yd, entity->zd) { _init(level, entity, type); } -// 4J - Added this so that we can use some shared_ptr functions that were needed in the ctor +// 4J - Added this so that we can use some std::shared_ptr functions that were needed in the ctor void CritParticle::CritParticlePostConstructor(void) { tick(); diff --git a/Minecraft.Client/Rendering/Particles/CritParticle.h b/Minecraft.Client/Rendering/Particles/CritParticle.h index 23f30339e..5bad1c251 100644 --- a/Minecraft.Client/Rendering/Particles/CritParticle.h +++ b/Minecraft.Client/Rendering/Particles/CritParticle.h @@ -7,17 +7,17 @@ class Entity; class CritParticle : public Particle { private: - shared_ptr entity; + std::shared_ptr entity; int life; int lifeTime; ePARTICLE_TYPE particleName; - void _init(Level *level, shared_ptr entity, ePARTICLE_TYPE type); + void _init(Level *level, std::shared_ptr entity, ePARTICLE_TYPE type); public: virtual eINSTANCEOF GetType() { return eType_CRITPARTICLE; } - CritParticle(Level *level, shared_ptr entity); - CritParticle(Level *level, shared_ptr entity, ePARTICLE_TYPE type); + CritParticle(Level *level, std::shared_ptr entity); + CritParticle(Level *level, std::shared_ptr entity, ePARTICLE_TYPE type); void CritParticlePostConstructor(void); void render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2); void tick(); diff --git a/Minecraft.Client/Rendering/Particles/GuiParticles.h b/Minecraft.Client/Rendering/Particles/GuiParticles.h index 3cbb9871e..82be7ec60 100644 --- a/Minecraft.Client/Rendering/Particles/GuiParticles.h +++ b/Minecraft.Client/Rendering/Particles/GuiParticles.h @@ -3,12 +3,12 @@ class GuiParticle; class Minecraft; -using namespace std; + class GuiParticles : public GuiComponent { private: - vector particles; + std::vector particles; Minecraft *mc; public: diff --git a/Minecraft.Client/Rendering/Particles/Particle.cpp b/Minecraft.Client/Rendering/Particles/Particle.cpp index 33994a7ac..203abcafa 100644 --- a/Minecraft.Client/Rendering/Particles/Particle.cpp +++ b/Minecraft.Client/Rendering/Particles/Particle.cpp @@ -61,19 +61,19 @@ Particle::Particle(Level *level, double x, double y, double z, double xa, double yd = yd / dd * speed * 0.4f + 0.1f; zd = zd / dd * speed * 0.4f;} -shared_ptr Particle::setPower(float power) +std::shared_ptr Particle::setPower(float power) { xd *= power; yd = (yd - 0.1f) * power + 0.1f; zd *= power; - return dynamic_pointer_cast( shared_from_this() ); + return std::dynamic_pointer_cast( shared_from_this() ); } -shared_ptr Particle::scale(float scale) +std::shared_ptr Particle::scale(float scale) { setSize(0.2f * scale, 0.2f * scale); size *= scale; - return dynamic_pointer_cast( shared_from_this() ); + return std::dynamic_pointer_cast( shared_from_this() ); } void Particle::setColor(float r, float g, float b) @@ -240,7 +240,7 @@ bool Particle::isAttackable() } //@Override -wstring Particle::toString() +std::wstring Particle::toString() { return L"A particle"; //getClass()->getSimpleName() + ", Pos (" + x + "," + y + "," + z + "), RGBA (" + rCol + "," + gCol + "," + bCol + "," + alpha + "), Age " + age; } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Particles/Particle.h b/Minecraft.Client/Rendering/Particles/Particle.h index 358559107..e2202c14c 100644 --- a/Minecraft.Client/Rendering/Particles/Particle.h +++ b/Minecraft.Client/Rendering/Particles/Particle.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include "../../../Minecraft.World/Entities/Entity.h" #include "../../../Minecraft.World/Util/ParticleTypes.h" @@ -28,8 +28,8 @@ protected: Particle(Level *level, double x, double y, double z); public: Particle(Level *level, double x, double y, double z, double xa, double ya, double za); - virtual shared_ptr setPower(float power); - virtual shared_ptr scale(float scale); + virtual std::shared_ptr setPower(float power); + virtual std::shared_ptr scale(float scale); void setColor(float r, float g, float b); void setAlpha(float alpha); float getRedCol(); @@ -49,5 +49,5 @@ public: virtual void setMiscTex(int slotIndex); virtual void setNextMiscAnimTex(); virtual bool isAttackable(); - virtual wstring toString(); + virtual std::wstring toString(); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp b/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp index 1e3b9a59a..d979256f1 100644 --- a/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp +++ b/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp @@ -27,7 +27,7 @@ ParticleEngine::~ParticleEngine() delete random; } -void ParticleEngine::add(shared_ptr p) +void ParticleEngine::add(std::shared_ptr p) { int t = p->getParticleTexture(); int l = p->level->dimension->id == 0 ? 0 : ( p->level->dimension->id == -1 ? 1 : 2); @@ -43,7 +43,7 @@ void ParticleEngine::tick() { for (unsigned int i = 0; i < particles[l][tt].size(); i++) { - shared_ptr p = particles[l][tt][i]; + std::shared_ptr p = particles[l][tt][i]; p->tick(); if (p->removed) { @@ -56,7 +56,7 @@ void ParticleEngine::tick() } } -void ParticleEngine::render(shared_ptr player, float a) +void ParticleEngine::render(std::shared_ptr player, float a) { // 4J - change brought forward from 1.2.3 float xa = Camera::xa; @@ -99,7 +99,7 @@ void ParticleEngine::render(shared_ptr player, float a) t->end(); t->begin(); } - shared_ptr p = particles[l][tt][i]; + std::shared_ptr p = particles[l][tt][i]; if (SharedConstants::TEXTURE_LIGHTING) // 4J - change brought forward from 1.8.2 { @@ -118,7 +118,7 @@ void ParticleEngine::render(shared_ptr player, float a) } -void ParticleEngine::renderLit(shared_ptr player, float a) +void ParticleEngine::renderLit(std::shared_ptr player, float a) { // 4J - added. We call this before ParticleEngine::render in the general render per player, so if we // don't set this here then the offsets will be from the previous player - a single frame lag for the @@ -142,7 +142,7 @@ void ParticleEngine::renderLit(shared_ptr player, float a) Tesselator *t = Tesselator::getInstance(); for (unsigned int i = 0; i < particles[l][tt].size(); i++) { - shared_ptr p = particles[l][tt][i]; + std::shared_ptr p = particles[l][tt][i]; if (SharedConstants::TEXTURE_LIGHTING) // 4J - change brought forward from 1.8.2 { @@ -182,7 +182,7 @@ void ParticleEngine::destroy(int x, int y, int z, int tid, int data) double yp = y + (yy + 0.5) / SD; double zp = z + (zz + 0.5) / SD; int face = random->nextInt(6); - add(( shared_ptr(new TerrainParticle(level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, zp - z - 0.5f, tile, face, data, textures) ) )->init(x, y, z, data)); + add(( std::shared_ptr(new TerrainParticle(level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, zp - z - 0.5f, tile, face, data, textures) ) )->init(x, y, z, data)); } } @@ -201,11 +201,11 @@ void ParticleEngine::crack(int x, int y, int z, int face) if (face == 3) zp = z + tile->getShapeZ1() + r; if (face == 4) xp = x + tile->getShapeX0() - r; if (face == 5) xp = x + tile->getShapeX1() + r; - add(( shared_ptr(new TerrainParticle(level, xp, yp, zp, 0, 0, 0, tile, face, level->getData(x, y, z), textures) ) )->init(x, y, z, level->getData(x, y, z))->setPower(0.2f)->scale(0.6f)); + add(( std::shared_ptr(new TerrainParticle(level, xp, yp, zp, 0, 0, 0, tile, face, level->getData(x, y, z), textures) ) )->init(x, y, z, level->getData(x, y, z))->setPower(0.2f)->scale(0.6f)); } -wstring ParticleEngine::countParticles() +std::wstring ParticleEngine::countParticles() { int l = level->dimension->id == 0 ? 0 : (level->dimension->id == -1 ? 1 : 2 ); return _toString((int)(particles[l][0].size() + particles[l][1].size() + particles[l][2].size())); diff --git a/Minecraft.Client/Rendering/Particles/ParticleEngine.h b/Minecraft.Client/Rendering/Particles/ParticleEngine.h index 09e3685be..0d06d6590 100644 --- a/Minecraft.Client/Rendering/Particles/ParticleEngine.h +++ b/Minecraft.Client/Rendering/Particles/ParticleEngine.h @@ -1,12 +1,12 @@ #pragma once -using namespace std; + class Particle; class Level; class Textures; class Entity; class Random; -using namespace std; + class ParticleEngine { @@ -26,19 +26,19 @@ public: protected: Level *level; private: - deque > particles[3][TEXTURE_COUNT]; // 4J made two arrays to cope with simultaneous two dimensions + std::deque > particles[3][TEXTURE_COUNT]; // 4J made two arrays to cope with simultaneous two dimensions Textures *textures; Random *random; public: ParticleEngine(Level *level, Textures *textures); ~ParticleEngine(); - void add(shared_ptr p); + void add(std::shared_ptr p); void tick(); - void render(shared_ptr player, float a); - void renderLit(shared_ptr player, float a); + void render(std::shared_ptr player, float a); + void renderLit(std::shared_ptr player, float a); void setLevel(Level *level); void destroy(int x, int y, int z, int tid, int data); void crack(int x, int y, int z, int face); - wstring countParticles(); + std::wstring countParticles(); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Particles/PlayerCloudParticle.cpp b/Minecraft.Client/Rendering/Particles/PlayerCloudParticle.cpp index b14e45df6..c112be7eb 100644 --- a/Minecraft.Client/Rendering/Particles/PlayerCloudParticle.cpp +++ b/Minecraft.Client/Rendering/Particles/PlayerCloudParticle.cpp @@ -49,7 +49,7 @@ void PlayerCloudParticle::tick() xd *= 0.96f; yd *= 0.96f; zd *= 0.96f; - shared_ptr p = level->getNearestPlayer(shared_from_this(), 2); + std::shared_ptr p = level->getNearestPlayer(shared_from_this(), 2); if (p != NULL) { if (y > p->bb->y0) diff --git a/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.cpp b/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.cpp index 7da250587..8f185d021 100644 --- a/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.cpp +++ b/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.cpp @@ -5,7 +5,7 @@ #include "../../../Minecraft.World/Headers/net.minecraft.world.level.h" #include "../../../Minecraft.World/Util/Mth.h" -TakeAnimationParticle::TakeAnimationParticle(Level *level, shared_ptr item, shared_ptr target, float yOffs) : Particle(level, item->x, item->y, item->z, item->xd, item->yd, item->zd) +TakeAnimationParticle::TakeAnimationParticle(Level *level, std::shared_ptr item, std::shared_ptr target, float yOffs) : Particle(level, item->x, item->y, item->z, item->xd, item->yd, item->zd) { // 4J - added initialisers life = 0; diff --git a/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.h b/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.h index 10026fdaa..33c4535f3 100644 --- a/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.h +++ b/Minecraft.Client/Rendering/Particles/TakeAnimationParticle.h @@ -7,14 +7,14 @@ class TakeAnimationParticle : public Particle public: virtual eINSTANCEOF GetType() { return eType_TAKEANIMATIONPARTICLE; } private: - shared_ptr item; - shared_ptr target; + std::shared_ptr item; + std::shared_ptr target; int life; int lifeTime; float yOffs; public: - TakeAnimationParticle(Level *level, shared_ptr item, shared_ptr target, float yOffs); + TakeAnimationParticle(Level *level, std::shared_ptr item, std::shared_ptr target, float yOffs); ~TakeAnimationParticle(); virtual void render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2); virtual void tick(); diff --git a/Minecraft.Client/Rendering/Particles/TerrainParticle.cpp b/Minecraft.Client/Rendering/Particles/TerrainParticle.cpp index 31e4f4051..505e852e6 100644 --- a/Minecraft.Client/Rendering/Particles/TerrainParticle.cpp +++ b/Minecraft.Client/Rendering/Particles/TerrainParticle.cpp @@ -14,24 +14,24 @@ TerrainParticle::TerrainParticle(Level *level, double x, double y, double z, dou size /= 2; } -shared_ptr TerrainParticle::init(int x, int y, int z, int data) // 4J - added data parameter +std::shared_ptr TerrainParticle::init(int x, int y, int z, int data) // 4J - added data parameter { - if (tile == Tile::grass) return dynamic_pointer_cast( shared_from_this() ); + if (tile == Tile::grass) return std::dynamic_pointer_cast( shared_from_this() ); int col = tile->getColor(level, x, y, z, data); // 4J - added data parameter rCol *= ((col >> 16) & 0xff) / 255.0f; gCol *= ((col >> 8) & 0xff) / 255.0f; bCol *= ((col) & 0xff) / 255.0f; - return dynamic_pointer_cast( shared_from_this() ); + return std::dynamic_pointer_cast( shared_from_this() ); } -shared_ptr TerrainParticle::init(int data) +std::shared_ptr TerrainParticle::init(int data) { - if (tile == Tile::grass) return dynamic_pointer_cast( shared_from_this() ); + if (tile == Tile::grass) return std::dynamic_pointer_cast( shared_from_this() ); int col = tile->getColor(data); rCol *= ((col >> 16) & 0xff) / 255.0f; gCol *= ((col >> 8) & 0xff) / 255.0f; bCol *= ((col) & 0xff) / 255.0f; - return dynamic_pointer_cast( shared_from_this() ); + return std::dynamic_pointer_cast( shared_from_this() ); } int TerrainParticle::getParticleTexture() diff --git a/Minecraft.Client/Rendering/Particles/TerrainParticle.h b/Minecraft.Client/Rendering/Particles/TerrainParticle.h index 5d4a743ff..df9ca42fe 100644 --- a/Minecraft.Client/Rendering/Particles/TerrainParticle.h +++ b/Minecraft.Client/Rendering/Particles/TerrainParticle.h @@ -11,8 +11,8 @@ private: public: TerrainParticle(Level *level, double x, double y, double z, double xa, double ya, double za, Tile *tile, int face, int data, Textures *textures); - shared_ptr init(int x, int y, int z, int data); // 4J - added data parameter - shared_ptr init(int data); + std::shared_ptr init(int x, int y, int z, int data); // 4J - added data parameter + std::shared_ptr init(int data); virtual int getParticleTexture(); virtual void render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2); }; \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Tesselator.cpp b/Minecraft.Client/Rendering/Tesselator.cpp index 9122c26c7..5f1231ff4 100644 --- a/Minecraft.Client/Rendering/Tesselator.cpp +++ b/Minecraft.Client/Rendering/Tesselator.cpp @@ -1022,9 +1022,9 @@ uint32_t _ConvertF32toX11Y11Z10N(float x, float y, float z) if (z<-1.0f || z>1.0f) { printf("Value (%5.3f) should be in range [-1..1]. Conversion will clamp to X11Y11Z10N.\n", z); } #endif - const uint32_t uX = ((int32_t(max(min(((x)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_X_MASK >> X11Y11Z10N_X_SHIFT)) << X11Y11Z10N_X_SHIFT); - const uint32_t uY = ((int32_t(max(min(((y)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_Y_MASK >> X11Y11Z10N_Y_SHIFT)) << X11Y11Z10N_Y_SHIFT); - const uint32_t uZ = ((int32_t(max(min(((z)*1023.f - 1.f)*0.5f, 511.f), -512.f )) & (X11Y11Z10N_Z_MASK >> X11Y11Z10N_Z_SHIFT)) << X11Y11Z10N_Z_SHIFT); + const uint32_t uX = ((int32_t(std::max(std::min(((x)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_X_MASK >> X11Y11Z10N_X_SHIFT)) << X11Y11Z10N_X_SHIFT); + const uint32_t uY = ((int32_t(std::max(std::min(((y)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_Y_MASK >> X11Y11Z10N_Y_SHIFT)) << X11Y11Z10N_Y_SHIFT); + const uint32_t uZ = ((int32_t(std::max(std::min(((z)*1023.f - 1.f)*0.5f, 511.f), -512.f )) & (X11Y11Z10N_Z_MASK >> X11Y11Z10N_Z_SHIFT)) << X11Y11Z10N_Z_SHIFT); const uint32_t xyz = uX | uY | uZ; return xyz; } diff --git a/Minecraft.Client/Textures/BufferedImage.cpp b/Minecraft.Client/Textures/BufferedImage.cpp index 7c1e42dd1..70b9664eb 100644 --- a/Minecraft.Client/Textures/BufferedImage.cpp +++ b/Minecraft.Client/Textures/BufferedImage.cpp @@ -47,11 +47,11 @@ void BufferedImage::ByteFlip4(unsigned int &data) // Loads a bitmap into a buffered image - only currently supports the 2 types of 32-bit image that we've made so far // and determines which of these is which by the compression method. Compression method 3 is a 32-bit image with only // 24-bits used (ie no alpha channel) whereas method 0 is a full 32-bit image with a valid alpha channel. -BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/) +BufferedImage::BufferedImage(const std::wstring& File, bool filenameHasExtension /*=false*/, bool bTitleUpdateTexture /*=false*/, const std::wstring &drive /*=L""*/) { HRESULT hr; - wstring wDrive; - wstring filePath; + std::wstring wDrive; + std::wstring filePath; filePath = File; wDrive = drive; @@ -87,7 +87,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f pchUsrDir=getUsrDirPath(); } - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); if(bTitleUpdateTexture) { @@ -102,7 +102,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f /*char *pchUsrDir=getUsrDirPath(); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); if(bTitleUpdateTexture) { @@ -145,8 +145,8 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f for( int l = 0; l < 10; l++ ) { - wstring name; - wstring mipMapPath = L""; + std::wstring name; + std::wstring mipMapPath = L""; if( l != 0 ) { mipMapPath = L"MipMapLevel" + _toString(l+1); @@ -189,10 +189,10 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f } } -BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenameHasExtension /*= false*/ ) +BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool filenameHasExtension /*= false*/ ) { HRESULT hr; - wstring filePath = File; + std::wstring filePath = File; BYTE *pbData = NULL; DWORD dwBytes = 0; @@ -203,8 +203,8 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam for( int l = 0; l < 10; l++ ) { - wstring name; - wstring mipMapPath = L""; + std::wstring name; + std::wstring mipMapPath = L""; if( l != 0 ) { mipMapPath = L"MipMapLevel" + _toString(l+1); diff --git a/Minecraft.Client/Textures/BufferedImage.h b/Minecraft.Client/Textures/BufferedImage.h index a0227fe29..026c457a7 100644 --- a/Minecraft.Client/Textures/BufferedImage.h +++ b/Minecraft.Client/Textures/BufferedImage.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + class Graphics; class DLCPack; @@ -15,8 +15,8 @@ public: static const int TYPE_INT_ARGB = 0; static const int TYPE_INT_RGB = 1; BufferedImage(int width,int height,int type); - BufferedImage(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); // 4J added - BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenameHasExtension = false ); // 4J Added + BufferedImage(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L""); // 4J added + BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool filenameHasExtension = false ); // 4J Added BufferedImage(BYTE *pbData, DWORD dwBytes); // 4J added ~BufferedImage(); diff --git a/Minecraft.Client/Textures/HttpTexture.cpp b/Minecraft.Client/Textures/HttpTexture.cpp index 4ba5a9bbe..8f8aa8378 100644 --- a/Minecraft.Client/Textures/HttpTexture.cpp +++ b/Minecraft.Client/Textures/HttpTexture.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "HttpTexture.h" -HttpTexture::HttpTexture(const wstring& _url, HttpTextureProcessor *processor) +HttpTexture::HttpTexture(const std::wstring& _url, HttpTextureProcessor *processor) { // 4J - added count = 1; diff --git a/Minecraft.Client/Textures/HttpTexture.h b/Minecraft.Client/Textures/HttpTexture.h index 469ef6cb5..3c87cd8f0 100644 --- a/Minecraft.Client/Textures/HttpTexture.h +++ b/Minecraft.Client/Textures/HttpTexture.h @@ -1,7 +1,7 @@ #pragma once class BufferedImage; class HttpTextureProcessor; -using namespace std; + class HttpTexture { public: @@ -10,5 +10,5 @@ public: int id; bool isLoaded; - HttpTexture(const wstring& _url, HttpTextureProcessor *processor); + HttpTexture(const std::wstring& _url, HttpTextureProcessor *processor); }; \ No newline at end of file diff --git a/Minecraft.Client/Textures/MemTexture.cpp b/Minecraft.Client/Textures/MemTexture.cpp index ebdd38c43..5dc6e5166 100644 --- a/Minecraft.Client/Textures/MemTexture.cpp +++ b/Minecraft.Client/Textures/MemTexture.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "MemTexture.h" -MemTexture::MemTexture(const wstring& _url, PBYTE pbData,DWORD dwBytes, MemTextureProcessor *processor) +MemTexture::MemTexture(const std::wstring& _url, PBYTE pbData,DWORD dwBytes, MemTextureProcessor *processor) { // 4J - added count = 1; diff --git a/Minecraft.Client/Textures/MemTexture.h b/Minecraft.Client/Textures/MemTexture.h index d11d68b12..e3f6b6bf7 100644 --- a/Minecraft.Client/Textures/MemTexture.h +++ b/Minecraft.Client/Textures/MemTexture.h @@ -1,7 +1,7 @@ #pragma once class BufferedImage; class MemTextureProcessor; -using namespace std; + class MemTexture { public: @@ -12,6 +12,6 @@ public: int ticksSinceLastUse; static const int UNUSED_TICKS_TO_FREE = 20; - MemTexture(const wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor); + MemTexture(const std::wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor); ~MemTexture(); }; \ No newline at end of file diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index 6629fe9a2..4ff7b9c6f 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 wstring &name, TexturePack *fallback) : id(id), name(name) +AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const std::wstring &name, TexturePack *fallback) : id(id), name(name) { // 4J init textureId = -1; @@ -25,7 +25,7 @@ AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &na //loadDescription(); } -wstring AbstractTexturePack::trim(wstring line) +std::wstring AbstractTexturePack::trim(std::wstring line) { if (!line.empty() && line.length() > 34) { @@ -101,7 +101,7 @@ void AbstractTexturePack::loadName() { } -InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFallback) //throws IOException +InputStream *AbstractTexturePack::getResource(const std::wstring &name, bool allowFallback) //throws IOException { app.DebugPrintf("texture - %ls\n",name.c_str()); InputStream *is = getResourceImplementation(name); @@ -114,7 +114,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal } // 4J Currently removed due to override in TexturePack class -//InputStream *AbstractTexturePack::getResource(const wstring &name) //throws IOException +//InputStream *AbstractTexturePack::getResource(const std::wstring &name) //throws IOException //{ // return getResource(name, true); //} @@ -145,7 +145,7 @@ void AbstractTexturePack::load(Textures *textures) } } -bool AbstractTexturePack::hasFile(const wstring &name, bool allowFallback) +bool AbstractTexturePack::hasFile(const std::wstring &name, bool allowFallback) { bool hasFile = this->hasFile(name); @@ -157,34 +157,34 @@ DWORD AbstractTexturePack::getId() return id; } -wstring AbstractTexturePack::getName() +std::wstring AbstractTexturePack::getName() { return texname; } -wstring AbstractTexturePack::getWorldName() +std::wstring AbstractTexturePack::getWorldName() { return m_wsWorldName; } -wstring AbstractTexturePack::getDesc1() +std::wstring AbstractTexturePack::getDesc1() { return desc1; } -wstring AbstractTexturePack::getDesc2() +std::wstring AbstractTexturePack::getDesc2() { return desc2; } -wstring AbstractTexturePack::getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback) +std::wstring AbstractTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path, bool allowFallback) { return getAnimationString(textureName, path); } -wstring AbstractTexturePack::getAnimationString(const wstring &textureName, const wstring &path) +std::wstring AbstractTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path) { - wstring animationDefinitionFile = textureName + L".txt"; + std::wstring animationDefinitionFile = textureName + L".txt"; bool requiresFallback = !hasFile(L"\\" + textureName + L".png", false); @@ -197,9 +197,9 @@ wstring AbstractTexturePack::getAnimationString(const wstring &textureName, cons InputStreamReader isr(fileStream); BufferedReader br(&isr); - wstring result = L""; + std::wstring result = L""; - wstring line = br.readLine(); + std::wstring line = br.readLine(); while (!line.empty()) { line = trimString(line); @@ -215,7 +215,7 @@ wstring AbstractTexturePack::getAnimationString(const wstring &textureName, cons return result; } -BufferedImage *AbstractTexturePack::getImageResource(const wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/) +BufferedImage *AbstractTexturePack::getImageResource(const std::wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const std::wstring &drive /*=L""*/) { const char *pchTexture=wstringtofilename(File); app.DebugPrintf("AbstractTexturePack::getImageResource - %s, drive is %s\n",pchTexture, wstringtofilename(drive)); @@ -361,7 +361,7 @@ void AbstractTexturePack::unloadUI() // Do nothing } -wstring AbstractTexturePack::getXuiRootPath() +std::wstring AbstractTexturePack::getXuiRootPath() { const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h index e6410c193..c861a88c0 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.h +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include "TexturePack.h" @@ -9,15 +9,15 @@ class AbstractTexturePack : public TexturePack { private: const DWORD id; - const wstring name; + const std::wstring name; protected: File *file; - wstring texname; - wstring m_wsWorldName; + std::wstring texname; + std::wstring m_wsWorldName; - wstring desc1; - wstring desc2; + std::wstring desc1; + std::wstring desc2; PBYTE m_iconData; DWORD m_iconSize; @@ -36,10 +36,10 @@ private: int textureId; protected: - AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback); + AbstractTexturePack(DWORD id, File *file, const std::wstring &name, TexturePack *fallback); private: - static wstring trim(wstring line); + static std::wstring trim(std::wstring line); protected: virtual void loadIcon(); @@ -48,29 +48,29 @@ protected: virtual void loadName(); public: - virtual InputStream *getResource(const wstring &name, bool allowFallback); //throws IOException + virtual InputStream *getResource(const std::wstring &name, bool allowFallback); //throws IOException // 4J Removed do to current override in TexturePack class - //virtual InputStream *getResource(const wstring &name); //throws IOException + //virtual InputStream *getResource(const std::wstring &name); //throws IOException virtual DLCPack * getDLCPack() =0; protected: - virtual InputStream *getResourceImplementation(const wstring &name) = 0; // throws IOException; + virtual InputStream *getResourceImplementation(const std::wstring &name) = 0; // throws IOException; public: virtual void unload(Textures *textures); virtual void load(Textures *textures); - virtual bool hasFile(const wstring &name, bool allowFallback); - virtual bool hasFile(const wstring &name) = 0; + virtual bool hasFile(const std::wstring &name, bool allowFallback); + virtual bool hasFile(const std::wstring &name) = 0; virtual DWORD getId(); - virtual wstring getName(); - virtual wstring getDesc1(); - virtual wstring getDesc2(); - virtual wstring getWorldName(); + virtual std::wstring getName(); + virtual std::wstring getDesc1(); + virtual std::wstring getDesc2(); + virtual std::wstring getWorldName(); - virtual wstring getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback); + virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path, bool allowFallback); protected: - virtual wstring getAnimationString(const wstring &textureName, const wstring &path); + virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path); void loadDefaultUI(); void loadDefaultColourTable(); void loadDefaultHTMLColourTable(); @@ -79,11 +79,11 @@ protected: #endif public: - virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); + virtual BufferedImage *getImageResource(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L""); virtual void loadColourTable(); virtual void loadUI(); virtual void unloadUI(); - virtual wstring getXuiRootPath(); + virtual std::wstring getXuiRootPath(); virtual PBYTE getPackIcon(DWORD &dwImageBytes); virtual PBYTE getPackComparison(DWORD &dwImageBytes); virtual unsigned int getDLCParentPackId(); diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index 00fc395cc..0be09c786 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -101,7 +101,7 @@ void DLCTexturePack::loadDescription() } } -wstring DLCTexturePack::getResource(const wstring& name) +std::wstring DLCTexturePack::getResource(const std::wstring& name) { // 4J Stu - We should never call this function #ifndef __CONTENT_PACKAGE @@ -110,7 +110,7 @@ wstring DLCTexturePack::getResource(const wstring& name) return L""; } -InputStream *DLCTexturePack::getResourceImplementation(const wstring &name) //throws IOException +InputStream *DLCTexturePack::getResourceImplementation(const std::wstring &name) //throws IOException { // 4J Stu - We should never call this function #ifndef _CONTENT_PACKAGE @@ -120,7 +120,7 @@ InputStream *DLCTexturePack::getResourceImplementation(const wstring &name) //th return NULL; //resource; } -bool DLCTexturePack::hasFile(const wstring &name) +bool DLCTexturePack::hasFile(const std::wstring &name) { bool hasFile = false; if(m_dlcDataPack != NULL) hasFile = m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_Texture, name); @@ -132,16 +132,16 @@ bool DLCTexturePack::isTerrainUpdateCompatible() return true; } -wstring DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/) +std::wstring DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/) { return L""; } -wstring DLCTexturePack::getAnimationString(const wstring &textureName, const wstring &path) +std::wstring DLCTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path) { - wstring result = L""; + std::wstring result = L""; - wstring fullpath = L"res/" + path + textureName + L".png"; + std::wstring fullpath = L"res/" + path + textureName + L".png"; if(hasFile(fullpath)) { result = m_dlcDataPack->getFile(DLCManager::e_DLCType_Texture, fullpath)->getParameterAsString(DLCManager::e_DLCParamType_Anim); @@ -150,7 +150,7 @@ wstring DLCTexturePack::getAnimationString(const wstring &textureName, const wst return result; } -BufferedImage *DLCTexturePack::getImageResource(const wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/) +BufferedImage *DLCTexturePack::getImageResource(const std::wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const std::wstring &drive /*=L""*/) { if(m_dlcDataPack) return new BufferedImage(m_dlcDataPack, L"/" + File, filenameHasExtension); else return fallback->getImageResource(File, filenameHasExtension, bTitleUpdateTexture, drive); @@ -267,7 +267,7 @@ void DLCTexturePack::loadData() -wstring DLCTexturePack::getFilePath(DWORD packId, wstring filename, bool bAddDataFolder) +std::wstring DLCTexturePack::getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder) { return app.getFilePath(packId,filename,bAddDataFolder); } @@ -288,7 +288,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen texturePack->setHasAudio(false); DWORD dwFilesProcessed = 0; // Load the DLC textures - wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath(); + std::wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath(); if(!dataFilePath.empty()) { if(!app.m_dlcManager.readDLCDataFile(dwFilesProcessed, getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dataFilePath),texturePack->m_dlcDataPack)) @@ -301,7 +301,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if(texturePack->m_dlcDataPack != NULL) { #ifdef _XBOX - File xzpPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"TexturePack.xzp") ) ); + File xzpPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"TexturePack.xzp") ) ); if(xzpPath.exists()) { @@ -332,7 +332,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen } } #else - File archivePath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"media.arc") ) ); + File archivePath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"media.arc") ) ); if(archivePath.exists()) texturePack->m_archiveFile = new ArchiveFile(archivePath); #endif @@ -355,7 +355,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if (grf.exists()) { #if defined(_UNICODE) && !defined(__linux__) - wstring path = grf.getPath(); + std::wstring path = grf.getPath(); const WCHAR *pchFilename=path.c_str(); HANDLE fileHandle = CreateFile( pchFilename, // file name @@ -407,7 +407,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if (grf.exists()) { #if defined(_UNICODE) && !defined(__linux__) - wstring path = grf.getPath(); + std::wstring path = grf.getPath(); const WCHAR *pchFilename=path.c_str(); HANDLE fileHandle = CreateFile( pchFilename, // file name @@ -452,8 +452,8 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen // any audio data? #ifdef _XBOX - File audioXSBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"MashUp.xsb") ) ); - File audioXWBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"MashUp.xwb") ) ); + File audioXSBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"MashUp.xsb") ) ); + File audioXWBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"MashUp.xwb") ) ); if(audioXSBPath.exists() && audioXWBPath.exists()) { @@ -584,9 +584,9 @@ void DLCTexturePack::unloadUI() bUILoaded = false; } -wstring DLCTexturePack::getXuiRootPath() +std::wstring DLCTexturePack::getXuiRootPath() { - wstring path = L""; + std::wstring path = L""; if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) { DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.h b/Minecraft.Client/Textures/Packs/DLCTexturePack.h index 14e6ea23e..375c8cafe 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.h +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.h @@ -25,7 +25,7 @@ public: DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback); ~DLCTexturePack(); - virtual wstring getResource(const wstring& name); + virtual std::wstring getResource(const std::wstring& name); virtual DLCPack * getDLCPack(); // Added for sound banks with MashUp packs #ifdef _XBOX @@ -38,31 +38,31 @@ protected: void loadComparison(); void loadName(); void loadDescription(); - InputStream *getResourceImplementation(const wstring &name); //throws IOException + InputStream *getResourceImplementation(const std::wstring &name); //throws IOException public: //@Override - bool hasFile(const wstring &name); + bool hasFile(const std::wstring &name); bool isTerrainUpdateCompatible(); // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false); - virtual wstring getAnimationString(const wstring &textureName, const wstring &path); - virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); + virtual std::wstring getPath(bool bTitleUpdateTexture = false); + virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path); + virtual BufferedImage *getImageResource(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L""); virtual void loadColourTable(); virtual bool hasData() { return m_bHasLoadedData; } virtual bool isLoadingData() { return m_bLoadingData; } private: - static wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder); - static wstring getFilePath(DWORD packId, wstring filename, bool bAddDataFolder=true); + static std::wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder); + static std::wstring getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder=true); public: static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask); virtual void loadData(); virtual void loadUI(); virtual void unloadUI(); - virtual wstring getXuiRootPath(); + virtual std::wstring getXuiRootPath(); virtual ArchiveFile *getArchiveFile() { return m_archiveFile; } virtual unsigned int getDLCParentPackId(); diff --git a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp index b92b2b649..5484ada30 100644 --- a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp @@ -45,7 +45,7 @@ void DefaultTexturePack::loadName() texname = L"Minecraft"; } -bool DefaultTexturePack::hasFile(const wstring &name) +bool DefaultTexturePack::hasFile(const std::wstring &name) { // return DefaultTexturePack::class->getResourceAsStream(name) != null; return true; @@ -56,9 +56,9 @@ bool DefaultTexturePack::isTerrainUpdateCompatible() return true; } -InputStream *DefaultTexturePack::getResourceImplementation(const wstring &name)// throws FileNotFoundException +InputStream *DefaultTexturePack::getResourceImplementation(const std::wstring &name)// throws FileNotFoundException { - wstring wDrive = L""; + std::wstring wDrive = L""; // Make the content package point to to the UPDATE: drive is needed #ifdef _XBOX #ifdef _TU_BUILD @@ -84,14 +84,14 @@ InputStream *DefaultTexturePack::getResourceImplementation(const wstring &name)/ } - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); wDrive = wstr + L"\\Common\\res\\TitleUpdate\\res"; #elif __PSVITA__ /* char *pchUsrDir=getUsrDirPath(); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); wDrive = wstr + L"Common\\res\\TitleUpdate\\res"; */ diff --git a/Minecraft.Client/Textures/Packs/DefaultTexturePack.h b/Minecraft.Client/Textures/Packs/DefaultTexturePack.h index 9aa87a07a..1b46f22f3 100644 --- a/Minecraft.Client/Textures/Packs/DefaultTexturePack.h +++ b/Minecraft.Client/Textures/Packs/DefaultTexturePack.h @@ -15,14 +15,14 @@ protected: public: //@Override - bool hasFile(const wstring &name); + bool hasFile(const std::wstring &name); bool isTerrainUpdateCompatible(); - wstring getDesc1() {return app.GetString(IDS_DEFAULT_TEXTUREPACK);} + std::wstring getDesc1() {return app.GetString(IDS_DEFAULT_TEXTUREPACK);} protected: //@Override - InputStream *getResourceImplementation(const wstring &name); // throws FileNotFoundException + InputStream *getResourceImplementation(const std::wstring &name); // throws FileNotFoundException public: virtual bool hasData() { return true; } diff --git a/Minecraft.Client/Textures/Packs/FileTexturePack.cpp b/Minecraft.Client/Textures/Packs/FileTexturePack.cpp index 6798d570a..93c9426a9 100644 --- a/Minecraft.Client/Textures/Packs/FileTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FileTexturePack.cpp @@ -24,7 +24,7 @@ void FileTexturePack::unload(Textures *textures) #endif } -InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //throws IOException +InputStream *FileTexturePack::getResourceImplementation(const std::wstring &name) //throws IOException { #if 0 loadZipFile(); @@ -39,7 +39,7 @@ InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //t return NULL; } -bool FileTexturePack::hasFile(const wstring &name) +bool FileTexturePack::hasFile(const std::wstring &name) { #if 0 try { diff --git a/Minecraft.Client/Textures/Packs/FileTexturePack.h b/Minecraft.Client/Textures/Packs/FileTexturePack.h index 85221d114..6a7be75fe 100644 --- a/Minecraft.Client/Textures/Packs/FileTexturePack.h +++ b/Minecraft.Client/Textures/Packs/FileTexturePack.h @@ -4,7 +4,7 @@ class BufferedImage; class File; class Textures; -using namespace std; + class FileTexturePack : public AbstractTexturePack { @@ -18,11 +18,11 @@ public: void unload(Textures *textures); protected: - InputStream *getResourceImplementation(const wstring &name); //throws IOException + InputStream *getResourceImplementation(const std::wstring &name); //throws IOException public: //@Override - bool hasFile(const wstring &name); + bool hasFile(const std::wstring &name); private: void loadZipFile(); //throws IOException diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp index f512f4eb9..a63498ecf 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp @@ -1,7 +1,7 @@ #include "../../Build/stdafx.h" #include "FolderTexturePack.h" -FolderTexturePack::FolderTexturePack(DWORD id, const wstring &name, File *folder, TexturePack *fallback) : AbstractTexturePack(id, folder, name, fallback) +FolderTexturePack::FolderTexturePack(DWORD 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(); @@ -11,7 +11,7 @@ FolderTexturePack::FolderTexturePack(DWORD id, const wstring &name, File *folder bUILoaded = false; } -InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) //throws IOException +InputStream *FolderTexturePack::getResourceImplementation(const std::wstring &name) //throws IOException { #if 0 final File file = new File(this.file, name.substring(1)); @@ -22,7 +22,7 @@ InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) / return new BufferedInputStream(new FileInputStream(file)); #endif - wstring wDrive = L""; + std::wstring wDrive = L""; // Make the content package point to to the UPDATE: drive is needed #ifdef _XBOX wDrive=L"GAME:\\DummyTexturePack\\res"; @@ -40,7 +40,7 @@ InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) / return resource; } -bool FolderTexturePack::hasFile(const wstring &name) +bool FolderTexturePack::hasFile(const std::wstring &name) { File file = File( getPath() + name); return file.exists() && file.isFile(); @@ -58,9 +58,9 @@ bool FolderTexturePack::isTerrainUpdateCompatible() return true; } -wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/) +std::wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/) { - wstring wDrive; + std::wstring wDrive; #ifdef _XBOX wDrive=L"GAME:\\" + file->getPath() + L"\\"; #else diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.h b/Minecraft.Client/Textures/Packs/FolderTexturePack.h index fff4abf5d..c57d2576e 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.h +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.h @@ -8,19 +8,19 @@ private: bool bUILoaded; public: - FolderTexturePack(DWORD id, const wstring &name, File *folder, TexturePack *fallback); + FolderTexturePack(DWORD id, const std::wstring &name, File *folder, TexturePack *fallback); protected: //@Override - InputStream *getResourceImplementation(const wstring &name); //throws IOException + InputStream *getResourceImplementation(const std::wstring &name); //throws IOException public: //@Override - bool hasFile(const wstring &name); + bool hasFile(const std::wstring &name); bool isTerrainUpdateCompatible(); // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false); + 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.cpp b/Minecraft.Client/Textures/Packs/TexturePack.cpp index 4102b533a..77e1d8b87 100644 --- a/Minecraft.Client/Textures/Packs/TexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePack.cpp @@ -1,9 +1,9 @@ #include "../../Build/stdafx.h" #include "TexturePack.h" -wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/) +std::wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/) { - wstring wDrive; + std::wstring wDrive; #ifdef _XBOX if(bTitleUpdateTexture) { @@ -27,7 +27,7 @@ wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/) char *pchUsrDir=getUsrDirPath(); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); if(bTitleUpdateTexture) { @@ -42,7 +42,7 @@ wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/) #elif __PSVITA__ char *pchUsrDir="";//getUsrDirPath(); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); if(bTitleUpdateTexture) { diff --git a/Minecraft.Client/Textures/Packs/TexturePack.h b/Minecraft.Client/Textures/Packs/TexturePack.h index 16f877b8a..0145c72d9 100644 --- a/Minecraft.Client/Textures/Packs/TexturePack.h +++ b/Minecraft.Client/Textures/Packs/TexturePack.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include "../../Build/Common/App_enums.h" @@ -19,16 +19,16 @@ public: virtual void loadData() {} virtual void unload(Textures *textures) = 0; virtual void load(Textures *textures) = 0; - virtual InputStream *getResource(const wstring &name, bool allowFallback) = 0;// throws IOException; - //virtual InputStream *getResource(const wstring &name) = 0;// throws IOException; + 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 wstring getName() = 0; - virtual wstring getDesc1() = 0; - virtual wstring getDesc2() = 0; - virtual bool hasFile(const wstring &name, bool allowFallback) = 0; + virtual std::wstring getName() = 0; + virtual std::wstring getDesc1() = 0; + virtual std::wstring getDesc2() = 0; + virtual bool hasFile(const std::wstring &name, bool allowFallback) = 0; virtual bool isTerrainUpdateCompatible() = 0; - virtual wstring getResource(const wstring& name) // 4J - changed to just return a name rather than an input stream + virtual std::wstring getResource(const std::wstring& name) // 4J - changed to just return a name rather than an input stream { /* 4J - TODO return TexturePack.class.getResourceAsStream(name); @@ -39,13 +39,13 @@ public: // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false); - virtual wstring getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback) = 0; - virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L"") = 0; + virtual std::wstring getPath(bool bTitleUpdateTexture = false); + virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path, bool allowFallback) = 0; + virtual BufferedImage *getImageResource(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L"") = 0; virtual void loadColourTable() = 0; virtual void loadUI() = 0; virtual void unloadUI() = 0; - virtual wstring getXuiRootPath() = 0; + virtual std::wstring getXuiRootPath() = 0; virtual PBYTE getPackIcon(DWORD &dwImageBytes) = 0; virtual PBYTE getPackComparison(DWORD &dwImageBytes) = 0; virtual unsigned int getDLCParentPackId() = 0; diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp index 817fc7aac..27a4df8e8 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp @@ -18,7 +18,7 @@ TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *m // 4J - added usingWeb = false; selected = NULL; - texturePacks = new vector; + texturePacks = new std::vector; this->minecraft = minecraft; @@ -105,7 +105,7 @@ bool TexturePackRepository::selectSkin(TexturePack *skin) return true; } -void TexturePackRepository::selectWebSkin(const wstring &url) +void TexturePackRepository::selectWebSkin(const std::wstring &url) { app.DebugPrintf("TexturePackRepository::selectWebSkin is not implemented\n"); #if 0 @@ -117,7 +117,7 @@ void TexturePackRepository::selectWebSkin(const wstring &url) #endif } -void TexturePackRepository::downloadWebSkin(const wstring &url, File file) +void TexturePackRepository::downloadWebSkin(const std::wstring &url, File file) { app.DebugPrintf("TexturePackRepository::selectWebSkin is not implemented\n"); #if 0 @@ -157,7 +157,7 @@ void TexturePackRepository::updateList() { // 4J Stu - We don't ever want to completely refresh the lists, we keep them up-to-date as we go #if 0 - vector *currentPacks = new vector; + std::vector *currentPacks = new std::vector; currentPacks->push_back(DEFAULT_TEXTURE_PACK); cacheById[DEFAULT_TEXTURE_PACK->getId()] = DEFAULT_TEXTURE_PACK; #ifndef _CONTENT_PACKAGE @@ -195,9 +195,9 @@ void TexturePackRepository::updateList() // 4J - was texturePacks.removeAll(currentPacks); AUTO_VAR(itEnd, currentPacks->end()); - for( vector::iterator it1 = currentPacks->begin(); it1 != itEnd; it1++ ) + for( std::vector::iterator it1 = currentPacks->begin(); it1 != itEnd; it1++ ) { - for( vector::iterator it2 = texturePacks->begin(); it2 != texturePacks->end(); it2++ ) + for( std::vector::iterator it2 = texturePacks->begin(); it2 != texturePacks->end(); it2++ ) { if( *it1 == *it2 ) { @@ -207,7 +207,7 @@ void TexturePackRepository::updateList() } itEnd = texturePacks->end(); - for( vector::iterator it = texturePacks->begin(); it != itEnd; it++ ) + for( std::vector::iterator it = texturePacks->begin(); it != itEnd; it++ ) { TexturePack *pack = *it; pack->unload(minecraft->textures); @@ -219,7 +219,7 @@ void TexturePackRepository::updateList() #endif } -wstring TexturePackRepository::getIdOrNull(File file) +std::wstring TexturePackRepository::getIdOrNull(File file) { app.DebugPrintf("TexturePackRepository::getIdOrNull is not implemented\n"); #if 0 @@ -234,7 +234,7 @@ wstring TexturePackRepository::getIdOrNull(File file) return L""; } -vector TexturePackRepository::getWorkDirContents() +std::vector TexturePackRepository::getWorkDirContents() { app.DebugPrintf("TexturePackRepository::getWorkDirContents is not implemented\n"); #if 0 @@ -244,10 +244,10 @@ vector TexturePackRepository::getWorkDirContents() return Collections.emptyList(); #endif - return vector(); + return std::vector(); } -vector *TexturePackRepository::getAll() +std::vector *TexturePackRepository::getAll() { // 4J - note that original constucted a copy of texturePacks here return texturePacks; @@ -291,14 +291,14 @@ bool TexturePackRepository::canUseWebSkin() return false; } -vector< pair > *TexturePackRepository::getTexturePackIdNames() +std::vector< std::pair > *TexturePackRepository::getTexturePackIdNames() { - vector< pair > *packList = new vector< 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( pair(pack->getId(),pack->getName()) ); + packList->push_back( std::pair(pack->getId(),pack->getName()) ); } return packList; } diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.h b/Minecraft.Client/Textures/Packs/TexturePackRepository.h index 2b66df43b..1f8e66b8c 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.h +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.h @@ -1,6 +1,6 @@ #pragma once #include "TexturePack.h" -using namespace std; + class Minecraft; @@ -18,10 +18,10 @@ private: Minecraft *minecraft; File workDir; File multiplayerDir; - vector *texturePacks; - vector m_texturePacksToDelete; + std::vector *texturePacks; + std::vector m_texturePacksToDelete; - unordered_map cacheById; + std::unordered_map cacheById; TexturePack *selected; TexturePack *lastSelected; @@ -37,10 +37,10 @@ private: public: bool selectSkin(TexturePack *skin); - void selectWebSkin(const wstring &url); + void selectWebSkin(const std::wstring &url); private: - void downloadWebSkin(const wstring &url, File file); + void downloadWebSkin(const std::wstring &url, File file); public: bool isUsingWebSkin(); @@ -48,11 +48,11 @@ public: void updateList(); private: - wstring getIdOrNull(File file); - vector getWorkDirContents(); + std::wstring getIdOrNull(File file); + std::vector getWorkDirContents(); public: - vector *getAll(); + std::vector *getAll(); TexturePack *getSelected(); bool shouldPromptForWebSkin(); @@ -60,7 +60,7 @@ public: bool isUsingDefaultSkin() { return selected == DEFAULT_TEXTURE_PACK; } // 4J Added TexturePack *getDefault() { return DEFAULT_TEXTURE_PACK; } // 4J Added - vector< pair > *getTexturePackIdNames(); + std::vector< std::pair > *getTexturePackIdNames(); bool selectTexturePackById(DWORD id); // 4J Added TexturePack *getTexturePackById(DWORD id); // 4J Added diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp index 68ad93421..cdcfb0a07 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp @@ -19,9 +19,9 @@ #include "../CompassTexture.h" #include "../ClockTexture.h" -const wstring PreStitchedTextureMap::NAME_MISSING_TEXTURE = L"missingno"; +const std::wstring PreStitchedTextureMap::NAME_MISSING_TEXTURE = L"missingno"; -PreStitchedTextureMap::PreStitchedTextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png") +PreStitchedTextureMap::PreStitchedTextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png") { this->missingTexture = missingTexture; @@ -70,14 +70,14 @@ void PreStitchedTextureMap::stitch() } // Collection bucket for multiple frames per texture - unordered_map * > textures; // = new HashMap>(); + std::unordered_map * > textures; // = new HashMap>(); Stitcher *stitcher = TextureManager::getInstance()->createStitcher(name); animatedTextures.clear(); // Create the final image - wstring filename = name + extension; + std::wstring filename = name + extension; TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected(); //try { @@ -87,7 +87,7 @@ void PreStitchedTextureMap::stitch() int magFilter = Texture::TFLT_NEAREST; MemSect(32); - wstring drive = L""; + std::wstring drive = L""; if(texturePack->hasFile(L"res/" + filename,false)) { drive = texturePack->getPath(true); @@ -129,8 +129,8 @@ void PreStitchedTextureMap::stitch() MemSect(52); for(AUTO_VAR(it, texturesToAnimate.begin()); it != texturesToAnimate.end(); ++it) { - wstring textureName = it->first; - wstring textureFileName = it->second; + std::wstring textureName = it->first; + std::wstring textureFileName = it->second; StitchedTexture *preStitched = (StitchedTexture *)texturesByName[textureName]; @@ -140,10 +140,10 @@ void PreStitchedTextureMap::stitch() continue; } - wstring filename = path + textureFileName + extension; + std::wstring filename = path + textureFileName + extension; // TODO: [EB] Put the frames into a proper object, not this inside out hack - vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); + std::vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); if (frames == NULL || frames->empty()) { continue; // Couldn't load a texture, skip it @@ -164,7 +164,7 @@ void PreStitchedTextureMap::stitch() { animatedTextures.push_back(preStitched); - wstring animString = texturePack->getAnimationString(textureFileName, path, true); + std::wstring animString = texturePack->getAnimationString(textureFileName, path, true); preStitched->loadAnimationFrames(animString); } @@ -216,7 +216,7 @@ void PreStitchedTextureMap::stitch() #endif } -StitchedTexture *PreStitchedTextureMap::getTexture(const wstring &name) +StitchedTexture *PreStitchedTextureMap::getTexture(const std::wstring &name) { #ifndef _CONTENT_PACKAGE app.DebugPrintf("Not implemented!\n"); @@ -246,7 +246,7 @@ Texture *PreStitchedTextureMap::getStitchedTexture() } // 4J Stu - register is a reserved keyword in C++ -Icon *PreStitchedTextureMap::registerIcon(const wstring &name) +Icon *PreStitchedTextureMap::registerIcon(const std::wstring &name) { Icon *result = NULL; if (name.empty()) @@ -363,11 +363,11 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"compassP1",new SimpleIcon(L"compassP1",slotSize*8,slotSize*14,slotSize*(8+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"compassP2",new SimpleIcon(L"compassP2",slotSize*9,slotSize*14,slotSize*(9+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"compassP3",new SimpleIcon(L"compassP3",slotSize*10,slotSize*14,slotSize*(10+1),slotSize*(14+1)))); - texturesToAnimate.push_back(pair(L"compass",L"compass")); - texturesToAnimate.push_back(pair(L"compassP0",L"compass")); - texturesToAnimate.push_back(pair(L"compassP1",L"compass")); - texturesToAnimate.push_back(pair(L"compassP2",L"compass")); - texturesToAnimate.push_back(pair(L"compassP3",L"compass")); + texturesToAnimate.push_back(std::pair(L"compass",L"compass")); + texturesToAnimate.push_back(std::pair(L"compassP0",L"compass")); + texturesToAnimate.push_back(std::pair(L"compassP1",L"compass")); + texturesToAnimate.push_back(std::pair(L"compassP2",L"compass")); + texturesToAnimate.push_back(std::pair(L"compassP3",L"compass")); texturesByName.insert(stringIconMap::value_type(L"diamond",new SimpleIcon(L"diamond",slotSize*7,slotSize*3,slotSize*(7+1),slotSize*(3+1)))); texturesByName.insert(stringIconMap::value_type(L"redstone",new SimpleIcon(L"redstone",slotSize*8,slotSize*3,slotSize*(8+1),slotSize*(3+1)))); texturesByName.insert(stringIconMap::value_type(L"clay",new SimpleIcon(L"clay",slotSize*9,slotSize*3,slotSize*(9+1),slotSize*(3+1)))); @@ -388,11 +388,11 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"clockP1",new SimpleIcon(L"clockP1",slotSize*12,slotSize*14,slotSize*(12+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"clockP2",new SimpleIcon(L"clockP2",slotSize*13,slotSize*14,slotSize*(13+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"clockP3",new SimpleIcon(L"clockP3",slotSize*14,slotSize*14,slotSize*(14+1),slotSize*(14+1)))); - texturesToAnimate.push_back(pair(L"clock",L"clock")); - texturesToAnimate.push_back(pair(L"clockP0",L"clock")); - texturesToAnimate.push_back(pair(L"clockP1",L"clock")); - texturesToAnimate.push_back(pair(L"clockP2",L"clock")); - texturesToAnimate.push_back(pair(L"clockP3",L"clock")); + texturesToAnimate.push_back(std::pair(L"clock",L"clock")); + texturesToAnimate.push_back(std::pair(L"clockP0",L"clock")); + texturesToAnimate.push_back(std::pair(L"clockP1",L"clock")); + texturesToAnimate.push_back(std::pair(L"clockP2",L"clock")); + texturesToAnimate.push_back(std::pair(L"clockP3",L"clock")); texturesByName.insert(stringIconMap::value_type(L"bowl",new SimpleIcon(L"bowl",slotSize*7,slotSize*4,slotSize*(7+1),slotSize*(4+1)))); texturesByName.insert(stringIconMap::value_type(L"mushroomStew",new SimpleIcon(L"mushroomStew",slotSize*8,slotSize*4,slotSize*(8+1),slotSize*(4+1)))); texturesByName.insert(stringIconMap::value_type(L"yellowDust",new SimpleIcon(L"yellowDust",slotSize*9,slotSize*4,slotSize*(9+1),slotSize*(4+1)))); @@ -607,7 +607,7 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"rose",new SimpleIcon(L"rose",slotSize*12,slotSize*0,slotSize*(12+1),slotSize*(0+1)))); texturesByName.insert(stringIconMap::value_type(L"flower",new SimpleIcon(L"flower",slotSize*13,slotSize*0,slotSize*(13+1),slotSize*(0+1)))); texturesByName.insert(stringIconMap::value_type(L"portal",new SimpleIcon(L"portal",slotSize*14,slotSize*0,slotSize*(14+1),slotSize*(0+1)))); - texturesToAnimate.push_back(pair(L"portal",L"portal")); + texturesToAnimate.push_back(std::pair(L"portal",L"portal")); texturesByName.insert(stringIconMap::value_type(L"sapling",new SimpleIcon(L"sapling",slotSize*15,slotSize*0,slotSize*(15+1),slotSize*(0+1)))); texturesByName.insert(stringIconMap::value_type(L"stonebrick",new SimpleIcon(L"stonebrick",slotSize*0,slotSize*1,slotSize*(0+1),slotSize*(1+1)))); texturesByName.insert(stringIconMap::value_type(L"bedrock",new SimpleIcon(L"bedrock",slotSize*1,slotSize*1,slotSize*(1+1),slotSize*(1+1)))); @@ -625,7 +625,7 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"mushroom_brown",new SimpleIcon(L"mushroom_brown",slotSize*13,slotSize*1,slotSize*(13+1),slotSize*(1+1)))); texturesByName.insert(stringIconMap::value_type(L"sapling_jungle",new SimpleIcon(L"sapling_jungle",slotSize*14,slotSize*1,slotSize*(14+1),slotSize*(1+1)))); texturesByName.insert(stringIconMap::value_type(L"fire_0",new SimpleIcon(L"fire_0",slotSize*15,slotSize*1,slotSize*(15+1),slotSize*(1+1)))); - texturesToAnimate.push_back(pair(L"fire_0",L"fire_0")); + texturesToAnimate.push_back(std::pair(L"fire_0",L"fire_0")); texturesByName.insert(stringIconMap::value_type(L"oreGold",new SimpleIcon(L"oreGold",slotSize*0,slotSize*2,slotSize*(0+1),slotSize*(2+1)))); texturesByName.insert(stringIconMap::value_type(L"oreIron",new SimpleIcon(L"oreIron",slotSize*1,slotSize*2,slotSize*(1+1),slotSize*(2+1)))); texturesByName.insert(stringIconMap::value_type(L"oreCoal",new SimpleIcon(L"oreCoal",slotSize*2,slotSize*2,slotSize*(2+1),slotSize*(2+1)))); @@ -642,7 +642,7 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"furnace_side",new SimpleIcon(L"furnace_side",slotSize*13,slotSize*2,slotSize*(13+1),slotSize*(2+1)))); texturesByName.insert(stringIconMap::value_type(L"dispenser_front",new SimpleIcon(L"dispenser_front",slotSize*14,slotSize*2,slotSize*(14+1),slotSize*(2+1)))); texturesByName.insert(stringIconMap::value_type(L"fire_1",new SimpleIcon(L"fire_1",slotSize*15,slotSize*1,slotSize*(15+1),slotSize*(1+1)))); - texturesToAnimate.push_back(pair(L"fire_1",L"fire_1")); + texturesToAnimate.push_back(std::pair(L"fire_1",L"fire_1")); texturesByName.insert(stringIconMap::value_type(L"sponge",new SimpleIcon(L"sponge",slotSize*0,slotSize*3,slotSize*(0+1),slotSize*(3+1)))); texturesByName.insert(stringIconMap::value_type(L"glass",new SimpleIcon(L"glass",slotSize*1,slotSize*3,slotSize*(1+1),slotSize*(3+1)))); texturesByName.insert(stringIconMap::value_type(L"oreDiamond",new SimpleIcon(L"oreDiamond",slotSize*2,slotSize*3,slotSize*(2+1),slotSize*(3+1)))); @@ -803,9 +803,9 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"potatoes_2",new SimpleIcon(L"potatoes_2",slotSize*10,slotSize*12,slotSize*(10+1),slotSize*(12+1)))); texturesByName.insert(stringIconMap::value_type(L"potatoes_3",new SimpleIcon(L"potatoes_3",slotSize*12,slotSize*12,slotSize*(12+1),slotSize*(12+1)))); texturesByName.insert(stringIconMap::value_type(L"water",new SimpleIcon(L"water",slotSize*13,slotSize*12,slotSize*(13+1),slotSize*(12+1)))); - texturesToAnimate.push_back(pair(L"water",L"water")); + texturesToAnimate.push_back(std::pair(L"water",L"water")); texturesByName.insert(stringIconMap::value_type(L"water_flow",new SimpleIcon(L"water_flow",slotSize*14,slotSize*12,slotSize*(14+2),slotSize*(12+2)))); - texturesToAnimate.push_back(pair(L"water_flow",L"water_flow")); + texturesToAnimate.push_back(std::pair(L"water_flow",L"water_flow")); texturesByName.insert(stringIconMap::value_type(L"sandstone_bottom",new SimpleIcon(L"sandstone_bottom",slotSize*0,slotSize*13,slotSize*(0+1),slotSize*(13+1)))); texturesByName.insert(stringIconMap::value_type(L"cloth_9",new SimpleIcon(L"cloth_9",slotSize*1,slotSize*13,slotSize*(1+1),slotSize*(13+1)))); texturesByName.insert(stringIconMap::value_type(L"cloth_1",new SimpleIcon(L"cloth_1",slotSize*2,slotSize*13,slotSize*(2+1),slotSize*(13+1)))); @@ -834,9 +834,9 @@ void PreStitchedTextureMap::loadUVs() texturesByName.insert(stringIconMap::value_type(L"quartzblock_side",new SimpleIcon(L"quartzblock_side",slotSize*11,slotSize*14,slotSize*(11+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"hopper_inside",new SimpleIcon(L"hopper_inside",slotSize*12,slotSize*14,slotSize*(12+1),slotSize*(14+1)))); texturesByName.insert(stringIconMap::value_type(L"lava",new SimpleIcon(L"lava",slotSize*13,slotSize*14,slotSize*(13+1),slotSize*(14+1)))); - texturesToAnimate.push_back(pair(L"lava",L"lava")); + texturesToAnimate.push_back(std::pair(L"lava",L"lava")); texturesByName.insert(stringIconMap::value_type(L"lava_flow",new SimpleIcon(L"lava_flow",slotSize*14,slotSize*14,slotSize*(14+2),slotSize*(14+2)))); - texturesToAnimate.push_back(pair(L"lava_flow",L"lava_flow")); + texturesToAnimate.push_back(std::pair(L"lava_flow",L"lava_flow")); texturesByName.insert(stringIconMap::value_type(L"destroy_0",new SimpleIcon(L"destroy_0",slotSize*0,slotSize*15,slotSize*(0+1),slotSize*(15+1)))); texturesByName.insert(stringIconMap::value_type(L"destroy_1",new SimpleIcon(L"destroy_1",slotSize*1,slotSize*15,slotSize*(1+1),slotSize*(15+1)))); texturesByName.insert(stringIconMap::value_type(L"destroy_2",new SimpleIcon(L"destroy_2",slotSize*2,slotSize*15,slotSize*(2+1),slotSize*(15+1)))); diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h index 6e6ea0870..3d6cac29e 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include "../../../Minecraft.World/Util/IconRegister.h" @@ -12,37 +12,37 @@ class BufferedImage; class PreStitchedTextureMap : public IconRegister { public: - static const wstring NAME_MISSING_TEXTURE; + static const std::wstring NAME_MISSING_TEXTURE; private: const int iconType; - const wstring name; - const wstring path; - const wstring extension; + const std::wstring name; + const std::wstring path; + const std::wstring extension; bool m_mipMap; - typedef unordered_map stringIconMap; + typedef std::unordered_map stringIconMap; stringIconMap texturesByName; // = new HashMap(); BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); StitchedTexture *missingPosition; Texture *stitchResult; - vector animatedTextures; // = new ArrayList(); + std::vector animatedTextures; // = new ArrayList(); - vector > texturesToAnimate; + std::vector > texturesToAnimate; void loadUVs(); public: - PreStitchedTextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipMap = false); + PreStitchedTextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipMap = false); void stitch(); - StitchedTexture *getTexture(const wstring &name); + StitchedTexture *getTexture(const std::wstring &name); void cycleAnimationFrames(); Texture *getStitchedTexture(); // 4J Stu - register is a reserved keyword in C++ - Icon *registerIcon(const wstring &name); + Icon *registerIcon(const std::wstring &name); int getIconType(); Icon *getMissingIcon(); diff --git a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp index c044dcce2..7f7d99b9d 100644 --- a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp @@ -52,7 +52,7 @@ bool StitchSlot::add(TextureHolder *textureHolder) // See if we're already divided before, if not, setup subSlots if (subSlots == NULL) { - subSlots = new vector(); + subSlots = new std::vector(); // First slot is for the new texture subSlots->push_back(new StitchSlot(originX, originY, textureWidth, textureHeight)); @@ -76,8 +76,8 @@ bool StitchSlot::add(TextureHolder *textureHolder) // (In the case of this ASCII drawing, it's the 'right hand side' that should win) // The 'fattest' area should be used (or when tied, the right hand one) - int right = max(height, spareWidth); - int bottom = max(width, spareHeight); + int right = std::max(height, spareWidth); + int bottom = std::max(width, spareHeight); if (right >= bottom) { subSlots->push_back(new StitchSlot(originX, originY + textureHeight, textureWidth, spareHeight)); @@ -132,7 +132,7 @@ bool StitchSlot::add(TextureHolder *textureHolder) return false; } -void StitchSlot::collectAssignments(vector *result) +void StitchSlot::collectAssignments(std::vector *result) { if (textureHolder != NULL) { @@ -150,7 +150,7 @@ void StitchSlot::collectAssignments(vector *result) } //@Override -wstring StitchSlot::toString() +std::wstring StitchSlot::toString() { return L"Slot{originX=" + _toString(originX) + L", originY=" + _toString(originY) + L", width=" + _toString(width) + L", height=" + _toString(height) + L", texture=" + _toString(textureHolder) + L", subSlots=" + _toString(subSlots) + L'}'; } \ No newline at end of file diff --git a/Minecraft.Client/Textures/Stitching/StitchSlot.h b/Minecraft.Client/Textures/Stitching/StitchSlot.h index 0990a06ef..a1a7dc832 100644 --- a/Minecraft.Client/Textures/Stitching/StitchSlot.h +++ b/Minecraft.Client/Textures/Stitching/StitchSlot.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + class TextureHolder; @@ -11,7 +11,7 @@ private: const int width; const int height; - vector *subSlots; + std::vector *subSlots; TextureHolder *textureHolder; public: @@ -21,8 +21,8 @@ public: int getX(); int getY(); bool add(TextureHolder *textureHolder); - void collectAssignments(vector *result); + void collectAssignments(std::vector *result); //@Override - wstring toString(); + std::wstring toString(); }; \ No newline at end of file diff --git a/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp b/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp index 4ed06b861..014b43eae 100644 --- a/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp @@ -6,7 +6,7 @@ #include "StitchedTexture.h" #include "../TextureManager.h" -StitchedTexture *StitchedTexture::create(const wstring &name) +StitchedTexture *StitchedTexture::create(const std::wstring &name) { // TODO: Generalize? if (name.compare(L"clock") == 0) @@ -23,7 +23,7 @@ StitchedTexture *StitchedTexture::create(const wstring &name) } } -StitchedTexture::StitchedTexture(const wstring &name) : name(name) +StitchedTexture::StitchedTexture(const std::wstring &name) : name(name) { // 4J Initialisers source = NULL; @@ -75,7 +75,7 @@ void StitchedTexture::initUVs(float U0, float V0, float U1, float V1) v1 = V1; } -void StitchedTexture::init(Texture *source, vector *frames, int x, int y, int width, int height, bool rotated) +void StitchedTexture::init(Texture *source, std::vector *frames, int x, int y, int width, int height, bool rotated) { this->source = source; this->frames = frames; @@ -170,7 +170,7 @@ float StitchedTexture::getV(double offset, bool adjust/*=false*/) const return getV0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION)); } -wstring StitchedTexture::getName() const +std::wstring StitchedTexture::getName() const { return name; } @@ -189,7 +189,7 @@ void StitchedTexture::cycleFrames() { if (frameOverride != NULL) { - pair current = frameOverride->at(frame); + std::pair current = frameOverride->at(frame); subFrame++; if (subFrame >= current.second) { @@ -256,7 +256,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader) intPairVector *results = new intPairVector(); //try { - wstring line = bufferedReader->readLine(); + std::wstring line = bufferedReader->readLine(); while (!line.empty()) { line = trimString(line); @@ -266,7 +266,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader) //for (String token : tokens) for(AUTO_VAR(it, tokens.begin()); it != tokens.end(); ++it) { - wstring token = *it; + std::wstring token = *it; int multiPos = token.find_first_of('*'); if (multiPos > 0) { @@ -297,7 +297,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader) } } -void StitchedTexture::loadAnimationFrames(const wstring &string) +void StitchedTexture::loadAnimationFrames(const std::wstring &string) { if(frameOverride != NULL) { @@ -313,7 +313,7 @@ void StitchedTexture::loadAnimationFrames(const wstring &string) //for (String token : tokens) for(AUTO_VAR(it, tokens.begin()); it != tokens.end(); ++it) { - wstring token = trimString(*it); + std::wstring token = trimString(*it); int multiPos = token.find_first_of('*'); if (multiPos > 0) { diff --git a/Minecraft.Client/Textures/Stitching/StitchedTexture.h b/Minecraft.Client/Textures/Stitching/StitchedTexture.h index 62ce19ccc..edb3c3c05 100644 --- a/Minecraft.Client/Textures/Stitching/StitchedTexture.h +++ b/Minecraft.Client/Textures/Stitching/StitchedTexture.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include "../../../Minecraft.World/Util/Icon.h" class Texture; @@ -7,14 +7,14 @@ class Texture; class StitchedTexture : public Icon { private: - const wstring name; + const std::wstring name; protected: Texture *source; - vector *frames; + std::vector *frames; private: - typedef vector > intPairVector; + typedef std::vector > intPairVector; intPairVector *frameOverride; int flags; @@ -41,15 +41,15 @@ protected: int subFrame; public: - static StitchedTexture *create(const wstring &name); + static StitchedTexture *create(const std::wstring &name); ~StitchedTexture(); protected: - StitchedTexture(const wstring &name); + StitchedTexture(const std::wstring &name); public: void initUVs(float U0, float V0, float U1, float V1); - void init(Texture *source, vector *frames, int x, int y, int width, int height, bool rotated); + void init(Texture *source, std::vector *frames, int x, int y, int width, int height, bool rotated); void replaceWith(StitchedTexture *texture); int getX() const; int getY() const; @@ -61,7 +61,7 @@ public: float getV0(bool adjust = false) const; float getV1(bool adjust = false) const; float getV(double offset, bool adjust = false) const; - wstring getName() const; + std::wstring getName() const; virtual int getSourceWidth() const; virtual int getSourceHeight() const; virtual void cycleFrames(); @@ -80,7 +80,7 @@ public: * @param bufferedReader */ void loadAnimationFrames(BufferedReader *bufferedReader); - void loadAnimationFrames(const wstring &string); // 4J Added + void loadAnimationFrames(const std::wstring &string); // 4J Added int getFlags() const ; // 4J added void setFlags(int flags); // 4J added diff --git a/Minecraft.Client/Textures/Stitching/Stitcher.cpp b/Minecraft.Client/Textures/Stitching/Stitcher.cpp index 821a72af6..4d8be3f12 100644 --- a/Minecraft.Client/Textures/Stitching/Stitcher.cpp +++ b/Minecraft.Client/Textures/Stitching/Stitcher.cpp @@ -6,7 +6,7 @@ #include "StitchedTexture.h" #include "Stitcher.h" -void Stitcher::_init(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) +void Stitcher::_init(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) { this->name = name; this->maxWidth = maxWidth; @@ -20,12 +20,12 @@ void Stitcher::_init(const wstring &name, int maxWidth, int maxHeight, bool forc stitchedTexture = NULL; } -Stitcher::Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo) +Stitcher::Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo) { _init(name, maxWidth, maxHeight, forcePowerOfTwo, 0); } -Stitcher::Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) +Stitcher::Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) { _init(name, maxWidth, maxHeight, forcePowerOfTwo, forcedScale); } @@ -60,7 +60,7 @@ Texture *Stitcher::constructTexture(bool mipmap) stitchedTexture = TextureManager::getInstance()->createTexture(name, Texture::TM_DYNAMIC, storageX, storageY, Texture::TFMT_RGBA, mipmap); stitchedTexture->fill(stitchedTexture->getRect(), 0xffff0000); - vector *slots = gatherAreas(); + std::vector *slots = gatherAreas(); for (int index = 0; index < slots->size(); index++) { StitchSlot *slot = slots->at(index); @@ -96,9 +96,9 @@ void Stitcher::stitch() } } -vector *Stitcher::gatherAreas() +std::vector *Stitcher::gatherAreas() { - vector *result = new vector(); + std::vector *result = new std::vector(); //for (StitchSlot slot : storage) for(AUTO_VAR(it, storage.begin()); it != storage.end(); ++it) @@ -154,7 +154,7 @@ bool Stitcher::addToStorage(TextureHolder *textureHolder) */ bool Stitcher::expand(TextureHolder *textureHolder) { - int minDistance = min(textureHolder->getHeight(), textureHolder->getWidth()); + int minDistance = std::min(textureHolder->getHeight(), textureHolder->getWidth()); bool firstAddition = storageX == 0 && storageY == 0; // It couldn't fit, decide which direction to grow to @@ -175,7 +175,7 @@ bool Stitcher::expand(TextureHolder *textureHolder) } // Even if the smallest side fits the larger might not >.> - int maxDistance = max(textureHolder->getHeight(), textureHolder->getWidth()); + int maxDistance = std::max(textureHolder->getHeight(), textureHolder->getWidth()); // TODO: This seems wrong ... if (firstAddition && !xCanGrow && !(smallestEncompassingPowerOfTwo(storageY + maxDistance) <= maxHeight)) { diff --git a/Minecraft.Client/Textures/Stitching/Stitcher.h b/Minecraft.Client/Textures/Stitching/Stitcher.h index b7f37a3de..7ade956a8 100644 --- a/Minecraft.Client/Textures/Stitching/Stitcher.h +++ b/Minecraft.Client/Textures/Stitching/Stitcher.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + class StitchSlot; class Texture; @@ -16,8 +16,8 @@ public: static const int MIN_TEXEL = 1 << MAX_MIPLEVEL; private: - set texturesToBeStitched; // = new HashSet(256); - vector storage; // = new ArrayList(256); + std::set texturesToBeStitched; // = new HashSet(256); + std::vector storage; // = new ArrayList(256); int storageX; int storageY; @@ -28,20 +28,20 @@ private: Texture *stitchedTexture; - wstring name; + std::wstring name; - void _init(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale); + void _init(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale); public: - Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo); - Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale); + Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo); + Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale); int getWidth(); int getHeight(); void addTexture(TextureHolder *textureHolder); Texture *constructTexture(bool mipmap = true); // 4J Added mipmap param void stitch(); - vector *gatherAreas(); + std::vector *gatherAreas(); private: // Based on: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 diff --git a/Minecraft.Client/Textures/Stitching/TextureMap.cpp b/Minecraft.Client/Textures/Stitching/TextureMap.cpp index 2a7c6c59c..3ee9794ff 100644 --- a/Minecraft.Client/Textures/Stitching/TextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/TextureMap.cpp @@ -15,9 +15,9 @@ #include "../Packs/TexturePackRepository.h" #include "TextureMap.h" -const wstring TextureMap::NAME_MISSING_TEXTURE = L"missingno"; +const std::wstring TextureMap::NAME_MISSING_TEXTURE = L"missingno"; -TextureMap::TextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png") +TextureMap::TextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png") { this->missingTexture = missingTexture; @@ -58,7 +58,7 @@ void TextureMap::stitch() } // Collection bucket for multiple frames per texture - unordered_map * > textures; // = new HashMap>(); + std::unordered_map * > textures; // = new HashMap>(); Stitcher *stitcher = TextureManager::getInstance()->createStitcher(name); @@ -74,20 +74,20 @@ void TextureMap::stitch() TextureHolder *missingHolder = new TextureHolder(missingTex); stitcher->addTexture(missingHolder); - vector *missingVec = new vector(); + std::vector *missingVec = new std::vector(); missingVec->push_back(missingTex); - textures.insert( unordered_map * >::value_type( missingHolder, missingVec )); + textures.insert( std::unordered_map * >::value_type( missingHolder, missingVec )); // Extract frames from textures and add them to the stitchers //for (final String name : texturesToRegister.keySet()) for(AUTO_VAR(it, texturesToRegister.begin()); it != texturesToRegister.end(); ++it) { - wstring name = it->first; + std::wstring name = it->first; - wstring filename = path + name + extension; + std::wstring filename = path + name + extension; // TODO: [EB] Put the frames into a proper object, not this inside out hack - vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); + std::vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); if (frames == NULL || frames->empty()) { @@ -98,7 +98,7 @@ void TextureMap::stitch() stitcher->addTexture(holder); // Store frames - textures.insert( unordered_map * >::value_type( holder, frames ) ); + textures.insert( std::unordered_map * >::value_type( holder, frames ) ); } // Stitch! @@ -121,9 +121,9 @@ void TextureMap::stitch() TextureHolder *textureHolder = slot->getHolder(); Texture *texture = textureHolder->getTexture(); - wstring textureName = texture->getName(); + std::wstring textureName = texture->getName(); - vector *frames = textures.find(textureHolder)->second; + std::vector *frames = textures.find(textureHolder)->second; StitchedTexture *stored = NULL; @@ -155,7 +155,7 @@ void TextureMap::stitch() { animatedTextures.push_back(stored); - wstring animationDefinitionFile = textureName + L".txt"; + std::wstring animationDefinitionFile = textureName + L".txt"; TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected(); bool requiresFallback = !texturePack->hasFile(L"\\" + textureName + L".png", false); @@ -189,7 +189,7 @@ void TextureMap::stitch() stitchResult->updateOnGPU(); } -StitchedTexture *TextureMap::getTexture(const wstring &name) +StitchedTexture *TextureMap::getTexture(const std::wstring &name) { StitchedTexture *result = texturesByName.find(name)->second; if (result == NULL) result = missingPosition; @@ -212,7 +212,7 @@ Texture *TextureMap::getStitchedTexture() } // 4J Stu - register is a reserved keyword in C++ -Icon *TextureMap::registerIcon(const wstring &name) +Icon *TextureMap::registerIcon(const std::wstring &name) { if (name.empty()) { diff --git a/Minecraft.Client/Textures/Stitching/TextureMap.h b/Minecraft.Client/Textures/Stitching/TextureMap.h index 99de21477..af13345ef 100644 --- a/Minecraft.Client/Textures/Stitching/TextureMap.h +++ b/Minecraft.Client/Textures/Stitching/TextureMap.h @@ -1,5 +1,5 @@ #pragma once -using namespace std; + #include "../../../Minecraft.World/Util/IconRegister.h" @@ -10,36 +10,36 @@ class BufferedImage; class TextureMap : public IconRegister { public: - static const wstring NAME_MISSING_TEXTURE; + static const std::wstring NAME_MISSING_TEXTURE; private: const int iconType; - const wstring name; - const wstring path; - const wstring extension; + const std::wstring name; + const std::wstring path; + const std::wstring extension; bool m_mipMap; - typedef unordered_map stringStitchedTextureMap; + typedef std::unordered_map stringStitchedTextureMap; stringStitchedTextureMap texturesByName; // = new HashMap(); BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); StitchedTexture *missingPosition; Texture *stitchResult; - vector animatedTextures; // = new ArrayList(); + std::vector animatedTextures; // = new ArrayList(); stringStitchedTextureMap texturesToRegister; // = new HashMap(); public: - TextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipMap = false); + TextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipMap = false); void stitch(); - StitchedTexture *getTexture(const wstring &name); + StitchedTexture *getTexture(const std::wstring &name); void cycleAnimationFrames(); Texture *getStitchedTexture(); // 4J Stu - register is a reserved keyword in C++ - Icon *registerIcon(const wstring &name); + Icon *registerIcon(const std::wstring &name); int getIconType(); Icon *getMissingIcon(); diff --git a/Minecraft.Client/Textures/Texture.cpp b/Minecraft.Client/Textures/Texture.cpp index 178d44d05..16084d176 100644 --- a/Minecraft.Client/Textures/Texture.cpp +++ b/Minecraft.Client/Textures/Texture.cpp @@ -15,12 +15,12 @@ C4JSpursJobQueue::Port* g_texBlitJobQueuePort; #define MAX_MIP_LEVELS 5 -Texture::Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap) +Texture::Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap) { _init(name, mode, width, height, depth, wrapMode, format, minFilter, magFilter, mipMap); } -void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap) +void Texture::_init(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap) { #ifdef __PS3__ if(g_texBlitJobQueuePort == NULL) @@ -101,7 +101,7 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de managerId = TextureManager::getInstance()->createTextureID(); } -void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) +void Texture::_init(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) { _init(name, mode, width, height, depth, wrapMode, format, minFilter, magFilter, mipMap); if (image == NULL) @@ -178,12 +178,12 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de } } -Texture::Texture(const wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) +Texture::Texture(const std::wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) { _init(name, mode, width, height, 1, wrapMode, format, minFilter, magFilter, image, mipMap); } -Texture::Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) +Texture::Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) { _init(name, mode, width, height, depth, wrapMode, format, minFilter, magFilter, image, mipMap); } @@ -242,7 +242,7 @@ void Texture::fill(const Rect2i *rect, int color) } } -void Texture::writeAsBMP(const wstring &name) +void Texture::writeAsBMP(const std::wstring &name) { // 4J Don't need #if 0 @@ -329,7 +329,7 @@ void Texture::writeAsBMP(const wstring &name) #endif } -void Texture::writeAsPNG(const wstring &filename) +void Texture::writeAsPNG(const std::wstring &filename) { // 4J Don't need #if 0 @@ -769,7 +769,7 @@ int Texture::getHeight() return height; } -wstring Texture::getName() +std::wstring Texture::getName() { return name; } diff --git a/Minecraft.Client/Textures/Texture.h b/Minecraft.Client/Textures/Texture.h index 09b7495e9..74afaea66 100644 --- a/Minecraft.Client/Textures/Texture.h +++ b/Minecraft.Client/Textures/Texture.h @@ -48,7 +48,7 @@ private: int magFilter; int wrapMode; bool mipmapped; - wstring name; + std::wstring name; Rect2i *rect; @@ -67,19 +67,19 @@ public: ~Texture(); private: - Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap = true); + Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap = true); - void _init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap); - void _init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap); + void _init(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap); + void _init(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap); public: - Texture(const wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true); - Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true); + Texture(const std::wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true); + Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true); const Rect2i *getRect(); void fill(const Rect2i *rect, int color); - void writeAsBMP(const wstring &name); - void writeAsPNG(const wstring &filename); + void writeAsBMP(const std::wstring &name); + void writeAsPNG(const std::wstring &filename); void blit(int x, int y, Texture *source); void blit(int x, int y, Texture *source, bool rotated); void transferFromBuffer(intArray buffer); @@ -88,7 +88,7 @@ public: int getGlId(); int getWidth(); int getHeight(); - wstring getName(); + std::wstring getName(); void setImmediateUpdate(bool immediateUpdate); void bind(int mipMapIndex); void updateOnGPU(); diff --git a/Minecraft.Client/Textures/TextureHolder.cpp b/Minecraft.Client/Textures/TextureHolder.cpp index 61cce49af..4ea7d3d9f 100644 --- a/Minecraft.Client/Textures/TextureHolder.cpp +++ b/Minecraft.Client/Textures/TextureHolder.cpp @@ -52,11 +52,11 @@ void TextureHolder::setForcedScale(int targetSize) return; } - scale = (float) targetSize / min(width, height); + scale = (float) targetSize / std::min(width, height); } //@Override -wstring TextureHolder::toString() +std::wstring TextureHolder::toString() { return L"TextureHolder{width=" + _toString(width) + L", height=" + _toString(height) + L'}'; } diff --git a/Minecraft.Client/Textures/TextureHolder.h b/Minecraft.Client/Textures/TextureHolder.h index 57fd2ca2e..cab827dd1 100644 --- a/Minecraft.Client/Textures/TextureHolder.h +++ b/Minecraft.Client/Textures/TextureHolder.h @@ -26,7 +26,7 @@ private: public: void setForcedScale(int targetSize); //@Override - wstring toString(); + std::wstring toString(); int compareTo(const TextureHolder *other) const; }; diff --git a/Minecraft.Client/Textures/TextureManager.cpp b/Minecraft.Client/Textures/TextureManager.cpp index 377f6e98b..b2808e470 100644 --- a/Minecraft.Client/Textures/TextureManager.cpp +++ b/Minecraft.Client/Textures/TextureManager.cpp @@ -29,7 +29,7 @@ int TextureManager::createTextureID() return nextID++; } -Texture *TextureManager::getTexture(const wstring &name) +Texture *TextureManager::getTexture(const std::wstring &name) { if (stringToIDMap.find(name) != stringToIDMap.end()) { @@ -39,7 +39,7 @@ Texture *TextureManager::getTexture(const wstring &name) return NULL; } -void TextureManager::registerName(const wstring &name, Texture *texture) +void TextureManager::registerName(const std::wstring &name, Texture *texture) { stringToIDMap.insert( stringIntMap::value_type( name, texture->getManagerId() ) ); @@ -64,7 +64,7 @@ void TextureManager::registerTexture(Texture *texture) idToTextureMap.insert( intTextureMap::value_type( texture->getManagerId(), texture ) ); } -void TextureManager::unregisterTexture(const wstring &name, Texture *texture) +void TextureManager::unregisterTexture(const std::wstring &name, Texture *texture) { AUTO_VAR(it, idToTextureMap.find(texture->getManagerId())); if(it != idToTextureMap.end()) idToTextureMap.erase(it); @@ -73,16 +73,16 @@ void TextureManager::unregisterTexture(const wstring &name, Texture *texture) if(it2 != stringToIDMap.end()) stringToIDMap.erase(it2); } -Stitcher *TextureManager::createStitcher(const wstring &name) +Stitcher *TextureManager::createStitcher(const std::wstring &name) { int maxTextureSize = Minecraft::maxSupportedTextureSize(); return new Stitcher(name, maxTextureSize, maxTextureSize, true); } -vector *TextureManager::createTextures(const wstring &filename, bool mipmap) +std::vector *TextureManager::createTextures(const std::wstring &filename, bool mipmap) { - vector *result = new vector(); + std::vector *result = new std::vector(); TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected(); //try { int mode = Texture::TM_CONTAINER; // Most important -- so it doesn't get uploaded to videoram @@ -92,7 +92,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool int magFilter = Texture::TFLT_NEAREST; MemSect(32); - wstring drive = L""; + std::wstring drive = L""; if(texturePack->hasFile(L"res/" + filename,false)) @@ -106,7 +106,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool { const char *pchTextureName=wstringtofilename(filename); char *pchUsrDir = app.GetBDUsrDirPath(pchTextureName); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); drive= wstr + L"\\Common\\res\\TitleUpdate\\"; } else @@ -123,7 +123,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool int height = image->getHeight(); int width = image->getWidth(); - wstring texName = getTextureNameFromPath(filename); + std::wstring texName = getTextureNameFromPath(filename); if (isAnimation(filename, texturePack)) { @@ -168,27 +168,27 @@ vector *TextureManager::createTextures(const wstring &filename, bool return result; } -wstring TextureManager::getTextureNameFromPath(const wstring &filename) +std::wstring TextureManager::getTextureNameFromPath(const std::wstring &filename) { File file(filename); return file.getName().substr(0, file.getName().find_last_of(L'.')); } -bool TextureManager::isAnimation(const wstring &filename, TexturePack *texturePack) +bool TextureManager::isAnimation(const std::wstring &filename, TexturePack *texturePack) { - wstring dataFileName = L"/" + filename.substr(0, filename.find_last_of(L'.')) + L".txt"; + std::wstring dataFileName = L"/" + filename.substr(0, filename.find_last_of(L'.')) + L".txt"; bool hasOriginalImage = texturePack->hasFile(L"/" + filename, false); return Minecraft::GetInstance()->skins->getSelected()->hasFile(dataFileName, !hasOriginalImage); } -Texture *TextureManager::createTexture(const wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image) +Texture *TextureManager::createTexture(const std::wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image) { Texture *newTex = new Texture(name, mode, width, height, wrap, format, minFilter, magFilter, image, mipmap); registerTexture(newTex); return newTex; } -Texture *TextureManager::createTexture(const wstring &name, int mode, int width, int height, int format, bool mipmap) +Texture *TextureManager::createTexture(const std::wstring &name, int mode, int width, int height, int format, bool mipmap) { // 4J Stu - Don't clamp as it causes issues with how we signal non-mipmmapped textures to the pixel shader //return createTexture(name, mode, width, height, Texture::WM_CLAMP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, NULL); diff --git a/Minecraft.Client/Textures/TextureManager.h b/Minecraft.Client/Textures/TextureManager.h index b1d71d2db..4fb859546 100644 --- a/Minecraft.Client/Textures/TextureManager.h +++ b/Minecraft.Client/Textures/TextureManager.h @@ -10,8 +10,8 @@ private: static TextureManager *instance; int nextID; - typedef unordered_map stringIntMap; - typedef unordered_map intTextureMap; + typedef std::unordered_map stringIntMap; + typedef std::unordered_map intTextureMap; intTextureMap idToTextureMap; stringIntMap stringToIDMap; @@ -24,18 +24,18 @@ private: public: int createTextureID(); - Texture *getTexture(const wstring &name); - void registerName(const wstring &name, Texture *texture); + Texture *getTexture(const std::wstring &name); + void registerName(const std::wstring &name, Texture *texture); void registerTexture(Texture *texture); - void unregisterTexture(const wstring &name, Texture *texture); - Stitcher *createStitcher(const wstring &name); - vector *createTextures(const wstring &filename, bool mipmap); // 4J added mipmap param + void unregisterTexture(const std::wstring &name, Texture *texture); + Stitcher *createStitcher(const std::wstring &name); + std::vector *createTextures(const std::wstring &filename, bool mipmap); // 4J added mipmap param private: - wstring getTextureNameFromPath(const wstring &filename); - bool isAnimation(const wstring &filename, TexturePack *texturePack); + std::wstring getTextureNameFromPath(const std::wstring &filename); + bool isAnimation(const std::wstring &filename, TexturePack *texturePack); public: - Texture *createTexture(const wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image); - Texture *createTexture(const wstring &name, int mode, int width, int height, int format, bool mipmap); // 4J Added mipmap param + Texture *createTexture(const std::wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image); + Texture *createTexture(const std::wstring &name, int mode, int width, int height, int format, bool mipmap); // 4J Added mipmap param }; \ No newline at end of file diff --git a/Minecraft.Client/Textures/Textures.cpp b/Minecraft.Client/Textures/Textures.cpp index 416bb95cd..9d0bcfb19 100644 --- a/Minecraft.Client/Textures/Textures.cpp +++ b/Minecraft.Client/Textures/Textures.cpp @@ -252,11 +252,11 @@ void Textures::loadIndexedTextures() // 4J - added - preload a set of commonly used textures that can then be referenced directly be an enumerated type rather by string for( int i = 0; i < TN_COUNT - 2; i++ ) { - preLoadedIdx[i] = loadTexture((TEXTURE_NAME)i, wstring(preLoaded[i]) + L".png"); + preLoadedIdx[i] = loadTexture((TEXTURE_NAME)i, std::wstring(preLoaded[i]) + L".png"); } } -intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const wstring& resourceName) +intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const std::wstring& resourceName) { TexturePack *skin = skins->getSelected(); @@ -270,7 +270,7 @@ intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const wstring& resource // 4J - removed try/catch // try { intArray res; - //wstring in = skin->getResource(resourceName); + //std::wstring in = skin->getResource(resourceName); if (false)// 4J - removed - was ( in == NULL) { res = loadTexturePixels(missingNo); @@ -335,7 +335,7 @@ int Textures::loadTexture(int idx) // 4J added - textures default to standard 32-bit RGBA format, but where we can, use an 8-bit format. There's 3 different varieties of these currently // in the renderer that map the single 8-bit channel to RGBA differently. -void Textures::setTextureFormat(const wstring& resourceName) +void Textures::setTextureFormat(const std::wstring& resourceName) { // 4J Stu - These texture formats are not currently in the render header #ifdef _XBOX @@ -366,7 +366,7 @@ void Textures::setTextureFormat(const wstring& resourceName) } } -void Textures::bindTexture(const wstring &resourceName) +void Textures::bindTexture(const std::wstring &resourceName) { bind(loadTexture(TN_COUNT,resourceName)); } @@ -392,7 +392,7 @@ void Textures::clearLastBoundId() lastBoundId = -1; } -int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName) +int Textures::loadTexture(TEXTURE_NAME texId, const std::wstring& resourceName) { // char buf[256]; // wcstombs(buf, resourceName.c_str(), 256); @@ -417,7 +417,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName) if (inMap) return id; } - wstring pathName = resourceName; + std::wstring pathName = resourceName; // 4J - added special cases to avoid mipmapping on clouds & shadows if( (resourceName == L"environment/clouds.png") || @@ -437,7 +437,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName) int id = MemoryTracker::genTextures(); - wstring prefix = L"%blur%"; + std::wstring prefix = L"%blur%"; bool blur = resourceName.substr(0, prefix.size()).compare(prefix) == 0; //resourceName.startsWith("%blur%"); if (blur) pathName = resourceName.substr(6); @@ -445,7 +445,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName) bool clamp = resourceName.substr(0, prefix.size()).compare(prefix) == 0; //resourceName.startsWith("%clamp%"); if (clamp) pathName = resourceName.substr(7); - //wstring in = skins->getSelected()->getResource(pathName); + //std::wstring in = skins->getSelected()->getResource(pathName); if (false ) // 4J - removed was ( in == NULL) { loadTexture(missingNo, id, blur, clamp); @@ -831,7 +831,7 @@ void Textures::releaseTexture(int id) glDeleteTextures(id); } -int Textures::loadHttpTexture(const wstring& url, const wstring& backup) +int Textures::loadHttpTexture(const std::wstring& url, const std::wstring& backup) { HttpTexture *texture = httpTextures[url]; if (texture != NULL) @@ -857,7 +857,7 @@ int Textures::loadHttpTexture(const wstring& url, const wstring& backup) return texture->id; } -int Textures::loadHttpTexture(const wstring& url, int backup) +int Textures::loadHttpTexture(const std::wstring& url, int backup) { HttpTexture *texture = httpTextures[url]; if (texture != NULL) @@ -882,12 +882,12 @@ int Textures::loadHttpTexture(const wstring& url, int backup) return texture->id; } -bool Textures::hasHttpTexture(const wstring &url) +bool Textures::hasHttpTexture(const std::wstring &url) { return httpTextures.find(url) != httpTextures.end(); } -HttpTexture *Textures::addHttpTexture(const wstring& url, HttpTextureProcessor *processor) +HttpTexture *Textures::addHttpTexture(const std::wstring& url, HttpTextureProcessor *processor) { HttpTexture *texture = httpTextures[url]; if (texture == NULL) @@ -901,7 +901,7 @@ HttpTexture *Textures::addHttpTexture(const wstring& url, HttpTextureProcessor * return texture; } -void Textures::removeHttpTexture(const wstring& url) +void Textures::removeHttpTexture(const std::wstring& url) { HttpTexture *texture = httpTextures[url]; if (texture != NULL) @@ -916,7 +916,7 @@ void Textures::removeHttpTexture(const wstring& url) } // 4J-PB - adding for texture in memory (from global title storage) -int Textures::loadMemTexture(const wstring& url, const wstring& backup) +int Textures::loadMemTexture(const std::wstring& url, const std::wstring& backup) { MemTexture *texture = NULL; AUTO_VAR(it, memTextures.find(url) ); @@ -960,7 +960,7 @@ int Textures::loadMemTexture(const wstring& url, const wstring& backup) return texture->id; } -int Textures::loadMemTexture(const wstring& url, int backup) +int Textures::loadMemTexture(const std::wstring& url, int backup) { MemTexture *texture = NULL; AUTO_VAR(it, memTextures.find(url) ); @@ -1003,7 +1003,7 @@ int Textures::loadMemTexture(const wstring& url, int backup) return texture->id; } -MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *processor) +MemTexture *Textures::addMemTexture(const std::wstring& name,MemTextureProcessor *processor) { MemTexture *texture = NULL; AUTO_VAR(it, memTextures.find(name) ); @@ -1039,7 +1039,7 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro return texture; } -// MemTexture *Textures::getMemTexture(const wstring& url, MemTextureProcessor *processor) +// MemTexture *Textures::getMemTexture(const std::wstring& url, MemTextureProcessor *processor) // { // MemTexture *texture = memTextures[url]; // if (texture != NULL) @@ -1049,7 +1049,7 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro // return texture; // } -void Textures::removeMemTexture(const wstring& url) +void Textures::removeMemTexture(const std::wstring& url) { MemTexture *texture = NULL; AUTO_VAR(it, memTextures.find(url) ); @@ -1139,34 +1139,34 @@ void Textures::reloadAll() #if 0 AUTO_VAR(itEndLI, loadedImages.end() ); - for(unordered_map::iterator it = loadedImages.begin(); it != itEndLI; it++ ) + for(std::unordered_map::iterator it = loadedImages.begin(); it != itEndLI; it++ ) { BufferedImage *image = it->second; loadTexture(image, it->first); } AUTO_VAR(itEndHT, httpTextures.end()); - for(unordered_map::iterator it = httpTextures.begin(); it != itEndHT; it++ ) + for(std::unordered_map::iterator it = httpTextures.begin(); it != itEndHT; it++ ) { it->second->isLoaded = false; } AUTO_VAR(itEndMT, memTextures.end()); - for(unordered_map::iterator it = memTextures.begin(); it != itEndMT; it++ ) + for(std::unordered_map::iterator it = memTextures.begin(); it != itEndMT; it++ ) { it->second->isLoaded = false; } AUTO_VAR(itEndIM, idMap.end()); - for( unordered_map::iterator it = idMap.begin(); it != itEndIM; it++ ) + for( std::unordered_map::iterator it = idMap.begin(); it != itEndIM; it++ ) { - wstring name = it->first; + std::wstring name = it->first; int id = idMap[name]; BufferedImage *image; - wstring prefix = L"%blur%"; + std::wstring prefix = L"%blur%"; bool blur = name.substr(0, prefix.size()).compare(prefix) == 0; //name.startsWith("%blur%"); if (blur) name = name.substr(6); @@ -1180,9 +1180,9 @@ void Textures::reloadAll() delete image; } AUTO_VAR(itEndPM, pixelsMap.end()); - for( unordered_map::iterator it = pixelsMap.begin(); it != itEndPM; it++ ) + for( std::unordered_map::iterator it = pixelsMap.begin(); it != itEndPM; it++ ) { - wstring name = it->first; + std::wstring name = it->first; BufferedImage *image = readImage(skin->getResource(name)); loadTexturePixels(image, pixelsMap[name]); @@ -1213,13 +1213,13 @@ Icon *Textures::getMissingIcon(int type) } } -BufferedImage *Textures::readImage(TEXTURE_NAME texId, const wstring& name) // 4J was InputStream *in +BufferedImage *Textures::readImage(TEXTURE_NAME texId, const std::wstring& name) // 4J was InputStream *in { BufferedImage *img=NULL; MemSect(32); // is this image one of the Title Update ones? bool isTu = IsTUImage(texId, name); - wstring drive = L""; + std::wstring drive = L""; if(!skins->isUsingDefaultSkin() && skins->getSelected()->hasFile(L"res/" + name,false)) { @@ -1233,7 +1233,7 @@ BufferedImage *Textures::readImage(TEXTURE_NAME texId, const wstring& name) // 4 if(app.GetBootedFromDiscPatch() && app.IsFileInPatchList(pchName)) { char *pchUsrDir = app.GetBDUsrDirPath(pchName); - wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); + std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); if(isTu) { @@ -1334,7 +1334,7 @@ const wchar_t *TUImagePaths[] = NULL }; -bool Textures::IsTUImage(TEXTURE_NAME texId, const wstring& name) +bool Textures::IsTUImage(TEXTURE_NAME texId, const std::wstring& name) { int i = 0; if(texId < TN_COUNT) @@ -1383,7 +1383,7 @@ const wchar_t *OriginalImagesPaths[] = NULL }; -bool Textures::IsOriginalImage(TEXTURE_NAME texId, const wstring& name) +bool Textures::IsOriginalImage(TEXTURE_NAME texId, const std::wstring& name) { int i = 0; if(texId < TN_COUNT) diff --git a/Minecraft.Client/Textures/Textures.h b/Minecraft.Client/Textures/Textures.h index e032f4d97..a96947384 100644 --- a/Minecraft.Client/Textures/Textures.h +++ b/Minecraft.Client/Textures/Textures.h @@ -9,7 +9,7 @@ class TexturePackRepository; class HttpTextureProcessor; class MemTextureProcessor; class Options; -using namespace std; + class IntBuffer; class PreStitchedTextureMap; @@ -208,14 +208,14 @@ private: static const wchar_t *preLoaded[TN_COUNT]; static int preLoadedIdx[TN_COUNT]; - unordered_map idMap; - unordered_map pixelsMap; - unordered_map loadedImages; + std::unordered_map idMap; + std::unordered_map pixelsMap; + std::unordered_map loadedImages; //IntBuffer *pixels; // 4J - removed so we don't have a permanent buffer kicking round using up 1MB - unordered_map httpTextures; + std::unordered_map httpTextures; // 4J-PB - Added for GTS textures - unordered_map memTextures; + std::unordered_map memTextures; Options *options; private: @@ -232,14 +232,14 @@ private: void loadIndexedTextures(); // 4J Added public: - intArray loadTexturePixels(TEXTURE_NAME texId, const wstring& resourceName); + intArray loadTexturePixels(TEXTURE_NAME texId, const std::wstring& resourceName); private: intArray loadTexturePixels(BufferedImage *img); intArray loadTexturePixels(BufferedImage *img, intArray pixels); - void setTextureFormat(const wstring& resourceName); // 4J added + void setTextureFormat(const std::wstring& resourceName); // 4J added public: - void bindTexture(const wstring &resourceName); + void bindTexture(const std::wstring &resourceName); void bindTexture(int resourceId); // 4J Added // 4J Made public for use in XUI controls @@ -249,7 +249,7 @@ public: void clearLastBoundId(); private: - int loadTexture(TEXTURE_NAME texId, const wstring& resourceName); + int loadTexture(TEXTURE_NAME texId, const std::wstring& resourceName); public: int loadTexture(int idx); // 4J added int getTexture(BufferedImage *img, C4JRender::eTextureFormat format = C4JRender::TEXTURE_FORMAT_RxGyBzAw, bool mipmap = true); @@ -262,26 +262,26 @@ public: void replaceTextureDirect(intArray rawPixels, int w, int h, int id); // 4J added as optimisation void replaceTextureDirect(shortArray rawPixels, int w, int h, int id); // 4J added as optimisation void releaseTexture(int id); - int loadHttpTexture(const wstring& url, const wstring& backup); - int loadHttpTexture(const wstring& url, int backup); // 4J added - bool hasHttpTexture(const wstring &url); - HttpTexture *addHttpTexture(const wstring& url, HttpTextureProcessor *processor); - void removeHttpTexture(const wstring& url); + int loadHttpTexture(const std::wstring& url, const std::wstring& backup); + int loadHttpTexture(const std::wstring& url, int backup); // 4J added + bool hasHttpTexture(const std::wstring &url); + HttpTexture *addHttpTexture(const std::wstring& url, HttpTextureProcessor *processor); + void removeHttpTexture(const std::wstring& url); // 4J-PB - for the GTS textures - int loadMemTexture(const wstring& url, const wstring& backup); - int loadMemTexture(const wstring& url, int backup); - MemTexture * addMemTexture(const wstring& url, MemTextureProcessor *processor); - //MemTexture * getMemTexture(const wstring& url, MemTextureProcessor *processor); - void removeMemTexture(const wstring& url); + int loadMemTexture(const std::wstring& url, const std::wstring& backup); + int loadMemTexture(const std::wstring& url, int backup); + MemTexture * addMemTexture(const std::wstring& url, MemTextureProcessor *processor); + //MemTexture * getMemTexture(const std::wstring& url, MemTextureProcessor *processor); + void removeMemTexture(const std::wstring& url); void tick(bool updateTextures, bool tickDynamics = true); // 4J added updateTextures parameter & tickDynamics public: void reloadAll(); void stitch(); Icon *getMissingIcon(int type); - BufferedImage *readImage(TEXTURE_NAME texId, const wstring& name); // Moved this to public for Font.cpp access + BufferedImage *readImage(TEXTURE_NAME texId, const std::wstring& name); // Moved this to public for Font.cpp access // check list of title update textures to see if we need to use the UPDATE: drive - static bool IsTUImage(TEXTURE_NAME texId, const wstring& name); - static bool IsOriginalImage(TEXTURE_NAME texId, const wstring& name); + static bool IsTUImage(TEXTURE_NAME texId, const std::wstring& name); + static bool IsOriginalImage(TEXTURE_NAME texId, const std::wstring& name); }; diff --git a/Minecraft.Client/UI/Button.cpp b/Minecraft.Client/UI/Button.cpp index cd4f8d3b2..cb74f5fc2 100644 --- a/Minecraft.Client/UI/Button.cpp +++ b/Minecraft.Client/UI/Button.cpp @@ -2,18 +2,18 @@ #include "Button.h" #include "../Textures/Textures.h" -Button::Button(int id, int x, int y, const wstring& msg) +Button::Button(int id, int x, int y, const std::wstring& msg) { init(id, x, y, 200, 20, msg); } -Button::Button(int id, int x, int y, int w, int h, const wstring& msg) +Button::Button(int id, int x, int y, int w, int h, const std::wstring& msg) { init(id, x, y, w, h, msg); } // 4J - added -void Button::init(int id, int x, int y, int w, int h, const wstring& msg) +void Button::init(int id, int x, int y, int w, int h, const std::wstring& msg) { active = true; visible = true; diff --git a/Minecraft.Client/UI/Button.h b/Minecraft.Client/UI/Button.h index 0bef133c6..aac43cda4 100644 --- a/Minecraft.Client/UI/Button.h +++ b/Minecraft.Client/UI/Button.h @@ -1,6 +1,6 @@ #pragma once #include "GuiComponent.h" -using namespace std; + class Button : public GuiComponent { @@ -9,14 +9,14 @@ protected: int h; public: int x, y; - wstring msg; + std::wstring msg; int id; bool active; bool visible; - Button(int id, int x, int y, const wstring& msg); - Button(int id, int x, int y, int w, int h, const wstring& msg); - void init(int id, int x, int y, int w, int h, const wstring& msg); // 4J - added + Button(int id, int x, int y, const std::wstring& msg); + Button(int id, int x, int y, int w, int h, const std::wstring& msg); + void init(int id, int x, int y, int w, int h, const std::wstring& msg); // 4J - added protected: virtual int getYImage(bool hovered); public: diff --git a/Minecraft.Client/UI/EditBox.cpp b/Minecraft.Client/UI/EditBox.cpp index 27c1e85c2..5d29b7291 100644 --- a/Minecraft.Client/UI/EditBox.cpp +++ b/Minecraft.Client/UI/EditBox.cpp @@ -2,7 +2,7 @@ #include "EditBox.h" #include "../../Minecraft.World/Util/SharedConstants.h" -EditBox::EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const wstring& value) +EditBox::EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const std::wstring& value) { // 4J - added initialisers maxLength = 0; @@ -17,12 +17,12 @@ EditBox::EditBox(Screen *screen, Font *font, int x, int y, int width, int height this->setValue(value); } -void EditBox::setValue(const wstring& value) +void EditBox::setValue(const std::wstring& value) { this->value = value; } -wstring EditBox::getValue() +std::wstring EditBox::getValue() { return value; } @@ -60,7 +60,7 @@ void EditBox::keyPressed(wchar_t ch, int eventKey) { value = value.substr(0, value.length() - 1); } - if (SharedConstants::acceptableLetters.find(ch) != wstring::npos && (value.length() < maxLength || maxLength == 0)) + if (SharedConstants::acceptableLetters.find(ch) != std::wstring::npos && (value.length() < maxLength || maxLength == 0)) { value += ch; } diff --git a/Minecraft.Client/UI/EditBox.h b/Minecraft.Client/UI/EditBox.h index 9e24553f9..d0f2e8614 100644 --- a/Minecraft.Client/UI/EditBox.h +++ b/Minecraft.Client/UI/EditBox.h @@ -1,6 +1,6 @@ #pragma once #include "GuiComponent.h" -using namespace std; + class Font; class Screen; @@ -12,7 +12,7 @@ private: int y; int width; int height; - wstring value; + std::wstring value; unsigned int maxLength; int frame; @@ -23,9 +23,9 @@ private: Screen *screen; public: - EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const wstring& value); - void setValue(const wstring& value); - wstring getValue(); + EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const std::wstring& value); + void setValue(const std::wstring& value); + std::wstring getValue(); void tick(); void keyPressed(wchar_t ch, int eventKey); void mouseClicked(int mouseX, int mouseY, int buttonNum); diff --git a/Minecraft.Client/UI/Font.cpp b/Minecraft.Client/UI/Font.cpp index df0758e26..65c2bf2b6 100644 --- a/Minecraft.Client/UI/Font.cpp +++ b/Minecraft.Client/UI/Font.cpp @@ -8,7 +8,7 @@ #include "../../Minecraft.World/Util/StringHelpers.h" #include "../../Minecraft.World/Util/Random.h" -Font::Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[]/* = nullptr */) : textures(textures) +Font::Font(Options *options, const std::wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[]/* = nullptr */) : textures(textures) { int charC = cols * rows; // Number of characters in the font @@ -169,36 +169,36 @@ void Font::renderCharacter(wchar_t c) xPos += (float) charWidths[c]; } -void Font::drawShadow(const wstring& str, int x, int y, int color) +void Font::drawShadow(const std::wstring& str, int x, int y, int color) { draw(str, x + 1, y + 1, color, true); draw(str, x, y, color, false); } -void Font::drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h) +void Font::drawShadowWordWrap(const std::wstring &str, int x, int y, int w, int color, int h) { drawWordWrapInternal(str, x + 1, y + 1, w, color, true, h); drawWordWrapInternal(str, x, y, w, color, h); } -void Font::draw(const wstring& str, int x, int y, int color) +void Font::draw(const std::wstring& str, int x, int y, int color) { draw(str, x, y, color, false); } -wstring Font::reorderBidi(const wstring &str) +std::wstring Font::reorderBidi(const std::wstring &str) { // 4J Not implemented return str; } -void Font::draw(const wstring &str, bool dropShadow) +void Font::draw(const std::wstring &str, bool dropShadow) { // Bind the texture textures->bindTexture(m_textureName); bool noise = false; - wstring cleanStr = sanitize(str); + std::wstring cleanStr = sanitize(str); for (int i = 0; i < (int)cleanStr.length(); ++i) { @@ -250,7 +250,7 @@ void Font::draw(const wstring &str, bool dropShadow) } } -void Font::draw(const wstring& str, int x, int y, int color, bool dropShadow) +void Font::draw(const std::wstring& str, int x, int y, int color, bool dropShadow) { if (!str.empty()) { @@ -268,9 +268,9 @@ void Font::draw(const wstring& str, int x, int y, int color, bool dropShadow) } } -int Font::width(const wstring& str) +int Font::width(const std::wstring& str) { - wstring cleanStr = sanitize(str); + std::wstring cleanStr = sanitize(str); if (cleanStr == L"") return 0; // 4J - was NULL comparison int len = 0; @@ -293,9 +293,9 @@ int Font::width(const wstring& str) return len; } -wstring Font::sanitize(const wstring& str) +std::wstring Font::sanitize(const std::wstring& str) { - wstring sb = str; + std::wstring sb = str; for (unsigned int i = 0; i < sb.length(); i++) { @@ -337,7 +337,7 @@ bool Font::CharacterExists(wchar_t c) } } -void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, int h) +void Font::drawWordWrap(const std::wstring &string, int x, int y, int w, int col, int h) { //if (bidirectional) //{ @@ -346,12 +346,12 @@ void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, int drawWordWrapInternal(string, x, y, w, col, h); } -void Font::drawWordWrapInternal(const wstring &string, int x, int y, int w, int col, int h) +void Font::drawWordWrapInternal(const std::wstring &string, int x, int y, int w, int col, int h) { drawWordWrapInternal(string, x, y, w, col, false, h); } -void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, bool darken, int h) +void Font::drawWordWrap(const std::wstring &string, int x, int y, int w, int col, bool darken, int h) { //if (bidirectional) //{ @@ -360,9 +360,9 @@ void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, boo drawWordWrapInternal(string, x, y, w, col, darken, h); } -void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int col, bool darken, int h) +void Font::drawWordWrapInternal(const std::wstring& string, int x, int y, int w, int col, bool darken, int h) { - vectorlines = stringSplit(string,L'\n'); + std::vectorlines = stringSplit(string,L'\n'); if (lines.size() > 1) { AUTO_VAR(itEnd, lines.end()); @@ -375,11 +375,11 @@ void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int } return; } - vector words = stringSplit(string,L' '); + std::vector words = stringSplit(string,L' '); unsigned int pos = 0; while (pos < words.size()) { - wstring line = words[pos++] + L" "; + std::wstring line = words[pos++] + L" "; while (pos < words.size() && width(line + words[pos]) < w) { line += words[pos++] + L" "; @@ -411,9 +411,9 @@ void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int } -int Font::wordWrapHeight(const wstring& string, int w) +int Font::wordWrapHeight(const std::wstring& string, int w) { - vector lines = stringSplit(string,L'\n'); + std::vector lines = stringSplit(string,L'\n'); if (lines.size() > 1) { int h = 0; @@ -424,12 +424,12 @@ int Font::wordWrapHeight(const wstring& string, int w) } return h; } - vector words = stringSplit(string,L' '); + std::vector words = stringSplit(string,L' '); unsigned int pos = 0; int y = 0; while (pos < words.size()) { - wstring line = words[pos++] + L" "; + std::wstring line = words[pos++] + L" "; while (pos < words.size() && width(line + words[pos]) < w) { line += words[pos++] + L" "; @@ -466,7 +466,7 @@ void Font::setBidirectional(bool bidirectional) this->bidirectional = bidirectional; } -bool Font::AllCharactersValid(const wstring &str) +bool Font::AllCharactersValid(const std::wstring &str) { for (int i = 0; i < (int)str.length(); ++i) { diff --git a/Minecraft.Client/UI/Font.h b/Minecraft.Client/UI/Font.h index b6ad555db..e7769698c 100644 --- a/Minecraft.Client/UI/Font.h +++ b/Minecraft.Client/UI/Font.h @@ -30,7 +30,7 @@ private: std::map m_charMap; public: - Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = NULL); + Font(Options *options, const std::wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = NULL); #ifndef _XBOX // 4J Stu - This dtor clashes with one in xui! We never delete these anyway so take it out for now. Can go back when we have got rid of XUI ~Font(); @@ -41,9 +41,9 @@ private: void renderCharacter(wchar_t c); // 4J added public: - void drawShadow(const wstring& str, int x, int y, int color); - void drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h); // 4J Added h param - void draw(const wstring &str, int x, int y, int color); + void drawShadow(const std::wstring& str, int x, int y, int color); + void drawShadowWordWrap(const std::wstring &str, int x, int y, int w, int color, int h); // 4J Added h param + void draw(const std::wstring &str, int x, int y, int color); /** * Reorders the string according to bidirectional levels. A bit expensive at * the moment. @@ -52,32 +52,32 @@ public: * @return */ private: - wstring reorderBidi(const wstring &str); + std::wstring reorderBidi(const std::wstring &str); - void draw(const wstring &str, bool dropShadow); - void draw(const wstring& str, int x, int y, int color, bool dropShadow); + void draw(const std::wstring &str, bool dropShadow); + void draw(const std::wstring& str, int x, int y, int color, bool dropShadow); int MapCharacter(wchar_t c); // 4J added bool CharacterExists(wchar_t c); // 4J added public: - int width(const wstring& str); - wstring sanitize(const wstring& str); - void drawWordWrap(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param + int width(const std::wstring& str); + std::wstring sanitize(const std::wstring& str); + void drawWordWrap(const std::wstring &string, int x, int y, int w, int col, int h); // 4J Added h param private: - void drawWordWrapInternal(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param + void drawWordWrapInternal(const std::wstring &string, int x, int y, int w, int col, int h); // 4J Added h param public: - void drawWordWrap(const wstring &string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param + void drawWordWrap(const std::wstring &string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param private: - void drawWordWrapInternal(const wstring& string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param + void drawWordWrapInternal(const std::wstring& string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param public: - int wordWrapHeight(const wstring& string, int w); + int wordWrapHeight(const std::wstring& string, int w); void setEnforceUnicodeSheet(bool enforceUnicodeSheet); void setBidirectional(bool bidirectional); // 4J-PB - check for invalid player name - Japanese local name - bool AllCharactersValid(const wstring &str); + bool AllCharactersValid(const std::wstring &str); }; diff --git a/Minecraft.Client/UI/Gui.cpp b/Minecraft.Client/UI/Gui.cpp index d9c2f564d..fb30994c7 100644 --- a/Minecraft.Client/UI/Gui.cpp +++ b/Minecraft.Client/UI/Gui.cpp @@ -225,7 +225,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // Display the pumpkin screen effect ///////////////////////////////////////////////////////////////////////////////////// - shared_ptr headGear = minecraft->player->inventory->getArmor(3); + std::shared_ptr headGear = minecraft->player->inventory->getArmor(3); // 4J-PB - changing this to be per player //if (!minecraft->options->thirdPersonView && headGear != NULL && headGear->id == Tile::pumpkin_Id) renderPumpkin(screenWidth, screenHeight); @@ -302,7 +302,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) minecraft->textures->bindTexture(TN_GUI_GUI); // 4J was L"/gui/gui.png" MemSect(0); - shared_ptr inventory = minecraft->player->inventory; + std::shared_ptr inventory = minecraft->player->inventory; if(bTwoPlayerSplitscreen) { // need to apply scale factors depending on the mode @@ -700,7 +700,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) wchar_t formatted[10]; swprintf(formatted, 10, L"%d",minecraft->player->experienceLevel); - wstring str = formatted; + std::wstring str = formatted; int x = iWidthOffset + (screenWidth - font->width(str)) / 2; int y = screenHeight - iSafezoneYHalf - iTooltipsYOffset; // If we're in creative mode, we don't need to offset the XP display so much @@ -795,7 +795,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) if(minecraft->level->dimension->id==0) { - wstring wfeature[eTerrainFeature_Count]; + std::wstring wfeature[eTerrainFeature_Count]; wfeature[eTerrainFeature_Stronghold] = L"Stronghold: "; wfeature[eTerrainFeature_Mineshaft] = L"Mineshaft: "; @@ -806,7 +806,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { FEATURE_DATA *pFeatureData=app.m_vTerrainFeatures[i]; - wstring itemInfo = L"[" + _toString( pFeatureData->x*16 ) + L", " + _toString( pFeatureData->z*16 ) + L"] "; + std::wstring itemInfo = L"[" + _toString( pFeatureData->x*16 ) + L", " + _toString( pFeatureData->z*16 ) + L"] "; wfeature[pFeatureData->eTerrainFeature] += itemInfo; } @@ -940,7 +940,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) y+= iHeightOffset; } - wstring msg = guiMessages[iPad][i].string; + std::wstring msg = guiMessages[iPad][i].string; // 4J-PB - fill the black bar across the whole screen, otherwise it looks odd due to the safe area this->fill(0, y - 1, screenWidth/fScaleFactorWidth, y + 8, (alpha / 2) << 24); glEnable(GL_BLEND); @@ -1027,7 +1027,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // { // if (EnderDragonRenderer::bossInstance == NULL) return; // -// shared_ptr boss = EnderDragonRenderer::bossInstance; +// std::shared_ptr boss = EnderDragonRenderer::bossInstance; // EnderDragonRenderer::bossInstance = NULL; // // Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -1050,7 +1050,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // blit(xLeft, yo, 0, 79, progress, 5); // } // -// wstring msg = L"Boss health - NON LOCALISED"; +// std::wstring msg = L"Boss health - NON LOCALISED"; // font->drawShadow(msg, screenWidth / 2 - font->width(msg) / 2, yo - 10, 0xff00ff); // glColor4f(1, 1, 1, 1); // glBindTexture(GL_TEXTURE_2D, pMinecraft->textures->loadTexture(TN_GUI_ICONS) );//"/gui/icons.png")); @@ -1148,7 +1148,7 @@ void Gui::renderTp(float br, int w, int h) void Gui::renderSlot(int slot, int x, int y, float a) { - shared_ptr item = minecraft->player->inventory->items[slot]; + std::shared_ptr item = minecraft->player->inventory->items[slot]; if (item == NULL) return; float pop = item->popTime - a; @@ -1211,9 +1211,9 @@ void Gui::clearMessages(int iPad) } -void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage) +void Gui::addMessage(const std::wstring& _string,int iPad,bool bIsDeathMessage) { - wstring string = _string; // 4J - Take copy of input as it is const + std::wstring string = _string; // 4J - Take copy of input as it is const //int iScale=1; //if((minecraft->player->m_iScreenSection==C4JRender::VIEWPORT_TYPE_SPLIT_TOP) || @@ -1374,7 +1374,7 @@ float Gui::getJukeboxOpacity(int iPad) return alpha; } -void Gui::setNowPlaying(const wstring& string) +void Gui::setNowPlaying(const std::wstring& string) { // overlayMessageString = L"Now playing: " + string; overlayMessageString = app.GetString(IDS_NOWPLAYING) + string; @@ -1385,7 +1385,7 @@ void Gui::setNowPlaying(const wstring& string) void Gui::displayClientMessage(int messageId, int iPad) { //Language *language = Language::getInstance(); - wstring languageString = app.GetString(messageId);//language->getElement(messageId); + std::wstring languageString = app.GetString(messageId);//language->getElement(messageId); addMessage(languageString, iPad); } diff --git a/Minecraft.Client/UI/Gui.h b/Minecraft.Client/UI/Gui.h index 417620163..590947f0e 100644 --- a/Minecraft.Client/UI/Gui.h +++ b/Minecraft.Client/UI/Gui.h @@ -12,15 +12,15 @@ private: //static const int MAX_MESSAGE_WIDTH = 320; static const int m_iMaxMessageWidth = 280; static ItemRenderer *itemRenderer; - vector guiMessages[XUSER_MAX_COUNT]; + std::vector guiMessages[XUSER_MAX_COUNT]; Random *random; Minecraft *minecraft; public: - wstring selectedName; + std::wstring selectedName; private: int tickCount; - wstring overlayMessageString; + std::wstring overlayMessageString; int overlayMessageTime; bool animateOverlayMessageColor; @@ -50,16 +50,16 @@ private: public: void tick(); void clearMessages(int iPad=-1); - void addMessage(const wstring& string, int iPad,bool bIsDeathMessage=false); - void setNowPlaying(const wstring& string); + void addMessage(const std::wstring& string, int iPad,bool bIsDeathMessage=false); + void setNowPlaying(const std::wstring& string); void displayClientMessage(int messageId, int iPad); // 4J Added DWORD getMessagesCount(int iPad) { return (int)guiMessages[iPad].size(); } - wstring getMessage(int iPad, DWORD index) { return guiMessages[iPad].at(index).string; } + std::wstring getMessage(int iPad, DWORD index) { return guiMessages[iPad].at(index).string; } float getOpacity(int iPad, DWORD index); - wstring getJukeboxMessage(int iPad) { return overlayMessageString; } + std::wstring getJukeboxMessage(int iPad) { return overlayMessageString; } float getJukeboxOpacity(int iPad); // 4J Added diff --git a/Minecraft.Client/UI/GuiComponent.cpp b/Minecraft.Client/UI/GuiComponent.cpp index 3e3976703..8ffc8b4d4 100644 --- a/Minecraft.Client/UI/GuiComponent.cpp +++ b/Minecraft.Client/UI/GuiComponent.cpp @@ -95,12 +95,12 @@ GuiComponent::GuiComponent() blitOffset = 0; } -void GuiComponent::drawCenteredString(Font *font, const wstring& str, int x, int y, int color) +void GuiComponent::drawCenteredString(Font *font, const std::wstring& str, int x, int y, int color) { font->drawShadow(str, x - (font->width(str)) / 2, y, color); } -void GuiComponent::drawString(Font *font, const wstring& str, int x, int y, int color) +void GuiComponent::drawString(Font *font, const std::wstring& str, int x, int y, int color) { font->drawShadow(str, x, y, color); } diff --git a/Minecraft.Client/UI/GuiComponent.h b/Minecraft.Client/UI/GuiComponent.h index 7073db404..71324d0e3 100644 --- a/Minecraft.Client/UI/GuiComponent.h +++ b/Minecraft.Client/UI/GuiComponent.h @@ -1,6 +1,6 @@ #pragma once class Font; -using namespace std; + class GuiComponent { @@ -13,7 +13,7 @@ protected: void fillGradient(int x0, int y0, int x1, int y1, int col1, int col2); public: GuiComponent(); // 4J added - void drawCenteredString(Font *font, const wstring& str, int x, int y, int color); - void drawString(Font *font, const wstring& str, int x, int y, int color); + void drawCenteredString(Font *font, const std::wstring& str, int x, int y, int color); + void drawString(Font *font, const std::wstring& str, int x, int y, int color); void blit(int x, int y, int sx, int sy, int w, int h); }; diff --git a/Minecraft.Client/UI/GuiMessage.cpp b/Minecraft.Client/UI/GuiMessage.cpp index a7c33a0b3..b0c034f8f 100644 --- a/Minecraft.Client/UI/GuiMessage.cpp +++ b/Minecraft.Client/UI/GuiMessage.cpp @@ -1,7 +1,7 @@ #include "../Build/stdafx.h" #include "GuiMessage.h" -GuiMessage::GuiMessage(const wstring& string) +GuiMessage::GuiMessage(const std::wstring& string) { this->string = string; ticks = 0; diff --git a/Minecraft.Client/UI/GuiMessage.h b/Minecraft.Client/UI/GuiMessage.h index dac9a9e39..ad1403084 100644 --- a/Minecraft.Client/UI/GuiMessage.h +++ b/Minecraft.Client/UI/GuiMessage.h @@ -1,10 +1,10 @@ #pragma once -using namespace std; + class GuiMessage { public: - wstring string; + std::wstring string; int ticks; - GuiMessage(const wstring& string); + GuiMessage(const std::wstring& string); }; \ No newline at end of file diff --git a/Minecraft.Client/UI/Rect2i.cpp b/Minecraft.Client/UI/Rect2i.cpp index b56bfd7eb..70a07e8ca 100644 --- a/Minecraft.Client/UI/Rect2i.cpp +++ b/Minecraft.Client/UI/Rect2i.cpp @@ -21,10 +21,10 @@ Rect2i *Rect2i::intersect(const Rect2i *other) int x3 = x2 + other->getWidth(); int y3 = y2 + other->getHeight(); - xPos = max(x0, x2); - yPos = max(y0, y2); - width = max(0, min(x1, x3) - xPos); - height = max(0, min(y1, y3) - yPos); + xPos = std::max(x0, x2); + yPos = std::max(y0, y2); + width = std::max(0, std::min(x1, x3) - xPos); + height = std::max(0, std::min(y1, y3) - yPos); return this; } diff --git a/Minecraft.Client/UI/Screen.cpp b/Minecraft.Client/UI/Screen.cpp index 6aa70d4e0..56133bc12 100644 --- a/Minecraft.Client/UI/Screen.cpp +++ b/Minecraft.Client/UI/Screen.cpp @@ -38,13 +38,13 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) } } -wstring Screen::getClipboard() +std::wstring Screen::getClipboard() { // 4J - removed return NULL; } -void Screen::setClipboard(const wstring& str) +void Screen::setClipboard(const std::wstring& str) { // 4J - removed } diff --git a/Minecraft.Client/UI/Screen.h b/Minecraft.Client/UI/Screen.h index 50deb1d08..169b49f33 100644 --- a/Minecraft.Client/UI/Screen.h +++ b/Minecraft.Client/UI/Screen.h @@ -3,7 +3,7 @@ class Button; class GuiParticles; class Minecraft; -using namespace std; + class Screen : public GuiComponent { @@ -13,7 +13,7 @@ public: int width; int height; protected: - vector