From da75e29d5c67162391b0a3b25f71115e1637a31c Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 2 Oct 2023 20:42:00 +1100 Subject: [PATCH] - Duke: Clean up player/actor accesses in `handle_se18()`. --- source/games/duke/src/actors.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 466ed810f..3856c6d7c 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -2910,7 +2910,8 @@ void handle_se18(DDukeActor *actor, bool morecheck) { if (a2->isPlayer() && a2->GetOwner()) { - if (getPlayer(a2->PlayerIndex())->on_ground == 1) getPlayer(a2->PlayerIndex())->GetActor()->spr.pos.Z += extra; + const auto p = getPlayer(a2->PlayerIndex()); + if (p->on_ground == 1) a2->spr.pos.Z += extra; } if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE) { @@ -2949,7 +2950,8 @@ void handle_se18(DDukeActor *actor, bool morecheck) { if (a2->isPlayer() && a2->GetOwner()) { - if (getPlayer(a2->PlayerIndex())->on_ground == 1) getPlayer(a2->PlayerIndex())->GetActor()->spr.pos.Z -= extra; + const auto p = getPlayer(a2->PlayerIndex()); + if (p->on_ground == 1) a2->spr.pos.Z -= extra; } if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE) {