aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/NbtSlotFile.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.World/NbtSlotFile.cpp
parent7d6658fe5b3095f35093701b5ab669ffc291e875 (diff)
Remove AUTO_VAR macro and _toString function (#592)
Diffstat (limited to 'Minecraft.World/NbtSlotFile.cpp')
-rw-r--r--Minecraft.World/NbtSlotFile.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/Minecraft.World/NbtSlotFile.cpp b/Minecraft.World/NbtSlotFile.cpp
index 81880cfb..8bae14c6 100644
--- a/Minecraft.World/NbtSlotFile.cpp
+++ b/Minecraft.World/NbtSlotFile.cpp
@@ -89,11 +89,8 @@ vector<CompoundTag *> *NbtSlotFile::readAll(int slot)
vector<int> *fileSlots = fileSlotMap[slot];
int skipped = 0;
- AUTO_VAR(itEnd, fileSlots->end());
- for (AUTO_VAR(it, fileSlots->begin()); it != itEnd; it++)
+ for (int c : *fileSlots)
{
- int c = *it; //fileSlots->at(i);
-
int pos = 0;
int continuesAt = -1;
int expectedSlot = slot + 1;
@@ -115,8 +112,6 @@ vector<CompoundTag *> *NbtSlotFile::readAll(int slot)
goto fileSlotLoop; // 4J - used to be continue fileSlotLoop, with for loop labelled as fileSlotLoop
}
-// if (oldSlot != expectedSlot) throw new IOException("Wrong slot! Got " + oldSlot + ", expected " + expectedSlot); // 4J - TODO
-
ReadFile(raf,READ_BUFFER.data + pos,size,&numberOfBytesRead,NULL);
if (continuesAt >= 0)
@@ -144,12 +139,12 @@ int NbtSlotFile::getFreeSlot()
// fileSlot = toReplace->back();
// toReplace->pop_back();
// } else
-
+
if (freeFileSlots.size() > 0)
{
fileSlot = freeFileSlots.back();
freeFileSlots.pop_back();
- }
+ }
else
{
fileSlot = totalFileSlots++;
@@ -164,11 +159,9 @@ void NbtSlotFile::replaceSlot(int slot, vector<CompoundTag *> *tags)
DWORD numberOfBytesWritten;
toReplace = fileSlotMap[slot];
fileSlotMap[slot] = new vector<int>();
-
- AUTO_VAR(itEndTags, tags->end());
- for (AUTO_VAR(it, tags->begin()); it != itEndTags; it++)
+
+ for (auto tag : *tags)
{
- CompoundTag *tag = *it; //tags->at(i);
byteArray compressed = NbtIo::compress(tag);
if (compressed.length > largest)
{
@@ -227,12 +220,9 @@ void NbtSlotFile::replaceSlot(int slot, vector<CompoundTag *> *tags)
}
delete[] compressed.data;
}
-
- AUTO_VAR(itEndToRep, toReplace->end());
- for (AUTO_VAR(it, toReplace->begin()); it != itEndToRep; it++)
- {
- int c = *it; //toReplace->at(i);
+ for (int c : *toReplace)
+ {
freeFileSlots.push_back(c);
seekSlotHeader(c);