// called once per frame to refresh the escort list if important flags changed
void hud_escort_cull_list()
{
	int i;

	int np_index;

	// multiplayer dogfight
	if(MULTI_DOGFIGHT){
		for ( i = 0; i < Num_escort_ships; i++ ) {
			np_index = find_player_id(Escort_ships[i].np_id);
			
			// maybe remove him if he left
			if ( np_index < 0 ) {
				hud_setup_escort_list(0);
				break;
			}
		}
	} 
	// everything else
	else {
		for ( i = 0; i < Num_escort_ships; i++ ) {
			int objnum = Escort_ships[i].objnum;
			Assert( objnum >=0 && objnum < MAX_OBJECTS );

			if ( Objects[objnum].flags[Object::Object_Flags::Should_be_dead] ) {
				hud_setup_escort_list(0);
				break;
			} else if ( Objects[objnum].type == OBJ_SHIP ) {
				int shipnum = Objects[objnum].instance;
				Assert( shipnum >= 0 && shipnum < MAX_SHIPS );

				if ( (Ships[shipnum].flags[Ship::Ship_Flags::Hidden_from_sensors])
					|| ((Ships[shipnum].flags[Ship::Ship_Flags::Stealth]) && ((Ships[shipnum].team != Player_ship->team) || (Ships[shipnum].flags[Ship::Ship_Flags::Friendly_stealth_invis])))
				) {
					hud_setup_escort_list(0);
					break;
				}
			}
		}
	}
}
// called once per frame to refresh the escort list if important flags changed
void hud_escort_cull_list()
{
	int i;

	int np_index;

	// multiplayer dogfight
	if(MULTI_DOGFIGHT){
		for ( i = 0; i < Num_escort_ships; i++ ) {
			np_index = find_player_id(Escort_ships[i].np_id);
			
			// maybe remove him if he left
			if ( np_index < 0 ) {
				hud_setup_escort_list(0);
				break;
			}
		}
	} 
	// everything else
	else {
		for ( i = 0; i < Num_escort_ships; i++ ) {
			int objnum = Escort_ships[i].objnum;
			Assert( objnum >=0 && objnum < MAX_OBJECTS );

			if ( Objects[objnum].flags & OF_SHOULD_BE_DEAD ) {
				hud_setup_escort_list(0);
				break;
			} else if ( Objects[objnum].type == OBJ_SHIP ) {
				int shipnum = Objects[objnum].instance;
				Assert( shipnum >= 0 && shipnum < MAX_SHIPS );

				if ( (Ships[shipnum].flags & SF_HIDDEN_FROM_SENSORS)
					|| ((Ships[shipnum].flags2 & SF2_STEALTH) && ((Ships[shipnum].team != Player_ship->team) || (Ships[shipnum].flags2 & SF2_FRIENDLY_STEALTH_INVIS)))
				) {
					hud_setup_escort_list(0);
					break;
				}
			}
		}
	}
}
void hud_escort_add_player(short id)
{
	Assert(Game_mode & GM_MULTIPLAYER);
	if(!(Game_mode & GM_MULTIPLAYER)){
		return;
	}	

	int idx;

	// just go through and add as long as its not a duplicate
	for(idx=0; idx<Num_escort_ships; idx++){
		if(Escort_ships[idx].np_id == id){
			return;
		}
	}

	// re-setup the escort list
	hud_setup_escort_list(0);
}