From ad529c7f6c185d69ff651021855412f8b771aecc Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 21 Jun 2020 14:22:17 -0300 Subject: [PATCH] Use const ref on MoneyEffect::Create --- src/openrct2/world/MoneyEffect.cpp | 9 +++++---- src/openrct2/world/Sprite.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/openrct2/world/MoneyEffect.cpp b/src/openrct2/world/MoneyEffect.cpp index 355ae5ce11..e0b44744ba 100644 --- a/src/openrct2/world/MoneyEffect.cpp +++ b/src/openrct2/world/MoneyEffect.cpp @@ -64,8 +64,9 @@ void MoneyEffect::CreateAt(money32 value, const CoordsXYZ& effectPos, bool verti * * rct2: 0x0069C5D0 */ -void MoneyEffect::Create(money32 value, CoordsXYZ loc) +void MoneyEffect::Create(money32 value, const CoordsXYZ& loc) { + auto offsetLoc = loc; if (loc.isNull()) { // If game actions return no valid location of the action we can not use the screen @@ -86,10 +87,10 @@ void MoneyEffect::Create(money32 value, CoordsXYZ loc) if (!mapPositionXY) return; - loc = { *mapPositionXY, tile_element_height(*mapPositionXY) }; + offsetLoc = { *mapPositionXY, tile_element_height(*mapPositionXY) }; } - loc.z += 10; - CreateAt(-value, loc, false); + offsetLoc.z += 10; + CreateAt(-value, offsetLoc, false); } /** diff --git a/src/openrct2/world/Sprite.h b/src/openrct2/world/Sprite.h index b8145a8cf7..043fc87964 100644 --- a/src/openrct2/world/Sprite.h +++ b/src/openrct2/world/Sprite.h @@ -82,7 +82,7 @@ struct MoneyEffect : SpriteBase uint16_t Wiggle; static void CreateAt(money32 value, const CoordsXYZ& effectPos, bool vertical); - static void Create(money32 value, CoordsXYZ loc); + static void Create(money32 value, const CoordsXYZ& loc); void Update(); std::pair GetStringId() const; };