mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 15:24:30 +01:00
add object property validation
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user