diff --git a/src/object/BannerObject.cpp b/src/object/BannerObject.cpp index 9dfd40a799..c4cba5beaf 100644 --- a/src/object/BannerObject.cpp +++ b/src/object/BannerObject.cpp @@ -44,6 +44,12 @@ void BannerObject::ReadLegacy(IReadObjectContext * context, IStream * stream) _sceneryTabEntry = stream->ReadValue(); GetImageTable()->Read(context, stream); + + // Validate properties + if (_legacyType.large_scenery.price <= 0) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Price can not be free or negative."); + } } void BannerObject::Load() diff --git a/src/object/FootpathItemObject.cpp b/src/object/FootpathItemObject.cpp index 3895133b2c..48f2916424 100644 --- a/src/object/FootpathItemObject.cpp +++ b/src/object/FootpathItemObject.cpp @@ -43,6 +43,12 @@ void FootpathItemObject::ReadLegacy(IReadObjectContext * context, IStream * stre _sceneryTabEntry = stream->ReadValue(); GetImageTable()->Read(context, stream); + + // Validate properties + if (_legacyType.large_scenery.price <= 0) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Price can not be free or negative."); + } } void FootpathItemObject::Load() diff --git a/src/object/FootpathObject.cpp b/src/object/FootpathObject.cpp index 9d255830a5..2580f42f01 100644 --- a/src/object/FootpathObject.cpp +++ b/src/object/FootpathObject.cpp @@ -41,6 +41,12 @@ void FootpathObject::ReadLegacy(IReadObjectContext * context, IStream * stream) GetStringTable()->Read(context, stream, OBJ_STRING_ID_NAME); GetImageTable()->Read(context, stream); + + // Validate properties + if (_legacyType.var_0A > 1) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "VAR_0A can not be greater than 1."); + } } void FootpathObject::Load() diff --git a/src/object/LargeSceneryObject.cpp b/src/object/LargeSceneryObject.cpp index 2e16535fec..cefb6828da 100644 --- a/src/object/LargeSceneryObject.cpp +++ b/src/object/LargeSceneryObject.cpp @@ -63,6 +63,21 @@ void LargeSceneryObject::ReadLegacy(IReadObjectContext * context, IStream * stre _tiles = ReadTiles(stream); GetImageTable()->Read(context, stream); + + // Validate properties + if (_legacyType.large_scenery.price <= 0) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Price can not be free or negative."); + } + if (_legacyType.large_scenery.removal_price <= 0) + { + // Make sure you don't make a profit when placing then removing. + money16 reimbursement = _legacyType.large_scenery.removal_price; + if (reimbursement > _legacyType.large_scenery.price) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Sell price can not be more than buy price."); + } + } } void LargeSceneryObject::Load() diff --git a/src/object/RideObject.cpp b/src/object/RideObject.cpp index e665026388..f09304c610 100644 --- a/src/object/RideObject.cpp +++ b/src/object/RideObject.cpp @@ -80,6 +80,20 @@ void RideObject::ReadLegacy(IReadObjectContext * context, IStream * stream) } GetImageTable()->Read(context, stream); + + // Validate properties + if (_legacyType.excitement_multipler > 75) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Excitement multiplier too high."); + } + if (_legacyType.intensity_multipler > 75) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Intensity multiplier too high."); + } + if (_legacyType.nausea_multipler > 75) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Nausea multiplier too high."); + } } void RideObject::Load() diff --git a/src/object/SmallSceneryObject.cpp b/src/object/SmallSceneryObject.cpp index 34d3e6111d..13133cf1d2 100644 --- a/src/object/SmallSceneryObject.cpp +++ b/src/object/SmallSceneryObject.cpp @@ -61,6 +61,21 @@ void SmallSceneryObject::ReadLegacy(IReadObjectContext * context, IStream * stre } GetImageTable()->Read(context, stream); + + // Validate properties + if (_legacyType.small_scenery.price <= 0) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Price can not be free or negative."); + } + if (_legacyType.small_scenery.removal_price <= 0) + { + // Make sure you don't make a profit when placing then removing. + money16 reimbursement = _legacyType.small_scenery.removal_price; + if (reimbursement > _legacyType.small_scenery.price) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Sell price can not be more than buy price."); + } + } } void SmallSceneryObject::Load() diff --git a/src/object/WallObject.cpp b/src/object/WallObject.cpp index 352af8d84c..1182551b5d 100644 --- a/src/object/WallObject.cpp +++ b/src/object/WallObject.cpp @@ -47,6 +47,12 @@ void WallObject::ReadLegacy(IReadObjectContext * context, IStream * stream) _sceneryTabEntry = stream->ReadValue(); GetImageTable()->Read(context, stream); + + // Validate properties + if (_legacyType.large_scenery.price <= 0) + { + context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "Price can not be free or negative."); + } } void WallObject::Load()