mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +00:00
- added initialization for line and sector portals
Resizing of portal arrays during serialization could lead to processing of junk data https://forum.zdoom.org/viewtopic.php?t=67494
This commit is contained in:
parent
05f9df7057
commit
f9708e225c
3 changed files with 10 additions and 4 deletions
|
@ -127,7 +127,6 @@ void MapLoader::SpawnLinePortal(line_t* line)
|
|||
line->portalindex = Level->linePortals.Reserve(1);
|
||||
FLinePortal *port = &Level->linePortals.Last();
|
||||
|
||||
memset(port, 0, sizeof(FLinePortal));
|
||||
port->mOrigin = line;
|
||||
port->mDestination = dst;
|
||||
port->mType = uint8_t(line->args[2]); // range check is done above.
|
||||
|
|
|
@ -540,7 +540,6 @@ unsigned FLevelLocals::GetSkyboxPortal(AActor *actor)
|
|||
if (sectorPortals[i].mSkybox == actor) return i;
|
||||
}
|
||||
unsigned i = sectorPortals.Reserve(1);
|
||||
memset(§orPortals[i], 0, sizeof(sectorPortals[i]));
|
||||
sectorPortals[i].mType = PORTS_SKYVIEWPOINT;
|
||||
sectorPortals[i].mFlags = actor->GetClass()->IsDescendantOf("SkyCamCompat") ? 0 : PORTSF_SKYFLATONLY;
|
||||
sectorPortals[i].mSkybox = actor;
|
||||
|
@ -565,7 +564,6 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, GetSkyboxPortal)
|
|||
unsigned FLevelLocals::GetPortal(int type, int plane, sector_t *from, sector_t *to, const DVector2 &displacement)
|
||||
{
|
||||
unsigned i = sectorPortals.Reserve(1);
|
||||
memset(§orPortals[i], 0, sizeof(sectorPortals[i]));
|
||||
sectorPortals[i].mType = type;
|
||||
sectorPortals[i].mPlane = plane;
|
||||
sectorPortals[i].mOrigin = from;
|
||||
|
@ -586,7 +584,6 @@ unsigned FLevelLocals::GetPortal(int type, int plane, sector_t *from, sector_t *
|
|||
unsigned FLevelLocals::GetStackPortal(AActor *point, int plane)
|
||||
{
|
||||
unsigned i = sectorPortals.Reserve(1);
|
||||
memset(§orPortals[i], 0, sizeof(sectorPortals[i]));
|
||||
sectorPortals[i].mType = PORTS_STACKEDSECTORTHING;
|
||||
sectorPortals[i].mPlane = plane;
|
||||
sectorPortals[i].mOrigin = point->target->Sector;
|
||||
|
|
|
@ -193,6 +193,11 @@ struct FLinePortal
|
|||
double mCosRot;
|
||||
portnode_t *lineportal_thinglist;
|
||||
FLinePortalSpan *mGroup;
|
||||
|
||||
FLinePortal()
|
||||
{
|
||||
memset(this, 0, sizeof *this);
|
||||
}
|
||||
};
|
||||
|
||||
struct FLinePortalSpan
|
||||
|
@ -238,6 +243,11 @@ struct FSectorPortal
|
|||
double mPlaneZ;
|
||||
TObjPtr<AActor*> mSkybox;
|
||||
|
||||
FSectorPortal()
|
||||
{
|
||||
memset(this, 0, sizeof * this);
|
||||
}
|
||||
|
||||
bool MergeAllowed() const
|
||||
{
|
||||
// For thing based stack sectors and regular skies the portal has no relevance for merging visplanes.
|
||||
|
|
Loading…
Reference in a new issue