Subject: Expanding region flags to 64 bits. Adding region protocol flags

From: Don Kjer <[email-masked]>
Date: Fri, 17 Aug 2012 03:56:38 +0000

---
 indra/llmessage/llregionflags.h            | 65 ++++++++++++++++--------------
 indra/llmessage/message_prehash.cpp        |  4 ++
 indra/llmessage/message_prehash.h          |  4 ++
 indra/newview/llestateinfomodel.cpp        | 24 +++--------
 indra/newview/llestateinfomodel.h          | 25 ++++++++++--
 indra/newview/llfloaterbuyland.cpp         |  4 +-
 indra/newview/llfloatergodtools.cpp        | 34 ++++++++++------
 indra/newview/llfloatergodtools.h          | 14 +++----
 indra/newview/llfloaterland.cpp            |  8 ++--
 indra/newview/llfloaterregioninfo.cpp      | 24 +++++++----
 indra/newview/llfloaterreporter.cpp        |  3 --
 indra/newview/lllocationinputctrl.cpp      |  4 +-
 indra/newview/llpanelland.cpp              |  2 +-
 indra/newview/llpanelplaceprofile.cpp      |  4 +-
 indra/newview/llpaneltopinfobar.cpp        |  4 +-
 indra/newview/llregioninfomodel.cpp        | 14 ++++++-
 indra/newview/llregioninfomodel.h          |  2 +-
 indra/newview/lltoolbrush.cpp              |  2 +-
 indra/newview/lltooldraganddrop.cpp        |  2 +-
 indra/newview/lltoolplacer.cpp             |  4 +-
 indra/newview/llviewermessage.cpp          | 14 ++++++-
 indra/newview/llviewerparcelmgr.cpp        |  8 ++--
 indra/newview/llviewerregion.cpp           | 40 +++++++++---------
 indra/newview/llviewerregion.h             | 65 ++++++++++++++++++++++++------
 indra/newview/llworldmap.cpp               |  2 +-
 indra/newview/llworldmap.h                 |  6 +--
 scripts/messages/message_template.msg      | 17 ++++++++
 scripts/messages/message_template.msg.sha1 |  2 +-
 28 files changed, 258 insertions(+), 143 deletions(-)

(limited to 'scripts/messages/message_template.msg')

diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h
index 7b796a0fa8..1cf940918b 100644
--- a/indra/llmessage/llregionflags.h
+++ b/indra/llmessage/llregionflags.h
@@ -28,95 +28,98 @@
 #define LL_LLREGIONFLAGS_H
 
 // Can you be hurt here? Should health be on?
-const U32 REGION_FLAGS_ALLOW_DAMAGE				= (1 << 0);
+const U64 REGION_FLAGS_ALLOW_DAMAGE				= (1 << 0);
 
 // Can you make landmarks here?
-const U32 REGION_FLAGS_ALLOW_LANDMARK			= (1 << 1);
+const U64 REGION_FLAGS_ALLOW_LANDMARK			= (1 << 1);
 
 // Do we reset the home position when someone teleports away from here?
-const U32 REGION_FLAGS_ALLOW_SET_HOME			= (1 << 2);
+const U64 REGION_FLAGS_ALLOW_SET_HOME			= (1 << 2);
 
 // Do we reset the home position when someone teleports away from here?
-const U32 REGION_FLAGS_RESET_HOME_ON_TELEPORT	= (1 << 3);
+const U64 REGION_FLAGS_RESET_HOME_ON_TELEPORT	= (1 << 3);
 
 // Does the sun move?
-const U32 REGION_FLAGS_SUN_FIXED				= (1 << 4);
+const U64 REGION_FLAGS_SUN_FIXED				= (1 << 4);
 
 // Can't change the terrain heightfield, even on owned parcels,
 // but can plant trees and grass.
-const U32 REGION_FLAGS_BLOCK_TERRAFORM			= (1 << 6);
+const U64 REGION_FLAGS_BLOCK_TERRAFORM			= (1 << 6);
 
 // Can't release, sell, or buy land.
-const U32 REGION_FLAGS_BLOCK_LAND_RESELL		= (1 << 7);
+const U64 REGION_FLAGS_BLOCK_LAND_RESELL		= (1 << 7);
 
 // All content wiped once per night
-const U32 REGION_FLAGS_SANDBOX					= (1 << 8);
-const U32 REGION_FLAGS_SKIP_COLLISIONS			= (1 << 12); // Pin all non agent rigid bodies
-const U32 REGION_FLAGS_SKIP_SCRIPTS				= (1 << 13);
-const U32 REGION_FLAGS_SKIP_PHYSICS				= (1 << 14); // Skip all physics
-const U32 REGION_FLAGS_EXTERNALLY_VISIBLE		= (1 << 15);
-const U32 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1 << 16);
-const U32 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1 << 17);
-const U32 REGION_FLAGS_BLOCK_DWELL				= (1 << 18);
+const U64 REGION_FLAGS_SANDBOX					= (1 << 8);
+const U64 REGION_FLAGS_SKIP_COLLISIONS			= (1 << 12); // Pin all non agent rigid bodies
+const U64 REGION_FLAGS_SKIP_SCRIPTS				= (1 << 13);
+const U64 REGION_FLAGS_SKIP_PHYSICS				= (1 << 14); // Skip all physics
+const U64 REGION_FLAGS_EXTERNALLY_VISIBLE		= (1 << 15);
+const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1 << 16);
+const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1 << 17);
+const U64 REGION_FLAGS_BLOCK_DWELL				= (1 << 18);
 
 // Is flight allowed?
-const U32 REGION_FLAGS_BLOCK_FLY				= (1 << 19);	
+const U64 REGION_FLAGS_BLOCK_FLY				= (1 << 19);	
 
 // Is direct teleport (p2p) allowed?
-const U32 REGION_FLAGS_ALLOW_DIRECT_TELEPORT	= (1 << 20);
+const U64 REGION_FLAGS_ALLOW_DIRECT_TELEPORT	= (1 << 20);
 
 // Is there an administrative override on scripts in the region at the
 // moment. This is the similar skip scripts, except this flag is
 // presisted in the database on an estate level.
-const U32 REGION_FLAGS_ESTATE_SKIP_SCRIPTS		= (1 << 21);
+const U64 REGION_FLAGS_ESTATE_SKIP_SCRIPTS		= (1 << 21);
 
