From 318d5656b51a527309695caf6930726adb94b594 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Mon, 12 Jun 2017 17:55:15 +0100
Subject: [PATCH] Keeping a total of thinkers saved/loaded and print the total
 in netplay devmode

Not a fix for anything, probably just useful for debugging
---
 src/p_saveg.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/p_saveg.c b/src/p_saveg.c
index 75f7b3e514..d1ec8e5abf 100644
--- a/src/p_saveg.c
+++ b/src/p_saveg.c
@@ -1653,12 +1653,18 @@ static inline void SaveWhatThinker(const thinker_t *th, const UINT8 type)
 static void P_NetArchiveThinkers(void)
 {
 	const thinker_t *th;
+	UINT32 numsaved = 0;
 
 	WRITEUINT32(save_p, ARCHIVEBLOCK_THINKERS);
 
 	// save off the current thinkers
 	for (th = thinkercap.next; th != &thinkercap; th = th->next)
 	{
+		if (!(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed
+		 || th->function.acp1 == (actionf_p1)P_RainThinker
+		 || th->function.acp1 == (actionf_p1)P_SnowThinker))
+			numsaved++;
+
 		if (th->function.acp1 == (actionf_p1)P_MobjThinker)
 		{
 			SaveMobjThinker(th, tc_mobj);
@@ -1846,6 +1852,8 @@ static void P_NetArchiveThinkers(void)
 #endif
 	}
 
+	CONS_Debug(DBG_NETPLAY, "%u thinkers saved\n", numsaved);
+
 	WRITEUINT8(save_p, tc_end);
 }
 
@@ -2610,6 +2618,7 @@ static void P_NetUnArchiveThinkers(void)
 	UINT8 tclass;
 	UINT8 restoreNum = false;
 	UINT32 i;
+	UINT32 numloaded = 0;
 
 	if (READUINT32(save_p) != ARCHIVEBLOCK_THINKERS)
 		I_Error("Bad $$$.sav at archive block Thinkers");
@@ -2643,6 +2652,7 @@ static void P_NetUnArchiveThinkers(void)
 
 		if (tclass == tc_end)
 			break; // leave the saved thinker reading loop
+		numloaded++;
 
 		switch (tclass)
 		{
@@ -2794,6 +2804,8 @@ static void P_NetUnArchiveThinkers(void)
 		}
 	}
 
+	CONS_Debug(DBG_NETPLAY, "%u thinkers loaded\n", numloaded);
+
 	if (restoreNum)
 	{
 		executor_t *delay = NULL;
-- 
GitLab