Cavegen: Fix non-constant array initializer error for MSVC

This commit is contained in:
SmallJoker 2017-04-07 17:59:27 +02:00
parent 71ffe699d0
commit c28a843592

@ -199,7 +199,7 @@ bool CavernsNoise::generateCaverns(MMVManip *vm, v3s16 nmin, v3s16 nmax)
noise_cavern->perlinMap3D(nmin.X, nmin.Y - 1, nmin.Z); noise_cavern->perlinMap3D(nmin.X, nmin.Y - 1, nmin.Z);
// Cache cavern_amp values // Cache cavern_amp values
float cavern_amp[m_csize.Y + 1]; float *cavern_amp = new float[m_csize.Y + 1];
u8 cavern_amp_index = 0; // Index zero at column top u8 cavern_amp_index = 0; // Index zero at column top
for (s16 y = nmax.Y; y >= nmin.Y - 1; y--, cavern_amp_index++) { for (s16 y = nmax.Y; y >= nmin.Y - 1; y--, cavern_amp_index++) {
cavern_amp[cavern_amp_index] = cavern_amp[cavern_amp_index] =
@ -241,6 +241,7 @@ bool CavernsNoise::generateCaverns(MMVManip *vm, v3s16 nmin, v3s16 nmax)
} }
} }
delete[] cavern_amp;
return has_cavern; return has_cavern;
} }