aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/StitchedTexture.cpp
diff options
context:
space:
mode:
authorvoid_17 <61356189+void2012@users.noreply.github.com>2026-03-06 02:11:18 +0700
committerGitHub <noreply@github.com>2026-03-06 02:11:18 +0700
commit55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b (patch)
tree953c537a5c66e328e9f4ab29626cf738112d53c0 /Minecraft.Client/StitchedTexture.cpp
parent7d6658fe5b3095f35093701b5ab669ffc291e875 (diff)
Remove AUTO_VAR macro and _toString function (#592)
Diffstat (limited to 'Minecraft.Client/StitchedTexture.cpp')
-rw-r--r--Minecraft.Client/StitchedTexture.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/Minecraft.Client/StitchedTexture.cpp b/Minecraft.Client/StitchedTexture.cpp
index c17f3db5..64ab2f36 100644
--- a/Minecraft.Client/StitchedTexture.cpp
+++ b/Minecraft.Client/StitchedTexture.cpp
@@ -48,12 +48,15 @@ StitchedTexture::StitchedTexture(const wstring &name, const wstring &filename) :
void StitchedTexture::freeFrameTextures()
{
- if( frames )
+ if ( frames )
{
- for(AUTO_VAR(it, frames->begin()); it != frames->end(); ++it)
+ for (auto& frame : *frames)
{
- TextureManager::getInstance()->unregisterTexture(L"", *it);
- delete *it;
+ if ( frame )
+ {
+ TextureManager::getInstance()->unregisterTexture(L"", frame);
+ delete frame;
+ }
}
delete frames;
}
@@ -61,9 +64,10 @@ void StitchedTexture::freeFrameTextures()
StitchedTexture::~StitchedTexture()
{
- for(AUTO_VAR(it, frames->begin()); it != frames->end(); ++it)
+ for(auto& frame : *frames)
{
- delete *it;
+ if ( frame )
+ delete frame;
}
delete frames;
}
@@ -241,7 +245,7 @@ int StitchedTexture::getFrames()
* 4*10,3,2,1,
* 0
* </code> or similar
-*
+*
* @param bufferedReader
*/
void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader)
@@ -265,20 +269,19 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader)
{
std::vector<std::wstring> tokens = stringSplit(line, L',');
//for (String token : tokens)
- for(AUTO_VAR(it, tokens.begin()); it != tokens.end(); ++it)
+ for( const auto& token : tokens)
{
- wstring token = *it;
int multiPos = token.find_first_of('*');
if (multiPos > 0)
{
int frame = _fromString<int>(token.substr(0, multiPos));
int count = _fromString<int>(token.substr(multiPos + 1));
- results->push_back( intPairVector::value_type(frame, count));
+ results->emplace_back(frame, count);
}
else
{
int tokenVal = _fromString<int>(token);
- results->push_back( intPairVector::value_type(tokenVal, 1));
+ results->emplace_back(tokenVal, 1);
}
}
}
@@ -311,21 +314,22 @@ void StitchedTexture::loadAnimationFrames(const wstring &string)
intPairVector *results = new intPairVector();
std::vector<std::wstring> tokens = stringSplit(trimString(string), L',');
- //for (String token : tokens)
- for(AUTO_VAR(it, tokens.begin()); it != tokens.end(); ++it)
+
+ wstring token;
+ for(auto& it : tokens)
{
- wstring token = trimString(*it);
+ token = trimString(it);
int multiPos = token.find_first_of('*');
if (multiPos > 0)
{
int frame = _fromString<int>(token.substr(0, multiPos));
int count = _fromString<int>(token.substr(multiPos + 1));
- results->push_back( intPairVector::value_type(frame, count));
+ results->emplace_back(frame, count);
}
else if(!token.empty())
{
int tokenVal = _fromString<int>(token);
- results->push_back( intPairVector::value_type(tokenVal, 1));
+ results->emplace_back(tokenVal, 1);
}
}