Keeping a total of thinkers saved/loaded and print the total in netplay devmode

Not a fix for anything, probably just useful for debugging
This commit is contained in:
Monster Iestyn 2017-06-12 17:55:15 +01:00
parent 02c098574c
commit 318d5656b5
1 changed files with 12 additions and 0 deletions

View File

@ -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;