diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs | 264 |
1 files changed, 132 insertions, 132 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs index 990a1e0..4e937bb 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs | |||
@@ -1,132 +1,132 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using System; | 30 | using System; |
31 | using System.Collections; | 31 | using System.Collections; |
32 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Region.Environment.Modules; | 35 | using OpenSim.Region.Environment.Modules; |
36 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
38 | using libsecondlife; | 38 | using libsecondlife; |
39 | 39 | ||
40 | namespace OpenSim.Region.Environment.Modules.Terrain | 40 | namespace OpenSim.Region.Environment.Modules.Terrain |
41 | { | 41 | { |
42 | /// <summary> | 42 | /// <summary> |
43 | /// A new version of the old Channel class, simplified | 43 | /// A new version of the old Channel class, simplified |
44 | /// </summary> | 44 | /// </summary> |
45 | public class TerrainChannel : ITerrainChannel | 45 | public class TerrainChannel : ITerrainChannel |
46 | { | 46 | { |
47 | private double[,] map; | 47 | private double[,] map; |
48 | 48 | ||
49 | public int Width | 49 | public int Width |
50 | { | 50 | { |
51 | get { return map.GetLength(0); } | 51 | get { return map.GetLength(0); } |
52 | } | 52 | } |
53 | 53 | ||
54 | public int Height | 54 | public int Height |
55 | { | 55 | { |
56 | get { return map.GetLength(1); } | 56 | get { return map.GetLength(1); } |
57 | } | 57 | } |
58 | 58 | ||
59 | public TerrainChannel Copy() | 59 | public TerrainChannel Copy() |
60 | { | 60 | { |
61 | TerrainChannel copy = new TerrainChannel(false); | 61 | TerrainChannel copy = new TerrainChannel(false); |
62 | copy.map = (double[,])this.map.Clone(); | 62 | copy.map = (double[,])this.map.Clone(); |
63 | 63 | ||
64 | return copy; | 64 | return copy; |
65 | } | 65 | } |
66 | 66 | ||
67 | public double this[int x, int y] | 67 | public double this[int x, int y] |
68 | { | 68 | { |
69 | get | 69 | get |
70 | { | 70 | { |
71 | return map[x, y]; | 71 | return map[x, y]; |
72 | } | 72 | } |
73 | set | 73 | set |
74 | { | 74 | { |
75 | map[x, y] = value; | 75 | map[x, y] = value; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | public TerrainChannel() | 79 | public TerrainChannel() |
80 | { | 80 | { |
81 | map = new double[Constants.RegionSize, Constants.RegionSize]; | 81 | map = new double[Constants.RegionSize, Constants.RegionSize]; |
82 | } | 82 | } |
83 | 83 | ||
84 | public TerrainChannel(bool createMap) | 84 | public TerrainChannel(bool createMap) |
85 | { | 85 | { |
86 | if (createMap) | 86 | if (createMap) |
87 | map = new double[Constants.RegionSize, Constants.RegionSize]; | 87 | map = new double[Constants.RegionSize, Constants.RegionSize]; |
88 | } | 88 | } |
89 | 89 | ||
90 | public TerrainChannel(int w, int h) | 90 | public TerrainChannel(int w, int h) |
91 | { | 91 | { |
92 | map = new double[w, h]; | 92 | map = new double[w, h]; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | public class TerrainModule : IRegionModule | 96 | public class TerrainModule : IRegionModule |
97 | { | 97 | { |
98 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 98 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
99 | 99 | ||
100 | Scene m_scene; | 100 | Scene m_scene; |
101 | 101 | ||
102 | private IConfigSource m_gConfig; | 102 | private IConfigSource m_gConfig; |
103 | 103 | ||
104 | public void Initialise(Scene scene, IConfigSource config) | 104 | public void Initialise(Scene scene, IConfigSource config) |
105 | { | 105 | { |
106 | m_scene = scene; | 106 | m_scene = scene; |
107 | m_gConfig = config; | 107 | m_gConfig = config; |
108 | } | 108 | } |
109 | 109 | ||
110 | public void Close() | 110 | public void Close() |
111 | { | 111 | { |
112 | 112 | ||
113 | } | 113 | } |
114 | 114 | ||
115 | public string Name | 115 | public string Name |
116 | { | 116 | { |
117 | get { return "TerrainModule"; } | 117 | get { return "TerrainModule"; } |
118 | } | 118 | } |
119 | 119 | ||
120 | public bool IsSharedModule | 120 | public bool IsSharedModule |
121 | { | 121 | { |
122 | get { return false; } | 122 | get { return false; } |
123 | } | 123 | } |
124 | 124 | ||
125 | public void PostInitialise() | 125 | public void PostInitialise() |
126 | { | 126 | { |
127 | 127 | ||
128 | } | 128 | } |
129 | 129 | ||
130 | } | 130 | } |
131 | 131 | ||
132 | } | 132 | } |