diff options
author | Melanie | 2010-02-15 00:20:48 +0000 |
---|---|---|
committer | Melanie | 2010-02-15 00:20:48 +0000 |
commit | c033223c63274ebe41075b24d108ca952fbd242c (patch) | |
tree | 8c969a9643c469feb37133b175be18eb52fdff49 /OpenSim/Region/CoreModules | |
parent | Extraneous debug messages removed (diff) | |
parent | Plug a small hole (diff) | |
download | opensim-SC_OLD-c033223c63274ebe41075b24d108ca952fbd242c.zip opensim-SC_OLD-c033223c63274ebe41075b24d108ca952fbd242c.tar.gz opensim-SC_OLD-c033223c63274ebe41075b24d108ca952fbd242c.tar.bz2 opensim-SC_OLD-c033223c63274ebe41075b24d108ca952fbd242c.tar.xz |
Merge branch 'master' into presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules')
11 files changed, 129 insertions, 283 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs deleted file mode 100644 index 9c646b6..0000000 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs +++ /dev/null | |||
@@ -1,226 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | //using System.Reflection; | ||
29 | //using log4net; | ||
30 | |||
31 | namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | ||
32 | { | ||
33 | /* | ||
34 | public class AgentAssetTransactionsManager | ||
35 | { | ||
36 | //private static readonly ILog m_log | ||
37 | // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
38 | |||
39 | /// <summary> | ||
40 | /// Each agent has its own singleton collection of transactions | ||
41 | /// </summary> | ||
42 | private Dictionary<UUID, AgentAssetTransactions> AgentTransactions = | ||
43 | new Dictionary<UUID, AgentAssetTransactions>(); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Should we dump uploaded assets to the filesystem? | ||
47 | /// </summary> | ||
48 | private bool m_dumpAssetsToFile; | ||
49 | |||
50 | public Scene MyScene; | ||
51 | |||
52 | public AgentAssetTransactionsManager(Scene scene, bool dumpAssetsToFile) | ||
53 | { | ||
54 | MyScene = scene; | ||
55 | m_dumpAssetsToFile = dumpAssetsToFile; | ||
56 | } | ||
57 | |||
58 | /// <summary> | ||
59 | /// Get the collection of asset transactions for the given user. If one does not already exist, it | ||
60 | /// is created. | ||
61 | /// </summary> | ||
62 | /// <param name="userID"></param> | ||
63 | /// <returns></returns> | ||
64 | private AgentAssetTransactions GetUserTransactions(UUID userID) | ||
65 | { | ||
66 | lock (AgentTransactions) | ||
67 | { | ||
68 | if (!AgentTransactions.ContainsKey(userID)) | ||
69 | { | ||
70 | AgentAssetTransactions transactions = null; | ||
71 | //= new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); | ||
72 | AgentTransactions.Add(userID, transactions); | ||
73 | } | ||
74 | |||
75 | return AgentTransactions[userID]; | ||
76 | } | ||
77 | } | ||
78 | |||
79 | /// <summary> | ||
80 | /// Remove the given agent asset transactions. This should be called when a client is departing | ||
81 | /// from a scene (and hence won't be making any more transactions here). | ||
82 | /// </summary> | ||
83 | /// <param name="userID"></param> | ||
84 | public void RemoveAgentAssetTransactions(UUID userID) | ||
85 | { | ||
86 | // m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID); | ||
87 | |||
88 | lock (AgentTransactions) | ||
89 | { | ||
90 | AgentTransactions.Remove(userID); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | /// <summary> | ||
95 | /// Create an inventory item from data that has been received through a transaction. | ||
96 | /// | ||
97 | /// This is called when new clothing or body parts are created. It may also be called in other | ||
98 | /// situations. | ||
99 | /// </summary> | ||
100 | /// <param name="remoteClient"></param> | ||
101 | /// <param name="transactionID"></param> | ||
102 | /// <param name="folderID"></param> | ||
103 | /// <param name="callbackID"></param> | ||
104 | /// <param name="description"></param> | ||
105 | /// <param name="name"></param> | ||
106 | /// <param name="invType"></param> | ||
107 | /// <param name="type"></param> | ||
108 | /// <param name="wearableType"></param> | ||
109 | /// <param name="nextOwnerMask"></param> | ||
110 | public void HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID, | ||
111 | uint callbackID, string description, string name, sbyte invType, | ||
112 | sbyte type, byte wearableType, uint nextOwnerMask) | ||
113 | { | ||
114 | // m_log.DebugFormat( | ||
115 | // "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name); | ||
116 | |||
117 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
118 | |||
119 | transactions.RequestCreateInventoryItem( | ||
120 | remoteClient, transactionID, folderID, callbackID, description, | ||
121 | name, invType, type, wearableType, nextOwnerMask); | ||
122 | } | ||
123 | |||
124 | /// <summary> | ||
125 | /// Update an inventory item with data that has been received through a transaction. | ||
126 | /// | ||
127 | /// This is called when clothing or body parts are updated (for instance, with new textures or | ||
128 | /// colours). It may also be called in other situations. | ||
129 | /// </summary> | ||
130 | /// <param name="remoteClient"></param> | ||
131 | /// <param name="transactionID"></param> | ||
132 | /// <param name="item"></param> | ||
133 | public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID, | ||
134 | InventoryItemBase item) | ||
135 | { | ||
136 | // m_log.DebugFormat( | ||
137 | // "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}", | ||
138 | // item.Name); | ||
139 | |||
140 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
141 | |||
142 | transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item); | ||
143 | } | ||
144 | |||
145 | /// <summary> | ||
146 | /// Update a task inventory item with data that has been received through a transaction. | ||
147 | /// | ||
148 | /// This is currently called when, for instance, a notecard in a prim is saved. The data is sent | ||
149 | /// up through a single AssetUploadRequest. A subsequent UpdateTaskInventory then references the transaction | ||
150 | /// and comes through this method. | ||
151 | /// </summary> | ||
152 | /// <param name="remoteClient"></param> | ||
153 | /// <param name="transactionID"></param> | ||
154 | /// <param name="item"></param> | ||
155 | public void HandleTaskItemUpdateFromTransaction( | ||
156 | IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item) | ||
157 | { | ||
158 | // m_log.DebugFormat( | ||
159 | // "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}", | ||
160 | // item.Name); | ||
161 | |||
162 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
163 | |||
164 | transactions.RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item); | ||
165 | } | ||
166 | |||
167 | /// <summary> | ||
168 | /// Request that a client (agent) begin an asset transfer. | ||
169 | /// </summary> | ||
170 | /// <param name="remoteClient"></param> | ||
171 | /// <param name="assetID"></param> | ||
172 | /// <param name="transaction"></param> | ||
173 | /// <param name="type"></param> | ||
174 | /// <param name="data"></param></param> | ||
175 | /// <param name="tempFile"></param> | ||
176 | public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, | ||
177 | byte[] data, bool storeLocal, bool tempFile) | ||
178 | { | ||
179 | //m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); | ||
180 | if (((AssetType)type == AssetType.Texture || | ||
181 | (AssetType)type == AssetType.Sound || | ||
182 | (AssetType)type == AssetType.TextureTGA || | ||
183 | (AssetType)type == AssetType.Animation) && | ||
184 | tempFile == false) | ||
185 | { | ||
186 | Scene scene = (Scene)remoteClient.Scene; | ||
187 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | ||
188 | |||
189 | if (mm != null) | ||
190 | { | ||
191 | if (!mm.UploadCovered(remoteClient)) | ||
192 | { | ||
193 | remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | ||
194 | return; | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | |||
199 | //m_log.Debug("asset upload of " + assetID); | ||
200 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
201 | |||
202 | AssetXferUploader uploader = transactions.RequestXferUploader(transaction); | ||
203 | if (uploader != null) | ||
204 | { | ||
205 | uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | /// <summary> | ||
210 | /// Handle asset transfer data packets received in response to the asset upload request in | ||
211 | /// HandleUDPUploadRequest() | ||
212 | /// </summary> | ||
213 | /// <param name="remoteClient"></param> | ||
214 | /// <param name="xferID"></param> | ||
215 | /// <param name="packetID"></param> | ||
216 | /// <param name="data"></param> | ||
217 | public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) | ||
218 | { | ||
219 | //m_log.Debug("xferID: " + xferID + " packetID: " + packetID + " data!"); | ||
220 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
221 | |||
222 | transactions.HandleXfer(xferID, packetID, data); | ||
223 | } | ||
224 | } | ||
225 | */ | ||
226 | } | ||
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index 1077f4a..7e08ecf 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | ||
31 | using log4net; | ||
30 | using Nini.Config; | 32 | using Nini.Config; |
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -37,6 +39,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
37 | { | 39 | { |
38 | public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions | 40 | public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions |
39 | { | 41 | { |
42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
40 | private readonly Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>(); | 44 | private readonly Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>(); |
41 | private bool m_dumpAssetsToFile = false; | 45 | private bool m_dumpAssetsToFile = false; |
42 | private Scene m_scene = null; | 46 | private Scene m_scene = null; |
@@ -226,7 +230,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
226 | public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, | 230 | public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, |
227 | byte[] data, bool storeLocal, bool tempFile) | 231 | byte[] data, bool storeLocal, bool tempFile) |
228 | { | 232 | { |
229 | //m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); | 233 | // m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); |
234 | |||
230 | if (((AssetType)type == AssetType.Texture || | 235 | if (((AssetType)type == AssetType.Texture || |
231 | (AssetType)type == AssetType.Sound || | 236 | (AssetType)type == AssetType.Sound || |
232 | (AssetType)type == AssetType.TextureTGA || | 237 | (AssetType)type == AssetType.TextureTGA || |
@@ -246,7 +251,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
246 | } | 251 | } |
247 | } | 252 | } |
248 | 253 | ||
249 | //m_log.Debug("asset upload of " + assetID); | ||
250 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | 254 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); |
251 | 255 | ||
252 | AssetXferUploader uploader = transactions.RequestXferUploader(transaction); | 256 | AssetXferUploader uploader = transactions.RequestXferUploader(transaction); |
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index fbd0ed1..ebe93d5 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs | |||
@@ -154,7 +154,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
154 | m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); | 154 | m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); |
155 | } | 155 | } |
156 | 156 | ||
157 | m_log.DebugFormat("[ASSET TRANSACTIONS]: Uploaded asset data for transaction {0}", TransactionID); | 157 | m_log.DebugFormat( |
158 | "[ASSET TRANSACTIONS]: Uploaded asset {0} for transaction {1}", m_asset.FullID, TransactionID); | ||
158 | 159 | ||
159 | if (m_dumpAssetToFile) | 160 | if (m_dumpAssetToFile) |
160 | { | 161 | { |
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index 1add0ab..1903eb9 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs | |||
@@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
91 | /// </example> | 91 | /// </example> |
92 | public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule | 92 | public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule |
93 | { | 93 | { |
94 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
95 | |||
94 | /// <summary> | 96 | /// <summary> |
95 | /// Cache's default maximal asset count. | 97 | /// Cache's default maximal asset count. |
96 | /// </summary> | 98 | /// </summary> |
@@ -115,12 +117,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
115 | /// Asset's default expiration time in the cache. | 117 | /// Asset's default expiration time in the cache. |
116 | /// </summary> | 118 | /// </summary> |
117 | public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0); | 119 | public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0); |
118 | 120 | ||
119 | /// <summary> | ||
120 | /// Log manager instance. | ||
121 | /// </summary> | ||
122 | private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
123 | |||
124 | /// <summary> | 121 | /// <summary> |
125 | /// Cache object. | 122 | /// Cache object. |
126 | /// </summary> | 123 | /// </summary> |
@@ -170,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
170 | { | 167 | { |
171 | if (maximalSize <= 0 || maximalCount <= 0) | 168 | if (maximalSize <= 0 || maximalCount <= 0) |
172 | { | 169 | { |
173 | //Log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled."); | 170 | //m_log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled."); |
174 | m_enabled = false; | 171 | m_enabled = false; |
175 | return; | 172 | return; |
176 | } | 173 | } |
@@ -186,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
186 | CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>( | 183 | CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>( |
187 | maximalSize, maximalCount, expirationTime)); | 184 | maximalSize, maximalCount, expirationTime)); |
188 | m_enabled = true; | 185 | m_enabled = true; |
189 | Log.DebugFormat( | 186 | m_log.DebugFormat( |
190 | "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", | 187 | "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", |
191 | maximalSize, | 188 | maximalSize, |
192 | maximalCount, | 189 | maximalCount, |
@@ -205,6 +202,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
205 | { | 202 | { |
206 | if (asset != null) | 203 | if (asset != null) |
207 | { | 204 | { |
205 | // m_log.DebugFormat("[CENOME ASSET CACHE]: Caching asset {0}", asset.ID); | ||
206 | |||
208 | long size = asset.Data != null ? asset.Data.Length : 1; | 207 | long size = asset.Data != null ? asset.Data.Length : 1; |
209 | m_cache.Set(asset.ID, asset, size); | 208 | m_cache.Set(asset.ID, asset, size); |
210 | m_cachedCount++; | 209 | m_cachedCount++; |
@@ -255,7 +254,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
255 | 254 | ||
256 | if (m_getCount == m_debugEpoch) | 255 | if (m_getCount == m_debugEpoch) |
257 | { | 256 | { |
258 | Log.DebugFormat( | 257 | m_log.DebugFormat( |
259 | "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", | 258 | "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", |
260 | m_cachedCount, | 259 | m_cachedCount, |
261 | m_getCount, | 260 | m_getCount, |
@@ -267,6 +266,9 @@ namespace OpenSim.Region.CoreModules.Asset | |||
267 | m_cachedCount = 0; | 266 | m_cachedCount = 0; |
268 | } | 267 | } |
269 | 268 | ||
269 | // if (null == assetBase) | ||
270 | // m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id); | ||
271 | |||
270 | return assetBase; | 272 | return assetBase; |
271 | } | 273 | } |
272 | 274 | ||
@@ -325,12 +327,11 @@ namespace OpenSim.Region.CoreModules.Asset | |||
325 | return; | 327 | return; |
326 | 328 | ||
327 | string name = moduleConfig.GetString("AssetCaching"); | 329 | string name = moduleConfig.GetString("AssetCaching"); |
328 | //Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); | 330 | //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); |
329 | 331 | ||
330 | if (name != Name) | 332 | if (name != Name) |
331 | return; | 333 | return; |
332 | 334 | ||
333 | // This module is used | ||
334 | long maxSize = DefaultMaxSize; | 335 | long maxSize = DefaultMaxSize; |
335 | int maxCount = DefaultMaxCount; | 336 | int maxCount = DefaultMaxCount; |
336 | TimeSpan expirationTime = DefaultExpirationTime; | 337 | TimeSpan expirationTime = DefaultExpirationTime; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index db94d2a..0bd68dd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | |||
@@ -148,13 +148,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
148 | private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) | 148 | private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) |
149 | { | 149 | { |
150 | ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 150 | ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); |
151 | if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) | 151 | try |
152 | { | 152 | { |
153 | avatar.Invulnerable = false; | 153 | if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) |
154 | { | ||
155 | avatar.Invulnerable = false; | ||
156 | } | ||
157 | else | ||
158 | { | ||
159 | avatar.Invulnerable = true; | ||
160 | } | ||
154 | } | 161 | } |
155 | else | 162 | catch (Exception ex) |
156 | { | 163 | { |
157 | avatar.Invulnerable = true; | ||
158 | } | 164 | } |
159 | } | 165 | } |
160 | } | 166 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs index 9fe669a..4004135 100644 --- a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs +++ b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander | |||
147 | m_args[i].ArgumentValue = Int32.Parse(arg.ToString()); | 147 | m_args[i].ArgumentValue = Int32.Parse(arg.ToString()); |
148 | break; | 148 | break; |
149 | case "Double": | 149 | case "Double": |
150 | m_args[i].ArgumentValue = Double.Parse(arg.ToString()); | 150 | m_args[i].ArgumentValue = Double.Parse(arg.ToString(), OpenSim.Framework.Culture.NumberFormatInfo); |
151 | break; | 151 | break; |
152 | case "Boolean": | 152 | case "Boolean": |
153 | m_args[i].ArgumentValue = Boolean.Parse(arg.ToString()); | 153 | m_args[i].ArgumentValue = Boolean.Parse(arg.ToString()); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index fd3aaf4..2f21e6d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -38,12 +38,9 @@ using OpenSim.Services.Interfaces; | |||
38 | 38 | ||
39 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | 39 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset |
40 | { | 40 | { |
41 | public class LocalAssetServicesConnector : | 41 | public class LocalAssetServicesConnector : ISharedRegionModule, IAssetService |
42 | ISharedRegionModule, IAssetService | ||
43 | { | 42 | { |
44 | private static readonly ILog m_log = | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | 44 | ||
48 | private IImprovedAssetCache m_Cache = null; | 45 | private IImprovedAssetCache m_Cache = null; |
49 | 46 | ||
@@ -72,7 +69,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
72 | IConfig assetConfig = source.Configs["AssetService"]; | 69 | IConfig assetConfig = source.Configs["AssetService"]; |
73 | if (assetConfig == null) | 70 | if (assetConfig == null) |
74 | { | 71 | { |
75 | m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); | 72 | m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: AssetService missing from OpenSim.ini"); |
76 | return; | 73 | return; |
77 | } | 74 | } |
78 | 75 | ||
@@ -81,22 +78,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
81 | 78 | ||
82 | if (serviceDll == String.Empty) | 79 | if (serviceDll == String.Empty) |
83 | { | 80 | { |
84 | m_log.Error("[ASSET CONNECTOR]: No LocalServiceModule named in section AssetService"); | 81 | m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: No LocalServiceModule named in section AssetService"); |
85 | return; | 82 | return; |
86 | } | 83 | } |
87 | 84 | ||
88 | Object[] args = new Object[] { source }; | 85 | Object[] args = new Object[] { source }; |
89 | m_AssetService = | 86 | m_AssetService = ServerUtils.LoadPlugin<IAssetService>(serviceDll, args); |
90 | ServerUtils.LoadPlugin<IAssetService>(serviceDll, | ||
91 | args); | ||
92 | 87 | ||
93 | if (m_AssetService == null) | 88 | if (m_AssetService == null) |
94 | { | 89 | { |
95 | m_log.Error("[ASSET CONNECTOR]: Can't load asset service"); | 90 | m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: Can't load asset service"); |
96 | return; | 91 | return; |
97 | } | 92 | } |
98 | m_Enabled = true; | 93 | m_Enabled = true; |
99 | m_log.Info("[ASSET CONNECTOR]: Local asset connector enabled"); | 94 | m_log.Info("[LOCAL ASSET SERVICES CONNECTOR]: Local asset connector enabled"); |
100 | } | 95 | } |
101 | } | 96 | } |
102 | } | 97 | } |
@@ -134,11 +129,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
134 | m_Cache = null; | 129 | m_Cache = null; |
135 | } | 130 | } |
136 | 131 | ||
137 | m_log.InfoFormat("[ASSET CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName); | 132 | m_log.InfoFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName); |
138 | 133 | ||
139 | if (m_Cache != null) | 134 | if (m_Cache != null) |
140 | { | 135 | { |
141 | m_log.InfoFormat("[ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); | 136 | m_log.InfoFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); |
142 | } | 137 | } |
143 | else | 138 | else |
144 | { | 139 | { |
@@ -151,6 +146,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
151 | 146 | ||
152 | public AssetBase Get(string id) | 147 | public AssetBase Get(string id) |
153 | { | 148 | { |
149 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Synchronously requesting asset {0}", id); | ||
150 | |||
154 | AssetBase asset = null; | 151 | AssetBase asset = null; |
155 | if (m_Cache != null) | 152 | if (m_Cache != null) |
156 | asset = m_Cache.Get(id); | 153 | asset = m_Cache.Get(id); |
@@ -160,7 +157,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
160 | asset = m_AssetService.Get(id); | 157 | asset = m_AssetService.Get(id); |
161 | if ((m_Cache != null) && (asset != null)) | 158 | if ((m_Cache != null) && (asset != null)) |
162 | m_Cache.Cache(asset); | 159 | m_Cache.Cache(asset); |
160 | |||
161 | // if (null == asset) | ||
162 | // m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not synchronously find asset with id {0}", id); | ||
163 | } | 163 | } |
164 | |||
164 | return asset; | 165 | return asset; |
165 | } | 166 | } |
166 | 167 | ||
@@ -204,15 +205,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
204 | 205 | ||
205 | public bool Get(string id, Object sender, AssetRetrieved handler) | 206 | public bool Get(string id, Object sender, AssetRetrieved handler) |
206 | { | 207 | { |
207 | AssetBase asset = null; | 208 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Asynchronously requesting asset {0}", id); |
208 | 209 | ||
209 | if (m_Cache != null) | 210 | if (m_Cache != null) |
210 | m_Cache.Get(id); | ||
211 | |||
212 | if (asset != null) | ||
213 | { | 211 | { |
214 | Util.FireAndForget(delegate { handler(id, sender, asset); }); | 212 | AssetBase asset = m_Cache.Get(id); |
215 | return true; | 213 | |
214 | if (asset != null) | ||
215 | { | ||
216 | Util.FireAndForget(delegate { handler(id, sender, asset); }); | ||
217 | return true; | ||
218 | } | ||
216 | } | 219 | } |
217 | 220 | ||
218 | return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) | 221 | return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) |
@@ -220,6 +223,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
220 | if ((a != null) && (m_Cache != null)) | 223 | if ((a != null) && (m_Cache != null)) |
221 | m_Cache.Cache(a); | 224 | m_Cache.Cache(a); |
222 | 225 | ||
226 | // if (null == a) | ||
227 | // m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id); | ||
228 | |||
223 | Util.FireAndForget(delegate { handler(assetID, s, a); }); | 229 | Util.FireAndForget(delegate { handler(assetID, s, a); }); |
224 | }); | 230 | }); |
225 | } | 231 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 9d6da4f..54e62e2 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
73 | IConfig inventoryConfig = source.Configs["InventoryService"]; | 73 | IConfig inventoryConfig = source.Configs["InventoryService"]; |
74 | if (inventoryConfig == null) | 74 | if (inventoryConfig == null) |
75 | { | 75 | { |
76 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | 76 | m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: InventoryService missing from OpenSim.ini"); |
77 | return; | 77 | return; |
78 | } | 78 | } |
79 | 79 | ||
@@ -81,18 +81,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
81 | 81 | ||
82 | if (serviceDll == String.Empty) | 82 | if (serviceDll == String.Empty) |
83 | { | 83 | { |
84 | m_log.Error("[INVENTORY CONNECTOR]: No LocalServiceModule named in section InventoryService"); | 84 | m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: No LocalServiceModule named in section InventoryService"); |
85 | return; | 85 | return; |
86 | } | 86 | } |
87 | 87 | ||
88 | Object[] args = new Object[] { source }; | 88 | Object[] args = new Object[] { source }; |
89 | m_log.DebugFormat("[INVENTORY CONNECTOR]: Service dll = {0}", serviceDll); | 89 | m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Service dll = {0}", serviceDll); |
90 | 90 | ||
91 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(serviceDll, args); | 91 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(serviceDll, args); |
92 | 92 | ||
93 | if (m_InventoryService == null) | 93 | if (m_InventoryService == null) |
94 | { | 94 | { |
95 | m_log.Error("[INVENTORY CONNECTOR]: Can't load inventory service"); | 95 | m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: Can't load inventory service"); |
96 | //return; | 96 | //return; |
97 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | 97 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); |
98 | } | 98 | } |
@@ -111,7 +111,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
111 | Init(source); | 111 | Init(source); |
112 | 112 | ||
113 | m_Enabled = true; | 113 | m_Enabled = true; |
114 | m_log.Info("[INVENTORY CONNECTOR]: Local inventory connector enabled"); | 114 | m_log.Info("[LOCAL INVENTORY SERVICES CONNECTOR]: Local inventory connector enabled"); |
115 | } | 115 | } |
116 | } | 116 | } |
117 | } | 117 | } |
@@ -135,7 +135,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
135 | } | 135 | } |
136 | 136 | ||
137 | // m_log.DebugFormat( | 137 | // m_log.DebugFormat( |
138 | // "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); | 138 | // "[LOCAL INVENTORY SERVICES CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); |
139 | 139 | ||
140 | scene.RegisterModuleInterface<IInventoryService>(this); | 140 | scene.RegisterModuleInterface<IInventoryService>(this); |
141 | m_cache.AddRegion(scene); | 141 | m_cache.AddRegion(scene); |
@@ -155,7 +155,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
155 | return; | 155 | return; |
156 | 156 | ||
157 | m_log.InfoFormat( | 157 | m_log.InfoFormat( |
158 | "[INVENTORY CONNECTOR]: Enabled local invnetory for region {0}", scene.RegionInfo.RegionName); | 158 | "[LOCAL INVENTORY SERVICES CONNECTOR]: Enabled local inventory for region {0}", scene.RegionInfo.RegionName); |
159 | } | 159 | } |
160 | 160 | ||
161 | #region IInventoryService | 161 | #region IInventoryService |
@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
210 | return folders; | 210 | return folders; |
211 | } | 211 | } |
212 | } | 212 | } |
213 | m_log.WarnFormat("[INVENTORY CONNECTOR]: System folders for {0} not found", userID); | 213 | m_log.WarnFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: System folders for {0} not found", userID); |
214 | return new Dictionary<AssetType, InventoryFolderBase>(); | 214 | return new Dictionary<AssetType, InventoryFolderBase>(); |
215 | } | 215 | } |
216 | 216 | ||
@@ -309,7 +309,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
309 | 309 | ||
310 | public override InventoryItemBase GetItem(InventoryItemBase item) | 310 | public override InventoryItemBase GetItem(InventoryItemBase item) |
311 | { | 311 | { |
312 | return m_InventoryService.GetItem(item); | 312 | // m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); |
313 | |||
314 | item = m_InventoryService.GetItem(item); | ||
315 | |||
316 | if (null == item) | ||
317 | m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}"); | ||
318 | |||
319 | return item; | ||
313 | } | 320 | } |
314 | 321 | ||
315 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) | 322 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 189efdc..e3bab2d 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -955,8 +955,8 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
955 | if (y == -1 || m_scene.RegionInfo.RegionLocY == y) | 955 | if (y == -1 || m_scene.RegionInfo.RegionLocY == y) |
956 | { | 956 | { |
957 | int corner = int.Parse(num); | 957 | int corner = int.Parse(num); |
958 | float lowValue = float.Parse(min); | 958 | float lowValue = float.Parse(min, Culture.NumberFormatInfo); |
959 | float highValue = float.Parse(max); | 959 | float highValue = float.Parse(max, Culture.NumberFormatInfo); |
960 | 960 | ||
961 | m_log.Debug("[ESTATEMODULE] Setting terrain heights " + m_scene.RegionInfo.RegionName + | 961 | m_log.Debug("[ESTATEMODULE] Setting terrain heights " + m_scene.RegionInfo.RegionName + |
962 | string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue)); | 962 | string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue)); |
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 37f1f2e..1f5a4ff 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
60 | } | 60 | } |
61 | 61 | ||
62 | public virtual void PlayAttachedSound( | 62 | public virtual void PlayAttachedSound( |
63 | UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags) | 63 | UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) |
64 | { | 64 | { |
65 | foreach (ScenePresence p in m_scene.GetAvatars()) | 65 | foreach (ScenePresence p in m_scene.GetAvatars()) |
66 | { | 66 | { |
@@ -69,14 +69,17 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
69 | continue; | 69 | continue; |
70 | 70 | ||
71 | // Scale by distance | 71 | // Scale by distance |
72 | gain = (float)((double)gain*((100.0 - dis) / 100.0)); | 72 | if (radius == 0) |
73 | gain = (float)((double)gain * ((100.0 - dis) / 100.0)); | ||
74 | else | ||
75 | gain = (float)((double)gain * ((radius - dis) / radius)); | ||
73 | 76 | ||
74 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); | 77 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); |
75 | } | 78 | } |
76 | } | 79 | } |
77 | 80 | ||
78 | public virtual void TriggerSound( | 81 | public virtual void TriggerSound( |
79 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle) | 82 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) |
80 | { | 83 | { |
81 | foreach (ScenePresence p in m_scene.GetAvatars()) | 84 | foreach (ScenePresence p in m_scene.GetAvatars()) |
82 | { | 85 | { |
@@ -85,7 +88,10 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
85 | continue; | 88 | continue; |
86 | 89 | ||
87 | // Scale by distance | 90 | // Scale by distance |
88 | gain = (float)((double)gain*((100.0 - dis) / 100.0)); | 91 | if (radius == 0) |
92 | gain = (float)((double)gain * ((100.0 - dis) / 100.0)); | ||
93 | else | ||
94 | gain = (float)((double)gain * ((radius - dis) / radius)); | ||
89 | 95 | ||
90 | p.ControllingClient.SendTriggeredSound( | 96 | p.ControllingClient.SendTriggeredSound( |
91 | soundId, ownerID, objectID, parentID, handle, position, (float)gain); | 97 | soundId, ownerID, objectID, parentID, handle, position, (float)gain); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index a40828b..1e7ea7b 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -84,6 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
84 | private ITerrainChannel m_revert; | 84 | private ITerrainChannel m_revert; |
85 | private Scene m_scene; | 85 | private Scene m_scene; |
86 | private volatile bool m_tainted; | 86 | private volatile bool m_tainted; |
87 | private readonly UndoStack<LandUndoState> m_undo = new UndoStack<LandUndoState>(5); | ||
87 | 88 | ||
88 | #region ICommandableModule Members | 89 | #region ICommandableModule Members |
89 | 90 | ||
@@ -174,6 +175,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
174 | 175 | ||
175 | #region ITerrainModule Members | 176 | #region ITerrainModule Members |
176 | 177 | ||
178 | public void UndoTerrain(ITerrainChannel channel) | ||
179 | { | ||
180 | m_channel = channel; | ||
181 | } | ||
182 | |||
177 | /// <summary> | 183 | /// <summary> |
178 | /// Loads a terrain file from disk and installs it in the scene. | 184 | /// Loads a terrain file from disk and installs it in the scene. |
179 | /// </summary> | 185 | /// </summary> |
@@ -574,6 +580,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
574 | { | 580 | { |
575 | client.OnModifyTerrain += client_OnModifyTerrain; | 581 | client.OnModifyTerrain += client_OnModifyTerrain; |
576 | client.OnBakeTerrain += client_OnBakeTerrain; | 582 | client.OnBakeTerrain += client_OnBakeTerrain; |
583 | client.OnLandUndo += client_OnLandUndo; | ||
577 | } | 584 | } |
578 | 585 | ||
579 | /// <summary> | 586 | /// <summary> |
@@ -664,6 +671,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
664 | return changesLimited; | 671 | return changesLimited; |
665 | } | 672 | } |
666 | 673 | ||
674 | private void client_OnLandUndo(IClientAPI client) | ||
675 | { | ||
676 | lock (m_undo) | ||
677 | { | ||
678 | if (m_undo.Count > 0) | ||
679 | { | ||
680 | LandUndoState goback = m_undo.Pop(); | ||
681 | if (goback != null) | ||
682 | goback.PlaybackState(); | ||
683 | } | ||
684 | } | ||
685 | } | ||
686 | |||
667 | /// <summary> | 687 | /// <summary> |
668 | /// Sends a copy of the current terrain to the scenes clients | 688 | /// Sends a copy of the current terrain to the scenes clients |
669 | /// </summary> | 689 | /// </summary> |
@@ -718,6 +738,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
718 | } | 738 | } |
719 | if (allowed) | 739 | if (allowed) |
720 | { | 740 | { |
741 | StoreUndoState(); | ||
721 | m_painteffects[(StandardTerrainEffects) action].PaintEffect( | 742 | m_painteffects[(StandardTerrainEffects) action].PaintEffect( |
722 | m_channel, allowMask, west, south, height, size, seconds); | 743 | m_channel, allowMask, west, south, height, size, seconds); |
723 | 744 | ||
@@ -758,6 +779,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
758 | 779 | ||
759 | if (allowed) | 780 | if (allowed) |
760 | { | 781 | { |
782 | StoreUndoState(); | ||
761 | m_floodeffects[(StandardTerrainEffects) action].FloodEffect( | 783 | m_floodeffects[(StandardTerrainEffects) action].FloodEffect( |
762 | m_channel, fillArea, size); | 784 | m_channel, fillArea, size); |
763 | 785 | ||
@@ -782,6 +804,25 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
782 | } | 804 | } |
783 | } | 805 | } |
784 | 806 | ||
807 | private void StoreUndoState() | ||
808 | { | ||
809 | lock (m_undo) | ||
810 | { | ||
811 | if (m_undo.Count > 0) | ||
812 | { | ||
813 | LandUndoState last = m_undo.Peek(); | ||
814 | if (last != null) | ||
815 | { | ||
816 | if (last.Compare(m_channel)) | ||
817 | return; | ||
818 | } | ||
819 | } | ||
820 | |||
821 | LandUndoState nUndo = new LandUndoState(this, m_channel); | ||
822 | m_undo.Push(nUndo); | ||
823 | } | ||
824 | } | ||
825 | |||
785 | #region Console Commands | 826 | #region Console Commands |
786 | 827 | ||
787 | private void InterfaceLoadFile(Object[] args) | 828 | private void InterfaceLoadFile(Object[] args) |