mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Use std::vector instead of dynamic C-Array (#6744)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user