- Fixed various instances of unused variables, accessing arrays out of bounds, initialization of non-primitive members in constructor's body, dead code, passing parameters by value instead of reference, usage of uninitialized variables, as reported by cppcheck.

This commit is contained in:
ZzZombo 2015-02-07 23:35:23 +08:00
commit 322742d4b1
28 changed files with 72 additions and 92 deletions

View file

@ -1234,9 +1234,16 @@ void AM_initVariables ()
for (pnum=0;pnum<MAXPLAYERS;pnum++)
if (playeringame[pnum])
break;
m_x = (players[pnum].camera->x >> FRACTOMAPBITS) - m_w/2;
m_y = (players[pnum].camera->y >> FRACTOMAPBITS) - m_h/2;
// [ZzZombo] no access out of bounds.
if(pnum>=MAXPLAYERS)
{
m_x=m_y=0;
}
else
{
m_x = (players[pnum].camera->x >> FRACTOMAPBITS) - m_w/2;
m_y = (players[pnum].camera->y >> FRACTOMAPBITS) - m_h/2;
}
AM_changeWindowLoc();
// for saving & restoring