From 9a76224a22b4b041ff31a0c4928426ac5bdd57c8 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Sun, 23 May 2021 15:43:57 +0200 Subject: [PATCH] =?UTF-8?q?Downgrade=20=E2=80=9CImage=20table=20longer=20t?= =?UTF-8?q?han=20expected=E2=80=9D=20to=20a=20verbose=20warning=20(#14722)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are lots of custom objects like this and there is little point spewing the console full of them, since they’re unlikely to cause many problems. --- src/openrct2/object/ImageTable.cpp | 2 +- src/openrct2/object/Object.h | 1 + src/openrct2/object/ObjectFactory.cpp | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/openrct2/object/ImageTable.cpp b/src/openrct2/object/ImageTable.cpp index 15b04d1c70..ab2e033ba3 100644 --- a/src/openrct2/object/ImageTable.cpp +++ b/src/openrct2/object/ImageTable.cpp @@ -315,7 +315,7 @@ void ImageTable::Read(IReadObjectContext* context, OpenRCT2::IStream* stream) uint64_t remainingBytes = stream->GetLength() - stream->GetPosition() - headerTableSize; if (remainingBytes > imageDataSize) { - context->LogWarning(ObjectError::BadImageTable, "Image table size longer than expected."); + context->LogVerbose(ObjectError::BadImageTable, "Image table size longer than expected."); imageDataSize = static_cast(remainingBytes); } diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index 7e3a496e86..0f3761986c 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -237,6 +237,7 @@ struct IReadObjectContext virtual std::vector GetData(std::string_view path) abstract; virtual ObjectAsset GetAsset(std::string_view path) abstract; + virtual void LogVerbose(ObjectError code, const utf8* text) abstract; virtual void LogWarning(ObjectError code, const utf8* text) abstract; virtual void LogError(ObjectError code, const utf8* text) abstract; }; diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index 98a045d31c..db5865e54a 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -105,10 +105,15 @@ private: std::string _identifier; bool _loadImages; std::string _basePath; + bool _wasVerbose = false; bool _wasWarning = false; bool _wasError = false; public: + bool WasVerbose() const + { + return _wasVerbose; + } bool WasWarning() const { return _wasWarning; @@ -161,6 +166,16 @@ public: return {}; } + void LogVerbose(ObjectError code, const utf8* text) override + { + _wasVerbose = true; + + if (!String::IsNullOrEmpty(text)) + { + log_verbose("[%s] Info (%d): %s", _identifier.c_str(), code, text); + } + } + void LogWarning(ObjectError code, const utf8* text) override { _wasWarning = true;