1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 13:03:11 +01:00

Close #12429: Refactor OBJECT_ERROR to use strong enum and typo fix in build.sh (#13145)

* Close #12429: Refactor OBJECT_ERROR to use strong enum

* Typo Fix in build.sh: Unknown
This commit is contained in:
Julia Pinheiro
2020-10-10 12:21:07 -03:00
committed by GitHub
parent f28907a87d
commit b628bba704
12 changed files with 40 additions and 40 deletions

View File

@@ -142,7 +142,7 @@ std::vector<std::unique_ptr<ImageTable::RequiredImage>> ImageTable::ParseImages(
catch (const std::exception& e)
{
auto msg = String::StdFormat("Unable to load image '%s': %s", s.c_str(), e.what());
context->LogWarning(OBJECT_ERROR_BAD_IMAGE_TABLE, msg.c_str());
context->LogWarning(ObjectError::BadImageTable, msg.c_str());
result.push_back(std::make_unique<RequiredImage>());
}
}
@@ -179,7 +179,7 @@ std::vector<std::unique_ptr<ImageTable::RequiredImage>> ImageTable::ParseImages(
catch (const std::exception& e)
{
auto msg = String::StdFormat("Unable to load image '%s': %s", path.c_str(), e.what());
context->LogWarning(OBJECT_ERROR_BAD_IMAGE_TABLE, msg.c_str());
context->LogWarning(ObjectError::BadImageTable, msg.c_str());
result.push_back(std::make_unique<RequiredImage>());
}
return result;
@@ -216,13 +216,13 @@ std::vector<std::unique_ptr<ImageTable::RequiredImage>> ImageTable::LoadObjectIm
if (placeHoldersAdded > 0)
{
std::string msg = "Adding " + std::to_string(placeHoldersAdded) + " placeholders";
context->LogWarning(OBJECT_ERROR_INVALID_PROPERTY, msg.c_str());
context->LogWarning(ObjectError::InvalidProperty, msg.c_str());
}
}
else
{
std::string msg = "Unable to open '" + objectPath + "'";
context->LogWarning(OBJECT_ERROR_INVALID_PROPERTY, 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>());
@@ -316,7 +316,7 @@ void ImageTable::Read(IReadObjectContext* context, OpenRCT2::IStream* stream)
uint64_t remainingBytes = stream->GetLength() - stream->GetPosition() - headerTableSize;
if (remainingBytes > imageDataSize)
{
context->LogWarning(OBJECT_ERROR_BAD_IMAGE_TABLE, "Image table size longer than expected.");
context->LogWarning(ObjectError::BadImageTable, "Image table size longer than expected.");
imageDataSize = static_cast<uint32_t>(remainingBytes);
}
@@ -324,7 +324,7 @@ void ImageTable::Read(IReadObjectContext* context, OpenRCT2::IStream* stream)
auto data = std::make_unique<uint8_t[]>(dataSize);
if (data == nullptr)
{
context->LogError(OBJECT_ERROR_BAD_IMAGE_TABLE, "Image table too large.");
context->LogError(ObjectError::BadImageTable, "Image table too large.");
throw std::runtime_error("Image table too large.");
}
@@ -356,7 +356,7 @@ void ImageTable::Read(IReadObjectContext* context, OpenRCT2::IStream* stream)
if (unreadBytes > 0)
{
std::fill_n(data.get() + readBytes, unreadBytes, 0);
context->LogWarning(OBJECT_ERROR_BAD_IMAGE_TABLE, "Image table size shorter than expected.");
context->LogWarning(ObjectError::BadImageTable, "Image table size shorter than expected.");
}
_data = std::move(data);
@@ -364,7 +364,7 @@ void ImageTable::Read(IReadObjectContext* context, OpenRCT2::IStream* stream)
}
catch (const std::exception&)
{
context->LogError(OBJECT_ERROR_BAD_IMAGE_TABLE, "Bad image table.");
context->LogError(ObjectError::BadImageTable, "Bad image table.");
throw;
}
}