Replace int loops with size_t and start work on overrides

This commit is contained in:
Chase Cooper 2026-03-07 20:01:30 -05:00
parent f45ec2b814
commit 98c5325b90
65 changed files with 294 additions and 268 deletions

View file

@ -521,7 +521,7 @@ void Chunk::rebuild()
else
{
// Easy case - nothing already existing for this chunk. Add them all in.
for( int i = 0; i < renderableTileEntities.size(); i++ )
for( size_t i = 0; i < renderableTileEntities.size(); i++ )
{
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
}
@ -826,7 +826,7 @@ void Chunk::rebuild_SPU()
}
// Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add
for( int i = 0; i < renderableTileEntities.size(); i++ )
for( size_t i = 0; i < renderableTileEntities.size(); i++ )
{
auto it2 = find( it->second.begin(), it->second.end(), renderableTileEntities[i] );
if( it2 == it->second.end() )
@ -842,7 +842,7 @@ void Chunk::rebuild_SPU()
else
{
// Easy case - nothing already existing for this chunk. Add them all in.
for( int i = 0; i < renderableTileEntities.size(); i++ )
for( size_t i = 0; i < renderableTileEntities.size(); i++ )
{
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
}

View file

@ -3898,7 +3898,7 @@ void ClientConnection::handleSetPlayerTeamPacket(shared_ptr<SetPlayerTeamPacket>
if (packet->method == SetPlayerTeamPacket::METHOD_ADD || packet->method == SetPlayerTeamPacket::METHOD_JOIN)
{
for (int i = 0; i < packet->players.size(); i++)
for (size_t i = 0; i < packet->players.size(); i++)
{
scoreboard->addPlayerToTeam(packet->players[i], team);
}
@ -3906,7 +3906,7 @@ void ClientConnection::handleSetPlayerTeamPacket(shared_ptr<SetPlayerTeamPacket>
if (packet->method == SetPlayerTeamPacket::METHOD_LEAVE)
{
for (int i = 0; i < packet->players.size(); i++)
for (size_t i = 0; i < packet->players.size(); i++)
{
scoreboard->removePlayerFromTeam(packet->players[i], team);
}
@ -3980,7 +3980,7 @@ void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId)
{
if (deferredEntityLinkPackets.empty()) return;
for (int i = 0; i < deferredEntityLinkPackets.size(); i++)
for (size_t i = 0; i < deferredEntityLinkPackets.size(); i++)
{
DeferredEntityLinkPacket *deferred = &deferredEntityLinkPackets[i];

View file

@ -108,23 +108,23 @@ class SoundEngine : public ConsoleSoundEngine
static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added
public:
SoundEngine();
virtual void destroy();
void destroy() override;
#ifdef _DEBUG
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 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<Mob> *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);
void play(int iSound, float x, float y, float z, float volume, float pitch) override;
void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) override;
void playUI(int iSound, float volume, float pitch) override;
void playMusicTick() override;
void updateMusicVolume(float fVal) override;
void updateSystemMusicPlaying(bool isPlaying) override;
void updateSoundEffectVolume(float fVal) override;
void init(Options *) override;
void tick(shared_ptr<Mob> *players, float a) override; // 4J - updated to take array of local players rather than single one
void add(const wstring& name, File *file) override;
void addMusic(const wstring& name, File *file) override;
void addStreaming(const wstring& name, File *file) override;
char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false) override;
bool isStreamingWavebankReady(); // 4J Added
int getMusicID(int iDomain);
int getMusicID(const wstring& name);
@ -138,7 +138,8 @@ private:
#ifdef __PS3__
int initAudioHardware(int iMinSpeakers);
#else
int initAudioHardware(int iMinSpeakers) { return iMinSpeakers;}
int initAudioHardware(int iMinSpeakers) override
{ return iMinSpeakers;}
#endif
int GetRandomishTrack(int iStart,int iEnd);

View file

@ -5564,7 +5564,7 @@ void CMinecraftApp::HandleDLC(DLCPack *pack)
// 4J Stu - I don't know why we handle more than one file here any more, however this doesn't seem to work with the PS4 patches
if(dlcFilenames.size() > 0) m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[0], pack);
#else
for(int i=0; i<dlcFilenames.size();i++)
for(size_t i=0; i<dlcFilenames.size();i++)
{
m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], pack);
}
@ -7190,7 +7190,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID)
{
unordered_map<string, DLC_INFO *>::iterator it= DLCInfo.begin();
for(int i=0;i<DLCInfo.size();i++)
for(size_t i=0;i<DLCInfo.size();i++)
{
if(((DLC_INFO *)it->second)->iConfig==iTPID)
{
@ -7392,7 +7392,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName)
unordered_map<wstring, DLC_INFO *>::iterator it= DLCInfo_Full.begin();
wstring wsProductName=pwchProductName;
for(int i=0;i<DLCInfo_Full.size();i++)
for(size_t i=0;i<DLCInfo_Full.size();i++)
{
DLC_INFO *pDLCInfo=(DLC_INFO *)it->second;
if(wsProductName==pDLCInfo->wsDisplayName)
@ -7697,8 +7697,8 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
{
PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new BYTE [dwDataBytes]);
int iSize=static_cast<int>(m_vBannedListA[iPad]->size());
for(int i=0;i<iSize;i++)
size_t iSize=m_vBannedListA[iPad]->size();
for(size_t i=0;i<iSize;i++)
{
PBANNEDLISTDATA pBannedListData =m_vBannedListA[iPad]->at(i);
@ -9809,7 +9809,7 @@ void CMinecraftApp::getLocale(vector<wstring> &vecWstrLocales)
locales.push_back(eMCLang_enUS);
locales.push_back(eMCLang_null);
for (int i=0; i<locales.size(); i++)
for (size_t i=0; i<locales.size(); i++)
{
eMCLang lang = locales.at(i);
vecWstrLocales.push_back( m_localeA[lang] );

View file

@ -87,7 +87,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
{
i++;
}
int iLast=static_cast<int>(creditValue.find_last_of(L" ", i));
size_t iLast=creditValue.find_last_of(L" ", i);
switch(XGetLanguage())
{
case XC_LANGUAGE_JAPANESE:
@ -96,7 +96,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
iLast = maximumChars;
break;
default:
iLast=static_cast<int>(creditValue.find_last_of(L" ", i));
iLast=creditValue.find_last_of(L" ", i);
break;
}
@ -198,7 +198,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
return true;
}
int DLCAudioFile::GetCountofType(DLCAudioFile::EAudioType eType)
int DLCAudioFile::GetCountofType(EAudioType eType)
{
return m_parameters[eType].size();
}

View file

@ -32,11 +32,11 @@ public:
DLCAudioFile(const wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes);
void addData(PBYTE pbData, DWORD dwBytes) override;
PBYTE getData(DWORD &dwBytes) override;
bool processDLCDataFile(PBYTE pbData, DWORD dwLength);
int GetCountofType(DLCAudioFile::EAudioType ptype);
int GetCountofType(EAudioType ptype);
wstring &GetSoundName(int iIndex);
private:
@ -49,6 +49,6 @@ private:
vector<wstring> 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 &paramName);
void addParameter(EAudioType type, EAudioParameterType ptype, const wstring &value);
EAudioParameterType getParameterType(const wstring &paramName);
};

View file

@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile
public:
DLCCapeFile(const wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes);
void addData(PBYTE pbData, DWORD dwBytes) override;
};

View file

@ -10,9 +10,9 @@ private:
public:
DLCColourTableFile(const wstring &path);
~DLCColourTableFile();
~DLCColourTableFile() override;
virtual void addData(PBYTE pbData, DWORD dwBytes);
void addData(PBYTE pbData, DWORD dwBytes) override;
ColourTable *getColourTable() { return m_colourTable; }
ColourTable *getColourTable() const { return m_colourTable; }
};

View file

@ -12,9 +12,9 @@ public:
DLCFile(DLCManager::EDLCType type, const wstring &path);
virtual ~DLCFile() {}
DLCManager::EDLCType getType() { return m_type; }
DLCManager::EDLCType getType() const { return m_type; }
wstring getPath() { return m_path; }
DWORD getSkinID() { return m_dwSkinId; }
DWORD getSkinID() const { return m_dwSkinId; }
virtual void addData(PBYTE pbData, DWORD dwBytes) {}
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return nullptr; }

View file

@ -10,6 +10,6 @@ private:
public:
DLCGameRulesFile(const wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes);
void addData(PBYTE pbData, DWORD dwBytes) override;
PBYTE getData(DWORD &dwBytes) override;
};

View file

