From d37ac17a39acf9ad255a7033ad6f3da3b5c9b173 Mon Sep 17 00:00:00 2001 From: Sezz Date: Wed, 12 Feb 2025 17:36:12 +1100 Subject: [PATCH] Formatting --- TombEngine/Game/Setup.cpp | 24 ++++++++++++------------ TombEngine/Game/Setup.h | 5 +++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/TombEngine/Game/Setup.cpp b/TombEngine/Game/Setup.cpp index 84bd677d6..733989cb6 100644 --- a/TombEngine/Game/Setup.cpp +++ b/TombEngine/Game/Setup.cpp @@ -78,38 +78,38 @@ ObjectInfo& ObjectHandler::GetFirstAvailableObject() void StaticHandler::Initialize() { - _lookupTable.resize(0); - _lookupTable.reserve(_defaultLUTSize); + _lut.resize(0); + _lut.reserve(LUT_SIZE); _statics.resize(0); } int StaticHandler::GetIndex(int staticID) { - if (staticID < 0 || staticID >= _lookupTable.size()) + if (staticID < 0 || staticID >= _lut.size()) { - TENLog("Attempt to get nonexistent static mesh ID slot index (" + std::to_string(staticID) + ")", LogLevel::Warning); - return _lookupTable.front(); + TENLog("Attempted to get index of missing static object " + std::to_string(staticID) + ".", LogLevel::Warning); + return _lut.front(); } - return _lookupTable[staticID]; + return _lut[staticID]; } StaticInfo& StaticHandler::operator [](int staticID) { if (staticID < 0) { - TENLog("Attempt to access illegal static mesh ID slot info", LogLevel::Warning); + TENLog("Attempted to access missing static object " + std::to_string(staticID) + ".", LogLevel::Warning); return _statics.front(); } - if (staticID >= _lookupTable.size()) - _lookupTable.resize(staticID + 1, NO_VALUE); + if (staticID >= _lut.size()) + _lut.resize(staticID + 1, NO_VALUE); - if (_lookupTable[staticID] != NO_VALUE) - return _statics[_lookupTable[staticID]]; + if (_lut[staticID] != NO_VALUE) + return _statics[_lut[staticID]]; _statics.emplace_back(); - _lookupTable[staticID] = (int)_statics.size() - 1; + _lut[staticID] = (int)_statics.size() - 1; return _statics.back(); } diff --git a/TombEngine/Game/Setup.h b/TombEngine/Game/Setup.h index 2ba3a4796..0cee4c098 100644 --- a/TombEngine/Game/Setup.h +++ b/TombEngine/Game/Setup.h @@ -135,10 +135,10 @@ struct StaticInfo class StaticHandler { private: - static const int _defaultLUTSize = 256; + static constexpr auto LUT_SIZE = 256; std::vector _statics = {}; - std::vector _lookupTable = {}; + std::vector _lut = {}; public: void Initialize(); @@ -147,6 +147,7 @@ public: StaticInfo& operator [](int staticID); // Iterators + auto begin() { return _statics.begin(); } // Non-const begin auto end() { return _statics.end(); } // Non-const end auto begin() const { return _statics.cbegin(); } // Const begin