-const U32 REGION_FLAGS_RESTRICT_PUSHOBJECT		= (1 << 22);
+const U64 REGION_FLAGS_RESTRICT_PUSHOBJECT		= (1 << 22);
 
-const U32 REGION_FLAGS_DENY_ANONYMOUS			= (1 << 23);
+const U64 REGION_FLAGS_DENY_ANONYMOUS			= (1 << 23);
 
-const U32 REGION_FLAGS_ALLOW_PARCEL_CHANGES		= (1 << 26);
+const U64 REGION_FLAGS_ALLOW_PARCEL_CHANGES		= (1 << 26);
 
-const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28);
+const U64 REGION_FLAGS_ALLOW_VOICE = (1 << 28);
 
-const U32 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29);
-const U32 REGION_FLAGS_DENY_AGEUNVERIFIED	= (1 << 30);
+const U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29);
+const U64 REGION_FLAGS_DENY_AGEUNVERIFIED	= (1 << 30);
 
-const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK |
+const U64 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK |
 								 REGION_FLAGS_ALLOW_SET_HOME |
                                  REGION_FLAGS_ALLOW_PARCEL_CHANGES |
                                  REGION_FLAGS_ALLOW_VOICE;

-const U32 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT;
-const U32 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK 
+const U64 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT;
+const U64 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK 
 									   | REGION_FLAGS_ALLOW_SET_HOME;
 
-const U32 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE
+const U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE
 									 | REGION_FLAGS_SUN_FIXED
 									 | REGION_FLAGS_DENY_ANONYMOUS
 									 | REGION_FLAGS_DENY_AGEUNVERIFIED;
 
-inline BOOL is_prelude( U32 flags )
+inline BOOL is_prelude( U64 flags )
 {
 	// definition of prelude does not depend on fixed-sun
 	return 0 == (flags & REGION_FLAGS_PRELUDE_UNSET)
 		   && 0 != (flags & REGION_FLAGS_PRELUDE_SET);
 }
 
-inline U32 set_prelude_flags(U32 flags)
+inline U64 set_prelude_flags(U64 flags)
 {
 	// also set the sun-fixed flag
 	return ((flags & ~REGION_FLAGS_PRELUDE_UNSET)
 			| (REGION_FLAGS_PRELUDE_SET | REGION_FLAGS_SUN_FIXED));
 }
 
-inline U32 unset_prelude_flags(U32 flags)
+inline U64 unset_prelude_flags(U64 flags)
 {
 	// also unset the fixed-sun flag
 	return ((flags | REGION_FLAGS_PRELUDE_UNSET) 
 			& ~(REGION_FLAGS_PRELUDE_SET | REGION_FLAGS_SUN_FIXED));
 }
 
+// Region protocols
+const U64 REGION_PROTOCOLS_AGENT_APPEARANCE_SERVICE = (1 << 0);
+
 // estate constants. Need to match first few etries in indra.estate table.
 const U32 ESTATE_ALL = 0; // will not match in db, reserved key for logic
 const U32 ESTATE_MAINLAND = 1;
diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp
index c3fa7ff048..39cfb6019e 100644
--- a/indra/llmessage/message_prehash.cpp
+++ b/indra/llmessage/message_prehash.cpp
@@ -279,6 +279,8 @@ char const* const _PREHASH_GrabOffset = LLMessageStringTable::getInstance()->get
 char const* const _PREHASH_SimPort = LLMessageStringTable::getInstance()->getString("SimPort");
 char const* const _PREHASH_PricePerMeter = LLMessageStringTable::getInstance()->getString("PricePerMeter");
 char const* const _PREHASH_RegionFlags = LLMessageStringTable::getInstance()->getString("RegionFlags");
+char const* const _PREHASH_RegionFlagsExtended = LLMessageStringTable::getInstance()->getString("RegionFlagsExtended");
+char const* const _PREHASH_RegionProtocols = LLMessageStringTable::getInstance()->getString("RegionProtocols");
 char const* const _PREHASH_VoteResult = LLMessageStringTable::getInstance()->getString("VoteResult");
 char const* const _PREHASH_ParcelDirFeeEstimate = LLMessageStringTable::getInstance()->getString("ParcelDirFeeEstimate");
 char const* const _PREHASH_ModifyBlock = LLMessageStringTable::getInstance()->getString("ModifyBlock");
@@ -305,6 +307,8 @@ char const* const _PREHASH_ViewerStartAuction = LLMessageStringTable::getInstanc
 char const* const _PREHASH_StartAuction = LLMessageStringTable::getInstance()->getString("StartAuction");
 char const* const _PREHASH_DuplicateFlags = LLMessageStringTable::getInstance()->getString("DuplicateFlags");
 char const* const _PREHASH_RegionInfo2 = LLMessageStringTable::getInstance()->getString("RegionInfo2");
+char const* const _PREHASH_RegionInfo3 = LLMessageStringTable::getInstance()->getString("RegionInfo3");
+char const* const _PREHASH_RegionInfo4 = LLMessageStringTable::getInstance()->getString("RegionInfo4");
 char const* const _PREHASH_TextColor = LLMessageStringTable::getInstance()->getString("TextColor");
 char const* const _PREHASH_SlaveID = LLMessageStringTable::getInstance()->getString("SlaveID");
 char const* const _PREHASH_Charter = LLMessageStringTable::getInstance()->getString("Charter");
diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h
index 9214682003..573e10dc0b 100644
--- a/indra/llmessage/message_prehash.h
+++ b/indra/llmessage/message_prehash.h
@@ -279,6 +279,8 @@ extern char const* const _PREHASH_GrabOffset;
 extern char const* const _PREHASH_SimPort;
 extern char const* const _PREHASH_PricePerMeter;
 extern char const* const _PREHASH_RegionFlags;
+extern char const* const _PREHASH_RegionFlagsExtended;
+extern char const* const _PREHASH_RegionProtocols;
 extern char const* const _PREHASH_VoteResult;
 extern char const* const _PREHASH_ParcelDirFeeEstimate;
 extern char const* const _PREHASH_ModifyBlock;
@@ -305,6 +307,8 @@ extern char const* const _PREHASH_ViewerStartAuction;
 extern char const* const _PREHASH_StartAuction;
 extern char const* const _PREHASH_DuplicateFlags;
 extern char const* const _PREHASH_RegionInfo2;
+extern char const* const _PREHASH_RegionInfo3;
+extern char const* const _PREHASH_RegionInfo4;
 extern char const* const _PREHASH_TextColor;
 extern char const* const _PREHASH_SlaveID;
 extern char const* const _PREHASH_Charter;
diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp
index 7ed22d68f6..0faa888398 100644
--- a/indra/newview/llestateinfomodel.cpp
+++ b/indra/newview/llestateinfomodel.cpp
@@ -65,12 +65,12 @@ void LLEstateInfoModel::sendEstateInfo()
 	}
 }
 
-bool LLEstateInfoModel::getUseFixedSun()			const {	return mFlags & REGION_FLAGS_SUN_FIXED;				}
-bool LLEstateInfoModel::getIsExternallyVisible()	const {	return mFlags & REGION_FLAGS_EXTERNALLY_VISIBLE;	}
-bool LLEstateInfoModel::getAllowDirectTeleport()	const {	return mFlags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT;	}
-bool LLEstateInfoModel::getDenyAnonymous()			const {	return mFlags & REGION_FLAGS_DENY_ANONYMOUS; 		}
-bool LLEstateInfoModel::getDenyAgeUnverified()		const {	return mFlags & REGION_FLAGS_DENY_AGEUNVERIFIED;	}
-bool LLEstateInfoModel::getAllowVoiceChat()			const {	return mFlags & REGION_FLAGS_ALLOW_VOICE;			}
+bool LLEstateInfoModel::getUseFixedSun()			const {	return getFlag(REGION_FLAGS_SUN_FIXED);				}
+bool LLEstateInfoModel::getIsExternallyVisible()	const {	return getFlag(REGION_FLAGS_EXTERNALLY_VISIBLE);	}
+bool LLEstateInfoModel::getAllowDirectTeleport()	const {	return getFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT);	}
+bool LLEstateInfoModel::getDenyAnonymous()			const {	return getFlag(REGION_FLAGS_DENY_ANONYMOUS); 		}
+bool LLEstateInfoModel::getDenyAgeUnverified()		const {	return getFlag(REGION_FLAGS_DENY_AGEUNVERIFIED);	}
+bool LLEstateInfoModel::getAllowVoiceChat()			const {	return getFlag(REGION_FLAGS_ALLOW_VOICE);			}
 
 void LLEstateInfoModel::setUseFixedSun(bool val)			{ setFlag(REGION_FLAGS_SUN_FIXED, 				val);	}
 void LLEstateInfoModel::setIsExternallyVisible(bool val)	{ setFlag(REGION_FLAGS_EXTERNALLY_VISIBLE,		val);	}
@@ -199,18 +199,6 @@ void LLEstateInfoModel::commitEstateInfoDataserver()
 	gAgent.sendMessage();
 }
 
-void LLEstateInfoModel::setFlag(U32 flag, bool val)
-{
-	if (val)
-	{
-		mFlags |= flag;
-	}
-	else
-	{
-		mFlags &= ~flag;
-	}
-}
-
 std::string LLEstateInfoModel::getInfoDump()
 {
 	LLSD dump;
diff --git a/indra/newview/llestateinfomodel.h b/indra/newview/llestateinfomodel.h
index 56391eda91..538f2f7c75 100644
--- a/indra/newview/llestateinfomodel.h
+++ b/indra/newview/llestateinfomodel.h
@@ -85,19 +85,38 @@ protected:
 private:
 	bool commitEstateInfoCaps();
 	void commitEstateInfoDataserver();
-	U32  getFlags() const { return mFlags; }
-	void setFlag(U32 flag, bool val);
+	inline bool getFlag(U64 flag) const;
+	inline void setFlag(U64 flag, bool val);
+	U64  getFlags() const { return mFlags; }
 	std::string getInfoDump();
 
 	// estate info
 	std::string	mName;			/// estate name
 	LLUUID		mOwnerID;		/// estate owner id
 	U32			mID;			/// estate id
-	U32			mFlags;			/// estate flags
+	U64			mFlags;			/// estate flags
 	F32			mSunHour;		/// estate sun hour
 
 	update_signal_t mUpdateSignal; /// emitted when we receive update from sim
 	update_signal_t mCommitSignal; /// emitted when our update gets applied to sim
 };
 
+inline bool LLEstateInfoModel::getFlag(U64 flag) const
+{
+	return ((mFlags & flag) != 0);
+}
+
+inline void LLEstateInfoModel::setFlag(U64 flag, bool val)
+{
+	if (val)
+	{
+		mFlags |= flag;
+	}
+	else
+	{
+		mFlags &= ~flag;
+	}
+}
+
+
 #endif // LL_LLESTATEINFOMODEL_H
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 8223e89b64..42857b2aa2 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -538,7 +538,7 @@ void LLFloaterBuyLandUI::updateCovenantInfo()
 	LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
 	if (resellable_clause)
 	{
-		if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
+		if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
 		{
 			resellable_clause->setText(getString("can_not_resell"));
 		}
@@ -551,7 +551,7 @@ void LLFloaterBuyLandUI::updateCovenantInfo()
 	LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
 	if (changeable_clause)
 	{
-		if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
+		if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
 		{
 			changeable_clause->setText(getString("can_change"));
 		}
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index fb905eae11..aac8f5bfc1 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -164,9 +164,9 @@ LLFloaterGodTools::~LLFloaterGodTools()
 }

-U32 LLFloaterGodTools::computeRegionFlags() const
+U64 LLFloaterGodTools::computeRegionFlags() const
 {
-	U32 flags = gAgent.getRegion()->getRegionFlags();
+	U64 flags = gAgent.getRegion()->getRegionFlags();
 	if (mPanelRegionTools) flags = mPanelRegionTools->computeRegionFlags(flags);
 	if (mPanelObjectTools) flags = mPanelObjectTools->computeRegionFlags(flags);
 	return flags;
@@ -210,7 +210,7 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg)
 	if (!msg) return;
 
 	//const S32 SIM_NAME_BUF = 256;
-	U32 region_flags;
+	U64 region_flags;
 	U8 sim_access;
 	U8 agent_limit;
 	std::string sim_name;
@@ -231,13 +231,23 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg)
 	msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, sim_name);
 	msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, estate_id);
 	msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, parent_estate_id);
-	msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, region_flags);
 	msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_SimAccess, sim_access);
 	msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_MaxAgents, agent_limit);
 	msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, object_bonus_factor);
 	msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_BillableFactor, billable_factor);
 	msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, water_height);
 
