@@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
26
26
#include " log.h"
27
27
#include " util/numeric.h"
28
28
#include < algorithm>
29
+ #include < vector>
29
30
30
31
31
32
FlagDesc flagdesc_deco[] = {
@@ -186,18 +187,16 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
186
187
187
188
// Get all floors and ceilings in node column
188
189
u16 size = (nmax.Y - nmin.Y + 1 ) / 2 ;
189
- s16 floors[size] ;
190
- s16 ceilings[size] ;
191
- u16 num_floors = 0 ;
192
- u16 num_ceilings = 0 ;
190
+ std::vector< s16> floors;
191
+ std::vector< s16> ceilings;
192
+ floors. reserve (size) ;
193
+ ceilings. reserve (size) ;
193
194
194
- mg->getSurfaces (v2s16 (x, z), nmin.Y , nmax.Y ,
195
- floors, ceilings, &num_floors, &num_ceilings);
195
+ mg->getSurfaces (v2s16 (x, z), nmin.Y , nmax.Y , floors, ceilings);
196
196
197
- if (( flags & DECO_ALL_FLOORS) && num_floors > 0 ) {
197
+ if (flags & DECO_ALL_FLOORS) {
198
198
// Floor decorations
199
- for (u16 fi = 0 ; fi < num_floors; fi++) {
200
- s16 y = floors[fi];
199
+ for (const s16 y : floors) {
201
200
if (y < y_min || y > y_max)
202
201
continue ;
203
202
@@ -208,10 +207,9 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
208
207
}
209
208
}
210
209
211
- if (( flags & DECO_ALL_CEILINGS) && num_ceilings > 0 ) {
210
+ if (flags & DECO_ALL_CEILINGS) {
212
211
// Ceiling decorations
213
- for (u16 ci = 0 ; ci < num_ceilings; ci++) {
214
- s16 y = ceilings[ci];
212
+ for (const s16 y : ceilings) {
215
213
if (y < y_min || y > y_max)
216
214
continue ;
217
215
0 commit comments