Beispiel #1
0
void deleteAllFlights (int numFlights, Flight* flights)
{
  
  for (int i = 0; i < numFlights ; i++ )
  {
    deletePlane(flights[i].plane);
  } //iterate trought the file to delete the plane in each flight
  
  free(flights);
} //deleat the flight array that has been created in heaps
Beispiel #2
0
//TODO 崩溃 未重现
bool Player::rotate(Plane *plane) {
	Direction direct = getRotateDirection(plane->direction);
	Plane * newPlane = new Plane(plane->pos, direct);
	if(!isPlaneConflicts(newPlane, plane) && isPlaneInBoard(plane->pos, direct)) {
		newPlane->release();
		CCLog("plane rotate");
		CCPoint pos = plane->pos;
		deletePlane(plane);
		addPlane(direct, pos);
		return true;
	}
	newPlane->release();
	return false;
}
Beispiel #3
0
//TODO 崩溃 未重现
bool Player::move(Plane *plane, int x, int y) {
	CCLog("************plane move:%f",plane->pos.x);
	CCPoint pos = ccp(plane->pos.x+x,plane->pos.y+y);
	Direction direct = plane->direction;
	Plane * newPlane = new Plane(pos, direct);
	if(!isPlaneConflicts(newPlane, plane) && isPlaneInBoard(pos, direct)) {
		CCLog("**************delete plane");
		deletePlane(plane);
		addPlane(direct, pos);
		newPlane->release();
		CCLog("**************newPlane release true");
		return true;
	}
	newPlane->release();
	CCLog("***************newPlane release false");
	return false;
}
Beispiel #4
0
void Player::deletePlane() {
	deletePlane(planeList->getObjectAtIndex(planeList->count()-1));
}