1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Rename members of ObjectError

This commit is contained in:
Gymnasiast
2025-10-07 22:01:22 +02:00
parent e045126fe3
commit 26b02d9126
13 changed files with 37 additions and 37 deletions

View File

@@ -39,7 +39,7 @@ namespace OpenRCT2
// Validate properties
if (_legacyType.price <= 0.00_GBP)
{
context->LogError(ObjectError::InvalidProperty, "Price can not be free or negative.");
context->LogError(ObjectError::invalidProperty, "Price can not be free or negative.");
}
// Add banners to 'Signs and items for footpaths' group, rather than lumping them in the Miscellaneous tab.

View File

@@ -31,7 +31,7 @@ namespace OpenRCT2
// Validate properties
if (_legacyType.support_type >= RailingEntrySupportType::Count)
{
context->LogError(ObjectError::InvalidProperty, "RailingEntrySupportType not supported.");
context->LogError(ObjectError::invalidProperty, "RailingEntrySupportType not supported.");
}
}

View File

@@ -181,7 +181,7 @@ namespace OpenRCT2
catch (const std::exception& e)
{
auto msg = String::stdFormat("Unable to load image '%s': %s", s.c_str(), e.what());
context->LogWarning(ObjectError::BadImageTable, msg.c_str());
context->LogWarning(ObjectError::badImageTable, msg.c_str());
result.push_back(std::make_unique<RequiredImage>());
}
}
@@ -216,7 +216,7 @@ namespace OpenRCT2
catch (const std::exception& e)
{
auto msg = String::stdFormat("Unable to load image '%s': %s", path.c_str(), e.what());
context->LogWarning(ObjectError::BadImageTable, msg.c_str());
context->LogWarning(ObjectError::badImageTable, msg.c_str());
result.push_back(std::make_unique<RequiredImage>());
}
return result;
@@ -263,7 +263,7 @@ namespace OpenRCT2
if (placeHoldersAdded > 0)
{
std::string msg = "Adding " + std::to_string(placeHoldersAdded) + " placeholders";
context->LogWarning(ObjectError::InvalidProperty, msg.c_str());
context->LogWarning(ObjectError::invalidProperty, msg.c_str());
}
}
else
@@ -275,7 +275,7 @@ namespace OpenRCT2
else
{
auto msg = String::stdFormat("Unable to load Gx '%s'", path.c_str());
context->LogWarning(ObjectError::BadImageTable, msg.c_str());
context->LogWarning(ObjectError::badImageTable, msg.c_str());
for (size_t i = 0; i < range.size(); i++)
{
result.push_back(std::make_unique<RequiredImage>());
@@ -328,13 +328,13 @@ namespace OpenRCT2
if (placeHoldersAdded > 0)
{
std::string msg = "Adding " + std::to_string(placeHoldersAdded) + " placeholders";
context->LogWarning(ObjectError::InvalidProperty, msg.c_str());
context->LogWarning(ObjectError::invalidProperty, msg.c_str());
}
}
else
{
std::string msg = "Unable to open '" + name + "'";
context->LogWarning(ObjectError::InvalidProperty, msg.c_str());
context->LogWarning(ObjectError::invalidProperty, msg.c_str());
for (size_t i = 0; i < range.size(); i++)
{
result.push_back(std::make_unique<RequiredImage>());
@@ -445,7 +445,7 @@ namespace OpenRCT2
uint64_t remainingBytes = stream->GetLength() - stream->GetPosition() - headerTableSize;
if (remainingBytes > imageDataSize)
{
context->LogVerbose(ObjectError::BadImageTable, "Image table size longer than expected.");
context->LogVerbose(ObjectError::badImageTable, "Image table size longer than expected.");
imageDataSize = static_cast<uint32_t>(remainingBytes);
}
@@ -453,7 +453,7 @@ namespace OpenRCT2
auto data = std::make_unique<uint8_t[]>(dataSize);
if (data == nullptr)
{
context->LogError(ObjectError::BadImageTable, "Image table too large.");
context->LogError(ObjectError::badImageTable, "Image table too large.");
throw std::runtime_error("Image table too large.");
}
@@ -485,7 +485,7 @@ namespace OpenRCT2
if (unreadBytes > 0)
{
std::fill_n(data.get() + readBytes, unreadBytes, 0);
context->LogWarning(ObjectError::BadImageTable, "Image table size shorter than expected.");
context->LogWarning(ObjectError::badImageTable, "Image table size shorter than expected.");
}
_data = std::move(data);
@@ -493,7 +493,7 @@ namespace OpenRCT2
}
catch (const std::exception&)
{
context->LogError(ObjectError::BadImageTable, "Bad image table.");
context->LogError(ObjectError::badImageTable, "Bad image table.");
throw;
}
}

View File

@@ -83,7 +83,7 @@ namespace OpenRCT2
// Validate properties
if (_legacyType.price <= 0.00_GBP)
{
context->LogError(ObjectError::InvalidProperty, "Price can not be free or negative.");
context->LogError(ObjectError::invalidProperty, "Price can not be free or negative.");
}
if (_legacyType.removal_price <= 0.00_GBP)
{
@@ -91,7 +91,7 @@ namespace OpenRCT2
const auto reimbursement = _legacyType.removal_price;
if (reimbursement > _legacyType.price)
{
context->LogError(ObjectError::InvalidProperty, "Sell price can not be more than buy price.");
context->LogError(ObjectError::invalidProperty, "Sell price can not be more than buy price.");
}
}

View File

@@ -169,7 +169,7 @@ namespace OpenRCT2
auto source = Json::GetString(jTrack["source"]);
if (source.empty())
{
context.LogError(ObjectError::InvalidProperty, "Invalid audio track definition.");
context.LogError(ObjectError::invalidProperty, "Invalid audio track definition.");
}
else
{

View File

@@ -154,13 +154,13 @@ namespace OpenRCT2
enum class ObjectError : uint32_t
{
Ok,
Unknown,
BadEncoding,
InvalidProperty,
BadStringTable,
BadImageTable,
UnexpectedEOF,
ok,
unknown,
badEncoding,
invalidProperty,
badStringTable,
badImageTable,
unexpectedEOF,
};
struct IReadObjectContext

View File

@@ -246,11 +246,11 @@ namespace OpenRCT2::ObjectFactory
catch (const IOException&)
{
// TODO check that ex is really EOF and not some other error
context->LogError(ObjectError::UnexpectedEOF, "Unexpectedly reached end of file.");
context->LogError(ObjectError::unexpectedEOF, "Unexpectedly reached end of file.");
}
catch (const std::exception&)
{
context->LogError(ObjectError::Unknown, nullptr);
context->LogError(ObjectError::unknown, nullptr);
}
}

View File

@@ -42,7 +42,7 @@ namespace OpenRCT2
// Validate properties
if (_legacyType.price <= 0.00_GBP)
{
context->LogError(ObjectError::InvalidProperty, "Price can not be free or negative.");
context->LogError(ObjectError::invalidProperty, "Price can not be free or negative.");
}
// Add path additions to 'Signs and items for footpaths' group, rather than lumping them in the Miscellaneous tab.

View File

@@ -277,15 +277,15 @@ namespace OpenRCT2
// Validate properties
if (_legacyType.excitement_multiplier > 75)
{
context->LogError(ObjectError::InvalidProperty, "Excitement multiplier too high.");
context->LogError(ObjectError::invalidProperty, "Excitement multiplier too high.");
}
if (_legacyType.intensity_multiplier > 75)
{
context->LogError(ObjectError::InvalidProperty, "Intensity multiplier too high.");
context->LogError(ObjectError::invalidProperty, "Intensity multiplier too high.");
}
if (_legacyType.nausea_multiplier > 75)
{
context->LogError(ObjectError::InvalidProperty, "Nausea multiplier too high.");
context->LogError(ObjectError::invalidProperty, "Nausea multiplier too high.");
}
RideObjectUpdateRideType(_legacyType);
_legacyType.Clearance = GetDefaultClearance();
@@ -565,7 +565,7 @@ namespace OpenRCT2
if (rideType == kRideTypeNull)
{
context->LogError(ObjectError::InvalidProperty, "Unknown ride type");
context->LogError(ObjectError::invalidProperty, "Unknown ride type");
}
}
@@ -608,7 +608,7 @@ namespace OpenRCT2
auto shopItem = ParseShopItem(Json::GetString(rideSells[i]));
if (shopItem == ShopItem::none)
{
context->LogWarning(ObjectError::InvalidProperty, "Unknown shop item");
context->LogWarning(ObjectError::invalidProperty, "Unknown shop item");
}
_legacyType.shop_item[i] = shopItem;
@@ -924,7 +924,7 @@ namespace OpenRCT2
{
if (!std::has_single_bit(numRotationFrames))
{
context->LogError(ObjectError::InvalidProperty, "spriteGroups values must be powers of 2");
context->LogError(ObjectError::invalidProperty, "spriteGroups values must be powers of 2");
continue;
}
car.SpriteGroups[i].spritePrecision = PrecisionFromNumFrames(numRotationFrames);

View File

@@ -174,7 +174,7 @@ namespace OpenRCT2
if (entryName.length() != kDatEntryLength)
{
std::string errorMessage = "Malformed DAT entry in scenery group: " + entryName;
context->LogError(ObjectError::InvalidProperty, errorMessage.c_str());
context->LogError(ObjectError::invalidProperty, errorMessage.c_str());
continue;
}
@@ -189,7 +189,7 @@ namespace OpenRCT2
catch (std::invalid_argument&)
{
std::string errorMessage = "Malformed flags in DAT entry in scenery group: " + entryName;
context->LogError(ObjectError::InvalidProperty, errorMessage.c_str());
context->LogError(ObjectError::invalidProperty, errorMessage.c_str());
}
}
else

