From 0450d2d914bfdbf867c7012e89fdfcabfa071a7b Mon Sep 17 00:00:00 2001
From: Lactozilla <jp6781615@gmail.com>
Date: Sun, 6 Aug 2023 17:46:45 -0300
Subject: [PATCH] Restore tmthing after a call to P_CheckPosition in
 G_CheckSpot

---
 src/g_game.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/g_game.c b/src/g_game.c
index 18b7ea4a81..e0af9496d4 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -2820,10 +2820,11 @@ static boolean G_CheckSpot(INT32 playernum, mapthing_t *mthing)
 	x = mthing->x << FRACBITS;
 	y = mthing->y << FRACBITS;
 
-	if (!P_CheckPosition(players[playernum].mo, x, y))
-		return false;
+	mobj_t *ptmthing = tmthing;
+	boolean success = P_CheckPosition(players[playernum].mo, x, y);
+	P_SetTarget(&tmthing, ptmthing);
 
-	return true;
+	return success;
 }
 
 //
-- 
GitLab