View Single Post
  #12  
Old 07-03-2011, 03:16 AM
Skoshi Tiger Skoshi Tiger is offline
Approved Member
 
Join Date: Nov 2007
Location: Western Australia
Posts: 2,197
Default

Quote:
Originally Posted by Ataros View Post
btw. There is a Break command there. What does it break?
The break statement terminates the closest enclosing loop or switch statement in which it appears. Control is passed to the statement that follows the terminated statement, if any.

Is this the break you are talking about?

Quote:
//check if there is any player inside
foreach (Player p in ps)
{
if (p != null)
{
if (p.Place() != null)
{
AiAircraft playerAircraft = (p.Place() as AiAircraft);
if (playerAircraft != null)
{
if (playerAircraft == aircraft)
{
aircraftWillBeDestroyed = false;
break;
}
}
}
}
}
I think the break statement will drop out of the foreach loop. As far as I can see the purpose of the code is to see if any of the planes contained in array ps have a player inside. If any of the array locations contains a player then the loop does not have to continue.

The next section of code checks 'aircraftWillBeDestroyed' if player is present then this is set to false and the section that destroys the aircraft will be skipped.


Cheers!

Last edited by Skoshi Tiger; 07-03-2011 at 03:22 AM.
Reply With Quote