예제 #1
0
			virtual EStatus process_impl(
				const LLChannelDescriptors& channels,
				buffer_ptr_t& buffer,
				bool& eos,
				LLSD& context,
				LLPumpIO* pump)
			{
				if(!eos) return STATUS_BREAK;
				LLSD sd = "yo!";
				LLBufferStream ostr(channels, buffer.get());
				ostr << LLSDXMLStreamer(sd);
				return STATUS_DONE;
			}
	/*virtual*/ void post(
		LLHTTPNode::ResponsePtr response,
		const LLSD& context,
		const LLSD& input) const
	{
		if (!input || !context || !input.isMap() || !input.has("body"))
		{
			llinfos << "malformed OpenRegionInfo update!" << llendl;	 
			return;
		}

		LLSD body = input["body"];
		llinfos << "data: " << LLSDNotationStreamer(body) << llendl;	 
		llinfos << "data: " << LLSDXMLStreamer(body) << llendl;	 	 
		
		//set the default limits/settings for this simulator type, as limits from our
		//previous region may not exist in this one
		gHippoLimits->setLimits();

		//limits are also reset in llviewermessage.cpp when we detect a new server
		//version, in case the destination simulator does not support OpenRegionInfo.

		BOOL limitschanged = FALSE;

		if ( body.has("AllowMinimap") )
		{
			gHippoLimits->mAllowMinimap = body["AllowMinimap"].asInteger() == 1;
		}
		if ( body.has("AllowPhysicalPrims") )
		{
			gHippoLimits->mAllowPhysicalPrims = body["AllowPhysicalPrims"].asInteger() == 1;
			limitschanged = TRUE;
		}
		///*
		if ( body.has("DrawDistance") )
		{
			F32 distance = body["DrawDistance"].asReal();
			if (distance > 0)
			{
				gAgent.mDrawDistance = distance;
				//gHippoLimits->mDrawDistance = distance;
			}
		}
		
		if ( body.has("ForceDrawDistance") )
		{
			gAgent.mLockedDrawDistance = body["ForceDrawDistance"].asInteger() == 1;
		}
		/*
		if ( body.has("LSLFunctions") )
		{
			//IMPLEMENT ME//not yet avail
		}
      */
	  if ( body.has("TerrainDetailScale") )
		{
			//gAgent.getRegion()->getComposition()->setScaleParams(body["TerrainDetailScale"].asReal(), body["TerrainDetailScale"].asReal());
			gHippoLimits->mTerrainScale = body["TerrainDetailScale"].asReal();
			gSavedSettings.setF32("RenderTerrainScale", body["TerrainDetailScale"].asReal());
			LLDrawPoolTerrain::sDetailScale = 1.f/body["TerrainDetailScale"].asReal();
		}
     
		if ( body.has("MaxDragDistance") )
		{
			gHippoLimits->mMaxDragDistance = body["MaxDragDistance"].asReal();
		}
		if ( body.has("MinHoleSize") )
		{
			gHippoLimits->mMinHoleSize = body["MinHoleSize"].asReal();
			limitschanged = TRUE;
		}
		if ( body.has("MaxHollowSize") )
		{
			gHippoLimits->mMaxHollow = body["MaxHollowSize"].asReal();
			limitschanged = TRUE;
		}
		if ( body.has("MaxInventoryItemsTransfer") )
		{
			gHippoLimits->mMaxInventoryItemsTransfer = body["MaxInventoryItemsTransfer"].asReal();
		}
		if ( body.has("MaxLinkCount") )
		{
			gHippoLimits->mMaxLinkedPrims = body["MaxLinkCount"].asInteger();
		}
		if ( body.has("MaxLinkCountPhys") )
		{
			gHippoLimits->mMaxPhysLinkedPrims = body["MaxLinkCountPhys"].asInteger();
		}
		if ( body.has("MaxPos") )
		{
			gHippoLimits->mMaxPrimXPos = body["MaxPosX"].asReal();
			gHippoLimits->mMaxPrimYPos = body["MaxPosY"].asReal();
			gHippoLimits->mMaxPrimZPos = body["MaxPosZ"].asReal();
			limitschanged = TRUE;
		}
		if ( body.has("MinPos") )
		{
			gHippoLimits->mMinPrimXPos = body["MinPosX"].asReal();
			gHippoLimits->mMinPrimYPos = body["MinPosY"].asReal();
			gHippoLimits->mMinPrimZPos = body["MinPosZ"].asReal();
			limitschanged = TRUE;
		}
		if ( body.has("MaxPrimScale") )
		{
			gHippoLimits->mMaxPrimScale = body["MaxPrimScale"].asReal();
			limitschanged = TRUE;
		}
		if ( body.has("MaxPhysPrimScale") )
		{
			//IMPLEMENT ME
		}
		if ( body.has("MinPrimScale") )
		{
			gHippoLimits->mMinPrimScale = body["MinPrimScale"].asReal();
			limitschanged = TRUE;
		}
		
		if ( body.has("OffsetOfUTC") )
		{
			gSavedSettings.setS32("TimeOffset", body["OffsetOfUTC"].asInteger());
			gSavedSettings.setBOOL("UseTimeOffset", true);
			ViewerTime::sUseTimeOffset = true;
			ViewerTime::sTimeOffset = gSavedSettings.getS32("TimeOffset");
		}
		
		if ( body.has("OffsetOfUTCDST") )
		{
			gSavedSettings.setBOOL("TimeOffsetDST", body["OffsetOfUTCDST"].asInteger() == 1 ? TRUE : FALSE);
			ViewerTime::sTimeOffsetDST = gSavedSettings.getBOOL("TimeOffsetDST");
		}
		
		if ( body.has("RenderWater") )
		{
			gHippoLimits->mRenderWater = body["RenderWater"].asInteger() == 1 ? TRUE : FALSE;
		//	gAgent.getRegion()->rebuildWater();//not yet
		}
		/*
		if ( body.has("SayDistance") )
		{
			gSavedSettings.setU32("ChatDistance", body["SayDistance"].asReal()); //this should override chat_normal_radius
			//CHAT_NORMAL_RADIUS = 20.f;
		}
		
		if ( body.has("ShoutDistance") )
		{
			gSavedSettings.setU32("ShoutDistance", body["ShoutDistance"].asReal()); //this should override chat_shout_radius
			//CHAT_SHOUT_RADIUS = 100.f;
		}
		if ( body.has("WhisperDistance") )
		{
			gSavedSettings.setU32("WhisperDistance", body["WhisperDistance"].asReal()); // this should override chat_whisper_radius
			//CHAT_WHISPER_RADIUS = 10.f;
		}
		*/
		if ( body.has("ToggleTeenMode") )
		{
			gHippoLimits->mEnableTeenMode = body["ToggleTeenMode"].asInteger() == 1 ? TRUE : FALSE;
		}
		if ( body.has("SetTeenMode") )
		{
			gAgent.setTeen( body["SetTeenMode"].asInteger() == 1 ? TRUE : FALSE );
			LLFloaterWorldMap::reloadIcons(NULL);
			llinfos << "PG status set to " << (S32)gAgent.isTeen() << llendl;
		}
		if ( body.has("ShowTags") )
		{
			gHippoLimits->mRenderName = body["ShowTags"].asReal();
		}
		if ( body.has("EnforceMaxBuild") )
		{
			gHippoLimits->mEnforceMaxBuild = body["EnforceMaxBuild"].asInteger() == 1 ? TRUE : FALSE;
			limitschanged = TRUE;
		}
		if ( body.has("MaxGroups") )
		{
			gHippoLimits->mMaxAgentGroups = body["MaxGroups"].asReal();
		}
		if ( body.has("AllowParcelWindLight") )
		{
			gHippoLimits->mAllowParcelWindLight = body["AllowParcelWindLight"].asInteger() == 1;
		}

		//Update the floater if its around
		LLPanelRegionOpenSettingsInfo* floater = LLFloaterRegionInfo::getPanelOpenSettings();

		if (floater != NULL)
		{
			floater->refreshFromRegion(gAgent.getRegion());
		}
	}