+	if (msg->has(_PREHASH_RegionInfo3))
+	{
+		msg->getU64Fast(_PREHASH_RegionInfo3, _PREHASH_RegionFlags, region_flags);
+	}
+	else
+	{
+		U32 flags = 0;
+		msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags);
+		region_flags = flags;
+	}
+
 	if (host != gAgent.getRegionHost())
 	{
 		// Update is for a different region than the one we're in.
@@ -434,7 +444,7 @@ LLPanelRegionTools::~LLPanelRegionTools()
 	// base class will take care of everything
 }
 
-U32 LLPanelRegionTools::computeRegionFlags(U32 flags) const
+U64 LLPanelRegionTools::computeRegionFlags(U64 flags) const
 {
 	flags &= getRegionFlagsMask();
 	flags |= getRegionFlags();
@@ -562,9 +572,9 @@ S32 LLPanelRegionTools::getGridPosY() const
 	return getChild<LLUICtrl>("gridposy")->getValue().asInteger();
 }
 
-U32 LLPanelRegionTools::getRegionFlags() const
+U64 LLPanelRegionTools::getRegionFlags() const
 {
-	U32 flags = 0x0;
+	U64 flags = 0x0;
 	flags = getChild<LLUICtrl>("check prelude")->getValue().asBoolean()  
 					? set_prelude_flags(flags)
 					: unset_prelude_flags(flags);
@@ -601,9 +611,9 @@ U32 LLPanelRegionTools::getRegionFlags() const
 	return flags;
 }
 
-U32 LLPanelRegionTools::getRegionFlagsMask() const
+U64 LLPanelRegionTools::getRegionFlagsMask() const
 {
-	U32 flags = 0xffffffff;
+	U64 flags = 0xFFFFFFFFFFFFFFFFULL;
 	flags = getChild<LLUICtrl>("check prelude")->getValue().asBoolean()
 				? set_prelude_flags(flags)
 				: unset_prelude_flags(flags);
@@ -684,7 +694,7 @@ void LLPanelRegionTools::setParentEstateID(U32 id)
 	getChild<LLUICtrl>("parentestate")->setValue((S32)id);
 }
 
-void LLPanelRegionTools::setCheckFlags(U32 flags)
+void LLPanelRegionTools::setCheckFlags(U64 flags)
 {
 	getChild<LLUICtrl>("check prelude")->setValue(is_prelude(flags) ? TRUE : FALSE);
 	getChild<LLUICtrl>("check fixed sun")->setValue(flags & REGION_FLAGS_SUN_FIXED ? TRUE : FALSE);
@@ -943,7 +953,7 @@ void LLPanelObjectTools::refresh()
 }

-U32 LLPanelObjectTools::computeRegionFlags(U32 flags) const
+U64 LLPanelObjectTools::computeRegionFlags(U64 flags) const
 {
 	if (getChild<LLUICtrl>("disable scripts")->getValue().asBoolean())
 	{
@@ -973,7 +983,7 @@ U32 LLPanelObjectTools::computeRegionFlags(U32 flags) const
 }

-void LLPanelObjectTools::setCheckFlags(U32 flags)
+void LLPanelObjectTools::setCheckFlags(U64 flags)
 {
 	getChild<LLUICtrl>("disable scripts")->setValue(flags & REGION_FLAGS_SKIP_SCRIPTS ? TRUE : FALSE);
 	getChild<LLUICtrl>("disable collisions")->setValue(flags & REGION_FLAGS_SKIP_COLLISIONS ? TRUE : FALSE);
diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h
index 1aa8b838fb..cbaeee7051 100644
--- a/indra/newview/llfloatergodtools.h
+++ b/indra/newview/llfloatergodtools.h
@@ -98,7 +98,7 @@ private:
 	~LLFloaterGodTools();
 	
 protected:
-	U32 computeRegionFlags() const;
+	U64 computeRegionFlags() const;
 
 protected:
 
@@ -147,8 +147,8 @@ public:
 	const std::string getSimName() const;
 	U32 getEstateID() const;
 	U32 getParentEstateID() const;
-	U32 getRegionFlags() const;
-	U32 getRegionFlagsMask() const;
+	U64 getRegionFlags() const;
+	U64 getRegionFlagsMask() const;
 	F32 getBillableFactor() const;
 	S32 getPricePerMeter() const;
 	S32 getGridPosX() const;
@@ -160,7 +160,7 @@ public:
 	void setSimName(const std::string& name);
 	void setEstateID(U32 id);
 	void setParentEstateID(U32 id);
-	void setCheckFlags(U32 flags);
+	void setCheckFlags(U64 flags);
 	void setBillableFactor(F32 billable_factor);
 	void setPricePerMeter(S32 price);
 	void setGridPosX(S32 pos);
@@ -168,7 +168,7 @@ public:
 	void setRedirectGridX(S32 pos);
 	void setRedirectGridY(S32 pos);
 
-	U32 computeRegionFlags(U32 initial_flags) const;
+	U64 computeRegionFlags(U64 initial_flags) const;
 	void clearAllWidgets();
 	void enableAllWidgets();
 
@@ -218,10 +218,10 @@ public:
 	/*virtual*/ void refresh();
 
 	void setTargetAvatar(const LLUUID& target_id);
-	U32 computeRegionFlags(U32 initial_flags) const;
+	U64 computeRegionFlags(U64 initial_flags) const;
 	void clearAllWidgets();
 	void enableAllWidgets();
-	void setCheckFlags(U32 flags);
+	void setCheckFlags(U64 flags);
 
 	void onChangeAnything();
 	void onApplyChanges();
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 55f3d548ec..ce95d8bacf 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -557,7 +557,7 @@ void LLPanelLandGeneral::refresh()
 		BOOL is_leased = (LLParcel::OS_LEASED == parcel->getOwnershipStatus());
 		BOOL region_xfer = FALSE;
 		if(regionp
-		   && !(regionp->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL))
+		   && !(regionp->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)))
 		{
 			region_xfer = TRUE;
 		}
@@ -2117,7 +2117,7 @@ void LLPanelLandOptions::refreshSearch()
 			LLViewerParcelMgr::isParcelModifiableByAgent(
 				parcel, GP_LAND_CHANGE_IDENTITY)
 			&& region
-			&& !(region->getRegionFlags() & REGION_FLAGS_BLOCK_PARCEL_SEARCH);
+			&& !(region->getRegionFlag(REGION_FLAGS_BLOCK_PARCEL_SEARCH));
 
 	// There is a bug with this panel whereby the Show Directory bit can be 
 	// slammed off by the Region based on an override.  Since this data is cached
