From 439d45eba94c17fd6c1e8d36a9dd71fa26196927 Mon Sep 17 00:00:00 2001
From: Lugent <35547583+Lugent@users.noreply.github.com>
Date: Thu, 23 Jan 2025 13:23:51 -0400
Subject: [PATCH 1/5] Inline P_MobjWasRemoved

---
 src/p_local.h | 2 +-
 src/p_mobj.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/p_local.h b/src/p_local.h
index de519b211b..3b29fb06f0 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -289,7 +289,7 @@ void P_RecalcPrecipInSector(sector_t *sector);
 void P_PrecipitationEffects(void);
 
 void P_RemoveMobj(mobj_t *th);
-boolean P_MobjWasRemoved(mobj_t *th);
+static inline boolean P_MobjWasRemoved(mobj_t *th);
 void P_RemoveSavegameMobj(mobj_t *th);
 boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
 void P_RunShields(void);
diff --git a/src/p_mobj.c b/src/p_mobj.c
index 85ae8b256f..b07e0163b4 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -11275,7 +11275,7 @@ void P_RemoveMobj(mobj_t *mobj)
 
 // This does not need to be added to Lua.
 // To test it in Lua, check mobj.valid
-boolean P_MobjWasRemoved(mobj_t *mobj)
+static inline boolean P_MobjWasRemoved(mobj_t *mobj)
 {
 	if (mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker)
 		return false;
-- 
GitLab


From 6106c5e936737e719684791119073ef31951a4fb Mon Sep 17 00:00:00 2001
From: Lugent <35547583+Lugent@users.noreply.github.com>
Date: Thu, 23 Jan 2025 13:47:15 -0400
Subject: [PATCH 2/5] Proper inlining, thx hanicef

---
 src/p_local.h | 7 ++++++-
 src/p_mobj.c  | 9 ---------
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/p_local.h b/src/p_local.h
index 3b29fb06f0..c8ca08d819 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -289,7 +289,6 @@ void P_RecalcPrecipInSector(sector_t *sector);
 void P_PrecipitationEffects(void);
 
 void P_RemoveMobj(mobj_t *th);
-static inline boolean P_MobjWasRemoved(mobj_t *th);
 void P_RemoveSavegameMobj(mobj_t *th);
 boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
 void P_RunShields(void);
@@ -301,6 +300,12 @@ boolean P_CheckSkyHit(mobj_t *mo, line_t *line);
 void P_PushableThinker(mobj_t *mobj);
 void P_SceneryThinker(mobj_t *mobj);
 
+// This does not need to be added to Lua.
+// To test it in Lua, check mobj.valid
+static inline boolean P_MobjWasRemoved(mobj_t *mobj)
+{
+	return mobj == NULL || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker;
+}
 
 fixed_t P_MobjFloorZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect);
 fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect);
diff --git a/src/p_mobj.c b/src/p_mobj.c
index b07e0163b4..9ddc7fd8e6 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -11273,15 +11273,6 @@ void P_RemoveMobj(mobj_t *mobj)
 #endif
 }
 
-// This does not need to be added to Lua.
-// To test it in Lua, check mobj.valid
-static inline boolean P_MobjWasRemoved(mobj_t *mobj)
-{
-	if (mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker)
-		return false;
-	return true;
-}
-
 void P_RemovePrecipMobj(precipmobj_t *mobj)
 {
 	// unlink from sector and block lists
-- 
GitLab


From b7131636e12277b30a0c7cd959040b585765c0c1 Mon Sep 17 00:00:00 2001
From: Lugent <35547583+Lugent@users.noreply.github.com>
Date: Thu, 23 Jan 2025 14:25:34 -0400
Subject: [PATCH 3/5] Use FORCEINLINE and ATTRINLINE instead

---
 src/p_local.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/p_local.h b/src/p_local.h
index c8ca08d819..cd67a9b11d 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -302,7 +302,7 @@ void P_SceneryThinker(mobj_t *mobj);
 
 // This does not need to be added to Lua.
 // To test it in Lua, check mobj.valid
-static inline boolean P_MobjWasRemoved(mobj_t *mobj)
+FORCEINLINE ATTRINLINE boolean P_MobjWasRemoved(mobj_t *mobj)
 {
 	return mobj == NULL || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker;
 }
-- 
GitLab


From 57704dfdff473afddae8b7965a22b1e121b3f24f Mon Sep 17 00:00:00 2001
From: Lugent <35547583+Lugent@users.noreply.github.com>
Date: Thu, 23 Jan 2025 14:28:16 -0400
Subject: [PATCH 4/5] Nvm, use FUNCNOINLINE instead of FORCEINLINE

---
 src/p_local.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/p_local.h b/src/p_local.h
index cd67a9b11d..bc294a9fad 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -302,7 +302,7 @@ void P_SceneryThinker(mobj_t *mobj);
 
 // This does not need to be added to Lua.
 // To test it in Lua, check mobj.valid
-FORCEINLINE ATTRINLINE boolean P_MobjWasRemoved(mobj_t *mobj)
+FUNCNOINLINE ATTRINLINE boolean P_MobjWasRemoved(mobj_t *mobj)
 {
 	return mobj == NULL || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker;
 }
-- 
GitLab


From 483ba16a87dfce93e19f5815bdb53d42af71ee32 Mon Sep 17 00:00:00 2001
From: Lugent <35547583+Lugent@users.noreply.github.com>
Date: Thu, 23 Jan 2025 14:28:49 -0400
Subject: [PATCH 5/5] And a static

---
 src/p_local.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/p_local.h b/src/p_local.h
index bc294a9fad..85a31cf898 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -302,7 +302,7 @@ void P_SceneryThinker(mobj_t *mobj);
 
 // This does not need to be added to Lua.
 // To test it in Lua, check mobj.valid
-FUNCNOINLINE ATTRINLINE boolean P_MobjWasRemoved(mobj_t *mobj)
+FUNCINLINE static ATTRINLINE boolean P_MobjWasRemoved(mobj_t *mobj)
 {
 	return mobj == NULL || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker;
 }
-- 
GitLab