forked from rosebudai/OpenRCT2-Web
add object property validation
This commit is contained in:
1 parent
7e1f948e19
commit
2cade7dd13
7 files changed
+68
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user