I have been battling one very simple function for some silly amount of time and still can not find a fault with it.
The error message is
Quote: "1>c:documents and settingsuserdesktop1.0.7versioncondorsourceupgrade5bullet.cpp(112) : error C2181: illegal else without matching if"
It points to the very last "else" in the function.
This is it:
else
Aircraft[x].fGunReloadTimer -= fTimeInc; // decrease gun reload timer
}
}
This is the whole function and hopefully people can see that it is correct ????? or am I blind ???
void ShootBullet( float fTimeInc )
{
/*****************************************************
* cycle through each aircraft structure
* see what aircraft is shooting
* if last shot reload time has passed
* select the current unused bullet ID
* activate a bullet of that ID at the correct position
* start last shot reload timer for that aircraft
* and incrament the counter to the next bullet ID
******************************************************/
for ( int x = 0 ; x < iMaxPlayers ; x++ )//look through all aircraft
{
if ( Aircraft[x].fGunReloadTimer <= 0.0f ); //gun reload timer finished
{
if ( Aircraft[x].iGunsShooting == 1 ) // is guns shooting
{
if ( x == iThisMachinePlayerID ) //use real bullets
{
Aircraft[x].fGunReloadTimer = 0.075f; //this gives 15 shots per second
// Line up bullet with aircraft direction and position
RealBullet[iNextRealBullet].fPosZ = Aircraft[x].fPosZ;
RealBullet[iNextRealBullet].fPosY = Aircraft[x].fPosY;
RealBullet[iNextRealBullet].fPosX = Aircraft[x].fPosX;
RealBullet[iNextRealBullet].fRotZ = Aircraft[x].fRotZ;
RealBullet[iNextRealBullet].fRotY = Aircraft[x].fRotY;
RealBullet[iNextRealBullet].fRotX = Aircraft[x].fRotX;
dbPositionObject (RealBullet[iNextRealBullet].iModelID, RealBullet[iNextRealBullet].fPosX, RealBullet[iNextRealBullet].fPosY, RealBullet[iNextRealBullet].fPosZ );
dbRotateObject (RealBullet[iNextRealBullet].iModelID, RealBullet[iNextRealBullet].fRotX, RealBullet[iNextRealBullet].fRotY, RealBullet[iNextRealBullet].fRotZ );
dbMoveObjectRight (RealBullet[iNextRealBullet].iModelID, fRealGunOffsetValue );// give bullet gun offset value
dbTurnObjectLeft (RealBullet[iNextRealBullet].iModelID, fRealGunConvergenceValue ); //aim bullet for convergence
fRealGunOffsetValue *= (-1); // move next bullet to other wing
fRealGunConvergenceValue *= (-1); // converge next bullet from other wing
dbShowObject ( RealBullet[iNextRealBullet].iModelID ); // show the bullet
RealBullet[iNextRealBullet].fTime = 2; // this gives bullet a 2 Second life
if (iNextRealBullet == 127) // the last bullet in structure
iNextRealBullet = 0; // repoint to first bullet in structure
else
iNextRealBullet++; // point to next bullet
}
else // use Phantom bullets
{
Aircraft[x].fGunReloadTimer = 0.075f; //this gives 15 shots per second
// Line up bullet with aircraft direction and position
PhantomBullet[iNextPhantomBullet].fPosZ = Aircraft[x].fPosZ;
PhantomBullet[iNextPhantomBullet].fPosY = Aircraft[x].fPosY;
PhantomBullet[iNextPhantomBullet].fPosX = Aircraft[x].fPosX;
PhantomBullet[iNextPhantomBullet].fRotZ = Aircraft[x].fRotZ;
PhantomBullet[iNextPhantomBullet].fRotY = Aircraft[x].fRotY;
PhantomBullet[iNextPhantomBullet].fRotX = Aircraft[x].fRotX;
dbPositionObject (PhantomBullet[iNextPhantomBullet].iModelID, PhantomBullet[iNextPhantomBullet].fPosX, PhantomBullet[iNextPhantomBullet].fPosY, PhantomBullet[iNextPhantomBullet].fPosZ );
dbRotateObject (PhantomBullet[iNextPhantomBullet].iModelID, PhantomBullet[iNextPhantomBullet].fRotX, PhantomBullet[iNextPhantomBullet].fRotY, PhantomBullet[iNextPhantomBullet].fRotZ );
dbMoveObjectRight (PhantomBullet[iNextPhantomBullet].iModelID, fPhantomGunOffsetValue );// give bullet gun offset value
dbTurnObjectLeft (PhantomBullet[iNextPhantomBullet].iModelID, fPhantomGunConvergenceValue ); //aim bullet for convergence
fPhantomGunOffsetValue *= (-1); // move next bullet to other wing
fPhantomGunConvergenceValue *= (-1); // converge next bullet from other wing
dbShowObject (PhantomBullet[iNextPhantomBullet].iModelID ); // show the bullet
PhantomBullet[iNextPhantomBullet].fTime = 2; // this gives bullet a 2 Second life
if (iNextPhantomBullet == 255) // the last bullet in structure
iNextPhantomBullet = 0; // repoint to first bullet in structure
else
iNextPhantomBullet++; // point to next bullet
}
}
}
else
Aircraft[x].fGunReloadTimer -= fTimeInc; // decrease gun reload timer
}
}
can any one see what this compiler is so hot and bothered about ???