@ -14,29 +14,52 @@ private:
bool m_hasData;
public:
virtual bool requiresTexturePack() {return m_bRequiresTexturePack;}
virtual UINT getRequiredTexturePackId() {return m_requiredTexturePackId;}
virtual 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";}
bool requiresTexturePack() override
{return m_bRequiresTexturePack;}
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;}
UINT getRequiredTexturePackId() override
{return m_requiredTexturePackId;}
wstring getDefaultSaveName() override
{return m_defaultSaveName;}
LPCWSTR getWorldName() override
{return m_worldName.c_str();}
LPCWSTR getDisplayName() override
{return m_displayName.c_str();}
wstring getGrfPath() override
{return L"GameRules.grf";}
void setRequiresTexturePack(bool x) override
{m_bRequiresTexturePack = x;}
void setRequiredTexturePackId(UINT x) override
{m_requiredTexturePackId = x;}
void setDefaultSaveName(const wstring &x) override
{m_defaultSaveName = x;}
void setWorldName(const wstring & x) override
{m_worldName = x;}
void setDisplayName(const wstring & x) override
{m_displayName = x;}
void setGrfPath(const wstring & x) override
{m_grfPath = x;}
LevelGenerationOptions *lgo;
public:
DLCGameRulesHeader(const wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes);
void addData(PBYTE pbData, DWORD dwBytes) override;
PBYTE getData(DWORD &dwBytes) override;
void setGrfData(PBYTE fData, DWORD fSize, StringTable *);
virtual bool ready() { return m_hasData; }
bool ready() override
{ return m_hasData; }
};

View file

@ -12,7 +12,7 @@ public:
DLCLocalisationFile(const 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);
void addData(PBYTE pbData, DWORD dwBytes) override;
StringTable *getStringTable() { return m_strings; }
};

View file

@ -373,7 +373,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL
bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack)
{
unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
unordered_map<int, EDLCParameterType> parameterMapping;
unsigned int uiCurrentByte=0;
// File format defined in the DLC_Creator
@ -405,8 +405,8 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
{
// Map DLC strings to application strings, then store the DLC index mapping to application index
wstring parameterName(static_cast<WCHAR *>(pParams->wchData));
DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName);
if( type != DLCManager::e_DLCParamType_Invalid )
EDLCParameterType type = getParameterType(parameterName);
if( type != e_DLCParamType_Invalid )
{
parameterMapping[pParams->dwType] = type;
}
@ -430,7 +430,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
for(unsigned int i=0;i<uiFileCount;i++)
{
DLCManager::EDLCType type = static_cast<DLCManager::EDLCType>(pFile->dwType);
EDLCType type = static_cast<EDLCType>(pFile->dwType);
DLCFile *dlcFile = nullptr;
DLCPack *dlcTexturePack = nullptr;
@ -485,7 +485,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
{
pack->addChildPack(dlcTexturePack);
if(dlcTexturePack->getDLCItemsCount(DLCManager::e_DLCType_Texture) > 0)
if(dlcTexturePack->getDLCItemsCount(e_DLCType_Texture) > 0)
{
Minecraft::GetInstance()->skins->addTexturePackFromDLC(dlcTexturePack, dlcTexturePack->GetPackId() );
}
@ -500,7 +500,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
// TODO - 4J Stu Remove the need for this vSkinNames vector, or manage it differently
switch(pFile->dwType)
{
case DLCManager::e_DLCType_Skin:
case e_DLCType_Skin:
app.vSkinNames.push_back((WCHAR *)pFile->wchFile);
break;
}
@ -515,13 +515,13 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
}
if( pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules) > 0
|| pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader) > 0)
if( pack->getDLCItemsCount(e_DLCType_GameRules) > 0
|| pack->getDLCItemsCount(e_DLCType_GameRulesHeader) > 0)
{
app.m_gameRules.loadGameRules(pack);
}
if(pack->getDLCItemsCount(DLCManager::e_DLCType_Audio) > 0)
if(pack->getDLCItemsCount(e_DLCType_Audio) > 0)
{
//app.m_Audio.loadAudioDetails(pack);
}
@ -580,7 +580,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
{
DWORD packId=0;
bool bPackIDSet=false;
unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
unordered_map<int, EDLCParameterType> parameterMapping;
unsigned int uiCurrentByte=0;
// File format defined in the DLC_Creator
@ -610,8 +610,8 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
{
// Map DLC strings to application strings, then store the DLC index mapping to application index
wstring parameterName(static_cast<WCHAR *>(pParams->wchData));
DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName);
if( type != DLCManager::e_DLCParamType_Invalid )
EDLCParameterType type = getParameterType(parameterName);
if( type != e_DLCParamType_Invalid )
{
parameterMapping[pParams->dwType] = type;
}
@ -634,7 +634,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
for(unsigned int i=0;i<uiFileCount;i++)
{
DLCManager::EDLCType type = static_cast<DLCManager::EDLCType>(pFile->dwType);
EDLCType type = static_cast<EDLCType>(pFile->dwType);
// Params
uiParameterCount=*(unsigned int *)pbTemp;

View file

@ -79,7 +79,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
{
i++;
}
int iLast=static_cast<int>(creditValue.find_last_of(L" ", i));
size_t iLast=creditValue.find_last_of(L" ", i);
switch(XGetLanguage())
{
case XC_LANGUAGE_JAPANESE:
@ -88,7 +88,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
iLast = maximumChars;
break;
default:
iLast=static_cast<int>(creditValue.find_last_of(L" ", i));
iLast=creditValue.find_last_of(L" ", i);
break;
}

View file

@ -17,11 +17,11 @@ public:
DLCSkinFile(const wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes);
virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value);
void addData(PBYTE pbData, DWORD dwBytes) override;
void addParameter(DLCManager::EDLCParameterType type, const wstring &value) override;
virtual wstring getParameterAsString(DLCManager::EDLCParameterType type);
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
wstring getParameterAsString(DLCManager::EDLCParameterType type) override;
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
vector<SKIN_BOX *> *getAdditionalBoxes();
int getAdditionalBoxesCount();
unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask;}

View file

@ -14,11 +14,11 @@ private:
public:
DLCTextureFile(const wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes);
void addData(PBYTE pbData, DWORD dwBytes) override;
PBYTE getData(DWORD &dwBytes) override;
virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value);
void addParameter(DLCManager::EDLCParameterType type, const wstring &value) override;
virtual wstring getParameterAsString(DLCManager::EDLCParameterType type);
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
wstring getParameterAsString(DLCManager::EDLCParameterType type) override;
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
};

View file

@ -10,11 +10,11 @@ private:
public:
DLCUIDataFile(const wstring &path);
~DLCUIDataFile();
~DLCUIDataFile() override;
using DLCFile::addData;
using DLCFile::addParameter;
virtual void addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData = false);
virtual PBYTE getData(DWORD &dwBytes);
PBYTE getData(DWORD &dwBytes) override;
};

View file

@ -243,7 +243,7 @@ void IUIScene_TradingMenu::updateDisplay()
// 4J-PB - need to get the villager type here
wsTemp = app.GetString(IDS_VILLAGER_OFFERS_ITEM);
wsTemp = replaceAll(wsTemp,L"{*VILLAGER_TYPE*}",m_merchant->getDisplayName());
int iPos=wsTemp.find(L"%s");
size_t iPos=wsTemp.find(L"%s");
wsTemp.replace(iPos,2,activeRecipe->getSellItem()->getHoverName());
setTitle(wsTemp.c_str());

View file

