From ed6e9df07ce61cf0a9329faf788a836319d736df Mon Sep 17 00:00:00 2001 From: ny00123 Date: Fri, 6 Mar 2020 15:49:58 +0000 Subject: [PATCH] SW: Handle cases in which the result of an expression with (possible) side-effects is written to an unused var. git-svn-id: https://svn.eduke32.com/eduke32@8688 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/sw/src/console.cpp # source/sw/src/jnstub.cpp # source/sw/src/save.cpp # source/sw/src/sounds.cpp # source/sw/src/swconfig.cpp --- source/sw/src/miscactr.cpp | 3 +-- source/sw/src/player.cpp | 9 +++------ source/sw/src/sector.cpp | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/source/sw/src/miscactr.cpp b/source/sw/src/miscactr.cpp index a040b5d3a..ecc693161 100644 --- a/source/sw/src/miscactr.cpp +++ b/source/sw/src/miscactr.cpp @@ -811,7 +811,6 @@ int PachinkoCheckWin(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; - short rnd; u->WaitTics = 0; // Can operate it again now @@ -820,7 +819,7 @@ int PachinkoCheckWin(short SpriteNum) if (TEST_BOOL1(sp)) return 0; // Well? Did I win????! - rnd = RANDOM_RANGE(1000); + /*short rnd = */RANDOM_RANGE(1000); if (RANDOM_RANGE(1000) > 900 || Pachinko_Win_Cheat) { short i, nexti; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 3e1df05c6..837cdbd15 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -2280,7 +2280,6 @@ void DoPlayerSlide(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; - int ret; int push_ret; if ((pp->slide_xvect|pp->slide_yvect) == 0) @@ -2308,7 +2307,7 @@ DoPlayerSlide(PLAYERp pp) } return; } - ret = clipmove((vec3_t *)pp, &pp->cursectnum, pp->slide_xvect, pp->slide_yvect, ((int)pp->SpriteP->clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER); + clipmove((vec3_t *)pp, &pp->cursectnum, pp->slide_xvect, pp->slide_yvect, ((int)pp->SpriteP->clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER); PlayerCheckValidMove(pp); push_ret = pushmove((vec3_t *)pp, &pp->cursectnum, ((int)pp->SpriteP->clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER); if (push_ret < 0) @@ -2538,7 +2537,6 @@ void PlayerSectorBound(PLAYERp pp, int amt) void DoPlayerMove(PLAYERp pp) { - int ret = 0; USERp u = User[pp->PlayerSprite]; int friction; int save_cstat; @@ -2622,7 +2620,7 @@ DoPlayerMove(PLAYERp pp) save_cstat = pp->SpriteP->cstat; RESET(pp->SpriteP->cstat, CSTAT_SPRITE_BLOCK); COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); - ret = clipmove((vec3_t *)pp, &pp->cursectnum, pp->xvect, pp->yvect, ((int)pp->SpriteP->clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER); + clipmove((vec3_t *)pp, &pp->cursectnum, pp->xvect, pp->yvect, ((int)pp->SpriteP->clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER); pp->SpriteP->cstat = save_cstat; PlayerCheckValidMove(pp); @@ -2790,7 +2788,6 @@ DoPlayerMoveBoat(PLAYERp pp) { int z; int floor_dist; - int ret; short save_sectnum; SECTOR_OBJECTp sop = pp->sop; @@ -2855,7 +2852,7 @@ DoPlayerMoveBoat(PLAYERp pp) pp->cursectnum = pp->sop->op_main_sector; // for speed floor_dist = labs(z - pp->sop->floor_loz); - ret = clipmove_old(&pp->posx, &pp->posy, &z, &pp->cursectnum, pp->xvect, pp->yvect, (int)pp->sop->clipdist, Z(4), floor_dist, CLIPMASK_PLAYER); + clipmove_old(&pp->posx, &pp->posy, &z, &pp->cursectnum, pp->xvect, pp->yvect, (int)pp->sop->clipdist, Z(4), floor_dist, CLIPMASK_PLAYER); OperateSectorObject(pp->sop, pp->pang, pp->posx, pp->posy); pp->cursectnum = save_sectnum; // for speed diff --git a/source/sw/src/sector.cpp b/source/sw/src/sector.cpp index 4b2182602..95501c1ac 100644 --- a/source/sw/src/sector.cpp +++ b/source/sw/src/sector.cpp @@ -1080,7 +1080,6 @@ DoExplodeSector(short match) { short orig_ang; int zh; - USERp u; short cf,nextcf; SPRITEp esp; @@ -1096,7 +1095,7 @@ DoExplodeSector(short match) continue; if (!User[cf]) - u = SpawnUser(cf, 0, NULL); + /*u = */SpawnUser(cf, 0, NULL); sectp = §or[esp->sectnum];