/**
 * Displays the right popup for a specific target.
 * @param target Pointer to target.
 */
void MultipleTargetsState::popupTarget(Target *target)
{
	_game->popState();
	if (_craft == 0)
	{
		Base* b = dynamic_cast<Base*>(target);
		Craft* c = dynamic_cast<Craft*>(target);
		Ufo* u = dynamic_cast<Ufo*>(target);
		if (b != 0)
		{
			_game->pushState(new InterceptState(_game, _state->getGlobe(), b));
		}
		else if (c != 0)
		{
			_game->pushState(new GeoscapeCraftState(_game, c, _state->getGlobe(), 0));
		}
		else if (u != 0)
		{
			_game->pushState(new UfoDetectedState(_game, u, _state, false, u->getHyperDetected()));
		}
		else
		{
			_game->pushState(new TargetInfoState(_game, target, _state->getGlobe()));
		}
	}
	else
	{
		_game->pushState(new ConfirmDestinationState(_game, _craft, target));
	}
}