View File

@@ -58,7 +58,7 @@ namespace OpenRCT2
// Validate properties
if (_legacyType.price <= 0.00_GBP)
{
context->LogError(ObjectError::InvalidProperty, "Price can not be free or negative.");
context->LogError(ObjectError::invalidProperty, "Price can not be free or negative.");
}
if (_legacyType.removal_price <= 0.00_GBP)
{
@@ -66,7 +66,7 @@ namespace OpenRCT2
const auto reimbursement = _legacyType.removal_price;
if (reimbursement > _legacyType.price)
{
context->LogError(ObjectError::InvalidProperty, "Sell price can not be more than buy price.");
context->LogError(ObjectError::invalidProperty, "Sell price can not be more than buy price.");
}
}
}

View File

@@ -76,7 +76,7 @@ namespace OpenRCT2
}
catch (const std::exception&)
{
context->LogError(ObjectError::BadStringTable, "Bad string table.");
context->LogError(ObjectError::badStringTable, "Bad string table.");
throw;
}
Sort();

View File

@@ -42,7 +42,7 @@ namespace OpenRCT2
// Validate properties
if (_legacyType.price <= 0.00_GBP)
{
context->LogError(ObjectError::InvalidProperty, "Price can not be free or negative.");
context->LogError(ObjectError::invalidProperty, "Price can not be free or negative.");
}
// Autofix this object (will be turned into an official object later).