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

View file

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