static Unit *GetSelectedUnit()
{
	Team *team = NULL;

	if (g_app->m_location &&
	    (team = g_app->m_location->GetMyTeam()))
		return team->GetMyUnit();
	else
		return NULL;
}
static bool UnitSelected()
{
	if( !g_app->m_location )
		return false;

    Team *team = g_app->m_location->GetMyTeam();

	if( !team )
		return false;

    if( team->GetMyEntity() )
		return true;

    Task *currentTask = g_app->m_taskManager->GetCurrentTask();
    // if the task has just been ended or killed, it isnt valid
    if (currentTask && currentTask->m_state == Task::StateStopping )
        return false;

    if( !currentTask )
        return false;

	Unit *unit = team->GetMyUnit();
	return unit != NULL;
}