From d0d481a0ab12173fd03c4b6151ee504e3e10b7da Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 7 Apr 2009 19:07:23 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=3418 * Prevents occasional wind module related exceptions on region server shutdown * Thanks Intimidated! --- CONTRIBUTORS.txt | 1 + .../CoreModules/World/Wind/Plugins/SimpleRandomWind.cs | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 0217476..8b0a616 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -60,6 +60,7 @@ Patches * Grumly57 * Fly-Man * Flyte Xevious +* Intimidated * jhurliman * jimbo2120 (IBM) * John R Sohn (XenReborn) diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs index cdd5a2e..2c371da 100644 --- a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs +++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs @@ -82,14 +82,18 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins public void WindUpdate(uint frame) { - for (int y = 0; y < 16; y++) + //Make sure our object is valid (we haven't been disposed of yet) + if (m_windSpeeds != null) { - for (int x = 0; x < 16; x++) + for (int y = 0; y < 16; y++) { - m_windSpeeds[y * 16 + x].X = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1 - m_windSpeeds[y * 16 + x].Y = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1 - m_windSpeeds[y * 16 + x].X *= m_strength; - m_windSpeeds[y * 16 + x].Y *= m_strength; + for (int x = 0; x < 16; x++) + { + m_windSpeeds[y * 16 + x].X = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1 + m_windSpeeds[y * 16 + x].Y = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1 + m_windSpeeds[y * 16 + x].X *= m_strength; + m_windSpeeds[y * 16 + x].Y *= m_strength; + } } } } -- cgit v1.1