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; };