Skip to content

Commit

Permalink
- fixed a few warnings pointed out by GCC.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Mar 26, 2023
1 parent 72d7a70 commit cffe67d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/maploader/renderinfo.cpp
Expand Up @@ -828,7 +828,7 @@ void MapLoader::FixHoles()
segloops.Reserve(1);
auto *segloop = &segloops.Last();

seg_t *startseg;
seg_t *startseg = nullptr;
seg_t *checkseg;
while (bogussegs.Size() > 0)
{
Expand Down
4 changes: 2 additions & 2 deletions src/maploader/specials.cpp
Expand Up @@ -166,7 +166,7 @@ void MapLoader::SpawnLinePortal(line_t* line)
line->portalindex = Level->linePortals.Reserve(1);
FLinePortal *port = &Level->linePortals.Last();

memset(port, 0, sizeof(FLinePortal));
port->Clear();
port->mOrigin = line;
port->mDestination = &ln;
port->mType = PORTT_LINKED;
Expand All @@ -177,7 +177,7 @@ void MapLoader::SpawnLinePortal(line_t* line)
ln.portalindex = Level->linePortals.Reserve(1);
port = &Level->linePortals.Last();

memset(port, 0, sizeof(FLinePortal));
port->Clear();
port->mOrigin = &ln;
port->mDestination = line;
port->mType = PORTT_LINKED;
Expand Down
4 changes: 2 additions & 2 deletions src/p_setup.cpp
Expand Up @@ -245,11 +245,11 @@ void FLevelLocals::ClearPortals()
PortalBlockmap.Clear();

// The first entry must always be the default skybox. This is what every sector gets by default.
memset(&sectorPortals[0], 0, sizeof(sectorPortals[0]));
sectorPortals[0].Clear();
sectorPortals[0].mType = PORTS_SKYVIEWPOINT;
sectorPortals[0].mFlags = PORTSF_SKYFLATONLY;
// The second entry will be the default sky. This is for forcing a regular sky through the skybox picker
memset(&sectorPortals[1], 0, sizeof(sectorPortals[0]));
sectorPortals[1].Clear();
sectorPortals[1].mType = PORTS_SKYVIEWPOINT;
sectorPortals[1].mFlags = PORTSF_SKYFLATONLY;

Expand Down
4 changes: 2 additions & 2 deletions src/playsim/p_map.cpp
Expand Up @@ -2510,8 +2510,8 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
while (true)
{
double bestfrac = 1.1;
spechit_t besthit;
int besthitnum;
spechit_t besthit{};
int besthitnum = -1;
// find the portal nearest to the crossing actor
for (unsigned i = 0; i < portalhit.Size();i++)
{
Expand Down
14 changes: 12 additions & 2 deletions src/playsim/portal.h
Expand Up @@ -197,7 +197,12 @@ struct FLinePortal

FLinePortal()
{
memset(this, 0, sizeof *this);
Clear();
}

void Clear()
{
memset((void*)this, 0, sizeof * this);
}
};

Expand Down Expand Up @@ -246,7 +251,12 @@ struct FSectorPortal

FSectorPortal()
{
memset(this, 0, sizeof * this);
Clear();
}

void Clear()
{
memset((void*)this, 0, sizeof * this);
}

bool MergeAllowed() const
Expand Down

0 comments on commit cffe67d

Please sign in to comment.