Extend fuctionality of non-SL capability

This commit is contained in:
Lirusaito
2013-02-11 19:12:17 -05:00
parent 491af1cbf0
commit f95830fe23
13 changed files with 115 additions and 17 deletions

View File

@@ -849,6 +849,7 @@ P(fetchScriptLimitsRegionDetailsResponder);
P(fetchScriptLimitsRegionInfoResponder);
P(fetchScriptLimitsRegionSummaryResponder);
P(fnPtrResponder);
P2(gamingDataReceived, transfer_18s);
P2(groupMemberDataResponder, transfer_300s);
P2(groupProposalBallotResponder, transfer_300s);
P(homeLocationResponder);

View File

@@ -98,6 +98,18 @@ const U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE
| REGION_FLAGS_DENY_ANONYMOUS
| REGION_FLAGS_DENY_AGEUNVERIFIED;
// 'Gaming' flags
const U32 REGION_GAMING_PRESENT = (1 << 0);
const U32 REGION_GAMING_HIDE_PARCEL = (1 << 1);
const U32 REGION_GAMING_HIDE_FIND_ALL = (1 << 2);
const U32 REGION_GAMING_HIDE_FIND_CLASSIFIEDS = (1 << 3);
const U32 REGION_GAMING_HIDE_FIND_EVENTS = (1 << 4);
const U32 REGION_GAMING_HIDE_FIND_LAND = (1 << 5);
const U32 REGION_GAMING_HIDE_FIND_SIMS = (1 << 6);
const U32 REGION_GAMING_HIDE_FIND_GROUPS = (1 << 7);
const U32 REGION_GAMING_HIDE_FIND_ALL_CLASSIC = (1 << 8);
const U32 REGION_GAMING_HIDE_GOD_FLOATER = (1 << 9);
inline BOOL is_prelude( U64 flags )
{
// definition of prelude does not depend on fixed-sun

View File

@@ -5779,7 +5779,7 @@ This should be as low as possible, but too low may break functionality</string>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<integer>1</integer>
</map>
<key>FilterGamingClassifieds</key>
<map>
@@ -5792,7 +5792,7 @@ This should be as low as possible, but too low may break functionality</string>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<integer>1</integer>
</map>
<key>FilterGamingEvents</key>
<map>
@@ -5805,7 +5805,7 @@ This should be as low as possible, but too low may break functionality</string>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<integer>1</integer>
</map>
<key>FilterGamingGroups</key>
<map>
@@ -5818,7 +5818,7 @@ This should be as low as possible, but too low may break functionality</string>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<integer>1</integer>
</map>
<key>FilterGamingLand</key>
<map>
@@ -5831,7 +5831,7 @@ This should be as low as possible, but too low may break functionality</string>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<integer>1</integer>
</map>
<key>FilterGamingSims</key>
<map>
@@ -5844,7 +5844,7 @@ This should be as low as possible, but too low may break functionality</string>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<integer>1</integer>
</map>
<key>FilterItemsPerFrame</key>
<map>

View File

@@ -461,7 +461,7 @@ BOOL LLPanelRegionTools::postBuild()
getChild<LLUICtrl>("block terraform")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
getChild<LLUICtrl>("allow transfer")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
getChild<LLUICtrl>("is sandbox")->setCommitCallback( boost::bind(&LLPanelRegionTools::onChangeAnything, this));
getChild<LLUICtrl>("is gaming")->setVisible(!gAgent.getRegion()->getCapability("GamingData").empty());
getChild<LLUICtrl>("is gaming")->setVisible((gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_GOD_FLOATER));
getChild<LLUICtrl>("is gaming")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
getChild<LLUICtrl>("hide from search")->setVisible(!gHippoGridManager->getConnectedGrid()->isSecondLife());
getChild<LLUICtrl>("hide from search")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));

View File