@@ -2866,7 +2866,7 @@ void LLPanelLandCovenant::refresh()
 	LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
 	if (resellable_clause)
 	{
-		if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
+		if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
 		{
 			resellable_clause->setText(getString("can_not_resell"));
 		}
@@ -2879,7 +2879,7 @@ void LLPanelLandCovenant::refresh()
 	LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
 	if (changeable_clause)
 	{
-		if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
+		if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
 		{
 			changeable_clause->setText(getString("can_change"));
 		}
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index fe29bb38c7..1d9f519d70 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -318,7 +318,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
 	// extract message
 	std::string sim_name;
 	std::string sim_type = LLTrans::getString("land_type_unknown");
-	U32 region_flags;
+	U64 region_flags;
 	U8 agent_limit;
 	F32 object_bonus_factor;
 	U8 sim_access;
@@ -328,7 +328,6 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
 	BOOL use_estate_sun;
 	F32 sun_hour;
 	msg->getString("RegionInfo", "SimName", sim_name);
-	msg->getU32("RegionInfo", "RegionFlags", region_flags);
 	msg->getU8("RegionInfo", "MaxAgents", agent_limit);
 	msg->getF32("RegionInfo", "ObjectBonusFactor", object_bonus_factor);
 	msg->getU8("RegionInfo", "SimAccess", sim_access);
@@ -347,6 +346,17 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
 		LLTrans::findString(sim_type, sim_type); // try localizing sim product name
 	}
 
+	if (msg->has(_PREHASH_RegionInfo3))
+	{
+		msg->getU64("RegionInfo", "RegionFlags", region_flags);
+	}
+	else
+	{
+		U32 flags = 0;
+		msg->getU32("RegionInfo", "RegionFlags", flags);
+		region_flags = flags;
+	}
+
 	// GENERAL PANEL
 	panel = tab->getChild<LLPanel>("General");
 	panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name));
@@ -378,9 +388,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
 	panel = tab->getChild<LLPanel>("Debug");
 
 	panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name) );
-	panel->getChild<LLUICtrl>("disable_scripts_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)) );
-	panel->getChild<LLUICtrl>("disable_collisions_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_COLLISIONS)) );
-	panel->getChild<LLUICtrl>("disable_physics_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_PHYSICS)) );
+	panel->getChild<LLUICtrl>("disable_scripts_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_SCRIPTS) ? TRUE : FALSE )) );
+	panel->getChild<LLUICtrl>("disable_collisions_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_COLLISIONS) ? TRUE : FALSE )) );
+	panel->getChild<LLUICtrl>("disable_physics_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_PHYSICS) ? TRUE : FALSE )) );
 	panel->setCtrlsEnabled(allow_modify);
 
 	// TERRAIN PANEL
@@ -2276,7 +2286,7 @@ bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region)
 	LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
 	if (resellable_clause)
 	{
-		if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
+		if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
 		{
 			resellable_clause->setText(getString("can_not_resell"));
 		}
@@ -2289,7 +2299,7 @@ bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region)
 	LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
 	if (changeable_clause)
 	{
-		if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
+		if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
 		{
 			changeable_clause->setText(getString("can_change"));
 		}
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 3ec1e372eb..479bdd5ff7 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -110,9 +110,6 @@ LLFloaterReporter::LLFloaterReporter(const LLSD& key)
 // static
 void LLFloaterReporter::processRegionInfo(LLMessageSystem* msg)
 {
-	U32 region_flags;
-	msg->getU32("RegionInfo", "RegionFlags", region_flags);
-	
 	if ( LLFloaterReg::instanceVisible("reporter") )
 	{
 		LLNotificationsUtil::add("HelpReportAbuseEmailLL");
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 8d9d70b50e..5022dba934 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -1217,11 +1217,11 @@ void LLLocationInputCtrl::onParcelIconClick(EParcelIcon icon)
 	case SCRIPTS_ICON:
 	{
 		LLViewerRegion* region = gAgent.getRegion();
-		if(region && region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS)
+		if(region && region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS))
 		{
 			LLNotificationsUtil::add("ScriptsStopped");
 		}
-		else if(region && region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS)
+		else if(region && region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS))
 		{
 			LLNotificationsUtil::add("ScriptsNotRunning");
 		}
diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp
index 04c1a86f69..5321ebc777 100644
--- a/indra/newview/llpanelland.cpp
+++ b/indra/newview/llpanelland.cpp
@@ -166,7 +166,7 @@ void LLPanelLandInfo::refresh()
 		getChildView("button abandon land")->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike());
 
 		// only mainland sims are subdividable by owner
-		if (regionp->getRegionFlags() && REGION_FLAGS_ALLOW_PARCEL_CHANGES)
+		if (regionp->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
 		{
 			getChildView("button subdivide land")->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike());
 		}
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index ce8057eead..884de65dd8 100644
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -572,7 +572,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
 
 		mTerraformLimitsText->setText(parcel->getAllowTerraform() ? on : off);
 
-		if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
+		if (region->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
 		{
 			mSubdivideText->setText(getString("can_change"));
 		}
@@ -580,7 +580,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
 		{
 			mSubdivideText->setText(getString("can_not_change"));
 		}
-		if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
+		if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL))
 		{
 			mResaleText->setText(getString("can_not_resell"));
 		}
diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp
index 280cc11179..fbd86df1f3 100644
--- a/indra/newview/llpaneltopinfobar.cpp
+++ b/indra/newview/llpaneltopinfobar.cpp
@@ -415,11 +415,11 @@ void LLPanelTopInfoBar::onParcelIconClick(EParcelIcon icon)
 	case SCRIPTS_ICON:
 	{
 		LLViewerRegion* region = gAgent.getRegion();
-		if(region && region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS)
+		if(region && region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS))
 		{
 			LLNotificationsUtil::add("ScriptsStopped");
 		}
-		else if(region && region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS)
+		else if(region && region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS))
 		{
 			LLNotificationsUtil::add("ScriptsNotRunning");
 		}
diff --git a/indra/newview/llregioninfomodel.cpp b/indra/newview/llregioninfomodel.cpp
index 698c4f9bb9..cc777d9297 100644
--- a/indra/newview/llregioninfomodel.cpp
+++ b/indra/newview/llregioninfomodel.cpp
@@ -119,7 +119,7 @@ void LLRegionInfoModel::sendRegionTerrain(const LLUUID& invoice) const
 
 bool LLRegionInfoModel::getUseFixedSun() const
 {
-	return mRegionFlags & REGION_FLAGS_SUN_FIXED;
+	return ((mRegionFlags & REGION_FLAGS_SUN_FIXED) != 0);
 }
 
 void LLRegionInfoModel::setUseFixedSun(bool fixed)
@@ -141,7 +141,6 @@ void LLRegionInfoModel::update(LLMessageSystem* msg)
 	msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, mSimName);
 	msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, mEstateID);
 	msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, mParentEstateID);
-	msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, mRegionFlags);
 	msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_SimAccess, mSimAccess);
 	msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_MaxAgents, mAgentLimit);
 	msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, mObjectBonusFactor);
@@ -159,6 +158,17 @@ void LLRegionInfoModel::update(LLMessageSystem* msg)
 	msg->getF32(_PREHASH_RegionInfo, _PREHASH_SunHour, mSunHour);
 	LL_DEBUGS("Windlight Sync") << "Got region sun hour: " << mSunHour << LL_ENDL;
 
+	if (msg->has(_PREHASH_RegionInfo3))
+	{
+		msg->getU64Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, mRegionFlags);
+	}
+	else
+	{
+		U32 flags = 0;
+		msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags);
+		mRegionFlags = flags;
+	}
+
 	// the only reasonable way to decide if we actually have any data is to
 	// check to see if any of these fields have nonzero sizes
 	if (msg->getSize(_PREHASH_RegionInfo2, _PREHASH_ProductSKU) > 0 ||
diff --git a/indra/newview/llregioninfomodel.h b/indra/newview/llregioninfomodel.h
index 89efd82767..d22a0de463 100644
--- a/indra/newview/llregioninfomodel.h
+++ b/indra/newview/llregioninfomodel.h
@@ -52,7 +52,7 @@ public:
 	U8			mSimAccess;
 	U8			mAgentLimit;
 
-	U32			mRegionFlags;
+	U64			mRegionFlags;
 	U32			mEstateID;
 	U32			mParentEstateID;
 
diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp
index aba43a9715..08d82ea9cb 100644
--- a/indra/newview/lltoolbrush.cpp
+++ b/indra/newview/lltoolbrush.cpp
@@ -657,7 +657,7 @@ bool LLToolBrushLand::canTerraform(LLViewerRegion* regionp) const
 {
 	if (!regionp) return false;
 	if (regionp->canManageEstate()) return true;
-	return !(regionp->getRegionFlags() & REGION_FLAGS_BLOCK_TERRAFORM);
+	return !regionp->getRegionFlag(REGION_FLAGS_BLOCK_TERRAFORM);
 }
 
 // static
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index c69999981c..3181e19cae 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1215,7 +1215,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
 	if (!item || !item->isFinished()) return;
 	
 	//if (regionp
-	//	&& (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
+	//	&& (regionp->getRegionFlag(REGION_FLAGS_SANDBOX)))
 	//{
 	//	LLFirstUse::useSandbox();
 	//}
diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp
index 93ba3b2558..641fbc5042 100644
--- a/indra/newview/lltoolplacer.cpp
+++ b/indra/newview/lltoolplacer.cpp
@@ -182,7 +182,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
 		return FALSE;
 	}
 
-	if (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX)
+	if (regionp->getRegionFlag(REGION_FLAGS_SANDBOX))
 	{
 		//LLFirstUse::useSandbox();
 	}
@@ -485,7 +485,7 @@ BOOL LLToolPlacer::addDuplicate(S32 x, S32 y)
 										FALSE);				// select copy
 
 	if (regionp
-		&& (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
+		&& (regionp->getRegionFlag(REGION_FLAGS_SANDBOX)))
 	{
 		//LLFirstUse::useSandbox();
 	}
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 903f4437a7..f399275c94 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -4900,9 +4900,19 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data)
 	// Various hacks that aren't statistics, but are being handled here.
 	//
 	U32 max_tasks_per_region;
-	U32 region_flags;
+	U64 region_flags;
 	msg->getU32("Region", "ObjectCapacity", max_tasks_per_region);
-	msg->getU32("Region", "RegionFlags", region_flags);
+
+	if (msg->has(_PREHASH_RegionInfo))
+	{
+		msg->getU64("RegionInfo", "RegionFlagsExtended", region_flags);
+	}
+	else
+	{
+		U32 flags = 0;
+		msg->getU32("Region", "RegionFlags", flags);
+		region_flags = flags;
+	}
 
 	LLViewerRegion* regionp = gAgent.getRegion();
 	if (regionp)
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 2bb2e92279..0077632b4a 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -696,8 +696,8 @@ bool LLViewerParcelMgr::allowAgentScripts(const LLViewerRegion* region, const LL
 	// This mirrors the traditional menu bar parcel icon code, but is not
 	// technically correct.
 	return region
-		&& !(region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS)
-		&& !(region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS)
+		&& !region->getRegionFlag(REGION_FLAGS_SKIP_SCRIPTS)
+		&& !region->getRegionFlag(REGION_FLAGS_ESTATE_SKIP_SCRIPTS)
 		&& parcel
 		&& parcel->getAllowOtherScripts();
 }
