Move OpenSim.Data.RegionFlags -> OpenSim.Framework.RegionFlags to make it easier for other code to use (e.g. LSL_Api) without having to reference OpenSim.Data just for this.

connector_plugin
Justin Clark-Casey (justincc) 2012-10-09 01:35:27 +01:00
parent d342adaa87
commit 73c9abf5f2
10 changed files with 39 additions and 50 deletions

View File

@ -85,21 +85,6 @@ namespace OpenSim.Data
List<RegionData> GetHyperlinks(UUID scopeID); List<RegionData> GetHyperlinks(UUID scopeID);
} }
[Flags]
public enum RegionFlags : int
{
DefaultRegion = 1, // Used for new Rez. Random if multiple defined
FallbackRegion = 2, // Regions we redirect to when the destination is down
RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false
NoDirectLogin = 8, // Region unavailable for direct logins (by name)
Persistent = 16, // Don't remove on unregister
LockedOut = 32, // Don't allow registration
NoMove = 64, // Don't allow moving this region
Reservation = 128, // This is an inactive reservation
Authenticate = 256, // Require authentication
Hyperlink = 512 // Record represents a HG link
}
public class RegionDataDistanceCompare : IComparer<RegionData> public class RegionDataDistanceCompare : IComparer<RegionData>
{ {
private Vector2 m_origin; private Vector2 m_origin;

View File

@ -37,6 +37,7 @@ using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using RegionFlags = OpenSim.Framework.RegionFlags;
namespace OpenSim.Data.MSSQL namespace OpenSim.Data.MSSQL
{ {

View File

@ -30,11 +30,11 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Reflection; using System.Reflection;
using MySql.Data.MySqlClient;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Data; using OpenSim.Data;
using MySql.Data.MySqlClient; using RegionFlags = OpenSim.Framework.RegionFlags;
namespace OpenSim.Data.MySQL namespace OpenSim.Data.MySQL
{ {

View File

@ -47,6 +47,7 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using Timer = System.Timers.Timer; using Timer = System.Timers.Timer;
using AssetLandmark = OpenSim.Framework.AssetLandmark; using AssetLandmark = OpenSim.Framework.AssetLandmark;
using RegionFlags = OpenMetaverse.RegionFlags;
using Nini.Config; using Nini.Config;
using System.IO; using System.IO;

View File

@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID); int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID);
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags);
if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
{ {
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID);
@ -232,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return true; return true;
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID);
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
return true; return true;
return false; return false;
@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
reason = string.Empty; reason = string.Empty;
logout = false; logout = false;
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID);
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
{ {
// this user is going to another grid // this user is going to another grid
// check if HyperGrid teleport is allowed, based on user level // check if HyperGrid teleport is allowed, based on user level
@ -298,7 +298,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// The rest is only needed for controlling appearance // The rest is only needed for controlling appearance
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID);
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
{ {
// this user is going to another grid // this user is going to another grid
if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID)) if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID))

View File

@ -39,6 +39,7 @@ using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using RegionFlags = OpenMetaverse.RegionFlags;
namespace OpenSim.Region.CoreModules.World.Estate namespace OpenSim.Region.CoreModules.World.Estate
{ {

View File

@ -33,6 +33,7 @@ using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using RegionFlags = OpenMetaverse.RegionFlags;
namespace OpenSim.Region.CoreModules.World.Land namespace OpenSim.Region.CoreModules.World.Land
{ {

View File

@ -384,8 +384,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (response["Success"].AsBoolean()) if (response["Success"].AsBoolean())
{ {
OSDMap extraData = response["ExtraData"] as OSDMap; OSDMap extraData = response["ExtraData"] as OSDMap;
int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0; int enabled = response["Enabled"].AsBoolean() ? (int)OpenSim.Framework.RegionFlags.RegionOnline : 0;
int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0; int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int)OpenSim.Framework.RegionFlags.Hyperlink : 0;
int flags = enabled | hypergrid; int flags = enabled | hypergrid;
m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags); m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags);
return flags; return flags;

View File

@ -151,11 +151,11 @@ namespace OpenSim.Services.GridService
// //
// Get it's flags // Get it's flags
// //
OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["flags"]); OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(region.Data["flags"]);
// Is this a reservation? // Is this a reservation?
// //
if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0) if ((rflags & OpenSim.Framework.RegionFlags.Reservation) != 0)
{ {
// Regions reserved for the null key cannot be taken. // Regions reserved for the null key cannot be taken.
if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString()) if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString())
@ -166,10 +166,10 @@ namespace OpenSim.Services.GridService
// NOTE: Fudging the flags value here, so these flags // NOTE: Fudging the flags value here, so these flags
// should not be used elsewhere. Don't optimize // should not be used elsewhere. Don't optimize
// this with the later retrieval of the same flags! // this with the later retrieval of the same flags!
rflags |= OpenSim.Data.RegionFlags.Authenticate; rflags |= OpenSim.Framework.RegionFlags.Authenticate;
} }
if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0) if ((rflags & OpenSim.Framework.RegionFlags.Authenticate) != 0)
{ {
// Can we authenticate at all? // Can we authenticate at all?
// //
@ -205,10 +205,10 @@ namespace OpenSim.Services.GridService
if ((region != null) && (region.RegionID == regionInfos.RegionID) && if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
{ {
if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.NoMove) != 0)
return "Can't move this region"; return "Can't move this region";
if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.LockedOut) != 0)
return "Region locked out"; return "Region locked out";
// Region reregistering in other coordinates. Delete the old entry // Region reregistering in other coordinates. Delete the old entry
@ -233,7 +233,7 @@ namespace OpenSim.Services.GridService
{ {
int oldFlags = Convert.ToInt32(region.Data["flags"]); int oldFlags = Convert.ToInt32(region.Data["flags"]);
oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; oldFlags &= ~(int)OpenSim.Framework.RegionFlags.Reservation;
rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags
} }
@ -252,7 +252,7 @@ namespace OpenSim.Services.GridService
} }
int flags = Convert.ToInt32(rdata.Data["flags"]); int flags = Convert.ToInt32(rdata.Data["flags"]);
flags |= (int)OpenSim.Data.RegionFlags.RegionOnline; flags |= (int)OpenSim.Framework.RegionFlags.RegionOnline;
rdata.Data["flags"] = flags.ToString(); rdata.Data["flags"] = flags.ToString();
try try
@ -283,9 +283,9 @@ namespace OpenSim.Services.GridService
int flags = Convert.ToInt32(region.Data["flags"]); int flags = Convert.ToInt32(region.Data["flags"]);
if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0) if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0)
{ {
flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline; flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline;
region.Data["flags"] = flags.ToString(); region.Data["flags"] = flags.ToString();
region.Data["last_seen"] = Util.UnixTimeSinceEpoch(); region.Data["last_seen"] = Util.UnixTimeSinceEpoch();
try try
@ -320,7 +320,7 @@ namespace OpenSim.Services.GridService
if (rdata.RegionID != regionID) if (rdata.RegionID != regionID)
{ {
int flags = Convert.ToInt32(rdata.Data["flags"]); int flags = Convert.ToInt32(rdata.Data["flags"]);
if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours if ((flags & (int)Framework.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours
rinfos.Add(RegionData2RegionInfo(rdata)); rinfos.Add(RegionData2RegionInfo(rdata));
} }
} }
@ -470,7 +470,7 @@ namespace OpenSim.Services.GridService
foreach (RegionData r in regions) foreach (RegionData r in regions)
{ {
if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0)
ret.Add(RegionData2RegionInfo(r)); ret.Add(RegionData2RegionInfo(r));
} }
@ -486,7 +486,7 @@ namespace OpenSim.Services.GridService
foreach (RegionData r in regions) foreach (RegionData r in regions)
{ {
if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0)
ret.Add(RegionData2RegionInfo(r)); ret.Add(RegionData2RegionInfo(r));
} }
@ -502,7 +502,7 @@ namespace OpenSim.Services.GridService
foreach (RegionData r in regions) foreach (RegionData r in regions)
{ {
if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0)
ret.Add(RegionData2RegionInfo(r)); ret.Add(RegionData2RegionInfo(r));
} }
@ -629,7 +629,7 @@ namespace OpenSim.Services.GridService
private void OutputRegionToConsole(RegionData r) private void OutputRegionToConsole(RegionData r)
{ {
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]);
ConsoleDisplayList dispList = new ConsoleDisplayList(); ConsoleDisplayList dispList = new ConsoleDisplayList();
dispList.AddRow("Region Name", r.RegionName); dispList.AddRow("Region Name", r.RegionName);
@ -659,7 +659,7 @@ namespace OpenSim.Services.GridService
foreach (RegionData r in regions) foreach (RegionData r in regions)
{ {
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]);
dispTable.AddRow( dispTable.AddRow(
r.RegionName, r.RegionName,
r.RegionID.ToString(), r.RegionID.ToString(),
@ -673,7 +673,7 @@ namespace OpenSim.Services.GridService
private int ParseFlags(int prev, string flags) private int ParseFlags(int prev, string flags)
{ {
OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev; OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)prev;
string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries); string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);
@ -685,18 +685,18 @@ namespace OpenSim.Services.GridService
{ {
if (p.StartsWith("+")) if (p.StartsWith("+"))
{ {
val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1));
f |= (OpenSim.Data.RegionFlags)val; f |= (OpenSim.Framework.RegionFlags)val;
} }
else if (p.StartsWith("-")) else if (p.StartsWith("-"))
{ {
val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1));
f &= ~(OpenSim.Data.RegionFlags)val; f &= ~(OpenSim.Framework.RegionFlags)val;
} }
else else
{ {
val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p); val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p);
f |= (OpenSim.Data.RegionFlags)val; f |= (OpenSim.Framework.RegionFlags)val;
} }
} }
catch (Exception) catch (Exception)
@ -728,7 +728,7 @@ namespace OpenSim.Services.GridService
int flags = Convert.ToInt32(r.Data["flags"]); int flags = Convert.ToInt32(r.Data["flags"]);
flags = ParseFlags(flags, cmd[4]); flags = ParseFlags(flags, cmd[4]);
r.Data["flags"] = flags.ToString(); r.Data["flags"] = flags.ToString();
OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)flags; OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)flags;
MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f)); MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f));
m_Database.Store(r); m_Database.Store(r);

View File

@ -390,8 +390,8 @@ namespace OpenSim.Services.GridService
List<RegionData> regions = m_Database.Get(mapName, m_ScopeID); List<RegionData> regions = m_Database.Get(mapName, m_ScopeID);
if (regions != null && regions.Count > 0) if (regions != null && regions.Count > 0)
{ {
OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]);
if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0) if ((rflags & OpenSim.Framework.RegionFlags.Hyperlink) != 0)
{ {
regInfo = new GridRegion(); regInfo = new GridRegion();
regInfo.RegionID = regions[0].RegionID; regInfo.RegionID = regions[0].RegionID;
@ -460,7 +460,7 @@ namespace OpenSim.Services.GridService
private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
{ {
RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; int flags = (int)OpenSim.Framework.RegionFlags.Hyperlink + (int)OpenSim.Framework.RegionFlags.NoDirectLogin + (int)OpenSim.Framework.RegionFlags.RegionOnline;
rdata.Data["flags"] = flags.ToString(); rdata.Data["flags"] = flags.ToString();
m_Database.Store(rdata); m_Database.Store(rdata);