@ -219,13 +219,13 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
m_iconItem = nullptr;
wstring openTag(L"{*ICON*}");
wstring closeTag(L"{*/ICON*}");
int iconTagStartPos = static_cast<int>(temp.find(openTag));
int iconStartPos = iconTagStartPos + static_cast<int>(openTag.length());
if( iconTagStartPos > 0 && iconStartPos < static_cast<int>(temp.length()) )
size_t iconTagStartPos = temp.find(openTag);
size_t iconStartPos = iconTagStartPos + openTag.length();
if( iconTagStartPos > 0 && iconStartPos < temp.length() )
{
int iconEndPos = static_cast<int>(temp.find(closeTag, iconStartPos));
size_t iconEndPos = temp.find(closeTag, iconStartPos);
if(iconEndPos > iconStartPos && iconEndPos < static_cast<int>(temp.length()) )
if(iconEndPos > iconStartPos && iconEndPos < temp.length() )
{
wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos);
@ -341,13 +341,13 @@ wstring UIComponent_TutorialPopup::_SetImage(wstring &desc)
wstring openTag(L"{*IMAGE*}");
wstring closeTag(L"{*/IMAGE*}");
int imageTagStartPos = (int)desc.find(openTag);
int imageStartPos = imageTagStartPos + (int)openTag.length();
if( imageTagStartPos > 0 && imageStartPos < (int)desc.length() )
size_t imageTagStartPos = desc.find(openTag);
size_t imageStartPos = imageTagStartPos + openTag.length();
if( imageTagStartPos > 0 && imageStartPos < desc.length() )
{
int imageEndPos = (int)desc.find( closeTag, imageStartPos );
size_t imageEndPos = desc.find( closeTag, imageStartPos );
if(imageEndPos > imageStartPos && imageEndPos < (int)desc.length() )
if(imageEndPos > imageStartPos && imageEndPos < desc.length() )
{
wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos);
m_image.SetImagePath( id.c_str() );

View file

@ -102,7 +102,7 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport)
bool UILayer::IsSceneInStack(EUIScene scene)
{
bool inStack = false;
for(int i = m_sceneStack.size() - 1;i >= 0; --i)
for(size_t i = (int)m_sceneStack.size() - 1;i >= 0; --i)
{
if(m_sceneStack[i]->getSceneType() == scene)
{
@ -118,7 +118,7 @@ bool UILayer::HasFocus(int iPad)
bool hasFocus = false;
if(m_hasFocus)
{
for(int i = m_sceneStack.size() - 1;i >= 0; --i)
for(size_t i = (int)m_sceneStack.size() - 1;i >= 0; --i)
{
if(m_sceneStack[i]->stealsFocus() )
{
@ -146,7 +146,7 @@ bool UILayer::hidesLowerScenes()
}
if(!hidesScenes && !m_sceneStack.empty())
{
for(int i = m_sceneStack.size() - 1;i >= 0; --i)
for(size_t i = (int)m_sceneStack.size() - 1;i >= 0; --i)
{
if(m_sceneStack[i]->hidesLowerScenes())
{
@ -897,7 +897,7 @@ void UILayer::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
// Returns the first scene of given type if it exists, nullptr otherwise
UIScene *UILayer::FindScene(EUIScene sceneType)
{
for (int i = 0; i < m_sceneStack.size(); i++)
for (size_t i = 0; i < m_sceneStack.size(); i++)
{
if (m_sceneStack[i]->getSceneType() == sceneType)
{

View file

@ -48,8 +48,8 @@ UIScene_EULA::UIScene_EULA(int iPad, void *initData, UILayer *parentLayer) : UIS
#endif
vector<wstring> paragraphs;
int lastIndex = 0;
for ( int index = EULA.find(L"\r\n", lastIndex, 2);
size_t lastIndex = 0;
for ( size_t index = EULA.find(L"\r\n", lastIndex, 2);
index != wstring::npos;
index = EULA.find(L"\r\n", lastIndex, 2)
)

View file

@ -300,8 +300,8 @@ void UIScene_HowToPlay::StartPage( EHowToPlayPage ePage )
finalText = startTags + finalText;
vector<wstring> paragraphs;
int lastIndex = 0;
for ( int index = finalText.find(L"\r\n", lastIndex, 2);
size_t lastIndex = 0;
for ( size_t index = finalText.find(L"\r\n", lastIndex, 2);
index != wstring::npos;
index = finalText.find(L"\r\n", lastIndex, 2)
)

View file

@ -19,8 +19,8 @@ UIScene_NewUpdateMessage::UIScene_NewUpdateMessage(int iPad, void *initData, UIL
message=app.FormatHTMLString(m_iPad,message);
vector<wstring> paragraphs;
int lastIndex = 0;
for ( int index = message.find(L"\r\n", lastIndex, 2);
size_t lastIndex = 0;
for ( size_t index = message.find(L"\r\n", lastIndex, 2);
index != wstring::npos;
index = message.find(L"\r\n", lastIndex, 2)
)

View file

@ -89,8 +89,8 @@ HRESULT CXuiSceneAnvil::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValue
// strip leading spaces
wstring b;
int start = static_cast<int>(newValue.find_first_not_of(L" "));
int end = static_cast<int>(newValue.find_last_not_of(L" "));
size_t start = newValue.find_first_not_of(L" ");
size_t end = newValue.find_last_not_of(L" ");
if( start == wstring::npos )
{
@ -99,7 +99,7 @@ HRESULT CXuiSceneAnvil::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValue
}
else
{
if( end == wstring::npos ) end = static_cast<int>(newValue.size())-1;
if( end == wstring::npos ) end = newValue.size() - 1;
b = newValue.substr(start,(end-start)+1);
newValue=b;
}

View file

@ -57,13 +57,13 @@ HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
noNoiseString = app.FormatHTMLString(m_iPad, noNoiseString, 0xff000000);
Random random(8124371);
int found=static_cast<int>(noNoiseString.find_first_of(L"{"));
int length;
size_t found=noNoiseString.find_first_of(L"{");
size_t length;
while (found!=string::npos)
{
length = random.nextInt(4) + 3;
m_noiseLengths.push_back(length);
found=static_cast<int>(noNoiseString.find_first_of(L"{", found + 1));
found=noNoiseString.find_first_of(L"{", found + 1);
}
Minecraft *pMinecraft = Minecraft::GetInstance();

View file

@ -298,13 +298,13 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS
{
wstring openTag(L"{*ICON*}");
wstring closeTag(L"{*/ICON*}");
int iconTagStartPos = static_cast<int>(temp.find(openTag));
int iconStartPos = iconTagStartPos + static_cast<int>(openTag.length());
if( iconTagStartPos > 0 && iconStartPos < static_cast<int>(temp.length()) )
size_t iconTagStartPos = temp.find(openTag);
size_t iconStartPos = iconTagStartPos + openTag.length();
if( iconTagStartPos > 0 && iconStartPos < temp.length() )
{
int iconEndPos = static_cast<int>(temp.find(closeTag, iconStartPos));
size_t iconEndPos = temp.find(closeTag, iconStartPos);
if(iconEndPos > iconStartPos && iconEndPos < static_cast<int>(temp.length()) )
if(iconEndPos > iconStartPos && iconEndPos < temp.length() )
{
wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos);
@ -443,13 +443,13 @@ wstring CScene_TutorialPopup::_SetImage(wstring &desc)
wstring openTag(L"{*IMAGE*}");
wstring closeTag(L"{*/IMAGE*}");
int imageTagStartPos = static_cast<int>(desc.find(openTag));
int imageStartPos = imageTagStartPos + static_cast<int>(openTag.length());
if( imageTagStartPos > 0 && imageStartPos < static_cast<int>(desc.length()) )
size_t imageTagStartPos = desc.find(openTag);
size_t imageStartPos = imageTagStartPos + openTag.length();
if( imageTagStartPos > 0 && imageStartPos < desc.length() )
{
int imageEndPos = static_cast<int>(desc.find(closeTag, imageStartPos));
size_t imageEndPos = desc.find(closeTag, imageStartPos);
if(imageEndPos > imageStartPos && imageEndPos < static_cast<int>(desc.length()) )
if(imageEndPos > imageStartPos && imageEndPos < desc.length() )
{
wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos);
m_image.SetImagePath( id.c_str() );

View file

@ -892,7 +892,7 @@ void DQRNetworkManager::Tick_VoiceChat()
#endif
// If we have to inform the chat integration layer of any players that have joined, do that now
EnterCriticalSection(&m_csVecChatPlayers);
for( int i = 0; i < m_vecChatPlayersJoined.size(); i++ )
for( size_t i = 0; i < m_vecChatPlayersJoined.size(); i++ )
{
int idx = m_vecChatPlayersJoined[i];
if( m_chat )
@ -1509,12 +1509,12 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
}
memcpy(&m_roomSyncData, pNewSyncData, sizeof(m_roomSyncData));
for( int i = 0; i < tempPlayers.size(); i++ )
for( size_t i = 0; i < tempPlayers.size(); i++ )
{
m_listener->HandlePlayerLeaving(tempPlayers[i]);
delete tempPlayers[i];
}
for( int i = 0; i < newPlayers.size(); i++ )
for( size_t i = 0; i < newPlayers.size(); i++ )
{
m_listener->HandlePlayerJoined(newPlayers[i]); // For clients, this is where we get notified of local and remote players joining
}
@ -1592,7 +1592,7 @@ void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int ses
}
m_roomSyncData.playerCount = iWriteIdx;
for( int i = 0; i < removedPlayers.size(); i++ )
for( size_t i = 0; i < removedPlayers.size(); i++ )
{
m_listener->HandlePlayerLeaving(removedPlayers[i]);
delete removedPlayers[i];
@ -1623,7 +1623,7 @@ void DQRNetworkManager::RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer)
}
m_roomSyncData.playerCount = iWriteIdx;
for( int i = 0; i < removedPlayers.size(); i++ )
for( size_t i = 0; i < removedPlayers.size(); i++ )
{
m_listener->HandlePlayerLeaving(removedPlayers[i]);
delete removedPlayers[i];

View file

@ -602,7 +602,7 @@ bool Font::AllCharactersValid(const wstring &str)
continue;
}
int index = SharedConstants::acceptableLetters.find(c);
size_t index = SharedConstants::acceptableLetters.find(c);
if ((c != ' ') && !(index > 0 && !enforceUnicodeSheet))
{

View file

@ -28,6 +28,7 @@
#include "..\Minecraft.World\net.minecraft.world.h"
#include "..\Minecraft.World\LevelChunk.h"
#include "..\Minecraft.World\Biome.h"
#include <Common/UI/UI.h>
ResourceLocation Gui::PUMPKIN_BLUR_LOCATION = ResourceLocation(TN__BLUR__MISC_PUMPKINBLUR);
@ -87,7 +88,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
int quickSelectHeight=22;
float fScaleFactorWidth=1.0f,fScaleFactorHeight=1.0f;
bool bTwoPlayerSplitscreen=false;
currentGuiScaleFactor = (float) guiScale; // Keep static copy of scale so we know how gui coordinates map to physical pixels - this is also affected by the viewport
currentGuiScaleFactor = static_cast<float>(guiScale); // Keep static copy of scale so we know how gui coordinates map to physical pixels - this is also affected by the viewport
switch(guiScale)
{
@ -117,7 +118,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
iSafezoneYHalf = splitYOffset;
iSafezoneTopYHalf = screenHeight/10;
fScaleFactorWidth=0.5f;
iWidthOffset=(int)((float)screenWidth*(1.0f - fScaleFactorWidth));
iWidthOffset=static_cast<int>((float)screenWidth * (1.0f - fScaleFactorWidth));
iTooltipsYOffset=44;
bTwoPlayerSplitscreen=true;
currentGuiScaleFactor *= 0.5f;
@ -127,7 +128,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
iSafezoneYHalf = splitYOffset + screenHeight/10;// 5% (need to treat the whole screen is 2x this screen)
iSafezoneTopYHalf = 0;
fScaleFactorWidth=0.5f;
iWidthOffset=(int)((float)screenWidth*(1.0f - fScaleFactorWidth));
iWidthOffset=static_cast<int>((float)screenWidth * (1.0f - fScaleFactorWidth));
iTooltipsYOffset=44;
bTwoPlayerSplitscreen=true;
currentGuiScaleFactor *= 0.5f;
@ -697,7 +698,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
#endif
glPushMatrix();
glTranslatef((float)xo, (float)yo, 50);
glTranslatef(static_cast<float>(xo), static_cast<float>(yo), 50);
float ss = 12;
glScalef(-ss, ss, ss);
glRotatef(180, 0, 0, 1);
@ -806,14 +807,14 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
glDisable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
int timer = minecraft->player->getSleepTimer();
float amount = (float) timer / (float) Player::SLEEP_DURATION;
float amount = static_cast<float>(timer) / static_cast<float>(Player::SLEEP_DURATION);
if (amount > 1)
{
// waking up
amount = 1.0f - ((float) (timer - Player::SLEEP_DURATION) / (float) Player::WAKE_UP_DURATION);
amount = 1.0f - (static_cast<float>(timer - Player::SLEEP_DURATION) / static_cast<float>(Player::WAKE_UP_DURATION));
}
int color = (int) (220.0f * amount) << 24 | (0x101020);
int color = static_cast<int>(220.0f * amount) << 24 | (0x101020);
fill(0, 0, screenWidth/fScaleFactorWidth, screenHeight/fScaleFactorHeight, color);
glEnable(GL_ALPHA_TEST);
glEnable(GL_DEPTH_TEST);
@ -825,9 +826,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
glDisable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
int timer = minecraft->player->getDeathFadeTimer();
float amount = (float) timer / (float) Player::DEATHFADE_DURATION;
float amount = static_cast<float>(timer) / static_cast<float>(Player::DEATHFADE_DURATION);
int color = (int) (220.0f * amount) << 24 | (0x200000);
int color = static_cast<int>(220.0f * amount) << 24 | (0x200000);
fill(0, 0, screenWidth/fScaleFactorWidth, screenHeight/fScaleFactorHeight, color);
glEnable(GL_ALPHA_TEST);
glEnable(GL_DEPTH_TEST);
@ -850,15 +851,15 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
const int debugTop = 1;
const float maxContentWidth = 1200.f;
const float maxContentHeight = 420.f;
float scale = (float)(screenWidth - debugLeft - 8) / maxContentWidth;
float scaleV = (float)(screenHeight - debugTop - 80) / maxContentHeight;
float scale = static_cast<float>(screenWidth - debugLeft - 8) / maxContentWidth;
float scaleV = static_cast<float>(screenHeight - debugTop - 80) / maxContentHeight;
if (scaleV < scale) scale = scaleV;
if (scale > 1.f) scale = 1.f;
if (scale < 0.5f) scale = 0.5f;
glPushMatrix();
glTranslatef((float)debugLeft, (float)debugTop, 0.f);
glTranslatef(static_cast<float>(debugLeft), static_cast<float>(debugTop), 0.f);
glScalef(scale, scale, 1.f);
glTranslatef((float)-debugLeft, (float)-debugTop, 0.f);
glTranslatef(static_cast<float>(-debugLeft), static_cast<float>(-debugTop), 0.f);
vector<wstring> lines;
@ -984,11 +985,11 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
wfeature[eTerrainFeature_Village] = L"Village: ";
wfeature[eTerrainFeature_Ravine] = L"Ravine: ";
float maxW = (float)(screenWidth - debugLeft - 8) / scale;
float maxWForContent = maxW - (float)font->width(L"...");
float maxW = static_cast<float>(screenWidth - debugLeft - 8) / scale;
float maxWForContent = maxW - static_cast<float>(font->width(L"..."));
bool truncated[eTerrainFeature_Count] = {};
for (int i = 0; i < (int)app.m_vTerrainFeatures.size(); i++)
for (size_t i = 0; i < app.m_vTerrainFeatures.size(); i++)
{
FEATURE_DATA *pFeatureData = app.m_vTerrainFeatures[i];
int type = pFeatureData->eTerrainFeature;
@ -1014,7 +1015,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
}
lines.push_back(L""); // Add a spacer line
for (int i = eTerrainFeature_Stronghold; i <= (int)eTerrainFeature_Ravine; i++)
for (int i = eTerrainFeature_Stronghold; i <= static_cast<int>(eTerrainFeature_Ravine); i++)
{
lines.push_back(wfeature[i]);
}
@ -1241,10 +1242,10 @@ void Gui::renderPumpkin(int w, int h)
MemSect(0);
Tesselator *t = Tesselator::getInstance();
t->begin();
t->vertexUV((float)(0), (float)( h), (float)( -90), (float)( 0), (float)( 1));
t->vertexUV((float)(w), (float)( h), (float)( -90), (float)( 1), (float)( 1));
t->vertexUV((float)(w), (float)( 0), (float)( -90), (float)( 1), (float)( 0));
t->vertexUV((float)(0), (float)( 0), (float)( -90), (float)( 0), (float)( 0));
t->vertexUV(static_cast<float>(0), static_cast<float>(h), static_cast<float>(-90), static_cast<float>(0), static_cast<float>(1));
t->vertexUV(static_cast<float>(w), static_cast<float>(h), static_cast<float>(-90), static_cast<float>(1), static_cast<float>(1));
t->vertexUV(static_cast<float>(w), static_cast<float>(0), static_cast<float>(-90), static_cast<float>(1), static_cast<float>(0));
t->vertexUV(static_cast<float>(0), static_cast<float>(0), static_cast<float>(-90), static_cast<float>(0), static_cast<float>(0));
t->end();
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
@ -1305,10 +1306,10 @@ void Gui::renderTp(float br, int w, int h)
float v1 = slot->getV1();
Tesselator *t = Tesselator::getInstance();
t->begin();
t->vertexUV((float)(0), (float)( h), (float)( -90), (float)( u0), (float)( v1));
t->vertexUV((float)(w), (float)( h), (float)( -90), (float)( u1), (float)( v1));
t->vertexUV((float)(w), (float)( 0), (float)( -90), (float)( u1), (float)( v0));
t->vertexUV((float)(0), (float)( 0), (float)( -90), (float)( u0), (float)( v0));
t->vertexUV(static_cast<float>(0), static_cast<float>(h), static_cast<float>(-90), (float)( u0), (float)( v1));
t->vertexUV(static_cast<float>(w), static_cast<float>(h), static_cast<float>(-90), (float)( u1), (float)( v1));
t->vertexUV(static_cast<float>(w), static_cast<float>(0), static_cast<float>(-90), (float)( u1), (float)( v0));
t->vertexUV(static_cast<float>(0), static_cast<float>(0), static_cast<float>(-90), (float)( u0), (float)( v0));
t->end();
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
@ -1326,10 +1327,10 @@ void Gui::renderSlot(int slot, int x, int y, float a)
if (pop > 0)
{
glPushMatrix();
float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION;
glTranslatef((float)(x + 8), (float)(y + 12), 0);
float squeeze = 1 + pop / static_cast<float>(Inventory::POP_TIME_DURATION);
glTranslatef(static_cast<float>(x + 8), static_cast<float>(y + 12), 0);
glScalef(1 / squeeze, (squeeze + 1) / 2, 1);
glTranslatef((float)-(x + 8), (float)-(y + 12), 0);
glTranslatef(static_cast<float>(-(x + 8)), static_cast<float>(-(y + 12)), 0);
}
itemRenderer->renderAndDecorateItem(minecraft->font, minecraft->textures, item, x, y);
@ -1468,7 +1469,7 @@ void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage)
{
i++;
}
int iLast=(int)string.find_last_of(L" ",i);
size_t iLast=string.find_last_of(L" ",i);
switch(XGetLanguage())
{
case XC_LANGUAGE_JAPANESE:
@ -1477,7 +1478,7 @@ void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage)
iLast = maximumChars;
break;
default:
iLast=(int)string.find_last_of(L" ",i);
iLast=string.find_last_of(L" ",i);
break;
}
@ -1537,7 +1538,7 @@ float Gui::getOpacity(int iPad, DWORD index)
float Gui::getJukeboxOpacity(int iPad)
{
float t = overlayMessageTime - lastTickA;
int alpha = (int) (t * 256 / 20);
int alpha = static_cast<int>(t * 256 / 20);
if (alpha > 255) alpha = 255;
alpha /= 255;
@ -1571,7 +1572,7 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc
glClear(GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, (float)minecraft->width, (float)height, 0, 1000, 3000);
glOrtho(0, static_cast<float>(minecraft->width), static_cast<float>(height), 0, 1000, 3000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -2000);
@ -1602,8 +1603,8 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc
int64_t aVal = dataA[i] / dataAScale;
t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), (float)( 0));
t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), (float)( 0));
t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), static_cast<float>(0));
t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), static_cast<float>(0));
}
if( dataB != NULL )
@ -1619,8 +1620,8 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc
int64_t bVal = dataB[i] / dataBScale;
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height - bVal + 0.5f), (float)( 0));
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height + 0.5f), (float)( 0));
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height - bVal + 0.5f), static_cast<float>(0));
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height + 0.5f), static_cast<float>(0));
}
}
t->end();
@ -1635,7 +1636,7 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64
glClear(GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, (float)minecraft->width, (float)height, 0, 1000, 3000);
glOrtho(0, static_cast<float>(minecraft->width), static_cast<float>(height), 0, 1000, 3000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -2000);
@ -1664,15 +1665,15 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64
if( thisVal > 0 )
{
float vary = (float)source/dataSources;
float vary = static_cast<float>(source)/dataSources;
int fColour = floor(vary * 0xffffff);
int colour = 0xff000000 + fColour;
//printf("Colour is %x\n", colour);
t->color(colour);
t->vertex((float)(i + 0.5f), (float)( height - topVal - thisVal + 0.5f), (float)( 0));
t->vertex((float)(i + 0.5f), (float)( height - topVal + 0.5f), (float)( 0));
t->vertex((float)(i + 0.5f), (float)( height - topVal - thisVal + 0.5f), static_cast<float>(0));
t->vertex((float)(i + 0.5f), (float)( height - topVal + 0.5f), static_cast<float>(0));
topVal += thisVal;
}
@ -1683,8 +1684,8 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64
{
t->color(0xff000000);
t->vertex((float)(0 + 0.5f), (float)( height - (horiz*100) + 0.5f), (float)( 0));
t->vertex((float)(dataLength + 0.5f), (float)( height - (horiz*100) + 0.5f), (float)( 0));
t->vertex((float)(0 + 0.5f), (float)( height - (horiz*100) + 0.5f), static_cast<float>(0));
t->vertex((float)(dataLength + 0.5f), (float)( height - (horiz*100) + 0.5f), static_cast<float>(0));
}
}
t->end();