@@ -1940,7 +1940,8 @@ BOOL LLPanelLandOptions::postBuild()
mGamingCtrl = getChild<LLCheckBoxCtrl>( "GamingCheck");
childSetCommitCallback("GamingCheck", onCommitAny, this);
mGamingCtrl->setVisible(!gAgent.getRegion()->getCapability("GamingData").empty());
mGamingCtrl->setVisible((gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_PARCEL));
mGamingCtrl->setEnabled(false);
mPublishHelpButton = getChild<LLButton>("?");
mPublishHelpButton->setClickedCallback(onClickPublishHelp, this);
@@ -2048,6 +2049,7 @@ void LLPanelLandOptions::refresh()
mClearBtn->setEnabled(FALSE);
mMatureCtrl->setEnabled(FALSE);
mGamingCtrl->setEnabled(false);
mPublishHelpButton->setEnabled(FALSE);
}
else
@@ -2170,8 +2172,9 @@ void LLPanelLandOptions::refresh()
mMatureCtrl->setToolTip(getString("mature_check_adult_tooltip"));
}
}
mGamingCtrl->set(parcel->getParcelFlag(PF_GAMING));
}
mGamingCtrl->set(parcel->getParcelFlag(PF_GAMING));
mGamingCtrl->setEnabled(can_change_options);
}
}

View File

@@ -121,7 +121,7 @@ BOOL LLPanelDirClassified::postBuild()
// Don't do this every time we open find, it's expensive; require clicking 'search'
//requestClassified();
childSetVisible("filter_gaming", !gAgent.getRegion()->getCapability("GamingData").empty());
childSetVisible("filter_gaming", (gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_FIND_CLASSIFIEDS));
return TRUE;
}

View File

@@ -95,7 +95,7 @@ BOOL LLPanelDirEvents::postBuild()
}
gDisplayEventHack = FALSE;
childSetVisible("filter_gaming", !gAgent.getRegion()->getCapability("GamingData").empty());
childSetVisible("filter_gaming", (gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_FIND_EVENTS));
return TRUE;
}

View File

@@ -161,7 +161,7 @@ BOOL LLPanelDirFind::postBuild()
navigateToDefaultPage();
}
childSetVisible("filter_gaming", !gAgent.getRegion()->getCapability("GamingData").empty());
childSetVisible("filter_gaming", (gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_FIND_ALL));
return TRUE;
}
@@ -570,7 +570,7 @@ BOOL LLPanelDirFindAllOld::postBuild()
childDisable("Search");
setDefaultBtn( "Search" );
childSetVisible("filter_gaming", !gAgent.getRegion()->getCapability("GamingData").empty());
childSetVisible("filter_gaming", (gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_FIND_ALL_CLASSIC));
return TRUE;
}

View File

@@ -61,7 +61,7 @@ BOOL LLPanelDirGroups::postBuild()
childDisable("Search");
setDefaultBtn( "Search" );
childSetVisible("filter_gaming", !gAgent.getRegion()->getCapability("GamingData").empty());
childSetVisible("filter_gaming", (gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_FIND_GROUPS));
return TRUE;
}

View File

@@ -126,7 +126,7 @@ BOOL LLPanelDirLand::postBuild()
}
}
childSetVisible("filter_gaming", !gAgent.getRegion()->getCapability("GamingData").empty());
childSetVisible("filter_gaming", (gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_FIND_LAND));
return TRUE;
}

View File

@@ -99,7 +99,7 @@ BOOL LLPanelDirPlaces::postBuild()
childSetEnabled("Category", true);
}
childSetVisible("filter_gaming", !gAgent.getRegion()->getCapability("GamingData").empty());
childSetVisible("filter_gaming", (gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_FIND_SIMS));
// Don't prepopulate the places list, as it hurts the database as of 2006-12-04. JC
// initialQuery();

View File

