diff --git a/tools/quake3/q3map2/bsp.cpp b/tools/quake3/q3map2/bsp.cpp index d47b470c..9abf3fc5 100644 --- a/tools/quake3/q3map2/bsp.cpp +++ b/tools/quake3/q3map2/bsp.cpp @@ -218,10 +218,9 @@ static void FixBrushSides( const entity_t& e ){ Sys_FPrintf( SYS_VRB, "--- FixBrushSides ---\n" ); /* walk list of drawsurfaces */ - for ( int i = e.firstDrawSurf; i < numMapDrawSurfs; ++i ) + for ( const mapDrawSurface_t& ds : Span( mapDrawSurfs + e.firstDrawSurf, mapDrawSurfs + numMapDrawSurfs ) ) { - /* get surface and try to early out */ - const mapDrawSurface_t& ds = mapDrawSurfs[ i ]; + /* try to early out */ if ( ds.outputNum < 0 ) { continue; } diff --git a/tools/quake3/q3map2/surface.cpp b/tools/quake3/q3map2/surface.cpp index 265558df..3ceee47e 100644 --- a/tools/quake3/q3map2/surface.cpp +++ b/tools/quake3/q3map2/surface.cpp @@ -487,7 +487,7 @@ void ClassifyEntitySurfaces( const entity_t& e ){ /* note it */ Sys_FPrintf( SYS_VRB, "--- ClassifyEntitySurfaces ---\n" ); - /* walk the surface list */ + /* walk the surface list */ /* numMapDrawSurfs may grow in FinishSurface() */ for ( int i = e.firstDrawSurf; i < numMapDrawSurfs; ++i ) { FinishSurface( mapDrawSurfs[ i ] ); @@ -2892,7 +2892,7 @@ void AddEntitySurfaceModels( entity_t& e ){ /* note it */ Sys_FPrintf( SYS_VRB, "--- AddEntitySurfaceModels ---\n" ); - /* walk the surface list */ + /* walk the surface list */ /* numMapDrawSurfs grows here; do we want SurfaceModels on model surfaces? (can create infinite loop) */ for ( int i = e.firstDrawSurf; i < numMapDrawSurfs; ++i ) numSurfaceModels += AddSurfaceModels( mapDrawSurfs[ i ], e ); } @@ -2952,6 +2952,7 @@ void FilterDrawsurfsIntoTree( entity_t& e, tree_t& tree ){ numSurfs = 0; numRefs = 0; numSkyboxSurfaces = 0; + /* numMapDrawSurfs can grow here */ for ( int i = e.firstDrawSurf; i < numMapDrawSurfs; ++i ) { /* get surface and try to early out */ diff --git a/tools/quake3/q3map2/tjunction.cpp b/tools/quake3/q3map2/tjunction.cpp index 77ba75d6..209b45db 100644 --- a/tools/quake3/q3map2/tjunction.cpp +++ b/tools/quake3/q3map2/tjunction.cpp @@ -500,10 +500,9 @@ void FixTJunctions( const entity_t& ent ){ // this actually creates axial edges, but it // only creates originalEdge_t structures // for non-axial edges - for ( int i = ent.firstDrawSurf; i < numMapDrawSurfs; ++i ) + for ( mapDrawSurface_t& ds : Span( mapDrawSurfs + ent.firstDrawSurf, mapDrawSurfs + numMapDrawSurfs ) ) { - /* get surface and early out if possible */ - mapDrawSurface_t& ds = mapDrawSurfs[ i ]; + /* early out if possible */ const shaderInfo_t *si = ds.shaderInfo; if ( ( si->compileFlags & C_NODRAW ) || si->autosprite || si->notjunc || ds.verts.empty() ) { continue; @@ -545,10 +544,9 @@ void FixTJunctions( const entity_t& ent ){ Sys_FPrintf( SYS_VRB, "%9d degenerate edges\n", c_degenerateEdges ); // insert any needed vertexes - for ( int i = ent.firstDrawSurf; i < numMapDrawSurfs; ++i ) + for ( mapDrawSurface_t& ds : Span( mapDrawSurfs + ent.firstDrawSurf, mapDrawSurfs + numMapDrawSurfs ) ) { - /* get surface and early out if possible */ - mapDrawSurface_t& ds = mapDrawSurfs[ i ]; + /* early out if possible */ const shaderInfo_t *si = ds.shaderInfo; if ( ( si->compileFlags & C_NODRAW ) || si->autosprite || si->notjunc || ds.verts.empty() || ds.type != ESurfaceType::Face ) { continue;