From 61a2cf9ac8a21d375e2ec740994676b0b60d6e78 Mon Sep 17 00:00:00 2001 From: ephphatha Date: Wed, 9 Jun 2021 23:30:18 +1000 Subject: [PATCH] Refactor OperateShrineOily to use Point Also added documentation about what the function does. --- Source/objects.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/objects.cpp b/Source/objects.cpp index 56fd23977..514f2b22d 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -3977,7 +3977,15 @@ bool OperateShrineTainted(int pnum) return true; } -bool OperateShrineOily(int pnum, int x, int y) +/** + * @brief Oily shrines increase the players primary stat(s) by a total of two, but spawn a + * firewall near the shrine that will spread towards the player + * @param pnum The player that activated the shrine + * @param spawnPosition Start location for the firewall + * @return false if the current player did not activate the shrine (i.e. it's a multiplayer + * game) and we bailed early to avoid doubling the effects, true otherwise. + */ +bool OperateShrineOily(int pnum, Point spawnPosition) { if (deltaload) return false; @@ -4010,7 +4018,7 @@ bool OperateShrineOily(int pnum, int x, int y) CheckStats(Players[pnum]); AddMissile( - { x, y }, + spawnPosition, Players[MyPlayerId].position.tile, Players[MyPlayerId]._pdir, MIS_FIREWALL, @@ -4316,7 +4324,7 @@ void OperateShrine(int pnum, int i, _sfx_id sType) return; break; case ShrineOily: - if (!OperateShrineOily(pnum, Objects[i].position.x, Objects[i].position.y)) + if (!OperateShrineOily(pnum, Objects[i].position)) return; break; case ShrineGlowing: