From f95830fe238a39b807c3d5ae936202e53e1c4f91 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Mon, 11 Feb 2013 19:12:17 -0500 Subject: [PATCH] Extend fuctionality of non-SL capability --- indra/llmessage/aihttptimeoutpolicy.cpp | 1 + indra/llmessage/llregionflags.h | 12 ++++ indra/newview/app_settings/settings.xml | 12 ++-- indra/newview/llfloatergodtools.cpp | 2 +- indra/newview/llfloaterland.cpp | 7 ++- indra/newview/llpaneldirclassified.cpp | 2 +- indra/newview/llpaneldirevents.cpp | 2 +- indra/newview/llpaneldirfind.cpp | 4 +- indra/newview/llpaneldirgroups.cpp | 2 +- indra/newview/llpaneldirland.cpp | 2 +- indra/newview/llpaneldirplaces.cpp | 2 +- indra/newview/llviewerregion.cpp | 80 ++++++++++++++++++++++++- indra/newview/llviewerregion.h | 4 ++ 13 files changed, 115 insertions(+), 17 deletions(-) diff --git a/indra/llmessage/aihttptimeoutpolicy.cpp b/indra/llmessage/aihttptimeoutpolicy.cpp index 4ecea84c9..f5f9f4428 100644 --- a/indra/llmessage/aihttptimeoutpolicy.cpp +++ b/indra/llmessage/aihttptimeoutpolicy.cpp @@ -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); diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h index 686033899..8d51207a9 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -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 diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3f48c89f0..b52c70e5d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5779,7 +5779,7 @@ This should be as low as possible, but too low may break functionality Type Boolean Value - 0 + 1 FilterGamingClassifieds @@ -5792,7 +5792,7 @@ This should be as low as possible, but too low may break functionality Type Boolean Value - 0 + 1 FilterGamingEvents @@ -5805,7 +5805,7 @@ This should be as low as possible, but too low may break functionality Type Boolean Value - 0 + 1 FilterGamingGroups @@ -5818,7 +5818,7 @@ This should be as low as possible, but too low may break functionality Type Boolean Value - 0 + 1 FilterGamingLand @@ -5831,7 +5831,7 @@ This should be as low as possible, but too low may break functionality Type Boolean Value - 0 + 1 FilterGamingSims @@ -5844,7 +5844,7 @@ This should be as low as possible, but too low may break functionality Type Boolean Value - 0 + 1 FilterItemsPerFrame diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index a97224815..873108ee0 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -461,7 +461,7 @@ BOOL LLPanelRegionTools::postBuild() getChild("block terraform")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); getChild("allow transfer")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); getChild("is sandbox")->setCommitCallback( boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - getChild("is gaming")->setVisible(!gAgent.getRegion()->getCapability("GamingData").empty()); + getChild("is gaming")->setVisible((gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_GOD_FLOATER)); getChild("is gaming")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); getChild("hide from search")->setVisible(!gHippoGridManager->getConnectedGrid()->isSecondLife()); getChild("hide from search")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 93fe292fa..154acc65e 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -1940,7 +1940,8 @@ BOOL LLPanelLandOptions::postBuild() mGamingCtrl = getChild( "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("?"); 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); } } diff --git a/indra/newview/llpaneldirclassified.cpp b/indra/newview/llpaneldirclassified.cpp index 19a9884b0..dbc2f8afa 100644 --- a/indra/newview/llpaneldirclassified.cpp +++ b/indra/newview/llpaneldirclassified.cpp @@ -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; } diff --git a/indra/newview/llpaneldirevents.cpp b/indra/newview/llpaneldirevents.cpp index e27aff354..bded7d142 100644 --- a/indra/newview/llpaneldirevents.cpp +++ b/indra/newview/llpaneldirevents.cpp @@ -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; } diff --git a/indra/newview/llpaneldirfind.cpp b/indra/newview/llpaneldirfind.cpp index ca8a3843a..2ba9aac2c 100644 --- a/indra/newview/llpaneldirfind.cpp +++ b/indra/newview/llpaneldirfind.cpp @@ -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; } diff --git a/indra/newview/llpaneldirgroups.cpp b/indra/newview/llpaneldirgroups.cpp index 965d9ccbd..ac7102a30 100644 --- a/indra/newview/llpaneldirgroups.cpp +++ b/indra/newview/llpaneldirgroups.cpp @@ -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; } diff --git a/indra/newview/llpaneldirland.cpp b/indra/newview/llpaneldirland.cpp index ced4a42ad..199426a6d 100644 --- a/indra/newview/llpaneldirland.cpp +++ b/indra/newview/llpaneldirland.cpp @@ -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; } diff --git a/indra/newview/llpaneldirplaces.cpp b/indra/newview/llpaneldirplaces.cpp index 17ae01373..43824da90 100644 --- a/indra/newview/llpaneldirplaces.cpp +++ b/indra/newview/llpaneldirplaces.cpp @@ -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(); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 40672b945..0bd16dcdf 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -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; diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 3000d4d5e..b3526560f 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -350,6 +350,9 @@ public: void getNeighboringRegions( std::vector& uniqueRegions ); void getNeighboringRegionsStatus( std::vector& 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