diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 34362bf..8a6a6b4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -4139,35 +4139,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4139 | 4139 | ||
4140 | switch (m_scene.SpawnPointRouting) | 4140 | switch (m_scene.SpawnPointRouting) |
4141 | { | 4141 | { |
4142 | case "closest": | ||
4143 | |||
4144 | float distance = 9999; | ||
4145 | int closest = -1; | ||
4146 | |||
4147 | for (int i = 0; i < spawnPoints.Length; i++) | ||
4148 | { | ||
4149 | Vector3 spawnPosition = spawnPoints[i].GetLocation( | ||
4150 | telehub.AbsolutePosition, | ||
4151 | telehub.GroupRotation | ||
4152 | ); | ||
4153 | Vector3 offset = spawnPosition - pos; | ||
4154 | float d = Vector3.Mag(offset); | ||
4155 | if (d >= distance) | ||
4156 | continue; | ||
4157 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4158 | if (land == null) | ||
4159 | continue; | ||
4160 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
4161 | continue; | ||
4162 | distance = d; | ||
4163 | closest = i; | ||
4164 | } | ||
4165 | if (closest == -1) | ||
4166 | return; | ||
4167 | |||
4168 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4169 | return; | ||
4170 | |||
4171 | case "random": | 4142 | case "random": |
4172 | 4143 | ||
4173 | do | 4144 | do |
@@ -4219,7 +4190,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
4219 | return; | 4190 | return; |
4220 | 4191 | ||
4221 | default: | 4192 | default: |
4193 | case "closest": | ||
4194 | |||
4195 | float distance = 9999; | ||
4196 | int closest = -1; | ||
4197 | |||
4198 | for (int i = 0; i < spawnPoints.Length; i++) | ||
4199 | { | ||
4200 | Vector3 spawnPosition = spawnPoints[i].GetLocation( | ||
4201 | telehub.AbsolutePosition, | ||
4202 | telehub.GroupRotation | ||
4203 | ); | ||
4204 | Vector3 offset = spawnPosition - pos; | ||
4205 | float d = Vector3.Mag(offset); | ||
4206 | if (d >= distance) | ||
4207 | continue; | ||
4208 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4209 | if (land == null) | ||
4210 | continue; | ||
4211 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
4212 | continue; | ||
4213 | distance = d; | ||
4214 | closest = i; | ||
4215 | } | ||
4216 | if (closest == -1) | ||
4217 | return; | ||
4218 | |||
4219 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4222 | return; | 4220 | return; |
4221 | |||
4223 | } | 4222 | } |
4224 | } | 4223 | } |
4225 | } | 4224 | } |