diff options
| author | void_17 <61356189+void2012@users.noreply.github.com> | 2026-03-06 02:11:18 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-06 02:11:18 +0700 |
| commit | 55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b (patch) | |
| tree | 953c537a5c66e328e9f4ab29626cf738112d53c0 /Minecraft.World/SynchedEntityData.cpp | |
| parent | 7d6658fe5b3095f35093701b5ab669ffc291e875 (diff) | |
Remove AUTO_VAR macro and _toString function (#592)
Diffstat (limited to 'Minecraft.World/SynchedEntityData.cpp')
| -rw-r--r-- | Minecraft.World/SynchedEntityData.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/Minecraft.World/SynchedEntityData.cpp b/Minecraft.World/SynchedEntityData.cpp index e6bb9ec7..655fa0c3 100644 --- a/Minecraft.World/SynchedEntityData.cpp +++ b/Minecraft.World/SynchedEntityData.cpp @@ -85,11 +85,11 @@ void SynchedEntityData::checkId(int id) #if 0 if (id > MAX_ID_VALUE) { - throw new IllegalArgumentException(L"Data value id is too big with " + _toString<int>(id) + L"! (Max is " + _toString<int>(MAX_ID_VALUE) + L")"); + throw new IllegalArgumentException(L"Data value id is too big with " + std::to_wstring(id) + L"! (Max is " + std::to_wstring(MAX_ID_VALUE) + L")"); } if (itemsById.find(id) != itemsById.end()) { - throw new IllegalArgumentException(L"Duplicate id value for " + _toString<int>(id) + L"!"); + throw new IllegalArgumentException(L"Duplicate id value for " + std::to_wstring(id) + L"!"); } #endif } @@ -223,12 +223,10 @@ bool SynchedEntityData::isDirty() void SynchedEntityData::pack(vector<shared_ptr<DataItem> > *items, DataOutputStream *output) // TODO throws IOException { - if (items != NULL) + if (items) { - AUTO_VAR(itEnd, items->end()); - for (AUTO_VAR(it, items->begin()); it != itEnd; it++) + for (auto& dataItem : *items) { - shared_ptr<DataItem> dataItem = *it; writeDataItem(output, dataItem); } } @@ -311,7 +309,7 @@ void SynchedEntityData::writeDataItem(DataOutputStream *output, shared_ptr<DataI { case TYPE_BYTE: output->writeByte( dataItem->getValue_byte()); - break; + break; case TYPE_INT: output->writeInt( dataItem->getValue_int()); break; @@ -324,13 +322,13 @@ void SynchedEntityData::writeDataItem(DataOutputStream *output, shared_ptr<DataI case TYPE_STRING: Packet::writeUtf(dataItem->getValue_wstring(), output); break; - case TYPE_ITEMINSTANCE: + case TYPE_ITEMINSTANCE: { shared_ptr<ItemInstance> instance = (shared_ptr<ItemInstance> )dataItem->getValue_itemInstance(); Packet::writeItem(instance, output); } break; - + default: assert(false); // 4J - not implemented break; @@ -387,7 +385,7 @@ vector<shared_ptr<SynchedEntityData::DataItem> > *SynchedEntityData::unpack(Data case TYPE_STRING: item = shared_ptr<DataItem>( new DataItem(itemType, itemId, Packet::readUtf(input, MAX_STRING_DATA_LENGTH)) ); break; - case TYPE_ITEMINSTANCE: + case TYPE_ITEMINSTANCE: { item = shared_ptr<DataItem>(new DataItem(itemType, itemId, Packet::readItem(input))); } @@ -408,17 +406,14 @@ vector<shared_ptr<SynchedEntityData::DataItem> > *SynchedEntityData::unpack(Data /** * Assigns values from a list of data items. -* +* * @param items */ void SynchedEntityData::assignValues(vector<shared_ptr<DataItem> > *items) { - AUTO_VAR(itEnd, items->end()); - for (AUTO_VAR(it, items->begin()); it != itEnd; it++) + for (auto& item : *items) { - shared_ptr<DataItem> item = *it; - shared_ptr<DataItem> itemFromId = itemsById[item->getId()]; if( itemFromId != NULL ) { @@ -479,7 +474,7 @@ int SynchedEntityData::getSizeInBytes() { case TYPE_BYTE: size += 1; - break; + break; case TYPE_SHORT: size += 2; break; |
