mirror of https://github.com/OpenRCT2/OpenRCT2.git
add function and line info to guards
This commit is contained in:
parent
d25baf7bd3
commit
5f41e3a0eb
|
@ -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<T>::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<T>::operator[](index);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -510,7 +510,7 @@ namespace ThemeManager
|
|||
|
||||
static void GetAvailableThemes(List<AvailableTheme> * outThemes)
|
||||
{
|
||||
Guard::ArgumentNotNull(outThemes);
|
||||
Guard::ArgumentNotNull(outThemes, GUARD_LINE);
|
||||
|
||||
outThemes->Clear();
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -360,7 +360,7 @@ namespace RCT1
|
|||
"LEMST ", // RCT1_RIDE_TYPE_LEMONADE_STALL
|
||||
};
|
||||
|
||||
Guard::ArgumentInRange<size_t>(rideType, 0, Util::CountOf(map), "");
|
||||
Guard::ArgumentInRange<size_t>(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<size_t>(vehicleType, 0, Util::CountOf(map), "");
|
||||
Guard::ArgumentInRange<size_t>(vehicleType, 0, Util::CountOf(map), "Unsupported RCT1 vehicle type.");
|
||||
return map[vehicleType];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue