- cleaned up some random crap with loops and bad variable types I just randomly found.

This commit is contained in:
Christoph Oelckers 2021-12-24 12:08:50 +01:00
parent 7bbd4343a8
commit ca14c809f9
2 changed files with 9 additions and 10 deletions

View file

@ -25,7 +25,7 @@ endif()
# Build does not work with signed chars! Also set a stricter warning level, but silence the pointless and annoying parts of level 4 (Intentionally only for C++! The C code we use is too old and would warn too much)
if (MSVC)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J /W4 /wd4100 /wd4127 /wd4131 /wd4201 /wd4210 /wd4244 /wd4245 /wd4324 /wd4389 /wd4505 /wd4706 /wd4458 /wd4459 /wd4703" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J /W4 /wd4100 /wd4127 /wd4131 /wd4201 /wd4210 /wd4244 /wd4245 /wd4324 /wd4389 /wd4505 /wd4706 /wd4458 /wd4459" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4189" ) # "unused initialized local variable" - useful warning that creates too much noise in external or macro based code. Can be enabled for cleanup passes on the code.
else()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funsigned-char -Wno-missing-braces -Wno-char-subscripts -Wno-unused-variable" )

View file

@ -12465,7 +12465,7 @@ int InitSwordAttack(PLAYERp pp)
-256, -128, 0, 128, 256
};
for (int i = 0; i < (int)SIZ(dangs); i++)
for (size_t i = 0; i < countof(dangs); i++)
{
if (RandomRange(1000) < 500) continue; // Don't spawn bubbles every time
bubble = SpawnBubble(pp->Actor());
@ -12646,7 +12646,7 @@ int InitFistAttack(PLAYERp pp)
-128,128
};
for (int i = 0; i < (int)SIZ(dangs); i++)
for (size_t i = 0; i < countof(dangs); i++)
{
bubble = SpawnBubble(pp->Actor());
if (bubble != nullptr)
@ -12837,7 +12837,7 @@ int InitSumoNapalm(DSWActor* actor)
SPRITEp sp = &actor->s(), wp;
USERp u = actor->u(), wu;
short dist;
short i,j,ang;
short ang;
typedef struct
{
@ -12853,18 +12853,18 @@ int InitSumoNapalm(DSWActor* actor)
PlaySound(DIGI_NAPFIRE, actor, v3df_none);
ang = sp->ang;
for (j=0; j<4; j++)
for (int j = 0; j < 4; j++)
{
for (i = 0; i < (int)SIZ(mp); i++)
for (size_t i = 0; i < countof(mp); i++)
{
auto wActor = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, sp->sector(),
sp->pos.X, sp->pos.Y, GetSpriteZOfTop(sp), ang, NAPALM_VELOCITY);
sp->pos.X, sp->pos.Y, GetSpriteZOfTop(sp), ang, NAPALM_VELOCITY);
wp = &wActor->s();
wu = wActor->u();
wp->hitag = LUMINOUS; //Always full brightness
if (i==0) // Only attach sound to first projectile
if (i == 0) // Only attach sound to first projectile
{
PlaySound(DIGI_NAPWIZ, wActor, v3df_follow);
}
@ -13316,7 +13316,6 @@ int InitStar(PLAYERp pp)
int zvel;
static short dang[] = {-12, 12};
uint8_t i;
SPRITEp np;
USERp nu;
const int STAR_REPEAT = 26;
@ -13380,7 +13379,7 @@ int InitStar(PLAYERp pp)
wp->backuppos();
for (i = 0; i < (int)SIZ(dang); i++)
for (size_t i = 0; i < countof(dang); i++)
{
auto actorNew2 = SpawnActor(STAT_MISSILE, STAR1, s_Star, pp->cursector, nx, ny, nz, NORM_ANGLE(wp->ang + dang[i]), wp->xvel);
np = &actorNew2->s();