aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Terrain
diff options
context:
space:
mode:
authorAdam Frisby2008-02-14 16:13:53 +0000
committerAdam Frisby2008-02-14 16:13:53 +0000
commit91d9248fcebfae4890e502c7140403f881b2a4d0 (patch)
treeda5222277d5ba451f943ecadcbb3393fcacaf589 /OpenSim/Region/Environment/Modules/Terrain
parentFix a casting subtlety in moving to constants. Logins should work (diff)
downloadopensim-SC-91d9248fcebfae4890e502c7140403f881b2a4d0.zip
opensim-SC-91d9248fcebfae4890e502c7140403f881b2a4d0.tar.gz
opensim-SC-91d9248fcebfae4890e502c7140403f881b2a4d0.tar.bz2
opensim-SC-91d9248fcebfae4890e502c7140403f881b2a4d0.tar.xz
* Removed some catch-all-ignores from UDPServer in an attempt to look for #305.
* Minor work towards abstracting terrain.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain')
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs132
1 files changed, 132 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs
new file mode 100644
index 0000000..990a1e0
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs
@@ -0,0 +1,132 @@
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 OpenSim 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
29using Nini.Config;
30using System;
31using System.Collections;
32using System.Collections.Generic;
33using OpenSim.Framework;
34using OpenSim.Framework.Console;
35using OpenSim.Region.Environment.Modules;
36using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Environment.Scenes;
38using libsecondlife;
39
40namespace OpenSim.Region.Environment.Modules.Terrain
41{
42 /// <summary>
43 /// A new version of the old Channel class, simplified
44 /// </summary>
45 public class TerrainChannel : ITerrainChannel
46 {
47 private double[,] map;
48
49 public int Width
50 {
51 get { return map.GetLength(0); }
52 }
53
54 public int Height
55 {
56 get { return map.GetLength(1); }
57 }
58
59 public TerrainChannel Copy()
60 {
61 TerrainChannel copy = new TerrainChannel(false);
62 copy.map = (double[,])this.map.Clone();
63
64 return copy;
65 }
66
67 public double this[int x, int y]
68 {
69 get
70 {
71 return map[x, y];
72 }
73 set
74 {
75 map[x, y] = value;
76 }
77 }
78
79 public TerrainChannel()
80 {
81 map = new double[Constants.RegionSize, Constants.RegionSize];
82 }
83
84 public TerrainChannel(bool createMap)
85 {
86 if (createMap)
87 map = new double[Constants.RegionSize, Constants.RegionSize];
88 }
89
90 public TerrainChannel(int w, int h)
91 {
92 map = new double[w, h];
93 }
94 }
95
96 public class TerrainModule : IRegionModule
97 {
98 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
99
100 Scene m_scene;
101
102 private IConfigSource m_gConfig;
103
104 public void Initialise(Scene scene, IConfigSource config)
105 {
106 m_scene = scene;
107 m_gConfig = config;
108 }
109
110 public void Close()
111 {
112
113 }
114
115 public string Name
116 {
117 get { return "TerrainModule"; }
118 }
119
120 public bool IsSharedModule
121 {
122 get { return false; }
123 }
124
125 public void PostInitialise()
126 {
127
128 }
129
130 }
131
132}