From 26b02d91260f24fea88da94e6c19a0ae5ac21d41 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Tue, 7 Oct 2025 22:01:22 +0200 Subject: [PATCH] Rename members of ObjectError --- src/openrct2/object/BannerObject.cpp | 2 +- src/openrct2/object/FootpathObject.cpp | 2 +- src/openrct2/object/ImageTable.cpp | 20 ++++++++++---------- src/openrct2/object/LargeSceneryObject.cpp | 4 ++-- src/openrct2/object/MusicObject.cpp | 2 +- src/openrct2/object/Object.h | 14 +++++++------- src/openrct2/object/ObjectFactory.cpp | 4 ++-- src/openrct2/object/PathAdditionObject.cpp | 2 +- src/openrct2/object/RideObject.cpp | 12 ++++++------ src/openrct2/object/SceneryGroupObject.cpp | 4 ++-- src/openrct2/object/SmallSceneryObject.cpp | 4 ++-- src/openrct2/object/StringTable.cpp | 2 +- src/openrct2/object/WallObject.cpp | 2 +- 13 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/openrct2/object/BannerObject.cpp b/src/openrct2/object/BannerObject.cpp index 48e7b161c0..f967614318 100644 --- a/src/openrct2/object/BannerObject.cpp +++ b/src/openrct2/object/BannerObject.cpp @@ -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. diff --git a/src/openrct2/object/FootpathObject.cpp b/src/openrct2/object/FootpathObject.cpp index c83b6a4956..8ab709e78b 100644 --- a/src/openrct2/object/FootpathObject.cpp +++ b/src/openrct2/object/FootpathObject.cpp @@ -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."); } } diff --git a/src/openrct2/object/ImageTable.cpp b/src/openrct2/object/ImageTable.cpp index a05fa25e77..f7f829fd51 100644 --- a/src/openrct2/object/ImageTable.cpp +++ b/src/openrct2/object/ImageTable.cpp @@ -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()); } } @@ -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()); } 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()); @@ -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()); @@ -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(remainingBytes); } @@ -453,7 +453,7 @@ namespace OpenRCT2 auto data = std::make_unique(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; } } diff --git a/src/openrct2/object/LargeSceneryObject.cpp b/src/openrct2/object/LargeSceneryObject.cpp index 210df13341..2e7e53958f 100644 --- a/src/openrct2/object/LargeSceneryObject.cpp +++ b/src/openrct2/object/LargeSceneryObject.cpp @@ -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."); } } diff --git a/src/openrct2/object/MusicObject.cpp b/src/openrct2/object/MusicObject.cpp index ae7f1945c5..263cdcb3e7 100644 --- a/src/openrct2/object/MusicObject.cpp +++ b/src/openrct2/object/MusicObject.cpp @@ -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 { diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index 97e28d394a..9f4ca2da55 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -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 diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index 011cd580c7..d40c335886 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -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); } } diff --git a/src/openrct2/object/PathAdditionObject.cpp b/src/openrct2/object/PathAdditionObject.cpp index 83cb0a1529..0196c7bab2 100644 --- a/src/openrct2/object/PathAdditionObject.cpp +++ b/src/openrct2/object/PathAdditionObject.cpp @@ -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. diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index 07b8c358ca..a26eaeb76b 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -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); diff --git a/src/openrct2/object/SceneryGroupObject.cpp b/src/openrct2/object/SceneryGroupObject.cpp index 1ccfeb56da..05b9031ce8 100644 --- a/src/openrct2/object/SceneryGroupObject.cpp +++ b/src/openrct2/object/SceneryGroupObject.cpp @@ -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 diff --git a/src/openrct2/object/SmallSceneryObject.cpp b/src/openrct2/object/SmallSceneryObject.cpp index 8293481ea4..b7abd313f0 100644 --- a/src/openrct2/object/SmallSceneryObject.cpp +++ b/src/openrct2/object/SmallSceneryObject.cpp @@ -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."); } } } diff --git a/src/openrct2/object/StringTable.cpp b/src/openrct2/object/StringTable.cpp index 9ff319a6af..09e587fddf 100644 --- a/src/openrct2/object/StringTable.cpp +++ b/src/openrct2/object/StringTable.cpp @@ -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(); diff --git a/src/openrct2/object/WallObject.cpp b/src/openrct2/object/WallObject.cpp index 63f717d2d3..1ba0136e70 100644 --- a/src/openrct2/object/WallObject.cpp +++ b/src/openrct2/object/WallObject.cpp @@ -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).