Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Cavegen: Fix non-constant array initializer error for MSVC
  • Loading branch information
SmallJoker committed Apr 7, 2017
1 parent 71ffe69 commit c28a843
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cavegen.cpp
Expand Up @@ -199,7 +199,7 @@ bool CavernsNoise::generateCaverns(MMVManip *vm, v3s16 nmin, v3s16 nmax)
noise_cavern->perlinMap3D(nmin.X, nmin.Y - 1, nmin.Z);

// 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
for (s16 y = nmax.Y; y >= nmin.Y - 1; y--, cavern_amp_index++) {
cavern_amp[cavern_amp_index] =
Expand Down Expand Up @@ -241,6 +241,7 @@ bool CavernsNoise::generateCaverns(MMVManip *vm, v3s16 nmin, v3s16 nmax)
}
}

delete[] cavern_amp;
return has_cavern;
}

Expand Down

1 comment on commit c28a843

@nerzhul
Copy link
Member

@nerzhul nerzhul commented on c28a843 Apr 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::array is a better usecase for this

Please sign in to comment.