aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen/mapgen.cpp
diff options
context:
space:
mode:
authoradrido <robots_only_adrido@gmx.com>2017-12-10 09:07:24 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-12-10 09:07:24 +0100
commitd677f292cc9fcb61078cb258761049c1fa4a424b (patch)
tree19a4c4aaa5252c7e5fc95b13fe2bc7cc00225bbc /src/mapgen/mapgen.cpp
parentda298a26ff3a412dda0caadddbfa4a92276daea3 (diff)
downloadminetest-d677f292cc9fcb61078cb258761049c1fa4a424b.tar.gz
minetest-d677f292cc9fcb61078cb258761049c1fa4a424b.tar.bz2
minetest-d677f292cc9fcb61078cb258761049c1fa4a424b.zip
Use std::vector instead of dynamic C-Array (#6744)
Diffstat (limited to 'src/mapgen/mapgen.cpp')
-rw-r--r--src/mapgen/mapgen.cpp13
1 files changed, 3 insertions, 10 deletions
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<s16> &floors, std::vector<s16> &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;
}