SW: Fix -Waggressive-loop-optimizations

git-svn-id: https://svn.eduke32.com/eduke32@7562 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-04-10 01:01:07 +00:00 committed by Christoph Oelckers
parent 7ea2d2024b
commit fdb5fabc86
2 changed files with 5 additions and 8 deletions

View file

@ -250,7 +250,7 @@ void CONFIG_SetDefaults(void)
} }
memset(JoystickDigitalAxes, -1, sizeof(JoystickDigitalAxes)); memset(JoystickDigitalAxes, -1, sizeof(JoystickDigitalAxes));
for (i=0; i < (int32_t)(sizeof(joystickanalogdefaults)/sizeof(char *)); i++) for (i=0; i < MAXJOYAXES; i++)
{ {
JoystickAnalogScale[i] = 65536; JoystickAnalogScale[i] = 65536;
JoystickAnalogDead[i] = 1024; JoystickAnalogDead[i] = 1024;

View file

@ -816,12 +816,9 @@ int TileRangeMem(int start)
void CON_Cache(void) void CON_Cache(void)
{ {
char incache[8192]; // 8192 so it can index maxwalls as well char incache[MAXTILES]{};
int i,j,tottiles,totsprites,totactors; int i,j,tottiles,totsprites,totactors;
memset(incache,0,8192);
// Calculate all level tiles, non-actor stuff // Calculate all level tiles, non-actor stuff
for (i=0; i<numsectors; i++) for (i=0; i<numsectors; i++)
{ {
@ -837,13 +834,13 @@ void CON_Cache(void)
} }
tottiles = 0; tottiles = 0;
for (i=0; i<8192; i++) for (i=0; i<MAXTILES; i++)
if (incache[i] > 0) if (incache[i] > 0)
tottiles += tilesiz[i].x*tilesiz[i].y; tottiles += tilesiz[i].x*tilesiz[i].y;
////////////////////////////////////////////// //////////////////////////////////////////////
memset(incache,0,8192); memset(incache, 0, sizeof(incache));
// Sprites on the stat list get counted as cached, others don't // Sprites on the stat list get counted as cached, others don't
for (i=0; i<MAXSPRITES; i++) for (i=0; i<MAXSPRITES; i++)
@ -853,7 +850,7 @@ void CON_Cache(void)
totsprites = 0; totsprites = 0;
totactors = 0; totactors = 0;
for (i=0; i<MAXSPRITES; i++) for (i=0; i<MAXTILES; i++)
{ {
if (incache[i] > 0) if (incache[i] > 0)
{ {