@@ -2121,7 +2121,7 @@ void LLViewerParcelMgr::startReleaseLand()
 		return;
 	}
 /*
-	if ((region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
+	if (region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)
 		&& !gAgent.isGodlike())
 	{
 		LLSD args;
@@ -2366,7 +2366,7 @@ void LLViewerParcelMgr::startDeedLandToGroup()
 	/*
 	if(!gAgent.isGodlike())
 	{
-		if((region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
+		if(region->getRegionFlag(REGION_FLAGS_BLOCK_LAND_RESELL)
 			&& (mCurrentParcel->getOwnerID() != region->getOwner()))
 		{
 			LLSD args;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index c6f1be4483..9ff00a1b82 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -279,6 +279,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
 	mZoning(""),
 	mIsEstateManager(FALSE),
 	mRegionFlags( REGION_FLAGS_DEFAULT ),
+	mRegionProtocols( 0 ),
 	mSimAccess( SIM_ACCESS_MIN ),
 	mBillableFactor(1.0),
 	mMaxTasks(DEFAULT_MAX_REGION_WIDE_PRIM_COUNT),
@@ -454,18 +455,6 @@ void LLViewerRegion::sendReliableMessage()
 	gMessageSystem->sendReliable(mImpl->mHost);
 }
 
-void LLViewerRegion::setFlags(BOOL b, U32 flags)
-{
-	if (b)
-	{
-		mRegionFlags |=  flags;
-	}
-	else
-	{
-		mRegionFlags &= ~flags;
-	}
-}
-
 void LLViewerRegion::setWaterHeight(F32 water_level)
 {
 	mImpl->mLandp->setWaterHeight(water_level);
@@ -478,10 +467,10 @@ F32 LLViewerRegion::getWaterHeight() const
 
 BOOL LLViewerRegion::isVoiceEnabled() const
 {
-	return (getRegionFlags() & REGION_FLAGS_ALLOW_VOICE);
+	return getRegionFlag(REGION_FLAGS_ALLOW_VOICE);
 }
 
-void LLViewerRegion::setRegionFlags(U32 flags)
+void LLViewerRegion::setRegionFlags(U64 flags)
 {
 	mRegionFlags = flags;
 }
@@ -574,7 +563,7 @@ std::string LLViewerRegion::getLocalizedSimProductName() const
 }
 
 // static
-std::string LLViewerRegion::regionFlagsToString(U32 flags)
+std::string LLViewerRegion::regionFlagsToString(U64 flags)
 {
 	std::string result;
 
@@ -1393,7 +1382,8 @@ void LLViewerRegion::unpackRegionHandshake()
 {
 	LLMessageSystem *msg = gMessageSystem;
 
-	U32 region_flags;
+	U64 region_flags = 0;
+	U64 region_protocols = 0;
 	U8 sim_access;
 	std::string sim_name;
 	LLUUID sim_owner;
@@ -1402,7 +1392,6 @@ void LLViewerRegion::unpackRegionHandshake()
 	F32 billable_factor;
 	LLUUID cache_id;
 
-	msg->getU32		("RegionInfo", "RegionFlags", region_flags);
 	msg->getU8		("RegionInfo", "SimAccess", sim_access);
 	msg->getString	("RegionInfo", "SimName", sim_name);
 	msg->getUUID	("RegionInfo", "SimOwner", sim_owner);
@@ -1411,7 +1400,20 @@ void LLViewerRegion::unpackRegionHandshake()
 	msg->getF32		("RegionInfo", "BillableFactor", billable_factor);
 	msg->getUUID	("RegionInfo", "CacheID", cache_id );
 
+	if (msg->has(_PREHASH_RegionInfo4))
+	{
+		msg->getU64Fast(_PREHASH_RegionInfo4, _PREHASH_RegionFlagsExtended, region_flags);
+		msg->getU64Fast(_PREHASH_RegionInfo4, _PREHASH_RegionProtocols, region_protocols);
+	}
+	else
+	{
+		U32 flags = 0;
+		msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, flags);
+		region_flags = flags;
+	}
+
 	setRegionFlags(region_flags);
+	setRegionProtocols(region_protocols);
 	setSimAccess(sim_access);
 	setRegionNameAndZone(sim_name);
 	setOwner(sim_owner);
@@ -1812,7 +1814,7 @@ LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type)
 
 // the viewer can not yet distinquish between normal- and estate-owned objects
 // so we collapse these two bits and enable the UI if either are set
-const U32 ALLOW_RETURN_ENCROACHING_OBJECT = REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT
+const U64 ALLOW_RETURN_ENCROACHING_OBJECT = REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT
 											| REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT;
 
 bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const std::vector<LLBBox>& boxes) const
@@ -1820,7 +1822,7 @@ bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const std::vector<
 	return (mParcelOverlay != NULL)
 		&& (mParcelOverlay->isOwnedSelf(pos)
 			|| mParcelOverlay->isOwnedGroup(pos)
-			|| ((mRegionFlags & ALLOW_RETURN_ENCROACHING_OBJECT)
+			|| (getRegionFlag(ALLOW_RETURN_ENCROACHING_OBJECT)
 				&& mParcelOverlay->encroachesOwned(boxes)) );
 }
 
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 2ddb17f171..20d96ad9ac 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -109,13 +109,13 @@ public:
 	//void setAgentOffset(const LLVector3d &offset);
 	void updateRenderMatrix();
 
-	void setAllowDamage(BOOL b) { setFlags(b, REGION_FLAGS_ALLOW_DAMAGE); }
-	void setAllowLandmark(BOOL b) { setFlags(b, REGION_FLAGS_ALLOW_LANDMARK); }
-	void setAllowSetHome(BOOL b) { setFlags(b, REGION_FLAGS_ALLOW_SET_HOME); }
-	void setResetHomeOnTeleport(BOOL b) { setFlags(b, REGION_FLAGS_RESET_HOME_ON_TELEPORT); }
-	void setSunFixed(BOOL b) { setFlags(b, REGION_FLAGS_SUN_FIXED); }
-	void setBlockFly(BOOL b) { setFlags(b, REGION_FLAGS_BLOCK_FLY); }
-	void setAllowDirectTeleport(BOOL b) { setFlags(b, REGION_FLAGS_ALLOW_DIRECT_TELEPORT); }
+	void setAllowDamage(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DAMAGE, b); }
+	void setAllowLandmark(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_LANDMARK, b); }
+	void setAllowSetHome(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_SET_HOME, b); }
+	void setResetHomeOnTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_RESET_HOME_ON_TELEPORT, b); }
+	void setSunFixed(BOOL b) { setRegionFlag(REGION_FLAGS_SUN_FIXED, b); }
+	void setBlockFly(BOOL b) { setRegionFlag(REGION_FLAGS_BLOCK_FLY, b); }
+	void setAllowDirectTeleport(BOOL b) { setRegionFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, b); }

 	inline BOOL getAllowDamage()			const;
@@ -156,8 +156,15 @@ public:
 	LLViewerParcelOverlay *getParcelOverlay() const
 			{ return mParcelOverlay; }
 
-	void setRegionFlags(U32 flags);
-	U32 getRegionFlags() const					{ return mRegionFlags; }
+	inline void setRegionFlag(U64 flag, BOOL on);
+	inline BOOL getRegionFlag(U64 flag) const;
+	void setRegionFlags(U64 flags);
+	U64 getRegionFlags() const					{ return mRegionFlags; }
+
+	inline void setRegionProtocol(U64 protocol, BOOL on);
+	BOOL getRegionProtocol(U64 protocol) const;
+	void setRegionProtocols(U64 protocols)			{ mRegionProtocols = protocols; }
+	U64 getRegionProtocols() const					{ return mRegionProtocols; }
 
 	void setTimeDilation(F32 time_dilation);
 	F32  getTimeDilation() const				{ return mTimeDilation; }
@@ -195,7 +202,7 @@ public:
 	std::string getLocalizedSimProductName() const;
 
 	// Returns "Sandbox", "Expensive", etc.
-	static std::string regionFlagsToString(U32 flags);
+	static std::string regionFlagsToString(U64 flags);
 
 	// Returns translated version of "Mature", "PG", "Adult", etc.
 	static std::string accessToString(U8 sim_access);
@@ -347,7 +354,6 @@ public:
 protected:
 	void disconnectAllNeighbors();
 	void initStats();
-	void setFlags(BOOL b, U32 flags);
 
 public:
 	LLWind  mWind;
@@ -392,7 +398,8 @@ private:
 	U32		mPingDelay;
 	F32		mDeltaTime;				// Time since last measurement of lastPackets, Bits, etc
 
-	U32		mRegionFlags;			// includes damage flags
+	U64		mRegionFlags;			// includes damage flags
+	U64		mRegionProtocols;		// protocols supported by this region
 	U8		mSimAccess;
 	F32 	mBillableFactor;
 	U32		mMaxTasks;				// max prim count
@@ -426,6 +433,40 @@ private:
 	LLSD mSimulatorFeatures;
 };
 
+inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const
+{
+	return ((mRegionProtocols & protocol) != 0);
+}
+
+inline void LLViewerRegion::setRegionProtocol(U64 protocol, BOOL on)
+{
+	if (on)
+	{
+		mRegionProtocols |= protocol;
+	}
+	else
+	{
+		mRegionProtocols &= ~protocol;
+	}
+}
+
+inline BOOL LLViewerRegion::getRegionFlag(U64 flag) const
+{
+	return ((mRegionFlags & flag) != 0);
+}
+
+inline void LLViewerRegion::setRegionFlag(U64 flag, BOOL on)
+{
+	if (on)
+	{
+		mRegionFlags |= flag;
+	}
+	else
+	{
+		mRegionFlags &= ~flag;
+	}
+}
+
 inline BOOL LLViewerRegion::getAllowDamage() const
 {
 	return ((mRegionFlags & REGION_FLAGS_ALLOW_DAMAGE) !=0);
diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp
index 350ba39b45..cb24e96d5b 100644
--- a/indra/newview/llworldmap.cpp
+++ b/indra/newview/llworldmap.cpp
@@ -389,7 +389,7 @@ void LLWorldMap::reloadItems(bool force)
 // static public
 // Insert a region in the region map
 // returns true if region inserted, false otherwise
-bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& image_id, U32 accesscode, U32 region_flags)
+bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& image_id, U32 accesscode, U64 region_flags)
 {
 	// This region doesn't exist
 	if (accesscode == 255)
diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h
index 73530b9694..c17feaa04b 100644
--- a/indra/newview/llworldmap.h
+++ b/indra/newview/llworldmap.h
@@ -102,7 +102,7 @@ public:
 	// Setters
 	void setName(std::string& name) { mName = name; }
 	void setAccess (U32 accesscode) { mAccess = accesscode; }
-	void setRegionFlags (U32 region_flags) { mRegionFlags = region_flags; }
+	void setRegionFlags (U64 region_flags) { mRegionFlags = region_flags; }
 	void setLandForSaleImage (LLUUID image_id);
 //	void setWaterHeight (F32 water_height) { mWaterHeight = water_height; }
 
@@ -152,7 +152,7 @@ private:
 	bool mFirstAgentRequest;	// Init agent request flag
 
 	U32  mAccess;				// Down/up and maturity rating of the region
-	U32 mRegionFlags;			// Tell us if the siminfo has been received (if non 0) and what kind of region it is (Sandbox, allow damage)
+	U64 mRegionFlags;			// Tell us if the siminfo has been received (if non 0) and what kind of region it is (Sandbox, allow damage)
 	// Currently not used but might prove useful one day so we comment out 
 //	F32 mWaterHeight;			// Water height on the region (not actively used)
 
@@ -198,7 +198,7 @@ public:
 
 	// Insert a region and items in the map global instance
 	// Note: x_world and y_world in world coordinates (meters)
-	static bool insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 accesscode, U32 region_flags);
+	static bool insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 accesscode, U64 region_flags);
 	static bool insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2);
 
 	// Get info on sims (region) : note that those methods only search the range of loaded sims (the one that are being browsed)
diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg
index 5b147db084..97f879629d 100644
--- a/scripts/messages/message_template.msg
+++ b/scripts/messages/message_template.msg
@@ -2939,6 +2939,10 @@ version 2.0
 		PidStat Single
 		{	PID					S32				}
 	}
+	{
+		RegionInfo Single
+		{	RegionFlagsExtended	U64				}
+	}
 }
 
 // viewer -> sim
@@ -2991,6 +2995,10 @@ version 2.0
 		{	HardMaxAgents		U32			}
 		{	HardMaxObjects		U32			}
 	}
+	{
+		RegionInfo3		Single
+		{	RegionFlagsExtended	U64			}
+	}
 }
 
 // GodUpdateRegionInfo
@@ -3016,6 +3024,10 @@ version 2.0
 		{	RedirectGridX 		S32			}
 		{	RedirectGridY 		S32			}
 	}
+	{
+		RegionInfo2	Single
+		{	RegionFlagsExtended	U64			}
+	}
 }
 
 //NearestLandingRegionRequest
@@ -3116,6 +3128,11 @@ version 2.0
 		{	ProductSKU				Variable	1	}	// string
 		{	ProductName				Variable	1	}	// string
 	}
+	{
+		RegionInfo4		Single
+		{	RegionFlagsExtended	U64			}
+		{	RegionProtocols		U64			}
+	}
 }
 
 // RegionHandshakeReply
diff --git a/scripts/messages/message_template.msg.sha1 b/scripts/messages/message_template.msg.sha1
index 9e3dd21fb0..2190f50c23 100644
--- a/scripts/messages/message_template.msg.sha1
+++ b/scripts/messages/message_template.msg.sha1
@@ -1 +1 @@
-ac4e232bd595c8dd31bc67fd77bcf68d8e9e837c
\ No newline at end of file
+74e56dceb590807a5d48ece83867879ea5c6d22e
\ No newline at end of file
-- 
cgit v1.3