loser(pp, "exceded flight ceiling.");
loser(pp, "exceeded flight ceiling.");
update(dummy)	int dummy;{	int	i, dir_diff, unclean;	PLANE	*pp, *p1, *p2;#ifdef SYSV	alarm(0);	signal(SIGALRM, update);#endif	clck++;	erase_all();	/* put some planes in the air */	do {		unclean = 0;		for (pp = ground.head; pp != NULL; pp = pp->next) {			if (pp->new_altitude > 0) {				delete(&ground, pp);				append(&air, pp);				unclean = 1;				break;			}		}	} while (unclean);	/* do altitude change and basic movement */	for (pp = air.head; pp != NULL; pp = pp->next) {		/* type 0 only move every other turn */		if (pp->plane_type == 0 && clck & 1)			continue;		pp->fuel--;		if (pp->fuel < 0)			loser(pp, "ran out of fuel.");		pp->altitude += SGN(pp->new_altitude - pp->altitude);		if (!pp->delayd) {			dir_diff = pp->new_dir - pp->dir;			/*			 * Allow for circle commands			 */			if (pp->new_dir >= 0 && pp->new_dir < MAXDIR) {				if (dir_diff > MAXDIR/2)					dir_diff -= MAXDIR;				else if (dir_diff < -(MAXDIR/2))					dir_diff += MAXDIR;			}			if (dir_diff > 2)				dir_diff = 2;			else if (dir_diff < -2)				dir_diff = -2;			pp->dir += dir_diff;			if (pp->dir >= MAXDIR)				pp->dir -= MAXDIR;			else if (pp->dir < 0)				pp->dir += MAXDIR;		}		pp->xpos += displacement[pp->dir].dx;		pp->ypos += displacement[pp->dir].dy;		if (pp->delayd && pp->xpos == sp->beacon[pp->delayd_no].x &&		    pp->ypos == sp->beacon[pp->delayd_no].y) {			pp->delayd = 0;			if (pp->status == S_UNMARKED)				pp->status = S_MARKED;		}		switch (pp->dest_type) {		case T_AIRPORT:			if (pp->xpos == sp->airport[pp->dest_no].x &&			    pp->ypos == sp->airport[pp->dest_no].y &&			    pp->altitude == 0) {				if (pp->dir != sp->airport[pp->dest_no].dir)				    loser(pp, "landed in the wrong direction.");				else {				    pp->status = S_GONE;				    continue;				}			}			break;		case T_EXIT:			if (pp->xpos == sp->exit[pp->dest_no].x &&			    pp->ypos == sp->exit[pp->dest_no].y) {			    	if (pp->altitude != 9)				    loser(pp, "exited at the wrong altitude.");				else {				    pp->status = S_GONE;				    continue;				}			}			break;		default:			loser(pp, "has a bizarre destination, get help!");		}		if (pp->altitude > 9)			/* "this is impossible" */			loser(pp, "exceded flight ceiling.");		if (pp->altitude <= 0) {			for (i = 0; i < sp->num_airports; i++)				if (pp->xpos == sp->airport[i].x &&				    pp->ypos == sp->airport[i].y) {					if (pp->dest_type == T_AIRPORT)					    loser(pp, 						"landed at the wrong airport.");					else					    loser(pp, 						"landed instead of exited.");				}			loser(pp, "crashed on the ground.");		}		if (pp->xpos < 1 || pp->xpos >= sp->width - 1 ||		    pp->ypos < 1 || pp->ypos >= sp->height - 1) {			for (i = 0; i < sp->num_exits; i++)				if (pp->xpos == sp->exit[i].x &&				    pp->ypos == sp->exit[i].y) {					if (pp->dest_type == T_EXIT)					    loser(pp, 						"exited via the wrong exit.");					else					    loser(pp, 						"exited instead of landed.");				}			loser(pp, "illegally left the flight arena.");		}	}	/*	 * Traverse the list once, deleting the planes that are gone.	 */	for (pp = air.head; pp != NULL; pp = p2) {		p2 = pp->next;		if (pp->status == S_GONE) {			safe_planes++;			delete(&air, pp);		}	}	draw_all();	for (p1 = air.head; p1 != NULL; p1 = p1->next)		for (p2 = p1->next; p2 != NULL; p2 = p2->next)			if (too_close(p1, p2, 1)) {				static char	buf[80];				(void)sprintf(buf, "collided with plane '%c'.",					name(p2));				loser(p1, buf);			}	/*	 * Check every other update.  Actually, only add on even updates.	 * Otherwise, prop jobs show up *on* entrance.  Remember that	 * we don't update props on odd updates.	 */	if ((random() % sp->newplane_time) == 0)		addplane();#ifdef SYSV	alarm(sp->update_secs);#endif}