OpenSim.Region.CoreModules.CloudModule.UpdateCloudCover C# (CSharp) Method

UpdateCloudCover() private method

private UpdateCloudCover ( ) : void
return void
        private void UpdateCloudCover()
        {
            float[] newCover = new float[16 * 16];
            int rowAbove = new int();
            int rowBelow = new int();
            int columnLeft = new int();
            int columnRight = new int();
            for (int x = 0; x < 16; x++)
            {
                if (x == 0)
                {
                    columnRight = x + 1;
                    columnLeft = 15;
                }
                else if (x == 15)
                {
                    columnRight = 0;
                    columnLeft = x - 1;
                }
                else 
                {
                    columnRight = x + 1;
                    columnLeft = x - 1;
                }
                for (int y = 0; y< 16; y++)
                {
                    if (y == 0)
                    {
                        rowAbove = y + 1;
                        rowBelow = 15;
                    }
                    else if (y == 15)
                    {
                        rowAbove = 0;
                        rowBelow = y - 1;
                    }
                    else
                    {
                        rowAbove = y + 1;
                        rowBelow = y - 1;
                    }
                    float neighborAverage = (cloudCover[rowBelow * 16 + columnLeft] + 
                                             cloudCover[y * 16 + columnLeft] + 
                                             cloudCover[rowAbove * 16 + columnLeft] + 
                                             cloudCover[rowBelow * 16 + x] + 
                                             cloudCover[rowAbove * 16 + x] + 
                                             cloudCover[rowBelow * 16 + columnRight] + 
                                             cloudCover[y * 16 + columnRight] + 
                                             cloudCover[rowAbove * 16 + columnRight] + 
                                             cloudCover[y * 16 + x]) / 9;
                    newCover[y * 16 + x] = ((neighborAverage / m_cloudDensity) + 0.175f) % 1.0f;
                    newCover[y * 16 + x] *= m_cloudDensity;
                }
            }
            Array.Copy(newCover, cloudCover, 16 * 16);
        }