aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs282
1 files changed, 141 insertions, 141 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs
index 6dc2e30..da03871 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs
@@ -1,141 +1,141 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.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
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32 32
33namespace libTerrain 33namespace libTerrain
34{ 34{
35 partial class Channel 35 partial class Channel
36 { 36 {
37 enum NeighbourSystem 37 enum NeighbourSystem
38 { 38 {
39 Moore, 39 Moore,
40 VonNeumann 40 VonNeumann
41 }; 41 };
42 42
43 private int[] Neighbours(NeighbourSystem type, int index) 43 private int[] Neighbours(NeighbourSystem type, int index)
44 { 44 {
45 int[] coord = new int[2]; 45 int[] coord = new int[2];
46 46
47 index++; 47 index++;
48 48
49 switch (type) 49 switch (type)
50 { 50 {
51 case NeighbourSystem.Moore: 51 case NeighbourSystem.Moore:
52 switch (index) 52 switch (index)
53 { 53 {
54 case 1: 54 case 1:
55 coord[0] = -1; 55 coord[0] = -1;
56 coord[1] = -1; 56 coord[1] = -1;
57 break; 57 break;
58 58
59 case 2: 59 case 2:
60 coord[0] = -0; 60 coord[0] = -0;
61 coord[1] = -1; 61 coord[1] = -1;
62 break; 62 break;
63 63
64 case 3: 64 case 3:
65 coord[0] = +1; 65 coord[0] = +1;
66 coord[1] = -1; 66 coord[1] = -1;
67 break; 67 break;
68 68
69 case 4: 69 case 4:
70 coord[0] = -1; 70 coord[0] = -1;
71 coord[1] = -0; 71 coord[1] = -0;
72 break; 72 break;
73 73
74 case 5: 74 case 5:
75 coord[0] = -0; 75 coord[0] = -0;
76 coord[1] = -0; 76 coord[1] = -0;
77 break; 77 break;
78 78
79 case 6: 79 case 6:
80 coord[0] = +1; 80 coord[0] = +1;
81 coord[1] = -0; 81 coord[1] = -0;
82 break; 82 break;
83 83
84 case 7: 84 case 7:
85 coord[0] = -1; 85 coord[0] = -1;
86 coord[1] = +1; 86 coord[1] = +1;
87 break; 87 break;
88 88
89 case 8: 89 case 8:
90 coord[0] = -0; 90 coord[0] = -0;
91 coord[1] = +1; 91 coord[1] = +1;
92 break; 92 break;
93 93
94 case 9: 94 case 9:
95 coord[0] = +1; 95 coord[0] = +1;
96 coord[1] = +1; 96 coord[1] = +1;
97 break; 97 break;
98 98
99 default: 99 default:
100 break; 100 break;
101 } 101 }
102 break; 102 break;
103 103
104 case NeighbourSystem.VonNeumann: 104 case NeighbourSystem.VonNeumann:
105 switch (index) 105 switch (index)
106 { 106 {
107 case 1: 107 case 1:
108 coord[0] = 0; 108 coord[0] = 0;
109 coord[1] = -1; 109 coord[1] = -1;
110 break; 110 break;
111 111
112 case 2: 112 case 2:
113 coord[0] = -1; 113 coord[0] = -1;
114 coord[1] = 0; 114 coord[1] = 0;
115 break; 115 break;
116 116
117 case 3: 117 case 3:
118 coord[0] = +1; 118 coord[0] = +1;
119 coord[1] = 0; 119 coord[1] = 0;
120 break; 120 break;
121 121
122 case 4: 122 case 4:
123 coord[0] = 0; 123 coord[0] = 0;
124 coord[1] = +1; 124 coord[1] = +1;
125 break; 125 break;
126 126
127 case 5: 127 case 5:
128 coord[0] = -0; 128 coord[0] = -0;
129 coord[1] = -0; 129 coord[1] = -0;
130 break; 130 break;
131 131
132 default: 132 default:
133 break; 133 break;
134 } 134 }
135 break; 135 break;
136 } 136 }
137 137
138 return coord; 138 return coord;
139 } 139 }
140 } 140 }
141} 141}