@@ -84,6 +84,7 @@
class AIHTTPTimeoutPolicy;
extern AIHTTPTimeoutPolicy baseCapabilitiesComplete_timeout;
extern AIHTTPTimeoutPolicy gamingDataReceived_timeout;
extern AIHTTPTimeoutPolicy simulatorFeaturesReceived_timeout;
const F32 WATER_TEXTURE_SCALE = 8.f; // Number of times to repeat the water texture across a region
@@ -306,7 +307,8 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
mCacheLoaded(FALSE),
mCacheDirty(FALSE),
mReleaseNotesRequested(FALSE),
mCapabilitiesReceived(false)
mCapabilitiesReceived(false),
mGamingFlags(0)
{
mWidth = region_width_meters;
mImpl->mOriginGlobal = from_region_handle(handle);
@@ -1250,6 +1252,36 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
mSimulatorFeatures = sim_features;
}
void LLViewerRegion::setGamingData(const LLSD& gaming_data)
{
mGamingFlags = 0;
if (!gaming_data.has("display"))
llerrs << "GamingData Capability requires \"display\"" << llendl;
if (gaming_data["display"].asBoolean())
mGamingFlags |= REGION_GAMING_PRESENT;
if (gaming_data.has("hide_parcel") && gaming_data["hide_parcel"].asBoolean())
mGamingFlags |= REGION_GAMING_HIDE_PARCEL;
if (gaming_data.has("hide_find_all") && gaming_data["hide_find_all"].asBoolean())
mGamingFlags |= REGION_GAMING_HIDE_FIND_ALL;
if (gaming_data.has("hide_find_classifieds") && gaming_data["hide_find_classifieds"].asBoolean())
mGamingFlags |= REGION_GAMING_HIDE_FIND_CLASSIFIEDS;
if (gaming_data.has("hide_find_events") && gaming_data["hide_find_events"].asBoolean())
mGamingFlags |= REGION_GAMING_HIDE_FIND_EVENTS;
if (gaming_data.has("hide_find_land") && gaming_data["hide_find_land"].asBoolean())
mGamingFlags |= REGION_GAMING_HIDE_FIND_LAND;
if (gaming_data.has("hide_find_sims") && gaming_data["hide_find_sims"].asBoolean())
mGamingFlags |= REGION_GAMING_HIDE_FIND_SIMS;
if (gaming_data.has("hide_find_groups") && gaming_data["hide_find_groups"].asBoolean())
mGamingFlags |= REGION_GAMING_HIDE_FIND_GROUPS;
if (gaming_data.has("hide_find_all_classic") && gaming_data["hide_find_all_classic"].asBoolean())
mGamingFlags |= REGION_GAMING_HIDE_FIND_ALL_CLASSIC;
if (gaming_data.has("hide_god_floater") && gaming_data["hide_god_floater"].asBoolean())
mGamingFlags |= REGION_GAMING_HIDE_GOD_FLOATER;
llinfos << "Gaming flags are " << mGamingFlags << llendl;
}
LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp)
{
U32 local_id = objectp->getLocalID();
@@ -1785,6 +1817,46 @@ private:
S32 mMaxAttempts;
};
class GamingDataReceived : public LLHTTPClient::ResponderWithResult
{
LOG_CLASS(GamingDataReceived);
public:
GamingDataReceived(const std::string& retry_url, U64 region_handle, S32 attempt = 0, S32 max_attempts = MAX_CAP_REQUEST_ATTEMPTS)
: mRetryURL(retry_url), mRegionHandle(region_handle), mAttempt(attempt), mMaxAttempts(max_attempts)
{}
/*virtual*/ void error(U32 statusNum, const std::string& reason)
{
LL_WARNS2("AppInit", "GamingData") << statusNum << ": " << reason << LL_ENDL;
retry();
}
/*virtual*/ void result(const LLSD& content)
{
LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle);
if(regionp) regionp->setGamingData(content);
}
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return gamingDataReceived_timeout; }
/*virtual*/ char const* getName(void) const { return "GamingDataReceived"; }
private:
void retry()
{
if (mAttempt < mMaxAttempts)
{
mAttempt++;
LL_WARNS2("AppInit", "GamingData") << "Retrying '" << mRetryURL << "'. Retry #" << mAttempt << LL_ENDL;
LLHTTPClient::get(mRetryURL, new GamingDataReceived(*this));
}
}
std::string mRetryURL;
U64 mRegionHandle;
S32 mAttempt;
S32 mMaxAttempts;
};
void LLViewerRegion::setCapability(const std::string& name, const std::string& url)
{
@@ -1803,6 +1875,12 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u
// kick off a request for simulator features
LLHTTPClient::get(url, new SimulatorFeaturesReceived(url, getHandle()));
}
else if (name == "GamingData")
{
LLSD gamingRequest = LLSD::emptyMap();
// request settings from simulator
LLHTTPClient::post(url, gamingRequest, new GamingDataReceived(url, getHandle()));
}
else
{
mImpl->mCapabilities[name] = url;

View File

@@ -350,6 +350,9 @@ public:
void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions );
void getNeighboringRegionsStatus( std::vector<S32>& regions );
void setGamingData(const LLSD& info);
const U32 getGamingFlags() const { return mGamingFlags; }
public:
struct CompareDistance
{
@@ -444,6 +447,7 @@ private:
BOOL mReleaseNotesRequested;
LLSD mSimulatorFeatures;
U32 mGamingFlags;
};
inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const