From 3fbbd9e0b7516d1c170267acc26a767af1fa4b1d Mon Sep 17 00:00:00 2001
From: Armin Weatherwax
Date: Mon, 29 Mar 2010 15:50:33 +0200
Subject: support more OpenSim limits (number of groups, hollow size)

---
 linden/indra/newview/llfloatergroups.cpp  |  8 +++++---
 linden/indra/newview/llmaniptranslate.cpp |  7 +++++--
 linden/indra/newview/llpanelobject.cpp    | 12 +++++++-----
 linden/indra/newview/lltoolgrab.cpp       |  7 +++++--
 linden/indra/newview/llviewermessage.cpp  |  2 +-
 linden/indra/newview/llworld.cpp          |  5 +++++
 linden/indra/newview/llworld.h            |  3 +--
 7 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/linden/indra/newview/llfloatergroups.cpp b/linden/indra/newview/llfloatergroups.cpp
index 874249b..e94734d 100644
--- a/linden/indra/newview/llfloatergroups.cpp
+++ b/linden/indra/newview/llfloatergroups.cpp
@@ -58,6 +58,8 @@
 #include "llviewerwindow.h"
 #include "llimview.h"
 
+#include "hippoLimits.h"
+
 // static
 std::map<const LLUUID, LLFloaterGroupPicker*> LLFloaterGroupPicker::sInstances;
 
@@ -200,7 +202,7 @@ void LLPanelGroups::reset()
 		group_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
 	}
 	childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count()));
-	childSetTextArg("groupcount", "[MAX]", llformat("%d",MAX_AGENT_GROUPS));
+	childSetTextArg("groupcount", "[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups()));
 
 	const std::string none_text = getString("none");
 	init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID(), none_text);
@@ -212,7 +214,7 @@ BOOL LLPanelGroups::postBuild()
 	childSetCommitCallback("group list", onGroupList, this);
 
 	childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count()));
-	childSetTextArg("groupcount", "[MAX]", llformat("%d",MAX_AGENT_GROUPS));
+	childSetTextArg("groupcount", "[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups()));
 
 	const std::string none_text = getString("none");
 	init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID(), none_text);
@@ -270,7 +272,7 @@ void LLPanelGroups::enableButtons()
 		childDisable("IM");
 		childDisable("Leave");
 	}
-	if(gAgent.mGroups.count() < MAX_AGENT_GROUPS)
+	if(gAgent.mGroups.count() < gHippoLimits->getMaxAgentGroups())
 	{
 		childEnable("Create");
 	}
diff --git a/linden/indra/newview/llmaniptranslate.cpp b/linden/indra/newview/llmaniptranslate.cpp
index 8d23e40..1362f0a 100644
--- a/linden/indra/newview/llmaniptranslate.cpp
+++ b/linden/indra/newview/llmaniptranslate.cpp
@@ -66,6 +66,8 @@
 #include "llui.h"
 #include "pipeline.h"
 
+#include "hippoLimits.h"
+
 const S32 NUM_AXES = 3;
 const S32 MOUSE_DRAG_SLOP = 2;       // pixels
 const F32 HANDLE_HIDE_ANGLE = 0.15f; // radians
@@ -731,9 +733,10 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 				}
 
 				// For safety, cap heights where objects can be dragged
-				if (new_position_global.mdV[VZ] > MAX_OBJECT_Z)
+				float maxHeight = gHippoLimits->getMaxHeight();
+				if (new_position_global.mdV[VZ] > maxHeight)
 				{
-					new_position_global.mdV[VZ] = MAX_OBJECT_Z;
+					new_position_global.mdV[VZ] = maxHeight;
 				}
 
 				// Grass is always drawn on the ground, so clamp its position to the ground
diff --git a/linden/indra/newview/llpanelobject.cpp b/linden/indra/newview/llpanelobject.cpp
index bcbd076..460611a 100644
--- a/linden/indra/newview/llpanelobject.cpp
+++ b/linden/indra/newview/llpanelobject.cpp
@@ -426,6 +426,8 @@ void LLPanelObject::getState( )
 	mCtrlPosY->setEnabled(enable_move);
 	mCtrlPosZ->setEnabled(enable_move);
 
