diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 74dc36cb0..c04a57477 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -252,46 +252,11 @@ struct FLevelLocals : public FLevelData extern FLevelLocals level; -inline int vertex_t::Index() const -{ - return int(this - &level.vertexes[0]); -} - -inline int side_t::Index() const -{ - return int(this - &level.sides[0]); -} - -inline int line_t::Index() const -{ - return int(this - &level.lines[0]); -} - -inline int seg_t::Index() const -{ - return int(this - &level.segs[0]); -} - -inline int subsector_t::Index() const -{ - return int(this - &level.subsectors[0]); -} - -inline int node_t::Index() const -{ - return int(this - &level.nodes[0]); -} - inline FSectorPortal *line_t::GetTransferredPortal() { return portaltransferred >= level.sectorPortals.Size() ? (FSectorPortal*)nullptr : &level.sectorPortals[portaltransferred]; } -inline int sector_t::Index() const -{ - return int(this - &level.sectors[0]); -} - inline FSectorPortal *sector_t::GetPortal(int plane) { return &level.sectorPortals[Portals[plane]]; diff --git a/src/hwrenderer/scene/hw_bsp.cpp b/src/hwrenderer/scene/hw_bsp.cpp index 6dab92cc8..d7f47f78e 100644 --- a/src/hwrenderer/scene/hw_bsp.cpp +++ b/src/hwrenderer/scene/hw_bsp.cpp @@ -229,7 +229,7 @@ void HWDrawInfo::UnclipSubsector(subsector_t *sub) void HWDrawInfo::AddLine (seg_t *seg, bool portalclip) { #ifdef _DEBUG - if (seg->linedef->Index() == 38) + if (seg->linedef && seg->linedef->Index() == 38) { int a = 0; } diff --git a/src/r_defs.h b/src/r_defs.h index 200b07f86..a7cdb5c87 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -148,7 +148,7 @@ struct vertex_t return p; } - int Index() const; + int Index() const { return vertexnum; } void RecalcVertexHeights(); @@ -776,7 +776,7 @@ public: sector_t *NextSpecialSector (int type, sector_t *prev) const; // [RH] void RemoveForceField(); - int Index() const; + int Index() const { return sectornum; } void AdjustFloorClip () const; void SetColor(PalEntry pe, int desat); @@ -1346,7 +1346,7 @@ struct side_t vertex_t *V1() const; vertex_t *V2() const; - int Index() const; + int Index() const { return sidenum; } }; enum AutomapLineStyle : int @@ -1415,7 +1415,7 @@ struct line_t inline int getPortalAlignment() const; inline bool hitSkyWall(AActor* mo) const; - int Index() const; + int Index() const { return linenum; } }; inline vertex_t *side_t::V1() const @@ -1491,7 +1491,7 @@ struct seg_t float sidefrac; // relative position of seg's ending vertex on owning sidedef int segnum; - int Index() const; + int Index() const { return segnum; } }; //extern seg_t *segs; @@ -1538,7 +1538,7 @@ struct subsector_t char hacked; // 1: is part of a render hack void BuildPolyBSP(); - int Index() const; + int Index() const { return subsectornum; } // 2: has one-sided walls FPortalCoverage portalcoverage[2]; }; @@ -1569,7 +1569,7 @@ struct node_t int intchildren[2]; // Used by nodebuilder. }; - int Index() const; + int Index() const { return nodenum; } };