Files
SingularityViewer/indra/newview/lfsimfeaturehandler.cpp
Latif Khalifa b4bc9727f1 Confirm to new OpenSimExtras specification of SimulatorFeatures cap
See: http://opensimulator.org/wiki/SimulatorFeatures_Extras
* Moved SupportsExport inside this map to avoid possible
  collision with Linden Lab
* Added the ability for a sim to specify map server
  (Fixes maps after hypergrid jumps)
2013-07-31 04:24:13 +02:00

71 lines
2.3 KiB
C++

/* Copyright (C) 2013 Liru Færs
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA */
#include "llviewerprecompiledheaders.h"
#include "lfsimfeaturehandler.h"
#include "llagent.h"
#include "llenvmanager.h"
#include "llviewerregion.h"
#include "hippogridmanager.h"
LFSimFeatureHandler::LFSimFeatureHandler()
: mSupportsExport(false)
{
if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) // Remove this line if we ever handle SecondLife sim features
LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LFSimFeatureHandler::handleRegionChange, this));
}
void LFSimFeatureHandler::handleRegionChange()
{
if (LLViewerRegion* region = gAgent.getRegion())
{
if (region->getFeaturesReceived())
{
setSupportedFeatures();
}
else
{
region->setFeaturesReceivedCallback(boost::bind(&LFSimFeatureHandler::setSupportedFeatures, this));
}
}
}
void LFSimFeatureHandler::setSupportedFeatures()
{
if (LLViewerRegion* region = gAgent.getRegion())
{
LLSD info;
region->getSimulatorFeatures(info);
//if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) // Non-SL specific sim features
{
// For definition of OpenSimExtras please see
// http://opensimulator.org/wiki/SimulatorFeatures_Extras
mSupportsExport = info["OpenSimExtras"]["ExportSupported"].asBoolean();
mMapServerURL = info["OpenSimExtras"]["map-server-url"].asString();
mSearchURL = info["OpenSimExtras"]["search-server-url"].asString();
}
}
}
boost::signals2::connection LFSimFeatureHandler::setSupportsExportCallback(const boost::signals2::signal<void()>::slot_type& slot)
{
return mSupportsExport.connect(slot);
}