+	mCtrlPosZ->setMaxValue(gHippoLimits->getMaxHeight());
+
 	if (enable_scale)
 	{
 		vec = objectp->getScale();
@@ -993,9 +995,9 @@ void LLPanelObject::getState( )
 		mSpinScaleY->set( scale_y );
 		calcp->setVar(LLCalc::X_HOLE, scale_x);
 		calcp->setVar(LLCalc::Y_HOLE, scale_y);
-		mSpinScaleX->setMinValue(OBJECT_MIN_HOLE_SIZE);
+		mSpinScaleX->setMinValue(gHippoLimits->getMinHoleSize());
 		mSpinScaleX->setMaxValue(OBJECT_MAX_HOLE_SIZE_X);
-		mSpinScaleY->setMinValue(OBJECT_MIN_HOLE_SIZE);
+		mSpinScaleY->setMinValue(gHippoLimits->getMinHoleSize());
 		mSpinScaleY->setMaxValue(OBJECT_MAX_HOLE_SIZE_Y);
 		break;
 	default:
@@ -1031,7 +1033,7 @@ void LLPanelObject::getState( )
 	else 
 	{
 		mSpinHollow->setMinValue(0.f);
-		mSpinHollow->setMaxValue(95.f);
+		mSpinHollow->setMaxValue(gHippoLimits->getMaxHollow() * 100.0f);
 	}
 
 	// Update field enablement
@@ -1583,11 +1585,11 @@ void LLPanelObject::getVolumeParams(LLVolumeParams& volume_params)
 	{
 		scale_x = llclamp(
 			scale_x,
-			OBJECT_MIN_HOLE_SIZE,
+			gHippoLimits->getMinHoleSize(),
 			OBJECT_MAX_HOLE_SIZE_X);
 		scale_y = llclamp(
 			scale_y,
-			OBJECT_MIN_HOLE_SIZE,
+			gHippoLimits->getMinHoleSize(),
 			OBJECT_MAX_HOLE_SIZE_Y);
 
 		// Limit radius offset, based on taper and hole size y.
diff --git a/linden/indra/newview/lltoolgrab.cpp b/linden/indra/newview/lltoolgrab.cpp
index 3437193..260d533 100644
--- a/linden/indra/newview/lltoolgrab.cpp
+++ b/linden/indra/newview/lltoolgrab.cpp
@@ -64,6 +64,8 @@
 #include "llvoavatar.h"
 #include "llworld.h"
 
+#include "hippoLimits.h"
+
 const S32 SLOP_DIST_SQ = 4;
 
 // Override modifier key behavior with these buttons
@@ -635,9 +637,10 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
 			}
 
 			// For safety, cap heights where objects can be dragged
-			if (grab_point_global.mdV[VZ] > MAX_OBJECT_Z)
+			float maxHeight = gHippoLimits->getMaxHeight();
+			if (grab_point_global.mdV[VZ] > maxHeight)
 			{
-				grab_point_global.mdV[VZ] = MAX_OBJECT_Z;
+				grab_point_global.mdV[VZ] = maxHeight;
 			}
 
 			grab_point_global = LLWorld::getInstance()->clipToVisibleRegions(mDragStartPointGlobal, grab_point_global);
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp
index 67dc082..8739f5c 100644
--- a/linden/indra/newview/llviewermessage.cpp
+++ b/linden/indra/newview/llviewermessage.cpp
@@ -655,7 +655,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
 	if(option == 0 && !group_id.isNull())
 	{
 		// check for promotion or demotion.
-		S32 max_groups = MAX_AGENT_GROUPS;
+		S32 max_groups = gHippoLimits->getMaxAgentGroups();
 		if(gAgent.isInGroup(group_id)) ++max_groups;
 
 		if(gAgent.mGroups.count() < max_groups)
diff --git a/linden/indra/newview/llworld.cpp b/linden/indra/newview/llworld.cpp
index 02c7be3..90ab49b 100644
--- a/linden/indra/newview/llworld.cpp
+++ b/linden/indra/newview/llworld.cpp
@@ -60,6 +60,7 @@
 #include "pipeline.h"
 #include "llappviewer.h"		// for do_disconnect()
 
+#include "hippoLimits.h"
 //
 // Globals
 //
@@ -128,6 +129,10 @@ void LLWorld::destroyClass()
 	LLViewerPartSim::getInstance()->destroyClass();
 }
 
+F32	LLWorld::getRegionMaxHeight() const
+{
+	return gHippoLimits->getMaxHeight();
+}
 
 LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
 {
diff --git a/linden/indra/newview/llworld.h b/linden/indra/newview/llworld.h
index ce83cbd..46aefd9 100644
--- a/linden/indra/newview/llworld.h
+++ b/linden/indra/newview/llworld.h
@@ -119,8 +119,7 @@ public:
 	// region X and Y size in meters
 	F32						getRegionWidthInMeters() const	{ return mWidthInMeters; }
 	F32						getRegionMinHeight() const		{ return -mWidthInMeters; }
-	F32						getRegionMaxHeight() const		{ return MAX_OBJECT_Z; }
-
+	F32						getRegionMaxHeight() const;
 	void					updateRegions(F32 max_update_time);
 	void					updateVisibilities();
 	void					updateParticles();
-- 
cgit v1.1