aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs100
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs5
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs47
3 files changed, 128 insertions, 24 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 17e4eb4..a4bb765 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -35,6 +35,104 @@ using log4net;
35 35
36namespace OpenSim.Framework 36namespace OpenSim.Framework
37{ 37{
38 // A special dictionary for avatar appearance
39 public struct LayerItem
40 {
41 public UUID ItemID;
42 public UUID AssetID;
43
44 public LayerItem(UUID itemID, UUID assetID)
45 {
46 ItemID = itemID;
47 AssetID = assetID;
48 }
49 }
50
51 public class Layer
52 {
53 protected int m_layerType;
54 protected Dictionary<UUID, UUID> m_items = new Dictionary<UUID, UUID>();
55 protected List<UUID> m_ids = new List<UUID>();
56
57 public Layer(int type)
58 {
59 m_layerType = type;
60 }
61
62 public int LayerType
63 {
64 get { return m_layerType; }
65 }
66
67 public int Count
68 {
69 get { return m_ids.Count; }
70 }
71
72 public void Add(UUID itemID, UUID assetID)
73 {
74 if (m_items.ContainsKey(itemID))
75 return;
76 if (m_ids.Count >= 5)
77 return;
78
79 m_ids.Add(itemID);
80 m_items[itemID] = assetID;
81 }
82
83 public void Wear(UUID itemID, UUID assetID)
84 {
85 Clear();
86 Add(itemID, assetID);
87 }
88
89 public void Clear()
90 {
91 m_ids.Clear();
92 m_items.Clear();
93 }
94
95 public void RemoveItem(UUID itemID)
96 {
97 if (m_items.ContainsKey(itemID))
98 {
99 m_ids.Remove(itemID);
100 m_items.Remove(itemID);
101 }
102 }
103
104 public void RemoveAsset(UUID assetID)
105 {
106 UUID itemID = UUID.Zero;
107
108 foreach (KeyValuePair<UUID, UUID> kvp in m_items)
109 {
110 if (kvp.Value == assetID)
111 {
112 itemID = kvp.Key;
113 break;
114 }
115 }
116
117 if (itemID != UUID.Zero)
118 {
119 m_ids.Remove(itemID);
120 m_items.Remove(itemID);
121 }
122 }
123
124 public LayerItem this [int idx]
125 {
126 get
127 {
128 if (idx >= m_ids.Count || idx < 0)
129 return new LayerItem(UUID.Zero, UUID.Zero);
130
131 return new LayerItem(m_ids[idx], m_items[m_ids[idx]]);
132 }
133 }
134 }
135
38 /// <summary> 136 /// <summary>
39 /// Contains the Avatar's Appearance and methods to manipulate the appearance. 137 /// Contains the Avatar's Appearance and methods to manipulate the appearance.
40 /// </summary> 138 /// </summary>
@@ -1460,4 +1558,4 @@ namespace OpenSim.Framework
1460 } 1558 }
1461 #endregion 1559 #endregion
1462 } 1560 }
1463} \ No newline at end of file 1561}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d4d6979..9402f8b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2923,9 +2923,8 @@ namespace OpenSim.Region.Framework.Scenes
2923 2923
2924 public void CopyTo(AgentData cAgent) 2924 public void CopyTo(AgentData cAgent)
2925 { 2925 {
2926// DEBUG ON 2926 cAgent.CallbackURI = m_callbackURI;
2927 m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYTO"); 2927
2928// DEBUG OFF
2929 cAgent.AgentID = UUID; 2928 cAgent.AgentID = UUID;
2930 cAgent.RegionID = Scene.RegionInfo.RegionID; 2929 cAgent.RegionID = Scene.RegionInfo.RegionID;
2931 2930
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index b86fb6f..a67404f 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Linq;
30using System.Net; 31using System.Net;
31using System.Reflection; 32using System.Reflection;
32using System.Xml; 33using System.Xml;
@@ -154,6 +155,11 @@ namespace OpenSim.Services.GridService
154 // From the command line link-region 155 // From the command line link-region
155 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 156 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
156 { 157 {
158 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
159 }
160
161 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
162 {
157 reason = string.Empty; 163 reason = string.Empty;
158 string host = "127.0.0.1"; 164 string host = "127.0.0.1";
159 string portstr; 165 string portstr;
@@ -189,7 +195,7 @@ namespace OpenSim.Services.GridService
189 //} 195 //}
190 196
191 GridRegion regInfo; 197 GridRegion regInfo;
192 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); 198 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
193 if (success) 199 if (success)
194 { 200 {
195 regInfo.RegionName = mapName; 201 regInfo.RegionName = mapName;
@@ -202,7 +208,8 @@ namespace OpenSim.Services.GridService
202 208
203 // From the command line and the 2 above 209 // From the command line and the 2 above
204 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, 210 public bool TryCreateLink(UUID scopeID, int xloc, int yloc,
205 string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) 211 string externalRegionName, uint externalPort, string externalHostName, UUID ownerID,
212 out GridRegion regInfo, out string reason)
206 { 213 {
207 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); 214 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
208 215
@@ -214,12 +221,22 @@ namespace OpenSim.Services.GridService
214 regInfo.RegionLocX = xloc; 221 regInfo.RegionLocX = xloc;
215 regInfo.RegionLocY = yloc; 222 regInfo.RegionLocY = yloc;
216 regInfo.ScopeID = scopeID; 223 regInfo.ScopeID = scopeID;
224 regInfo.EstateOwner = ownerID;
217 225
218 // Big HACK for Simian Grid !!! 226 // Big HACK for Simian Grid !!!
219 // We need to clean up all URLs used in OpenSim !!! 227 // We need to clean up all URLs used in OpenSim !!!
220 if (externalHostName.Contains("/")) 228 if (externalHostName.Contains("/"))
221 regInfo.ServerURI = externalHostName; 229 regInfo.ServerURI = externalHostName;
222 230
231 // Check for free coordinates
232 GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
233 if (region != null)
234 {
235 m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", regInfo.RegionLocX, regInfo.RegionLocY, region.RegionName, region.RegionID);
236 reason = "Coordinates are already in use";
237 return false;
238 }
239
223 try 240 try
224 { 241 {
225 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); 242 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
@@ -241,11 +258,11 @@ namespace OpenSim.Services.GridService
241 258
242 if (regionID != UUID.Zero) 259 if (regionID != UUID.Zero)
243 { 260 {
244 GridRegion r = m_GridService.GetRegionByUUID(scopeID, regionID); 261 region = m_GridService.GetRegionByUUID(scopeID, regionID);
245 if (r != null) 262 if (region != null)
246 { 263 {
247 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); 264 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize);
248 regInfo = r; 265 regInfo = region;
249 return true; 266 return true;
250 } 267 }
251 268
@@ -355,17 +372,8 @@ namespace OpenSim.Services.GridService
355 { 372 {
356 // Check for regions which are not linked regions 373 // Check for regions which are not linked regions
357 List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); 374 List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
358 // would like to use .Except, but doesn't seem to exist 375 IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
359 //IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); 376 if (availableRegions.Count() == 0)
360 List<GridRegion> availableRegions = regions.FindAll(delegate(GridRegion region)
361 {
362 // Ewww! n^2
363 if (hyperlinks.Find(delegate(GridRegion r) { return r.RegionID == region.RegionID; }) == null) // not hyperlink. good.
364 return true;
365
366 return false;
367 });
368 if (availableRegions.Count == 0)
369 return false; 377 return false;
370 } 378 }
371 379
@@ -529,7 +537,7 @@ namespace OpenSim.Services.GridService
529 xloc = xloc * (int)Constants.RegionSize; 537 xloc = xloc * (int)Constants.RegionSize;
530 yloc = yloc * (int)Constants.RegionSize; 538 yloc = yloc * (int)Constants.RegionSize;
531 string reason = string.Empty; 539 string reason = string.Empty;
532 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason)) 540 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
533 { 541 {
534 if (cmdparams.Length >= 5) 542 if (cmdparams.Length >= 5)
535 { 543 {
@@ -631,8 +639,7 @@ namespace OpenSim.Services.GridService
631 xloc = xloc * (int)Constants.RegionSize; 639 xloc = xloc * (int)Constants.RegionSize;
632 yloc = yloc * (int)Constants.RegionSize; 640 yloc = yloc * (int)Constants.RegionSize;
633 string reason = string.Empty; 641 string reason = string.Empty;
634 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, 642 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
635 externalHostName, out regInfo, out reason))
636 { 643 {
637 regInfo.RegionName = config.GetString("localName", ""); 644 regInfo.RegionName = config.GetString("localName", "");
638 } 645 }