From a526caa1cb35fb423f2b1bf607620bf6da098ab5 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Sat, 4 Sep 2021 00:03:24 +0200 Subject: [PATCH] Use std::copy for gParkRatingHistory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ζeh Matt <5415177+ZehMatt@users.noreply.github.com> --- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 6bf6d87777..23010d8d50 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2121,7 +2121,7 @@ namespace RCT1 auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); park.ResetHistories(); - std::memcpy(gParkRatingHistory, _s4.park_rating_history, sizeof(_s4.park_rating_history)); + std::copy(std::begin(_s4.park_rating_history), std::end(_s4.park_rating_history), gParkRatingHistory); for (size_t i = 0; i < std::size(_s4.guests_in_park_history); i++) { if (_s4.guests_in_park_history[i] != RCT12ParkHistoryUndefined) diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 95d7fdcc09..6f3e4b0168 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -351,7 +351,7 @@ void S6Exporter::Export() _s6.park_rating = gParkRating; - std::memcpy(_s6.park_rating_history, gParkRatingHistory, sizeof(_s6.park_rating_history)); + std::copy(std::begin(gParkRatingHistory), std::end(gParkRatingHistory), _s6.park_rating_history); std::fill(std::begin(_s6.guests_in_park_history), std::end(_s6.guests_in_park_history), RCT12ParkHistoryUndefined); for (size_t i = 0; i < std::size(gGuestsInParkHistory); i++) { diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 4b7652d2b6..708d6e404e 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -272,7 +272,7 @@ public: auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); park.ResetHistories(); - std::memcpy(gParkRatingHistory, _s6.park_rating_history, sizeof(_s6.park_rating_history)); + std::copy(std::begin(_s6.park_rating_history), std::end(_s6.park_rating_history), gParkRatingHistory); for (size_t i = 0; i < std::size(_s6.guests_in_park_history); i++) { if (_s6.guests_in_park_history[i] != RCT12ParkHistoryUndefined)