View file

@ -55,7 +55,7 @@ void JoinMultiplayerScreen::buttonClicked(Button *button)
vector<wstring> parts = stringSplit(ip,L'L');
if (ip[0]==L'[')
{
int pos = static_cast<int>(ip.find(L"]"));
size_t pos = ip.find(L"]");
if (pos != wstring::npos)
{
wstring path = ip.substr(1, pos);

View file

@ -389,7 +389,7 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel *level)
void LevelRenderer::AddDLCSkinsToMemTextures()
{
for(int i=0;i<app.vSkinNames.size();i++)
for(size_t i=0;i<app.vSkinNames.size();i++)
{
textures->addMemTexture(app.vSkinNames[i], new MobSkinMemTextureProcessor());
}

View file

@ -2178,7 +2178,7 @@ void MinecraftServer::tick()
// 4J - removed
#if 0
for (int i = 0; i < tickables.size(); i++) {
for (size_t i = 0; i < tickables.size(); i++) {
tickables.get(i)-tick();
}
#endif
@ -2275,7 +2275,7 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player)
if( s_hasSentEnoughPackets ) return false;
if( player == nullptr ) return false;
for( int i = 0; i < s_sentTo.size(); i++ )
for( size_t i = 0; i < s_sentTo.size(); i++ )
{
if( s_sentTo[i]->IsSameSystem(player) )
{

View file

@ -422,7 +422,7 @@ void Options::load()
// 4J - removed try/catch
// try {
wstring cmds[2];
int splitpos = static_cast<int>(line.find(L":"));
size_t splitpos = line.find(L":");
if( splitpos == wstring::npos )
{
cmds[0] = line;

View file

@ -685,7 +685,7 @@ bool SQRNetworkManager_Orbis::FriendRoomManagerSearch()
}
// Free up any external data that we received from the previous search
for( int i = 0; i < m_aFriendSearchResults.size(); i++ )
for( size_t i = 0; i < m_aFriendSearchResults.size(); i++ )
{
if(m_aFriendSearchResults[i].m_RoomExtDataReceived)
free(m_aFriendSearchResults[i].m_RoomExtDataReceived);
@ -3358,7 +3358,7 @@ void SQRNetworkManager_Orbis::ProcessSignallingEvent(SceNpMatching2ContextId ctx
void SQRNetworkManager_Orbis::SignallingEventsTick()
{
EnterCriticalSection(&m_signallingEventListCS);
for(int i=0;i<m_signallingEventList.size(); i++)
for(size_t i=0;i<m_signallingEventList.size(); i++)
{
SignallingEvent& ev = m_signallingEventList[i];
ProcessSignallingEvent(ev.ctxId, ev.roomId, ev.peerMemberId, ev.event, ev.error_code);

View file

@ -665,7 +665,7 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch
// find the DLC
for(int i=0;i<m_ProductListCategoriesC;i++)
{
for(int j=0;j<m_ProductListA[i].size();j++)
for(size_t j=0;j<m_ProductListA[i].size();j++)
{
std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
for ( SonyCommerce::ProductInfo& : *pProductList )

View file

@ -1501,7 +1501,7 @@ uint8_t * AddRichPresenceString(int iID)
void FreeRichPresenceStrings()
{
uint8_t *strUtf8;
for(int i=0;i<vRichPresenceStrings.size();i++)
for(size_t i=0;i<vRichPresenceStrings.size();i++)
{
strUtf8=vRichPresenceStrings.at(i);
free(strUtf8);

View file

@ -766,7 +766,7 @@ int SonyCommerce_PS3::checkout(CheckoutInputParams &params)
}
}
for (int i = 0; i < params.skuIds.size(); i++) {
for (size_t i = 0; i < params.skuIds.size(); i++) {
skuIdsTemp[i] = (const char *)(*iter);
iter++;
}
@ -794,7 +794,7 @@ int SonyCommerce_PS3::downloadList(DownloadListInputParams &params)
}
}
for (int i = 0; i < params.skuIds.size(); i++) {
for (size_t i = 0; i < params.skuIds.size(); i++) {
skuIdsTemp[i] = (const char *)(*iter);
iter++;
}

View file

@ -769,7 +769,7 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch
// find the DLC
for(int i=0;i<m_ProductListCategoriesC;i++)
{
for(int j=0;j<m_ProductListA[i].size();j++)
for(size_t j=0;j<m_ProductListA[i].size();j++)
{
std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
auto itEnd = pProductList->end();
@ -842,7 +842,7 @@ bool CConsoleMinecraftApp::DLCAlreadyPurchased(char *pchTitle)
// find the DLC
for(int i=0;i<m_ProductListCategoriesC;i++)
{
for(int j=0;j<m_ProductListA[i].size();j++)
for(size_t j=0;j<m_ProductListA[i].size();j++)
{
std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
auto itEnd = pProductList->end();

View file

@ -1379,7 +1379,7 @@ uint8_t * AddRichPresenceString(int iID)
void FreeRichPresenceStrings()
{
uint8_t *strUtf8;
for(int i=0;i<vRichPresenceStrings.size();i++)
for(size_t i=0;i<vRichPresenceStrings.size();i++)
{
strUtf8=vRichPresenceStrings.at(i);
free(strUtf8);

View file

@ -388,7 +388,7 @@ bool SQRNetworkManager_AdHoc_Vita::CreateMatchingContext(bool bServer /*= false*
// Free up any external data that we received from the previous search
for( int i = 0; i < m_aFriendSearchResults.size(); i++ )
for( size_t i = 0; i < m_aFriendSearchResults.size(); i++ )
{
if(m_aFriendSearchResults[i].m_RoomExtDataReceived)
free(m_aFriendSearchResults[i].m_RoomExtDataReceived);
@ -1086,7 +1086,7 @@ void SQRNetworkManager_AdHoc_Vita::ResetToIdle()
{
memberIDs.push_back(m_aRoomSlotPlayers[i]->m_roomMemberId);
}
for(int i=0;i<memberIDs.size();i++)
for(size_t i=0;i<memberIDs.size();i++)
{
if(memberIDs[i] != m_hostMemberId)
RemoveRemotePlayersAndSync(memberIDs[i], 15);
@ -1137,7 +1137,7 @@ bool SQRNetworkManager_AdHoc_Vita::JoinRoom(SceNetInAddr netAddr, int localPlaye
}
else
{
for(int i=0;i<m_aFriendSearchResults.size();i++)
for(size_t i=0;i<m_aFriendSearchResults.size();i++)
{
if(m_aFriendSearchResults[i].m_netAddr.s_addr == netAddr.s_addr)
{
@ -1807,7 +1807,7 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe
// check we don't have this already
int currIndex = -1;
bool bChanged = false;
for(int i=0; i<manager->m_aFriendSearchResults.size(); i++)
for(size_t i=0; i<manager->m_aFriendSearchResults.size(); i++)
{
if(manager->m_aFriendSearchResults[i].m_netAddr.s_addr == peer->s_addr)
{
@ -2852,7 +2852,7 @@ int SQRNetworkManager_AdHoc_Vita::GetRemovedMask(int newMask, int oldMask)
void SQRNetworkManager_AdHoc_Vita::GetExtDataForRoom( SceNpMatching2RoomId roomId, void *extData, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam )
{
for(int i=0;i<m_aFriendSearchResults.size();i++)
for(size_t i=0;i<m_aFriendSearchResults.size();i++)
{
if(m_aFriendSearchResults[i].m_netAddr.s_addr == roomId)
{

View file

@ -608,7 +608,7 @@ bool SQRNetworkManager_Vita::FriendRoomManagerSearch()
}
// Free up any external data that we received from the previous search
for( int i = 0; i < m_aFriendSearchResults.size(); i++ )
for( size_t i = 0; i < m_aFriendSearchResults.size(); i++ )
{
if(m_aFriendSearchResults[i].m_RoomExtDataReceived)
free(m_aFriendSearchResults[i].m_RoomExtDataReceived);

View file

@ -378,7 +378,7 @@ uint32_t lastReadFrameCnt = 0;
void PrintAllOutputVoiceStates( std::vector<SQRVoiceConnection*>& connections)
{
for(int rIdx=0;rIdx<connections.size(); rIdx++)
for(size_t rIdx=0;rIdx<connections.size(); rIdx++)
{
SQRVoiceConnection* pVoice = connections[rIdx];
SceVoiceBasePortInfo portInfo;
@ -565,7 +565,7 @@ void SonyVoiceChat_Vita::sendAllVoiceData()
EnterCriticalSection(&m_csRemoteConnections);
// send this packet out to all our remote connections
for(int rIdx=0;rIdx<m_remoteConnections.size(); rIdx++)
for(size_t rIdx=0;rIdx<m_remoteConnections.size(); rIdx++)
{
SQRVoiceConnection* pVoice = m_remoteConnections[rIdx];
if(pVoice->m_bConnected)
@ -668,7 +668,7 @@ void SonyVoiceChat_Vita::tick()
EnterCriticalSection(&m_csRemoteConnections);
for(int i=m_remoteConnections.size()-1;i>=0;i--)
for(size_t i=m_remoteConnections.size()-1;i>=0;i--)
{
if(m_remoteConnections[i]->m_bFlaggedForShutdown)
{
@ -998,7 +998,7 @@ void SonyVoiceChat_Vita::disconnectLocalPlayer( int localIdx )
if(m_numLocalDevicesConnected == 0) // no more local players, kill all the remote connections
{
for(int i=0;i<m_remoteConnections.size();i++)
for(size_t i=0;i<m_remoteConnections.size();i++)
{
delete m_remoteConnections[i];
}

View file

@ -590,7 +590,7 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch
// find the DLC
for(int i=0;i<m_ProductListCategoriesC;i++)
{
for(int j=0;j<m_ProductListA[i].size();j++)
for(size_t j=0;j<m_ProductListA[i].size();j++)
{
std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
auto itEnd = pProductList->end();
@ -617,7 +617,7 @@ void CConsoleMinecraftApp::Checkout(char *pchSkuID)
for(int i=0;i<m_ProductListCategoriesC;i++)
{
for(int j=0;j<m_ProductListA[i].size();j++)
for(size_t j=0;j<m_ProductListA[i].size();j++)
{
std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
auto itEnd = pProductList->end();
@ -697,7 +697,7 @@ bool CConsoleMinecraftApp::DLCAlreadyPurchased(char *pchTitle)
// find the DLC
for(int i=0;i<m_ProductListCategoriesC;i++)
{
for(int j=0;j<m_ProductListA[i].size();j++)
for(size_t j=0;j<m_ProductListA[i].size();j++)
{
std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
auto itEnd = pProductList->end();

View file

@ -1078,7 +1078,7 @@ uint8_t * AddRichPresenceString(int iID)
void FreeRichPresenceStrings()
{
uint8_t *strUtf8;
for(int i=0;i<vRichPresenceStrings.size();i++)
for(size_t i=0;i<vRichPresenceStrings.size();i++)
{
strUtf8=vRichPresenceStrings.at(i);
free(strUtf8);

View file

@ -375,7 +375,7 @@ void PlayerChunkMap::tick()
{
lastInhabitedUpdate = time;
for (int i = 0; i < knownChunks.size(); i++)
for (size_t i = 0; i < knownChunks.size(); i++)
{
PlayerChunk *chunk = knownChunks.at(i);
@ -784,7 +784,7 @@ void PlayerChunkMap::setRadius(int newRadius)
if( radius != newRadius )
{
PlayerList* players = level->getServer()->getPlayerList();
for( int i = 0;i < players->players.size();i += 1 )
for( size_t i = 0;i < players->players.size();i += 1 )
{
shared_ptr<ServerPlayer> player = players->players[i];
if( player->level == level )

View file

@ -463,7 +463,7 @@ void PlayerList::add(shared_ptr<ServerPlayer> player)
changeDimension(player, nullptr);
level->addEntity(player);
for (int i = 0; i < players.size(); i++)
for (size_t i = 0; i < players.size(); i++)
{
shared_ptr<ServerPlayer> op = players.at(i);
//player->connection->send(shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket(op->name, true, op->latency) ) );
@ -1145,7 +1145,7 @@ shared_ptr<ServerPlayer> PlayerList::getNearestPlayer(Pos *position, int range)
double dist = -1;
int rangeSqr = range * range;
for (int i = 0; i < players.size(); i++)
for (size_t i = 0; i < players.size(); i++)
{
shared_ptr<ServerPlayer> next = players.at(i);
double newDist = position->distSqr(next->getCommandSenderWorldPosition());
@ -1177,7 +1177,7 @@ vector<ServerPlayer> *PlayerList::getPlayers(Pos *position, int rangeMin, int ra
if (playerNameNot) playerName = playerName.substring(1);
if (teamNameNot) teamName = teamName.substring(1);
for (int i = 0; i < players.size(); i++) {
for (size_t i = 0; i < players.size(); i++) {
ServerPlayer player = players.get(i);
if (level != null && player.level != level) continue;

View file

@ -679,19 +679,19 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener)
vector<LevelChunk *> sortedChunkList;
for( int i = 0; i < m_loadedChunkList.size(); i++ )
for( size_t i = 0; i < m_loadedChunkList.size(); i++ )
{
if( ( m_loadedChunkList[i]->x < 0 ) && ( m_loadedChunkList[i]->z < 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]);
}
for( int i = 0; i < m_loadedChunkList.size(); i++ )
for( size_t i = 0; i < m_loadedChunkList.size(); i++ )
{
if( ( m_loadedChunkList[i]->x >= 0 ) && ( m_loadedChunkList[i]->z < 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]);
}
for( int i = 0; i < m_loadedChunkList.size(); i++ )
for( size_t i = 0; i < m_loadedChunkList.size(); i++ )
{
if( ( m_loadedChunkList[i]->x >= 0 ) && ( m_loadedChunkList[i]->z >= 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]);
}
for( int i = 0; i < m_loadedChunkList.size(); i++ )
for( size_t i = 0; i < m_loadedChunkList.size(); i++ )
{
if( ( m_loadedChunkList[i]->x < 0 ) && ( m_loadedChunkList[i]->z >= 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]);
}
@ -764,19 +764,19 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener)
vector<LevelChunk *> sortedChunkList;
for( int i = 0; i < m_loadedChunkList.size(); i++ )
for( size_t i = 0; i < m_loadedChunkList.size(); i++ )
{
if( ( m_loadedChunkList[i]->x < 0 ) && ( m_loadedChunkList[i]->z < 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]);
}
for( int i = 0; i < m_loadedChunkList.size(); i++ )
for( size_t i = 0; i < m_loadedChunkList.size(); i++ )
{
if( ( m_loadedChunkList[i]->x >= 0 ) && ( m_loadedChunkList[i]->z < 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]);
}
for( int i = 0; i < m_loadedChunkList.size(); i++ )
for( size_t i = 0; i < m_loadedChunkList.size(); i++ )
{
if( ( m_loadedChunkList[i]->x >= 0 ) && ( m_loadedChunkList[i]->z >= 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]);
}
for( int i = 0; i < m_loadedChunkList.size(); i++ )
for( size_t i = 0; i < m_loadedChunkList.size(); i++ )
{
if( ( m_loadedChunkList[i]->x < 0 ) && ( m_loadedChunkList[i]->z >= 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]);
}

View file

@ -122,7 +122,7 @@ int Stitcher::smallestEncompassingPowerOfTwo(int input)
bool Stitcher::addToStorage(TextureHolder *textureHolder)
{
for (int i = 0; i < storage.size(); i++)
for (size_t i = 0; i < storage.size(); i++)
{
if (storage.at(i)->add(textureHolder))
{

View file

@ -77,31 +77,32 @@ class SoundEngine : public ConsoleSoundEngine
#endif
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 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<Mob> *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);
void destroy() override;
void play(int iSound, float x, float y, float z, float volume, float pitch) override;
void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) override;
void playUI(int iSound, float volume, float pitch) override;
void playMusicTick() override;
void updateMusicVolume(float fVal) override;
void updateSystemMusicPlaying(bool isPlaying) override;
void updateSoundEffectVolume(float fVal) override;
void init(Options *) override;
void tick(shared_ptr<Mob> *players, float a) override; // 4J - updated to take array of local players rather than single one
void add(const wstring& name, File *file) override;
void addMusic(const wstring& name, File *file) override;
void addStreaming(const wstring& name, File *file) override;
#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);
char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false) override;
bool isStreamingWavebankReady(); // 4J Added
#ifdef _XBOX
bool isStreamingWavebankReady(IXACT3WaveBank *pWaveBank);
#endif
int initAudioHardware(int iMinSpeakers) { return iMinSpeakers;}
int initAudioHardware(int iMinSpeakers) override
{ return iMinSpeakers;}
private:
#ifndef __PS3__

View file

@ -480,7 +480,7 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
for (int pass = 0; pass < 2; pass++ )
{
// In the first pass, we only get partial stacks.
for (int i = start; i >= 0 && i < static_cast<int>(slots.size()) && carried->count < carried->getMaxStackSize(); i += step)
for (size_t i = start; i >= 0 && i < static_cast<int>(slots.size()) && carried->count < carried->getMaxStackSize(); i += step)
{
Slot *target = slots.at(i);

View file

@ -34,7 +34,7 @@ BaseRailTile::Rail::Rail(Level *level, int x, int y, int z)
BaseRailTile::Rail::~Rail()
{
for( int i = 0; i < connections.size(); i++ )
for( size_t i = 0; i < connections.size(); i++ )
{
delete connections[i];
}
@ -44,7 +44,7 @@ void BaseRailTile::Rail::updateConnections(int direction)
{
if(m_bValidRail)
{
for( int i = 0; i < connections.size(); i++ )
for( size_t i = 0; i < connections.size(); i++ )
{
delete connections[i];
}

View file

@ -439,7 +439,7 @@ C4JThread* C4JThread::getCurrentThread()
#endif //__PS3__
EnterCriticalSection(&ms_threadListCS);
for(int i=0;i<ms_threadList.size(); i++)
for(size_t i=0;i<ms_threadList.size(); i++)
{
if(currThreadID == ms_threadList[i]->m_threadID)
{

View file

@ -71,12 +71,12 @@ void ChatPacket::write(DataOutputStream *dos)
dos->writeShort(packedCounts);
for(int i = 0; i < m_stringArgs.size(); i++)
for(size_t i = 0; i < m_stringArgs.size(); i++)
{
writeUtf(m_stringArgs[i], dos);
}
for(int i = 0; i < m_intArgs.size(); i++)
for(size_t i = 0; i < m_intArgs.size(); i++)
{
dos->writeInt(m_intArgs[i]);
}
@ -92,7 +92,7 @@ void ChatPacket::handle(PacketListener *listener)
int ChatPacket::getEstimatedSize()
{
int stringsSize = 0;
for(int i = 0; i < m_stringArgs.size(); i++)
for(size_t i = 0; i < m_stringArgs.size(); i++)
{
stringsSize += m_stringArgs[i].length();
}

View file

@ -170,7 +170,7 @@ CombatEntry *CombatTracker::getMostSignificantFall()
int altDamage = 0;
float bestFall = 0;
for (int i = 0; i < entries.size(); i++)
for (size_t i = 0; i < entries.size(); i++)
{
CombatEntry *entry = entries.at(i);
CombatEntry *previous = i > 0 ? entries.at(i - 1) : nullptr;

View file

@ -341,7 +341,7 @@ bool Connection::readTick()
// printf("Con:0x%x readTick close EOS\n",this);
// 4J Stu - Remove this line
// Fix for #10410 - UI: If the player is removed from a splitscreened hosts game, the next game that player joins will produce a message stating that the host has left.
// Fix for #10410 - UI: If the player is removed from a splitscreened host<EFBFBD>s game, the next game that player joins will produce a message stating that the host has left.
//close(DisconnectPacket::eDisconnect_EndOfStream);
}
@ -498,7 +498,7 @@ void Connection::tick()
LeaveCriticalSection(&incoming_cs);
// MGH - moved the packet handling outside of the incoming_cs block, as it was locking up sometimes when disconnecting
for(int i=0; i<packetsToHandle.size();i++)
for(size_t i = 0; i < packetsToHandle.size(); i++)
{
PIXBeginNamedEvent(0,"Handling packet %d\n",packetsToHandle[i]->getId());
packetsToHandle[i]->handle(packetListener);

View file

@ -53,7 +53,7 @@ void EnchantmentMenu::broadcastChanges()
// 4J Added m_costsChanged to stop continually sending update packets even when no changes have been made
if(m_costsChanged)
{
for (int i = 0; i < containerListeners.size(); i++)
for (size_t i = 0; i < containerListeners.size(); i++)
{
ContainerListener *listener = containerListeners.at(i);
listener->setContainerData(this, 0, costs[0]);

View file

@ -673,7 +673,7 @@ const std::wstring File::getPath() const
std::wstring File::getName() const
{
unsigned int sep = static_cast<unsigned int>(m_abstractPathName.find_last_of(this->pathSeparator));
size_t sep = m_abstractPathName.find_last_of(this->pathSeparator);
return m_abstractPathName.substr( sep + 1, m_abstractPathName.length() );
}

View file

@ -69,7 +69,7 @@ void FireworksItem::appendHoverText(shared_ptr<ItemInstance> itemInstance, share
if (eLines.size() > 0)
{
// Indent lines after first line
for (int i = 1; i < eLines.size(); i++)
for (size_t i = 1; i < eLines.size(); i++)
{
eLines[i].indent = true;
}

View file

@ -66,7 +66,7 @@ wstring FlatGeneratorInfo::toString()
builder.append(SERIALIZATION_VERSION);
builder.append(";");
for (int i = 0; i < layers.size(); i++)
for (size_t i = 0; i < layers.size(); i++)
{
if (i > 0) builder.append(",");
builder.append(layers.get(i).toString());

View file

@ -28,7 +28,7 @@ IntCache::ThreadStorage::~ThreadStorage()
{
delete [] allocated[i].data;
}
for( int i = 0; i < toosmall.size(); i++ )
for( size_t i = 0; i < toosmall.size(); i++ )
{
delete [] toosmall[i].data;
}
@ -103,7 +103,7 @@ void IntCache::releaseAll()
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
// 4J - added - we can now remove the vectors that were deemed as too small (see comment in IntCache::allocate)
for( int i = 0; i < tls->toosmall.size(); i++ )
for( size_t i = 0; i < tls->toosmall.size(); i++ )
{
delete [] tls->toosmall[i].data;
}
@ -132,25 +132,25 @@ void IntCache::Reset()
{
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
tls->maxSize = TINY_CUTOFF;
for( int i = 0; i < tls->allocated.size(); i++ )
for( size_t i = 0; i < tls->allocated.size(); i++ )
{
delete [] tls->allocated[i].data;
}
tls->allocated.clear();
for( int i = 0; i < tls->cache.size(); i++ )
for( size_t i = 0; i < tls->cache.size(); i++ )
{
delete [] tls->cache[i].data;
}
tls->cache.clear();
for( int i = 0; i < tls->tallocated.size(); i++ )
for( size_t i = 0; i < tls->tallocated.size(); i++ )
{
delete [] tls->tallocated[i].data;
}
tls->tallocated.clear();
for( int i = 0; i < tls->tcache.size(); i++ )
for( size_t i = 0; i < tls->tcache.size(); i++ )
{
delete [] tls->tcache[i].data;
}

View file

@ -2895,7 +2895,7 @@ shared_ptr<TileEntity> Level::getTileEntity(int x, int y, int z)
if (updatingTileEntities)
{
EnterCriticalSection(&m_tileEntityListCS);
for (int i = 0; i < pendingTileEntities.size(); i++)
for (size_t i = 0; i < pendingTileEntities.size(); i++)
{
shared_ptr<TileEntity> e = pendingTileEntities.at(i);
if (!e->isRemoved() && e->x == x && e->y == y && e->z == z)

View file

@ -34,7 +34,7 @@ MerchantRecipe *MerchantRecipeList::getRecipeFor(shared_ptr<ItemInstance> buyA,
}
return nullptr;
}
for (int i = 0; i < m_recipes.size(); i++)
for (size_t i = 0; i < m_recipes.size(); i++)
{
MerchantRecipe *r = m_recipes.at(i);
if (buyA->id == r->getBuyAItem()->id && buyA->count >= r->getBuyAItem()->count
@ -49,7 +49,7 @@ MerchantRecipe *MerchantRecipeList::getRecipeFor(shared_ptr<ItemInstance> buyA,
bool MerchantRecipeList::addIfNewOrBetter(MerchantRecipe *recipe)
{
bool added = false;
for (int i = 0; i < m_recipes.size(); i++)
for (size_t i = 0; i < m_recipes.size(); i++)
{
MerchantRecipe *r = m_recipes.at(i);
if (recipe->isSame(r))
@ -69,7 +69,7 @@ bool MerchantRecipeList::addIfNewOrBetter(MerchantRecipe *recipe)
MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(shared_ptr<ItemInstance> buy, shared_ptr<ItemInstance> buyB, shared_ptr<ItemInstance> sell)
{
for (int i = 0; i < m_recipes.size(); i++)
for (size_t i = 0; i < m_recipes.size(); i++)
{
MerchantRecipe *r = m_recipes.at(i);
if (buy->id == r->getBuyAItem()->id && buy->count >= r->getBuyAItem()->count && sell->id == r->getSellItem()->id)
@ -86,7 +86,7 @@ MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(shared_ptr<ItemInstance
void MerchantRecipeList::writeToStream(DataOutputStream *stream)
{
stream->writeByte(static_cast<byte>(m_recipes.size() & 0xff));
for (int i = 0; i < m_recipes.size(); i++)
for (size_t i = 0; i < m_recipes.size(); i++)
{
MerchantRecipe *r = m_recipes.at(i);
Packet::writeItem(r->getBuyAItem(), stream);
@ -149,7 +149,7 @@ CompoundTag *MerchantRecipeList::createTag()
CompoundTag *tag = new CompoundTag();
ListTag<CompoundTag> *list = new ListTag<CompoundTag>(L"Recipes");
for (int i = 0; i < m_recipes.size(); i++)
for (size_t i = 0; i < m_recipes.size(); i++)
{
MerchantRecipe *merchantRecipe = m_recipes.at(i);
list->add(merchantRecipe->createTag());

View file

@ -325,16 +325,16 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start,
}
// split by and
int andIndex = static_cast<int>(definition.find_first_of(L'&', start));
if (andIndex >= 0 && andIndex < end)
size_t andIndex = definition.find_first_of(L'&', start);
if (andIndex != wstring::npos && andIndex < static_cast<size_t>(end))
{
int leftSide = parseEffectFormulaValue(definition, start, andIndex - 1, brew);
int leftSide = parseEffectFormulaValue(definition, start, static_cast<int>(andIndex) - 1, brew);
if (leftSide <= 0)
{
return 0;
}
int rightSide = parseEffectFormulaValue(definition, andIndex + 1, end, brew);
int rightSide = parseEffectFormulaValue(definition, static_cast<int>(andIndex) + 1, end, brew);
if (rightSide <= 0)
{
return 0;
@ -413,16 +413,16 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start,
}
// split by or
int orIndex = definition.find_first_of(L'|', start);
if (orIndex >= 0 && orIndex < end)
size_t orIndex = definition.find_first_of(L'|', start);
if (orIndex != wstring::npos && orIndex < static_cast<size_t>(end))
{
int leftSide = parseEffectFormulaValue(definition, start, orIndex - 1, brew);
int leftSide = parseEffectFormulaValue(definition, start, static_cast<int>(orIndex) - 1, brew);
if (leftSide > 0)
{
return leftSide;
}
int rightSide = parseEffectFormulaValue(definition, orIndex + 1, end, brew);
int rightSide = parseEffectFormulaValue(definition, static_cast<int>(orIndex) + 1, end, brew);
if (rightSide > 0)
{
return rightSide;
@ -430,10 +430,10 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start,
return 0;
}
// split by and
int andIndex = definition.find_first_of(L'&', start);
if (andIndex >= 0 && andIndex < end)
size_t andIndex = definition.find_first_of(L'&', start);
if (andIndex != wstring::npos && andIndex < static_cast<size_t>(end))
{
int leftSide = parseEffectFormulaValue(definition, start, andIndex - 1, brew);
int leftSide = parseEffectFormulaValue(definition, start, static_cast<int>(andIndex) - 1, brew);
if (leftSide <= 0)
{
return 0;

View file

@ -69,7 +69,7 @@ unordered_set<AttributeInstance *> *ServersideAttributeMap::getSyncableAttribute
unordered_set<AttributeInstance *> *result = new unordered_set<AttributeInstance *>();
vector<AttributeInstance *> atts;
getAttributes(atts);
for (int i = 0; i < atts.size(); i++)
for (size_t i = 0; i < atts.size(); i++)
{
AttributeInstance *instance = atts.at(i);

View file

@ -10,10 +10,10 @@ wstring toLower(const wstring& a)
wstring trimString(const wstring& a)
{
wstring b;
int start = static_cast<int>(a.find_first_not_of(L" \t\n\r"));
int end = static_cast<int>(a.find_last_not_of(L" \t\n\r"));
size_t start = a.find_first_not_of(L" \t\n\r");
size_t end = a.find_last_not_of(L" \t\n\r");
if( start == wstring::npos ) start = 0;
if( end == wstring::npos ) end = static_cast<int>(a.size())-1;
if( end == wstring::npos ) end = a.size() - 1;
b = a.substr(start,(end-start)+1);
return b;
}