mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-10 19:01:50 +00:00
Consistency for mobjnum 0 meaning NULL
Moves `P_Net(Un)ArchiveTubeWaypoints` down the file to take advantage of `SaveMobjnum` inline.
This commit is contained in:
parent
5c1235407b
commit
22b87e0f19
1 changed files with 34 additions and 37 deletions
|
|
@ -1062,41 +1062,6 @@ static void P_NetUnArchiveColormaps(savebuffer_t *save)
|
||||||
net_colormaps = NULL;
|
net_colormaps = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetArchiveTubeWaypoints(savebuffer_t *save)
|
|
||||||
{
|
|
||||||
INT32 i, j;
|
|
||||||
|
|
||||||
for (i = 0; i < NUMTUBEWAYPOINTSEQUENCES; i++)
|
|
||||||
{
|
|
||||||
WRITEUINT16(save->p, numtubewaypoints[i]);
|
|
||||||
for (j = 0; j < numtubewaypoints[i]; j++)
|
|
||||||
{
|
|
||||||
if (tubewaypoints[i][j])
|
|
||||||
WRITEUINT32(save->p, tubewaypoints[i][j]->mobjnum);
|
|
||||||
else
|
|
||||||
WRITEUINT32(save->p, UINT32_MAX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void P_NetUnArchiveTubeWaypoints(savebuffer_t *save)
|
|
||||||
{
|
|
||||||
INT32 i, j;
|
|
||||||
UINT32 mobjnum;
|
|
||||||
|
|
||||||
for (i = 0; i < NUMTUBEWAYPOINTSEQUENCES; i++)
|
|
||||||
{
|
|
||||||
numtubewaypoints[i] = READUINT16(save->p);
|
|
||||||
for (j = 0; j < numtubewaypoints[i]; j++)
|
|
||||||
{
|
|
||||||
mobjnum = READUINT32(save->p);
|
|
||||||
tubewaypoints[i][j] = NULL;
|
|
||||||
if (mobjnum != UINT32_MAX)
|
|
||||||
P_SetTarget(&tubewaypoints[i][j], P_FindNewPosition(mobjnum));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// World Archiving
|
/// World Archiving
|
||||||
///
|
///
|
||||||
|
|
@ -3084,6 +3049,38 @@ static void P_NetUnArchiveWaypoints(savebuffer_t *save)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void P_NetArchiveTubeWaypoints(savebuffer_t *save)
|
||||||
|
{
|
||||||
|
INT32 i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < NUMTUBEWAYPOINTSEQUENCES; i++)
|
||||||
|
{
|
||||||
|
WRITEUINT16(save->p, numtubewaypoints[i]);
|
||||||
|
for (j = 0; j < numtubewaypoints[i]; j++)
|
||||||
|
{
|
||||||
|
WRITEUINT32(save->p, SaveMobjnum(tubewaypoints[i][j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void P_NetUnArchiveTubeWaypoints(savebuffer_t *save)
|
||||||
|
{
|
||||||
|
INT32 i, j;
|
||||||
|
UINT32 mobjnum;
|
||||||
|
|
||||||
|
for (i = 0; i < NUMTUBEWAYPOINTSEQUENCES; i++)
|
||||||
|
{
|
||||||
|
numtubewaypoints[i] = READUINT16(save->p);
|
||||||
|
for (j = 0; j < numtubewaypoints[i]; j++)
|
||||||
|
{
|
||||||
|
mobjnum = READUINT32(save->p);
|
||||||
|
tubewaypoints[i][j] = NULL;
|
||||||
|
if (mobjnum != 0)
|
||||||
|
P_SetTarget(&tubewaypoints[i][j], P_FindNewPosition(mobjnum));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now save the pointers, tracer and target, but at load time we must
|
// Now save the pointers, tracer and target, but at load time we must
|
||||||
// relink to this; the savegame contains the old position in the pointer
|
// relink to this; the savegame contains the old position in the pointer
|
||||||
// field copyed in the info field temporarily, but finally we just search
|
// field copyed in the info field temporarily, but finally we just search
|
||||||
|
|
@ -3104,7 +3101,7 @@ mobj_t *P_FindNewPosition(UINT32 oldposition)
|
||||||
|
|
||||||
return mobj;
|
return mobj;
|
||||||
}
|
}
|
||||||
CONS_Debug(DBG_GAMELOGIC, "mobj not found\n");
|
CONS_Debug(DBG_GAMELOGIC, "mobj %d not found\n", oldposition);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5118,7 +5115,7 @@ void P_SaveNetGame(savebuffer_t *save, boolean resending)
|
||||||
{
|
{
|
||||||
thinker_t *th;
|
thinker_t *th;
|
||||||
mobj_t *mobj;
|
mobj_t *mobj;
|
||||||
INT32 i = 1; // don't start from 0, it'd be confused with a blank pointer otherwise
|
UINT32 i = 1; // don't start from 0, it'd be confused with a blank pointer otherwise
|
||||||
|
|
||||||
CV_SaveNetVars(&save->p);
|
CV_SaveNetVars(&save->p);
|
||||||
P_NetArchiveMisc(save, resending);
|
P_NetArchiveMisc(save, resending);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue