mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-22 14:00:13 +00:00
Eliminate VLAs for the benefit of MSVC.
This commit is contained in:
parent
6753cc2e39
commit
62db7ee250
@ -8,7 +8,7 @@
|
||||
|
||||
CXXFLAGS += -std=c++11 -march=native -DMAC
|
||||
CXXFLAGS += -W -Wall -Wextra -pedantic
|
||||
CXXFLAGS += -Wno-format-pedantic -Wno-unused-parameter -Wno-missing-field-initializers -Wno-vla-extension
|
||||
CXXFLAGS += -Wno-format-pedantic -Wno-unused-parameter -Wno-missing-field-initializers
|
||||
CXXFLAGS += -I/usr/local/include
|
||||
CXXFLAGS += ${EXTRA_CXXFLAGS}
|
||||
|
||||
|
@ -360,9 +360,9 @@ void sdltogl(SDL_Surface *txt, glfont_t& f, int ch) {
|
||||
int theight = next_p2( otheight );
|
||||
|
||||
#if CAP_TABFONT
|
||||
int expanded_data[twidth * theight];
|
||||
std::vector<int> expanded_data(twidth * theight);
|
||||
#else
|
||||
Uint16 expanded_data[twidth * theight];
|
||||
std::vector<Uint16> expanded_data(twidth * theight);
|
||||
#endif
|
||||
|
||||
for(int j=0; j <theight;j++) for(int i=0; i < twidth; i++) {
|
||||
@ -387,7 +387,7 @@ void sdltogl(SDL_Surface *txt, glfont_t& f, int ch) {
|
||||
#else
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
|
||||
#endif
|
||||
expanded_data );
|
||||
expanded_data.data() );
|
||||
|
||||
float x=(float)otwidth / (float)twidth;
|
||||
float y=(float)otheight / (float)theight;
|
||||
|
@ -176,7 +176,7 @@ heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special) {
|
||||
|
||||
// okay, let's go then!
|
||||
cellwalker bf(c, gdir);
|
||||
cell *cx[rad+1];
|
||||
std::vector<cell *> cx(rad+1);
|
||||
for(int i=0; i<rad; i++) {
|
||||
cx[i] = bf.c;
|
||||
bf += revstep;
|
||||
@ -1347,4 +1347,4 @@ void moreBigStuff(cell *c) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2046,7 +2046,7 @@ void livecaves() {
|
||||
vector<cell*> bringlife;
|
||||
int gr = gamerange();
|
||||
|
||||
int heatvals[dcs];
|
||||
std::vector<int> heatvals(dcs);
|
||||
|
||||
for(int i=0; i<dcs; i++) {
|
||||
cell *c = allcells[i];
|
||||
@ -2991,7 +2991,7 @@ namespace ca {
|
||||
if(cwt.c->land != laCA) return;
|
||||
vector<cell*>& allcells = currentmap->allcells();
|
||||
int dcs = isize(allcells);
|
||||
bool willlive[dcs];
|
||||
std::vector<bool> willlive(dcs);
|
||||
for(int i=0; i<dcs; i++) {
|
||||
cell *c = allcells[i];
|
||||
if(c->land != laCA) return;
|
||||
@ -3126,9 +3126,9 @@ namespace windmap {
|
||||
|
||||
for(int i=0; i<N; i++) windcodes[i] = hrand(256);
|
||||
|
||||
bool inqueue[N];
|
||||
vector<bool> inqueue(N, true);
|
||||
vector<int> tocheck;
|
||||
for(int i=0; i<N; i++) tocheck.push_back(i), inqueue[i] = true;
|
||||
for(int i=0; i<N; i++) tocheck.push_back(i);
|
||||
hrandom_shuffle(&tocheck[0], isize(tocheck));
|
||||
|
||||
for(int a=0; a<isize(tocheck); a++) {
|
||||
|
@ -219,12 +219,11 @@ struct fpattern {
|
||||
} else wsquare = 0;
|
||||
|
||||
#ifdef EASY
|
||||
int sqrts[Prime];
|
||||
for(int k=0; k<Prime; k++) sqrts[k] = 0;
|
||||
std::vector<int> sqrts(Prime, 0);
|
||||
for(int k=1-Prime; k<Prime; k++) sqrts[sqr(k)] = k;
|
||||
int fmax = Prime;
|
||||
#else
|
||||
int sqrts[Field];
|
||||
std::vector<int> sqrts(Field);
|
||||
for(int k=0; k<Field; k++) sqrts[sqr(k)] = k;
|
||||
int fmax = Field;
|
||||
#endif
|
||||
|
@ -201,9 +201,9 @@ void polylineColor(SDL_Surface *s, int *x, int *y, int polyi, int col) {
|
||||
}
|
||||
|
||||
void filledPolygonColorI(SDL_Surface *s, int* px, int *py, int polyi, int col) {
|
||||
Sint16 spx[polyi], spy[polyi];
|
||||
for(int i=0; i<polyi; i++) spx[i] = px[i], spy[i] = py[i];
|
||||
filledPolygonColor(s, spx, spy, polyi, col);
|
||||
std::vector<Sint16> spx(px, px + polyi);
|
||||
std::vector<Sint16> spy(py, py + polyi);
|
||||
filledPolygonColor(s, spx.data(), spy.data(), polyi, col);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
12
shaders.cpp
12
shaders.cpp
@ -172,10 +172,10 @@ int compileShader(int type, const string& s) {
|
||||
GLint logLength;
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if (logLength > 0) {
|
||||
char log[logLength];
|
||||
glGetShaderInfoLog(shader, logLength, &logLength, log);
|
||||
std::vector<char> log(logLength);
|
||||
glGetShaderInfoLog(shader, logLength, &logLength, log.data());
|
||||
if(logLength > 0)
|
||||
printf("compiler log (%d): '%s'\n", logLength, log);
|
||||
printf("compiler log (%d): '%s'\n", logLength, log.data());
|
||||
}
|
||||
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
||||
@ -232,10 +232,10 @@ struct GLprogram {
|
||||
GLint logLength;
|
||||
glGetProgramiv(_program, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if (logLength > 0) {
|
||||
char log[logLength];
|
||||
glGetProgramInfoLog(_program, logLength, &logLength, log);
|
||||
std::vector<char> log(logLength);
|
||||
glGetProgramInfoLog(_program, logLength, &logLength, log.data());
|
||||
if(logLength > 0)
|
||||
printf("linking log (%d): %s\n", logLength, log);
|
||||
printf("linking log (%d): %s\n", logLength, log.data());
|
||||
}
|
||||
|
||||
glGetProgramiv(_program, GL_LINK_STATUS, &status);
|
||||
|
Loading…
x
Reference in New Issue
Block a user