diff --git a/src/core/List.hpp b/src/core/List.hpp index c3ef781b27..70c1897144 100644 --- a/src/core/List.hpp +++ b/src/core/List.hpp @@ -72,7 +72,7 @@ public: void Insert(T item, size_t index) { - Guard::ArgumentInRange(index, (size_t)0, this->size()); + Guard::ArgumentInRange(index, (size_t)0, this->size(), GUARD_LINE); this->insert(this->begin() + index, item); } @@ -91,7 +91,7 @@ public: void RemoveAt(size_t index) { - Guard::ArgumentInRange(index, (size_t)0, this->size() - 1); + Guard::ArgumentInRange(index, (size_t)0, this->size() - 1, GUARD_LINE); this->erase(this->begin() + index); } @@ -102,13 +102,13 @@ public: const_reference operator[](size_t index) const { - Guard::ArgumentInRange(index, (size_t)0, this->size() - 1); + Guard::ArgumentInRange(index, (size_t)0, this->size() - 1, GUARD_LINE); return std::vector::operator[](index); } reference operator[](size_t index) { - Guard::ArgumentInRange(index, (size_t)0, this->size() - 1); + Guard::ArgumentInRange(index, (size_t)0, this->size() - 1, GUARD_LINE); return std::vector::operator[](index); } diff --git a/src/drawing/Image.cpp b/src/drawing/Image.cpp index 0fab47c9b9..734509821a 100644 --- a/src/drawing/Image.cpp +++ b/src/drawing/Image.cpp @@ -56,7 +56,7 @@ static bool AllocatedListContains(uint32 baseImageId, uint32 count) static uint32 AllocateImageList(uint32 count) { - Guard::Assert(count != 0); + Guard::Assert(count == 0, GUARD_LINE); if (!_initialised) { @@ -92,12 +92,12 @@ static uint32 AllocateImageList(uint32 count) static void FreeImageList(uint32 baseImageId, uint32 count) { - Guard::Assert(_initialised); - Guard::Assert(baseImageId >= BASE_IMAGE_ID); + Guard::Assert(_initialised, GUARD_LINE); + Guard::Assert(baseImageId >= BASE_IMAGE_ID, GUARD_LINE); #ifdef DEBUG bool contains = AllocatedListContains(baseImageId, count); - Guard::Assert(contains); + Guard::Assert(contains, GUARD_LINE); #endif // TODO validate that this was an allocated list diff --git a/src/interface/Theme.cpp b/src/interface/Theme.cpp index 99949916d8..77bedbad39 100644 --- a/src/interface/Theme.cpp +++ b/src/interface/Theme.cpp @@ -510,7 +510,7 @@ namespace ThemeManager static void GetAvailableThemes(List * outThemes) { - Guard::ArgumentNotNull(outThemes); + Guard::ArgumentNotNull(outThemes, GUARD_LINE); outThemes->Clear(); diff --git a/src/object/ObjectFactory.cpp b/src/object/ObjectFactory.cpp index d4486d4b70..9ab31adf6f 100644 --- a/src/object/ObjectFactory.cpp +++ b/src/object/ObjectFactory.cpp @@ -166,8 +166,8 @@ namespace ObjectFactory Object * CreateObjectFromLegacyData(const rct_object_entry * entry, const void * data, size_t dataSize) { - Guard::ArgumentNotNull(entry); - Guard::ArgumentNotNull(data); + Guard::ArgumentNotNull(entry, GUARD_LINE); + Guard::ArgumentNotNull(data, GUARD_LINE); Object * result = CreateObject(*entry); if (result != nullptr) diff --git a/src/object/ObjectManager.cpp b/src/object/ObjectManager.cpp index 70b18484a9..a0f6c8dfaa 100644 --- a/src/object/ObjectManager.cpp +++ b/src/object/ObjectManager.cpp @@ -225,7 +225,7 @@ private: size_t GetLoadedObjectIndex(const Object * object) { - Guard::ArgumentNotNull(object); + Guard::ArgumentNotNull(object, GUARD_LINE); size_t result = SIZE_MAX; if (_loadedObjects != nullptr) diff --git a/src/object/ObjectRepository.cpp b/src/object/ObjectRepository.cpp index 1aff117211..c183709cdc 100644 --- a/src/object/ObjectRepository.cpp +++ b/src/object/ObjectRepository.cpp @@ -167,7 +167,7 @@ public: Object * LoadObject(const ObjectRepositoryItem * ori) override { - Guard::ArgumentNotNull(ori); + Guard::ArgumentNotNull(ori, GUARD_LINE); Object * object = ObjectFactory::CreateObjectFromLegacyFile(ori->Path); return object; @@ -177,7 +177,7 @@ public: { ObjectRepositoryItem * item = &_items[ori->Id]; - Guard::Assert(item->LoadedObject == nullptr); + Guard::Assert(item->LoadedObject == nullptr, GUARD_LINE); item->LoadedObject = object; } @@ -518,7 +518,7 @@ private: int newRealChecksum = object_calculate_checksum(entry, newData, newDataSize); if (newRealChecksum != entry->checksum) { - Guard::Fail("CalculateExtraBytesToFixChecksum failed to fix checksum."); + Guard::Fail("CalculateExtraBytesToFixChecksum failed to fix checksum.", GUARD_LINE); // Save old data form SaveObject(path, entry, data, dataSize, false); diff --git a/src/object/SceneryGroupObject.cpp b/src/object/SceneryGroupObject.cpp index a0120220dc..c7831e7a0d 100644 --- a/src/object/SceneryGroupObject.cpp +++ b/src/object/SceneryGroupObject.cpp @@ -94,7 +94,7 @@ void SceneryGroupObject::UpdateEntryIndexes() if (ori->LoadedObject == nullptr) continue; uint16 sceneryEntry = objectManager->GetLoadedObjectEntryIndex(ori->LoadedObject); - Guard::Assert(sceneryEntry != UINT8_MAX); + Guard::Assert(sceneryEntry != UINT8_MAX, GUARD_LINE); uint8 objectType = objectEntry->flags & 0x0F; switch (objectType) { diff --git a/src/rct1/tables.cpp b/src/rct1/tables.cpp index 6fb2b865e8..7534d34716 100644 --- a/src/rct1/tables.cpp +++ b/src/rct1/tables.cpp @@ -360,7 +360,7 @@ namespace RCT1 "LEMST ", // RCT1_RIDE_TYPE_LEMONADE_STALL }; - Guard::ArgumentInRange(rideType, 0, Util::CountOf(map), ""); + Guard::ArgumentInRange(rideType, 0, Util::CountOf(map), "Unsupported RCT1 ride type."); return map[rideType]; } @@ -459,7 +459,7 @@ namespace RCT1 "ENTERP ", // RCT1_VEHICLE_TYPE_ENTERPRISE_WHEEL }; - Guard::ArgumentInRange(vehicleType, 0, Util::CountOf(map), ""); + Guard::ArgumentInRange(vehicleType, 0, Util::CountOf(map), "Unsupported RCT1 vehicle type."); return map[vehicleType]; }