From 75191e7ac5cded02023192435d7c8f38f315767c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Sun, 22 Jan 2023 09:17:13 +0100 Subject: [PATCH] Skip loading authorship info in render --- src/PowderToyRenderer.cpp | 2 +- src/client/GameSave.cpp | 5 +++-- src/client/GameSave.h | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/PowderToyRenderer.cpp b/src/PowderToyRenderer.cpp index e308aa869..2082243c9 100644 --- a/src/PowderToyRenderer.cpp +++ b/src/PowderToyRenderer.cpp @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) GameSave * gameSave = NULL; try { - gameSave = new GameSave(fileData); + gameSave = new GameSave(fileData, false); } catch (ParseException &e) { diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 54372a684..b7e03a441 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -27,8 +27,9 @@ GameSave::GameSave(int width, int height) setSize(width, height); } -GameSave::GameSave(const std::vector &data) +GameSave::GameSave(const std::vector &data, bool newWantAuthors) { + wantAuthors = newWantAuthors; blockWidth = 0; blockHeight = 0; @@ -688,7 +689,7 @@ void GameSave::readOPS(const std::vector &data) fprintf(stderr, "Wrong type for %s\n", bson_iterator_key(&iter)); } } - else if (!strcmp(bson_iterator_key(&iter), "authors")) + else if (wantAuthors && !strcmp(bson_iterator_key(&iter), "authors")) { if (bson_iterator_type(&iter) == BSON_OBJECT) { diff --git a/src/client/GameSave.h b/src/client/GameSave.h index 73eccda14..4cb0211ea 100644 --- a/src/client/GameSave.h +++ b/src/client/GameSave.h @@ -115,6 +115,7 @@ public: int airMode = 0; float ambientAirTemp = R_TEMP + 273.15f; int edgeMode = 0; + bool wantAuthors = true; //Signs std::vector signs; @@ -130,7 +131,7 @@ public: int pmapbits = 8; // default to 8 bits for older saves GameSave(int width, int height); - GameSave(const std::vector &data); + GameSave(const std::vector &data, bool newWantAuthors = true); void setSize(int width, int height); // return value is [ fakeFromNewerVersion, gameData ] std::pair> Serialise() const;