we dont really need to check for precipthinkers in the precip thinkerlist

also makes precip handling in P_NetUnArchiveThinkers a little safer
This commit is contained in:
Alug committed 2025-01-01 05:07:56 +01:00
1 parent cf32ce90b6
commit da3ffafc90
4 files changed
+26 -25

No files matched your search

+14 -9
View File
@@ -2670,6 +2670,8 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
{
thinker_t *currentthinker;
thinker_t *next;
thinker_t *currentprecipthinker;
thinker_t *nextprecip;
UINT8 tclass;
UINT8 restoreNum = false;
UINT32 i;
@@ -2694,19 +2696,22 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
}
}
currentthinker = precipcap.next;
for (currentthinker = precipcap.next; currentthinker != &precipcap; currentthinker = next)
// remove all the current precip thinkers
currentprecipthinker = precipcap.next;
for (currentprecipthinker = precipcap.next; currentprecipthinker != &precipcap; currentprecipthinker = nextprecip)
{
next = currentthinker->next;
nextprecip = currentprecipthinker->next;
if (currentthinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
P_RemoveSavegameMobj((mobj_t *)currentthinker); // item isn't saved, don't remove it
else
#ifdef PARANOIA
if (currentprecipthinker->function.acp1 != (actionf_p1)P_NullPrecipThinker)
{
(next->prev = currentthinker->prev)->next = next;
R_DestroyLevelInterpolators(currentthinker);
Z_Free(currentthinker);
(next->prev = currentprecipthinker->prev)->next = nextprecip;
R_DestroyLevelInterpolators(currentprecipthinker);
Z_Free(currentprecipthinker);
}
else
#endif
P_RemoveSavegameMobj((mobj_t *)currentprecipthinker); // item isn't saved, don't remove it
}
// we don't want the removed mobjs to come back
+4
View File
@@ -1783,8 +1783,10 @@ void P_SwitchWeather(INT32 weathernum)
{
next = think->next;
#ifdef PARANOIA
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
continue; // not a precipmobj thinker
#endif
precipmobj = (precipmobj_t *)think;
P_FreePrecipMobj(precipmobj);
@@ -1798,8 +1800,10 @@ void P_SwitchWeather(INT32 weathernum)
for (think = precipcap.next; think != &precipcap; think = think->next)
{
#ifdef PARANOIA
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
continue; // not a precipmobj thinker
#endif
precipmobj = (precipmobj_t *)think;
+6 -16
View File
@@ -57,6 +57,7 @@ void Command_Numthinkers_f(void)
INT32 count = 0;
actionf_p1 action;
thinker_t *think;
thinker_t *listtype;
if (gamestate != GS_LEVEL)
{
@@ -105,25 +106,14 @@ void Command_Numthinkers_f(void)
return;
}
if (num == 2) // P_NullPrecipThinker
{
for (think = precipcap.next; think != &precipcap; think = think->next)
{
if (think->function.acp1 != action)
continue;
listtype = (num == 2) ? &precipcap : &thinkercap;
count++;
}
}
else
for (think = listtype->next; think != listtype; think = think->next)
{
for (think = thinkercap.next; think != &thinkercap; think = think->next)
{
if (think->function.acp1 != action)
continue;
if (think->function.acp1 != action)
continue;
count++;
}
count++;
}
CONS_Printf("%d\n", count);
+2
View File
@@ -314,8 +314,10 @@ static void Precipstuff_OnChange(void)
{
next = think->next;
#ifdef PARANOIA
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
continue; // not a precipmobj thinker
#endif
precipmobj = (precipmobj_t *)think;
P_FreePrecipMobj(precipmobj);