From d677f292cc9fcb61078cb258761049c1fa4a424b Mon Sep 17 00:00:00 2001 From: adrido Date: Sun, 10 Dec 2017 09:07:24 +0100 Subject: Use std::vector instead of dynamic C-Array (#6744) --- src/mapgen/mapgen.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/mapgen/mapgen.cpp') diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index a8b987325..ea3204196 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -301,10 +301,8 @@ void Mapgen::updateHeightmap(v3s16 nmin, v3s16 nmax) void Mapgen::getSurfaces(v2s16 p2d, s16 ymin, s16 ymax, - s16 *floors, s16 *ceilings, u16 *num_floors, u16 *num_ceilings) + std::vector &floors, std::vector &ceilings) { - u16 floor_i = 0; - u16 ceiling_i = 0; const v3s16 &em = vm->m_area.getExtent(); bool is_walkable = false; @@ -318,19 +316,14 @@ void Mapgen::getSurfaces(v2s16 p2d, s16 ymin, s16 ymax, is_walkable = ndef->get(mn).walkable; if (is_walkable && !walkable_above) { - floors[floor_i] = y; - floor_i++; + floors.push_back(y); } else if (!is_walkable && walkable_above) { - ceilings[ceiling_i] = y + 1; - ceiling_i++; + ceilings.push_back(y + 1); } vm->m_area.add_y(em, vi, -1); walkable_above = is_walkable; } - - *num_floors = floor_i; - *num_ceilings = ceiling_i; } -- cgit v1.2.3