aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
diff options
context:
space:
mode:
authorUbitUmarov2015-09-01 14:54:35 +0100
committerUbitUmarov2015-09-01 14:54:35 +0100
commit371c9dd2af01a2e7422ec901ee1f80757284a78c (patch)
tree058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
parentremove lixo (diff)
parentdont change camera on crossings (diff)
downloadopensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz
bad merge?
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs480
1 files changed, 469 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 932652c..925de2a 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -75,6 +75,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
75 #endregion 75 #endregion
76 76
77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
78<<<<<<< HEAD
79=======
80
81#pragma warning disable 414
82 private static readonly string LogHeader = "[TERRAIN MODULE]";
83#pragma warning restore 414
84
85 private readonly Commander m_commander = new Commander("terrain");
86>>>>>>> avn/ubitvar
78 87
79#pragma warning disable 414 88#pragma warning disable 414
80 private static readonly string LogHeader = "[TERRAIN MODULE]"; 89 private static readonly string LogHeader = "[TERRAIN MODULE]";
@@ -86,6 +95,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
86 private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>(); 95 private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>();
87 private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = 96 private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects =
88 new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); 97 new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>();
98<<<<<<< HEAD
89 private Dictionary<string, ITerrainEffect> m_plugineffects; 99 private Dictionary<string, ITerrainEffect> m_plugineffects;
90 private Dictionary<string, ITerrainModifier> m_modifyOperations = 100 private Dictionary<string, ITerrainModifier> m_modifyOperations =
91 new Dictionary<string, ITerrainModifier>(); 101 new Dictionary<string, ITerrainModifier>();
@@ -94,6 +104,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
94 private Scene m_scene; 104 private Scene m_scene;
95 private volatile bool m_tainted; 105 private volatile bool m_tainted;
96 private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); 106 private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
107=======
108
109 private Dictionary<string, ITerrainEffect> m_plugineffects;
110 private ITerrainChannel m_channel;
111 private ITerrainChannel m_baked;
112 private Scene m_scene;
113 private volatile bool m_tainted;
114
115>>>>>>> avn/ubitvar
97 private String m_InitialTerrain = "pinhead-island"; 116 private String m_InitialTerrain = "pinhead-island";
98 117
99 // If true, send terrain patch updates to clients based on their view distance 118 // If true, send terrain patch updates to clients based on their view distance
@@ -107,13 +126,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
107 private bool[,] updated; // for each patch, whether it needs to be sent to this client 126 private bool[,] updated; // for each patch, whether it needs to be sent to this client
108 private int updateCount; // number of patches that need to be sent 127 private int updateCount; // number of patches that need to be sent
109 public ScenePresence Presence; // a reference to the client to send to 128 public ScenePresence Presence; // a reference to the client to send to
129<<<<<<< HEAD
110 public TerrainData Terrain; // reference to the underlying terrain 130 public TerrainData Terrain; // reference to the underlying terrain
131=======
132>>>>>>> avn/ubitvar
111 public PatchUpdates(TerrainData terrData, ScenePresence pPresence) 133 public PatchUpdates(TerrainData terrData, ScenePresence pPresence)
112 { 134 {
113 updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize]; 135 updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize];
114 updateCount = 0; 136 updateCount = 0;
115 Presence = pPresence; 137 Presence = pPresence;
138<<<<<<< HEAD
116 Terrain = terrData; 139 Terrain = terrData;
140=======
141>>>>>>> avn/ubitvar
117 // Initially, send all patches to the client 142 // Initially, send all patches to the client
118 SetAll(true); 143 SetAll(true);
119 } 144 }
@@ -122,17 +147,26 @@ namespace OpenSim.Region.CoreModules.World.Terrain
122 { 147 {
123 return (updateCount > 0); 148 return (updateCount > 0);
124 } 149 }
150<<<<<<< HEAD
125 151
152=======
153>>>>>>> avn/ubitvar
126 public void SetByXY(int x, int y, bool state) 154 public void SetByXY(int x, int y, bool state)
127 { 155 {
128 this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state); 156 this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state);
129 } 157 }
158<<<<<<< HEAD
130 159
160=======
161>>>>>>> avn/ubitvar
131 public bool GetByPatch(int patchX, int patchY) 162 public bool GetByPatch(int patchX, int patchY)
132 { 163 {
133 return updated[patchX, patchY]; 164 return updated[patchX, patchY];
134 } 165 }
166<<<<<<< HEAD
135 167
168=======
169>>>>>>> avn/ubitvar
136 public void SetByPatch(int patchX, int patchY, bool state) 170 public void SetByPatch(int patchX, int patchY, bool state)
137 { 171 {
138 bool prevState = updated[patchX, patchY]; 172 bool prevState = updated[patchX, patchY];
@@ -142,12 +176,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain
142 updateCount--; 176 updateCount--;
143 updated[patchX, patchY] = state; 177 updated[patchX, patchY] = state;
144 } 178 }
179<<<<<<< HEAD
145 180
146 public void SetAll(bool state) 181 public void SetAll(bool state)
147 { 182 {
148 updateCount = 0; 183 updateCount = 0;
149 for(int xx = 0; xx < updated.GetLength(0); xx++) 184 for(int xx = 0; xx < updated.GetLength(0); xx++)
150 for(int yy = 0; yy < updated.GetLength(1); yy++) 185 for(int yy = 0; yy < updated.GetLength(1); yy++)
186=======
187 public void SetAll(bool state)
188 {
189 updateCount = 0;
190 for (int xx = 0; xx < updated.GetLength(0); xx++)
191 for (int yy = 0; yy < updated.GetLength(1); yy++)
192>>>>>>> avn/ubitvar
151 updated[xx, yy] = state; 193 updated[xx, yy] = state;
152 if (state) 194 if (state)
153 updateCount = updated.GetLength(0) * updated.GetLength(1); 195 updateCount = updated.GetLength(0) * updated.GetLength(1);
@@ -164,9 +206,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
164 terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize) 206 terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize)
165 ); 207 );
166 } 208 }
209<<<<<<< HEAD
167 for(int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) 210 for(int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize)
168 { 211 {
169 for(int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) 212 for(int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize)
213=======
214 for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize)
215 {
216 for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize)
217>>>>>>> avn/ubitvar
170 { 218 {
171 // Only set tainted. The patch bit may be set if the patch was to be sent later. 219 // Only set tainted. The patch bit may be set if the patch was to be sent later.
172 if (terrData.IsTaintedAt(xx, yy, false)) 220 if (terrData.IsTaintedAt(xx, yy, false))
@@ -227,12 +275,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain
227 (int)m_scene.RegionInfo.RegionSizeY, 275 (int)m_scene.RegionInfo.RegionSizeY,
228 (int)m_scene.RegionInfo.RegionSizeZ); 276 (int)m_scene.RegionInfo.RegionSizeZ);
229 m_scene.Heightmap = m_channel; 277 m_scene.Heightmap = m_channel;
278<<<<<<< HEAD
230 UpdateRevertMap(); 279 UpdateRevertMap();
280=======
281 UpdateBakedMap();
282>>>>>>> avn/ubitvar
231 } 283 }
232 else 284 else
233 { 285 {
234 m_channel = m_scene.Heightmap; 286 m_channel = m_scene.Heightmap;
287<<<<<<< HEAD
235 UpdateRevertMap(); 288 UpdateRevertMap();
289=======
290 UpdateBakedMap();
291>>>>>>> avn/ubitvar
236 } 292 }
237 293
238 m_scene.RegisterModuleInterface<ITerrainModule>(this); 294 m_scene.RegisterModuleInterface<ITerrainModule>(this);
@@ -240,7 +296,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
240 m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; 296 m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed;
241 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; 297 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
242 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; 298 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
299<<<<<<< HEAD
243 m_scene.EventManager.OnFrame += EventManager_OnFrame; 300 m_scene.EventManager.OnFrame += EventManager_OnFrame;
301=======
302 m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates;
303>>>>>>> avn/ubitvar
244 } 304 }
245 305
246 InstallDefaultEffects(); 306 InstallDefaultEffects();
@@ -279,7 +339,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
279 // remove the commands 339 // remove the commands
280 m_scene.UnregisterModuleCommander(m_commander.Name); 340 m_scene.UnregisterModuleCommander(m_commander.Name);
281 // remove the event-handlers 341 // remove the event-handlers
342<<<<<<< HEAD
282 m_scene.EventManager.OnFrame -= EventManager_OnFrame; 343 m_scene.EventManager.OnFrame -= EventManager_OnFrame;
344=======
345 m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates;
346>>>>>>> avn/ubitvar
283 m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; 347 m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick;
284 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; 348 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
285 m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; 349 m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed;
@@ -334,7 +398,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
334 m_log.DebugFormat("[TERRAIN]: Loaded terrain, wd/ht: {0}/{1}", channel.Width, channel.Height); 398 m_log.DebugFormat("[TERRAIN]: Loaded terrain, wd/ht: {0}/{1}", channel.Width, channel.Height);
335 m_scene.Heightmap = channel; 399 m_scene.Heightmap = channel;
336 m_channel = channel; 400 m_channel = channel;
337 UpdateRevertMap(); 401 UpdateBakedMap();
338 } 402 }
339 catch(NotImplementedException) 403 catch(NotImplementedException)
340 { 404 {
@@ -426,7 +490,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
426 { 490 {
427 ITerrainChannel channel = loader.Value.LoadStream(stream); 491 ITerrainChannel channel = loader.Value.LoadStream(stream);
428 m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); 492 m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement);
493<<<<<<< HEAD
429 UpdateRevertMap(); 494 UpdateRevertMap();
495=======
496 UpdateBakedMap();
497>>>>>>> avn/ubitvar
430 } 498 }
431 catch(NotImplementedException) 499 catch(NotImplementedException)
432 { 500 {
@@ -506,16 +574,48 @@ namespace OpenSim.Region.CoreModules.World.Terrain
506 574
507 // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients. 575 // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients.
508 // ITerrainModule.TaintTerrain() 576 // ITerrainModule.TaintTerrain()
577<<<<<<< HEAD
509 public void TaintTerrain() 578 public void TaintTerrain()
510 { 579 {
511 lock(m_perClientPatchUpdates) 580 lock(m_perClientPatchUpdates)
512 { 581 {
513 // Set the flags for all clients so the tainted patches will be sent out 582 // Set the flags for all clients so the tainted patches will be sent out
514 foreach(PatchUpdates pups in m_perClientPatchUpdates.Values) 583 foreach(PatchUpdates pups in m_perClientPatchUpdates.Values)
584=======
585 public void TaintTerrain ()
586 {
587 lock (m_perClientPatchUpdates)
588 {
589 // Set the flags for all clients so the tainted patches will be sent out
590 foreach (PatchUpdates pups in m_perClientPatchUpdates.Values)
591>>>>>>> avn/ubitvar
515 { 592 {
516 pups.SetAll(m_scene.Heightmap.GetTerrainData()); 593 pups.SetAll(m_scene.Heightmap.GetTerrainData());
517 } 594 }
518 } 595 }
596<<<<<<< HEAD
597=======
598 }
599
600 // ITerrainModule.PushTerrain()
601 public void PushTerrain(IClientAPI pClient)
602 {
603 ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId);
604 if (presence != null)
605 {
606 lock (m_perClientPatchUpdates)
607 {
608 PatchUpdates pups;
609 if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups))
610 {
611 // There is a ScenePresence without a send patch map. Create one.
612 pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence);
613 m_perClientPatchUpdates.Add(presence.UUID, pups);
614 }
615 pups.SetAll(true);
616 }
617 }
618>>>>>>> avn/ubitvar
519 } 619 }
520 620
521 // ITerrainModule.PushTerrain() 621 // ITerrainModule.PushTerrain()
@@ -636,7 +736,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
636 m_painteffects[StandardTerrainEffects.Smooth] = new SmoothSphere(); 736 m_painteffects[StandardTerrainEffects.Smooth] = new SmoothSphere();
637 m_painteffects[StandardTerrainEffects.Noise] = new NoiseSphere(); 737 m_painteffects[StandardTerrainEffects.Noise] = new NoiseSphere();
638 m_painteffects[StandardTerrainEffects.Flatten] = new FlattenSphere(); 738 m_painteffects[StandardTerrainEffects.Flatten] = new FlattenSphere();
639 m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_revert); 739 m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked);
640 m_painteffects[StandardTerrainEffects.Erode] = new ErodeSphere(); 740 m_painteffects[StandardTerrainEffects.Erode] = new ErodeSphere();
641 m_painteffects[StandardTerrainEffects.Weather] = new WeatherSphere(); 741 m_painteffects[StandardTerrainEffects.Weather] = new WeatherSphere();
642 m_painteffects[StandardTerrainEffects.Olsen] = new OlsenSphere(); 742 m_painteffects[StandardTerrainEffects.Olsen] = new OlsenSphere();
@@ -647,7 +747,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
647 m_floodeffects[StandardTerrainEffects.Smooth] = new SmoothArea(); 747 m_floodeffects[StandardTerrainEffects.Smooth] = new SmoothArea();
648 m_floodeffects[StandardTerrainEffects.Noise] = new NoiseArea(); 748 m_floodeffects[StandardTerrainEffects.Noise] = new NoiseArea();
649 m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea(); 749 m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea();
650 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_revert); 750 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
651 751
652 // Terrain Modifier operations 752 // Terrain Modifier operations
653 m_modifyOperations["min"] = new MinModifier(this); 753 m_modifyOperations["min"] = new MinModifier(this);
@@ -673,10 +773,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
673 } 773 }
674 774
675 /// <summary> 775 /// <summary>
676 /// Saves the current state of the region into the revert map buffer. 776 /// Saves the current state of the region into the baked map buffer.
777
677 /// </summary> 778 /// </summary>
678 public void UpdateRevertMap() 779 public void UpdateBakedMap()
679 { 780 {
781<<<<<<< HEAD
680 /* 782 /*
681 int x; 783 int x;
682 for (x = 0; x < m_channel.Width; x++) 784 for (x = 0; x < m_channel.Width; x++)
@@ -689,6 +791,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
689 } 791 }
690 */ 792 */
691 m_revert = m_channel.MakeCopy(); 793 m_revert = m_channel.MakeCopy();
794=======
795 m_baked = m_channel.MakeCopy();
796 m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked);
797 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
798>>>>>>> avn/ubitvar
692 } 799 }
693 800
694 /// <summary> 801 /// <summary>
@@ -715,11 +822,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain
715 { 822 {
716 ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, 823 ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY,
717 fileWidth, fileHeight, 824 fileWidth, fileHeight,
825<<<<<<< HEAD
718 (int)m_scene.RegionInfo.RegionSizeX, 826 (int)m_scene.RegionInfo.RegionSizeX,
719 (int)m_scene.RegionInfo.RegionSizeY); 827 (int)m_scene.RegionInfo.RegionSizeY);
828=======
829 (int) m_scene.RegionInfo.RegionSizeX,
830 (int) m_scene.RegionInfo.RegionSizeY);
831>>>>>>> avn/ubitvar
720 m_scene.Heightmap = channel; 832 m_scene.Heightmap = channel;
721 m_channel = channel; 833 m_channel = channel;
722 UpdateRevertMap(); 834 UpdateBakedMap();
723 } 835 }
724 836
725 return; 837 return;
@@ -782,12 +894,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain
782 } 894 }
783 895
784 /// <summary> 896 /// <summary>
897<<<<<<< HEAD
785 /// Called before processing of every simulation frame. 898 /// Called before processing of every simulation frame.
899=======
900>>>>>>> avn/ubitvar
786 /// This is used to check to see of any of the terrain is tainted and, if so, schedule 901 /// This is used to check to see of any of the terrain is tainted and, if so, schedule
787 /// updates for all the presences. 902 /// updates for all the presences.
788 /// This also checks to see if there are updates that need to be sent for each presence. 903 /// This also checks to see if there are updates that need to be sent for each presence.
789 /// This is where the logic is to send terrain updates to clients. 904 /// This is where the logic is to send terrain updates to clients.
790 /// </summary> 905 /// </summary>
906<<<<<<< HEAD
791 private void EventManager_OnFrame() 907 private void EventManager_OnFrame()
792 { 908 {
793 TerrainData terrData = m_channel.GetTerrainData(); 909 TerrainData terrData = m_channel.GetTerrainData();
@@ -798,6 +914,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
798 for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) 914 for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
799 { 915 {
800 if (terrData.IsTaintedAt(x, y)) 916 if (terrData.IsTaintedAt(x, y))
917=======
918 private void EventManager_TerrainCheckUpdates()
919 {
920 // this needs fixing
921 TerrainData terrData = m_channel.GetTerrainData();
922
923 bool shouldTaint = false;
924 for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
925 {
926 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
927 {
928 if (terrData.IsTaintedAt(x, y,true))
929>>>>>>> avn/ubitvar
801 { 930 {
802 // Found a patch that was modified. Push this flag into the clients. 931 // Found a patch that was modified. Push this flag into the clients.
803 SendToClients(terrData, x, y); 932 SendToClients(terrData, x, y);
@@ -815,6 +944,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
815 m_scene.EventManager.TriggerTerrainTainted(); 944 m_scene.EventManager.TriggerTerrainTainted();
816 m_tainted = true; 945 m_tainted = true;
817 } 946 }
947<<<<<<< HEAD
948=======
949
950>>>>>>> avn/ubitvar
818 } 951 }
819 952
820 /// <summary> 953 /// <summary>
@@ -883,11 +1016,18 @@ namespace OpenSim.Region.CoreModules.World.Terrain
883 presence.ControllingClient.OnLandUndo -= client_OnLandUndo; 1016 presence.ControllingClient.OnLandUndo -= client_OnLandUndo;
884 presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain; 1017 presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain;
885 } 1018 }
1019<<<<<<< HEAD
886 1020
887 lock(m_perClientPatchUpdates) 1021 lock(m_perClientPatchUpdates)
888 m_perClientPatchUpdates.Remove(client); 1022 m_perClientPatchUpdates.Remove(client);
889 } 1023 }
1024=======
1025>>>>>>> avn/ubitvar
890 1026
1027 lock (m_perClientPatchUpdates)
1028 m_perClientPatchUpdates.Remove(client);
1029 }
1030
891 /// <summary> 1031 /// <summary>
892 /// Scan over changes in the terrain and limit height changes. This enforces the 1032 /// Scan over changes in the terrain and limit height changes. This enforces the
893 /// non-estate owner limits on rate of terrain editting. 1033 /// non-estate owner limits on rate of terrain editting.
@@ -898,12 +1038,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain
898 TerrainData terrData = m_channel.GetTerrainData(); 1038 TerrainData terrData = m_channel.GetTerrainData();
899 1039
900 bool wasLimited = false; 1040 bool wasLimited = false;
1041<<<<<<< HEAD
901 for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) 1042 for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
902 { 1043 {
903 for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) 1044 for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
904 { 1045 {
905 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) 1046 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */))
906 { 1047 {
1048=======
1049 for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
1050 {
1051 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
1052 {
1053 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */))
1054 {
1055>>>>>>> avn/ubitvar
907 // If we should respect the estate settings then 1056 // If we should respect the estate settings then
908 // fixup and height deltas that don't respect them. 1057 // fixup and height deltas that don't respect them.
909 // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. 1058 // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values.
@@ -926,13 +1075,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain
926 float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; 1075 float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit;
927 1076
928 // loop through the height map for this patch and compare it against 1077 // loop through the height map for this patch and compare it against
1078<<<<<<< HEAD
929 // the revert map 1079 // the revert map
930 for(int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) 1080 for(int x = xStart; x < xStart + Constants.TerrainPatchSize; x++)
1081=======
1082 // the baked map
1083 for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++)
1084>>>>>>> avn/ubitvar
931 { 1085 {
932 for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++) 1086 for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++)
933 { 1087 {
934 float requestedHeight = terrData[x, y]; 1088 float requestedHeight = terrData[x, y];
1089<<<<<<< HEAD
935 float bakedHeight = (float)m_revert[x, y]; 1090 float bakedHeight = (float)m_revert[x, y];
1091=======
1092 float bakedHeight = (float)m_baked[x, y];
1093>>>>>>> avn/ubitvar
936 float requestedDelta = requestedHeight - bakedHeight; 1094 float requestedDelta = requestedHeight - bakedHeight;
937 1095
938 if (requestedDelta > maxDelta) 1096 if (requestedDelta > maxDelta)
@@ -953,6 +1111,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
953 1111
954 private void client_OnLandUndo(IClientAPI client) 1112 private void client_OnLandUndo(IClientAPI client)
955 { 1113 {
1114<<<<<<< HEAD
956 lock(m_undo) 1115 lock(m_undo)
957 { 1116 {
958 if (m_undo.Count > 0) 1117 if (m_undo.Count > 0)
@@ -962,6 +1121,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
962 goback.PlaybackState(); 1121 goback.PlaybackState();
963 } 1122 }
964 } 1123 }
1124=======
1125
1126>>>>>>> avn/ubitvar
965 } 1127 }
966 1128
967 /// <summary> 1129 /// <summary>
@@ -971,6 +1133,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
971 /// <param name="x">The patch corner to send</param> 1133 /// <param name="x">The patch corner to send</param>
972 /// <param name="y">The patch corner to send</param> 1134 /// <param name="y">The patch corner to send</param>
973 private void SendToClients(TerrainData terrData, int x, int y) 1135 private void SendToClients(TerrainData terrData, int x, int y)
1136<<<<<<< HEAD
974 { 1137 {
975 if (m_sendTerrainUpdatesByViewDistance) 1138 if (m_sendTerrainUpdatesByViewDistance)
976 { 1139 {
@@ -1138,6 +1301,181 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1138 ret.Add(new PatchesToSend(x, y, dist)); 1301 ret.Add(new PatchesToSend(x, y, dist));
1139 } 1302 }
1140 } 1303 }
1304=======
1305 {
1306 // Add that this patch needs to be sent to the accounting for each client.
1307 lock (m_perClientPatchUpdates)
1308 {
1309 m_scene.ForEachScenePresence(presence =>
1310 {
1311 PatchUpdates thisClientUpdates;
1312 if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates))
1313 {
1314 // There is a ScenePresence without a send patch map. Create one.
1315 thisClientUpdates = new PatchUpdates(terrData, presence);
1316 m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates);
1317 }
1318 thisClientUpdates.SetByXY(x, y, true);
1319 }
1320 );
1321 }
1322 }
1323
1324 private class PatchesToSend : IComparable<PatchesToSend>
1325 {
1326 public int PatchX;
1327 public int PatchY;
1328 public float Dist;
1329 public PatchesToSend(int pX, int pY, float pDist)
1330 {
1331 PatchX = pX;
1332 PatchY = pY;
1333 Dist = pDist;
1334 }
1335 public int CompareTo(PatchesToSend other)
1336 {
1337 return Dist.CompareTo(other.Dist);
1338 }
1339 }
1340
1341 // Called each frame time to see if there are any patches to send to any of the
1342 // ScenePresences.
1343 // Loop through all the per-client info and send any patches necessary.
1344 private void CheckSendingPatchesToClients()
1345 {
1346 lock (m_perClientPatchUpdates)
1347 {
1348 foreach (PatchUpdates pups in m_perClientPatchUpdates.Values)
1349 {
1350 // throught acording to land queue free to send bytes
1351 if (!pups.Presence.ControllingClient.CanSendLayerData())
1352 continue;
1353
1354 if (pups.HasUpdates())
1355 {
1356 // There is something that could be sent to this client.
1357 List<PatchesToSend> toSend = GetModifiedPatchesInViewDistance(pups);
1358 if (toSend.Count > 0)
1359 {
1360 // m_log.DebugFormat("{0} CheckSendingPatchesToClient: sending {1} patches to {2} in region {3}",
1361 // LogHeader, toSend.Count, pups.Presence.Name, m_scene.RegionInfo.RegionName);
1362 // Sort the patches to send by the distance from the presence
1363 toSend.Sort();
1364 /*
1365 foreach (PatchesToSend pts in toSend)
1366 {
1367 pups.Presence.ControllingClient.SendLayerData(pts.PatchX, pts.PatchY, null);
1368 // presence.ControllingClient.SendLayerData(xs.ToArray(), ys.ToArray(), null, TerrainPatch.LayerType.Land);
1369 }
1370 */
1371
1372 int[] xPieces = new int[toSend.Count];
1373 int[] yPieces = new int[toSend.Count];
1374 float[] patchPieces = new float[toSend.Count * 2];
1375 int pieceIndex = 0;
1376 foreach (PatchesToSend pts in toSend)
1377 {
1378 patchPieces[pieceIndex++] = pts.PatchX;
1379 patchPieces[pieceIndex++] = pts.PatchY;
1380 }
1381 pups.Presence.ControllingClient.SendLayerData(-toSend.Count, 0, patchPieces);
1382 }
1383 }
1384 }
1385 }
1386 }
1387
1388 private List<PatchesToSend> GetModifiedPatchesInViewDistance(PatchUpdates pups)
1389 {
1390 List<PatchesToSend> ret = new List<PatchesToSend>();
1391
1392 int npatchs = 0;
1393
1394 ScenePresence presence = pups.Presence;
1395 if (presence == null)
1396 return ret;
1397
1398 float minz = presence.AbsolutePosition.Z;
1399 if (presence.CameraPosition.Z < minz)
1400 minz = presence.CameraPosition.Z;
1401
1402 // this limit should be max terrainheight + max draw
1403 if (minz > 1500f)
1404 return ret;
1405
1406 int DrawDistance = (int)presence.DrawDistance;
1407
1408 DrawDistance = DrawDistance / Constants.TerrainPatchSize;
1409
1410 int testposX;
1411 int testposY;
1412
1413 if (Math.Abs(presence.AbsolutePosition.X - presence.CameraPosition.X) > 30
1414 || Math.Abs(presence.AbsolutePosition.Y - presence.CameraPosition.Y) > 30)
1415 {
1416 testposX = (int)presence.CameraPosition.X / Constants.TerrainPatchSize;
1417 testposY = (int)presence.CameraPosition.Y / Constants.TerrainPatchSize;
1418 }
1419 else
1420 {
1421 testposX = (int)presence.AbsolutePosition.X / Constants.TerrainPatchSize;
1422 testposY = (int)presence.AbsolutePosition.Y / Constants.TerrainPatchSize;
1423 }
1424 int limitX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize;
1425 int limitY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize;
1426
1427 // Compute the area of patches within our draw distance
1428 int startX = testposX - DrawDistance;
1429 if (startX < 0)
1430 startX = 0;
1431 else if (startX > limitX)
1432 startX = limitX;
1433
1434 int startY = testposY - DrawDistance;
1435 if (startY < 0)
1436 startY = 0;
1437 else if (startY > limitY)
1438 startY = limitY;
1439
1440 int endX = testposX + DrawDistance;
1441 if (endX < 0)
1442 endX = 0;
1443 else if (endX > limitX)
1444 endX = limitX;
1445
1446 int endY = testposY + DrawDistance;
1447 if (endY < 0)
1448 endY = 0;
1449 else if (endY > limitY)
1450 endY = limitY;
1451
1452 int distx;
1453 int disty;
1454 int distsq;
1455
1456 DrawDistance *= DrawDistance;
1457
1458 for (int x = startX; x < endX; x++)
1459 {
1460 for (int y = startY; y < endY; y++)
1461 {
1462 if (pups.GetByPatch(x, y))
1463 {
1464 distx = x - testposX;
1465 disty = y - testposY;
1466 distsq = distx * distx + disty * disty;
1467 if (distsq < DrawDistance)
1468 {
1469 pups.SetByPatch(x, y, false);
1470 ret.Add(new PatchesToSend(x, y, (float)distsq));
1471 if (npatchs++ > 65536)
1472 {
1473 y = endY;
1474 x = endX;
1475 }
1476 }
1477 }
1478>>>>>>> avn/ubitvar
1141 } 1479 }
1142 } 1480 }
1143 return ret; 1481 return ret;
@@ -1161,6 +1499,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1161 int zx = (int)(west + 0.5); 1499 int zx = (int)(west + 0.5);
1162 int zy = (int)(north + 0.5); 1500 int zy = (int)(north + 0.5);
1163 1501
1502<<<<<<< HEAD
1164 int dx; 1503 int dx;
1165 for(dx=-n; dx<=n; dx++) 1504 for(dx=-n; dx<=n; dx++)
1166 { 1505 {
@@ -1176,16 +1515,52 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1176 allowMask[x, y] = true; 1515 allowMask[x, y] = true;
1177 allowed = true; 1516 allowed = true;
1178 } 1517 }
1518=======
1519
1520 int startX = zx - n;
1521 if (startX < 0)
1522 startX = 0;
1523
1524 int startY = zy - n;
1525 if (startY < 0)
1526 startY = 0;
1527
1528 int endX = zx + n;
1529 if (endX >= m_channel.Width)
1530 endX = m_channel.Width - 1;
1531 int endY = zy + n;
1532 if (endY >= m_channel.Height)
1533 endY = m_channel.Height - 1;
1534
1535 int x, y;
1536
1537 for (x = startX; x <= endX; x++)
1538 {
1539 for (y = startY; y <= endY; y++)
1540 {
1541 if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0)))
1542 {
1543 allowMask[x, y] = true;
1544 allowed = true;
1545>>>>>>> avn/ubitvar
1179 } 1546 }
1180 } 1547 }
1181 } 1548 }
1182 if (allowed) 1549 if (allowed)
1183 { 1550 {
1184 StoreUndoState(); 1551 StoreUndoState();
1552<<<<<<< HEAD
1185 m_painteffects[(StandardTerrainEffects)action].PaintEffect( 1553 m_painteffects[(StandardTerrainEffects)action].PaintEffect(
1186 m_channel, allowMask, west, south, height, size, seconds); 1554 m_channel, allowMask, west, south, height, size, seconds);
1187 1555
1188 //revert changes outside estate limits 1556 //revert changes outside estate limits
1557=======
1558 m_painteffects[(StandardTerrainEffects) action].PaintEffect(
1559 m_channel, allowMask, west, south, height, size, seconds,
1560 startX, endX, startY, endY);
1561
1562 //block changes outside estate limits
1563>>>>>>> avn/ubitvar
1189 if (!god) 1564 if (!god)
1190 EnforceEstateLimits(); 1565 EnforceEstateLimits();
1191 } 1566 }
@@ -1225,9 +1600,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1225 if (allowed) 1600 if (allowed)
1226 { 1601 {
1227 StoreUndoState(); 1602 StoreUndoState();
1603<<<<<<< HEAD
1228 m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size); 1604 m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size);
1229 1605
1230 //revert changes outside estate limits 1606 //revert changes outside estate limits
1607=======
1608 m_floodeffects[(StandardTerrainEffects) action].FloodEffect(m_channel, fillArea, size);
1609
1610 //block changes outside estate limits
1611>>>>>>> avn/ubitvar
1231 if (!god) 1612 if (!god)
1232 EnforceEstateLimits(); 1613 EnforceEstateLimits();
1233 } 1614 }
@@ -1260,6 +1641,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1260 1641
1261 private void StoreUndoState() 1642 private void StoreUndoState()
1262 { 1643 {
1644<<<<<<< HEAD
1263 lock(m_undo) 1645 lock(m_undo)
1264 { 1646 {
1265 if (m_undo.Count > 0) 1647 if (m_undo.Count > 0)
@@ -1275,22 +1657,36 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1275 LandUndoState nUndo = new LandUndoState(this, m_channel); 1657 LandUndoState nUndo = new LandUndoState(this, m_channel);
1276 m_undo.Push(nUndo); 1658 m_undo.Push(nUndo);
1277 } 1659 }
1660=======
1661>>>>>>> avn/ubitvar
1278 } 1662 }
1279 1663
1280 #region Console Commands 1664 #region Console Commands
1281 1665
1282 private void InterfaceLoadFile(Object[] args) 1666 private void InterfaceLoadFile(Object[] args)
1283 { 1667 {
1668<<<<<<< HEAD
1284 LoadFromFile((string)args[0]); 1669 LoadFromFile((string)args[0]);
1670=======
1671 LoadFromFile((string) args[0]);
1672>>>>>>> avn/ubitvar
1285 } 1673 }
1286 1674
1287 private void InterfaceLoadTileFile(Object[] args) 1675 private void InterfaceLoadTileFile(Object[] args)
1288 { 1676 {
1677<<<<<<< HEAD
1289 LoadFromFile((string)args[0], 1678 LoadFromFile((string)args[0],
1290 (int)args[1], 1679 (int)args[1],
1291 (int)args[2], 1680 (int)args[2],
1292 (int)args[3], 1681 (int)args[3],
1293 (int)args[4]); 1682 (int)args[4]);
1683=======
1684 LoadFromFile((string) args[0],
1685 (int) args[1],
1686 (int) args[2],
1687 (int) args[3],
1688 (int) args[4]);
1689>>>>>>> avn/ubitvar
1294 } 1690 }
1295 1691
1296 private void InterfaceSaveFile(Object[] args) 1692 private void InterfaceSaveFile(Object[] args)
@@ -1309,15 +1705,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1309 1705
1310 private void InterfaceBakeTerrain(Object[] args) 1706 private void InterfaceBakeTerrain(Object[] args)
1311 { 1707 {
1312 UpdateRevertMap(); 1708 UpdateBakedMap();
1313 } 1709 }
1314 1710
1315 private void InterfaceRevertTerrain(Object[] args) 1711 private void InterfaceRevertTerrain(Object[] args)
1316 { 1712 {
1317 int x, y; 1713 int x, y;
1714<<<<<<< HEAD
1318 for(x = 0; x < m_channel.Width; x++) 1715 for(x = 0; x < m_channel.Width; x++)
1319 for(y = 0; y < m_channel.Height; y++) 1716 for(y = 0; y < m_channel.Height; y++)
1320 m_channel[x, y] = m_revert[x, y]; 1717 m_channel[x, y] = m_revert[x, y];
1718=======
1719 for (x = 0; x < m_channel.Width; x++)
1720 for (y = 0; y < m_channel.Height; y++)
1721 m_channel[x, y] = m_baked[x, y];
1722>>>>>>> avn/ubitvar
1321 1723
1322 } 1724 }
1323 1725
@@ -1327,9 +1729,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1327 1729
1328 if (direction.ToLower().StartsWith("y")) 1730 if (direction.ToLower().StartsWith("y"))
1329 { 1731 {
1732<<<<<<< HEAD
1330 for(int x = 0; x < m_channel.Width; x++) 1733 for(int x = 0; x < m_channel.Width; x++)
1331 { 1734 {
1332 for(int y = 0; y < m_channel.Height / 2; y++) 1735 for(int y = 0; y < m_channel.Height / 2; y++)
1736=======
1737 for (int x = 0; x < m_channel.Width; x++)
1738 {
1739 for (int y = 0; y < m_channel.Height / 2; y++)
1740>>>>>>> avn/ubitvar
1333 { 1741 {
1334 double height = m_channel[x, y]; 1742 double height = m_channel[x, y];
1335 double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y]; 1743 double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y];
@@ -1341,9 +1749,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1341 } 1749 }
1342 else if (direction.ToLower().StartsWith("x")) 1750 else if (direction.ToLower().StartsWith("x"))
1343 { 1751 {
1752<<<<<<< HEAD
1344 for(int y = 0; y < m_channel.Height; y++) 1753 for(int y = 0; y < m_channel.Height; y++)
1345 { 1754 {
1346 for(int x = 0; x < m_channel.Width / 2; x++) 1755 for(int x = 0; x < m_channel.Width / 2; x++)
1756=======
1757 for (int y = 0; y < m_channel.Height; y++)
1758 {
1759 for (int x = 0; x < m_channel.Width / 2; x++)
1760>>>>>>> avn/ubitvar
1347 { 1761 {
1348 double height = m_channel[x, y]; 1762 double height = m_channel[x, y];
1349 double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y]; 1763 double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y];
@@ -1420,45 +1834,81 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1420 1834
1421 private void InterfaceElevateTerrain(Object[] args) 1835 private void InterfaceElevateTerrain(Object[] args)
1422 { 1836 {
1837 double val = (double)args[0];
1838
1423 int x, y; 1839 int x, y;
1840<<<<<<< HEAD
1424 for(x = 0; x < m_channel.Width; x++) 1841 for(x = 0; x < m_channel.Width; x++)
1425 for(y = 0; y < m_channel.Height; y++) 1842 for(y = 0; y < m_channel.Height; y++)
1426 m_channel[x, y] += (double)args[0]; 1843 m_channel[x, y] += (double)args[0];
1844=======
1845 for (x = 0; x < m_channel.Width; x++)
1846 for (y = 0; y < m_channel.Height; y++)
1847 m_channel[x, y] += val;
1848>>>>>>> avn/ubitvar
1427 } 1849 }
1428 1850
1429 private void InterfaceMultiplyTerrain(Object[] args) 1851 private void InterfaceMultiplyTerrain(Object[] args)
1430 { 1852 {
1431 int x, y; 1853 int x, y;
1854<<<<<<< HEAD
1432 for(x = 0; x < m_channel.Width; x++) 1855 for(x = 0; x < m_channel.Width; x++)
1433 for(y = 0; y < m_channel.Height; y++) 1856 for(y = 0; y < m_channel.Height; y++)
1434 m_channel[x, y] *= (double)args[0]; 1857 m_channel[x, y] *= (double)args[0];
1858=======
1859 double val = (double)args[0];
1860
1861 for (x = 0; x < m_channel.Width; x++)
1862 for (y = 0; y < m_channel.Height; y++)
1863 m_channel[x, y] *= val;
1864>>>>>>> avn/ubitvar
1435 } 1865 }
1436 1866
1437 private void InterfaceLowerTerrain(Object[] args) 1867 private void InterfaceLowerTerrain(Object[] args)
1438 { 1868 {
1439 int x, y; 1869 int x, y;
1870<<<<<<< HEAD
1440 for(x = 0; x < m_channel.Width; x++) 1871 for(x = 0; x < m_channel.Width; x++)
1441 for(y = 0; y < m_channel.Height; y++) 1872 for(y = 0; y < m_channel.Height; y++)
1442 m_channel[x, y] -= (double)args[0]; 1873 m_channel[x, y] -= (double)args[0];
1874=======
1875 double val = (double)args[0];
1876
1877 for (x = 0; x < m_channel.Width; x++)
1878 for (y = 0; y < m_channel.Height; y++)
1879 m_channel[x, y] -= val;
1880>>>>>>> avn/ubitvar
1443 } 1881 }
1444 1882
1445 public void InterfaceFillTerrain(Object[] args) 1883 public void InterfaceFillTerrain(Object[] args)
1446 { 1884 {
1447 int x, y; 1885 int x, y;
1886 double val = (double)args[0];
1448 1887
1888<<<<<<< HEAD
1449 for(x = 0; x < m_channel.Width; x++) 1889 for(x = 0; x < m_channel.Width; x++)
1450 for(y = 0; y < m_channel.Height; y++) 1890 for(y = 0; y < m_channel.Height; y++)
1451 m_channel[x, y] = (double)args[0]; 1891 m_channel[x, y] = (double)args[0];
1892=======
1893 for (x = 0; x < m_channel.Width; x++)
1894 for (y = 0; y < m_channel.Height; y++)
1895 m_channel[x, y] = val;
1896>>>>>>> avn/ubitvar
1452 } 1897 }
1453 1898
1454 private void InterfaceMinTerrain(Object[] args) 1899 private void InterfaceMinTerrain(Object[] args)
1455 { 1900 {
1456 int x, y; 1901 int x, y;
1902<<<<<<< HEAD
1457 for(x = 0; x < m_channel.Width; x++) 1903 for(x = 0; x < m_channel.Width; x++)
1904=======
1905 double val = (double)args[0];
1906 for (x = 0; x < m_channel.Width; x++)
1907>>>>>>> avn/ubitvar
1458 { 1908 {
1459 for(y = 0; y < m_channel.Height; y++) 1909 for(y = 0; y < m_channel.Height; y++)
1460 { 1910 {
1461 m_channel[x, y] = Math.Max((double)args[0], m_channel[x, y]); 1911 m_channel[x, y] = Math.Max(val, m_channel[x, y]);
1462 } 1912 }
1463 } 1913 }
1464 } 1914 }
@@ -1466,13 +1916,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1466 private void InterfaceMaxTerrain(Object[] args) 1916 private void InterfaceMaxTerrain(Object[] args)
1467 { 1917 {
1468 int x, y; 1918 int x, y;
1919<<<<<<< HEAD
1469 for(x = 0; x < m_channel.Width; x++) 1920 for(x = 0; x < m_channel.Width; x++)
1921=======
1922 double val = (double)args[0];
1923 for (x = 0; x < m_channel.Width; x++)
1924>>>>>>> avn/ubitvar
1470 { 1925 {
1471 for(y = 0; y < m_channel.Height; y++) 1926 for(y = 0; y < m_channel.Height; y++)
1472 { 1927 {
1473 m_channel[x, y] = Math.Min((double)args[0], m_channel[x, y]); 1928 m_channel[x, y] = Math.Min(val, m_channel[x, y]);
1474 } 1929 }
1475 } 1930 }
1931<<<<<<< HEAD
1476 } 1932 }
1477 1933
1478 private void InterfaceShow(Object[] args) 1934 private void InterfaceShow(Object[] args)
@@ -1488,6 +1944,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1488 double height = m_channel[(int)point.X, (int)point.Y]; 1944 double height = m_channel[(int)point.X, (int)point.Y];
1489 1945
1490 Console.WriteLine("Terrain height at {0} is {1}", point, height); 1946 Console.WriteLine("Terrain height at {0} is {1}", point, height);
1947=======
1948>>>>>>> avn/ubitvar
1491 } 1949 }
1492 1950
1493 private void InterfaceShowDebugStats(Object[] args) 1951 private void InterfaceShowDebugStats(Object[] args)
@@ -1620,9 +2078,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1620 multiplyCommand.AddArgument("value", "The value to multiply the heightmap by.", "Double"); 2078 multiplyCommand.AddArgument("value", "The value to multiply the heightmap by.", "Double");
1621 2079
1622 Command bakeRegionCommand = 2080 Command bakeRegionCommand =
1623 new Command("bake", CommandIntentions.COMMAND_HAZARDOUS, InterfaceBakeTerrain, "Saves the current terrain into the regions revert map."); 2081 new Command("bake", CommandIntentions.COMMAND_HAZARDOUS, InterfaceBakeTerrain, "Saves the current terrain into the regions baked map.");
1624 Command revertRegionCommand = 2082 Command revertRegionCommand =
1625 new Command("revert", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRevertTerrain, "Loads the revert map terrain into the regions heightmap."); 2083 new Command("revert", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRevertTerrain, "Loads the baked map terrain into the regions heightmap.");
1626 2084
1627 Command flipCommand = 2085 Command flipCommand =
1628 new Command("flip", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFlipTerrain, "Flips the current terrain about the X or Y axis"); 2086 new Command("flip", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFlipTerrain, "Flips the current terrain about the X or Y axis");