diff options
-rw-r--r-- | OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 165 |
1 files changed, 86 insertions, 79 deletions
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index f4485df..f84beb6 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | |||
@@ -715,88 +715,93 @@ namespace OpenSim.Data.MySQL | |||
715 | { | 715 | { |
716 | RegionMeta7WindlightData nWP = new RegionMeta7WindlightData(); | 716 | RegionMeta7WindlightData nWP = new RegionMeta7WindlightData(); |
717 | nWP.OnSave += StoreRegionWindlightSettings; | 717 | nWP.OnSave += StoreRegionWindlightSettings; |
718 | lock (m_Connection) | 718 | |
719 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
719 | { | 720 | { |
720 | 721 | dbcon.Open(); | |
722 | |||
721 | string command = "select * from `regionwindlight` where region_id = ?regionID"; | 723 | string command = "select * from `regionwindlight` where region_id = ?regionID"; |
722 | 724 | ||
723 | MySqlCommand cmd = new MySqlCommand(command); | 725 | using(MySqlCommand cmd = new MySqlCommand(command)) |
726 | { | ||
727 | cmd.Connection = dbcon; | ||
724 | 728 | ||
725 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); | 729 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); |
726 | 730 | ||
727 | IDataReader result = ExecuteReader(cmd); | 731 | IDataReader result = ExecuteReader(cmd); |
728 | if (!result.Read()) | 732 | if (!result.Read()) |
729 | { | 733 | { |
730 | //No result, so store our default windlight profile and return it | 734 | //No result, so store our default windlight profile and return it |
731 | nWP.regionID = regionUUID; | 735 | nWP.regionID = regionUUID; |
732 | StoreRegionWindlightSettings(nWP); | 736 | StoreRegionWindlightSettings(nWP); |
733 | return nWP; | 737 | return nWP; |
734 | } | 738 | } |
735 | else | 739 | else |
736 | { | 740 | { |
737 | UUID.TryParse(result["region_id"].ToString(), out nWP.regionID); | 741 | UUID.TryParse(result["region_id"].ToString(), out nWP.regionID); |
738 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); | 742 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); |
739 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); | 743 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); |
740 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); | 744 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); |
741 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); | 745 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); |
742 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); | 746 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); |
743 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); | 747 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); |
744 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); | 748 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); |
745 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); | 749 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); |
746 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); | 750 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); |
747 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); | 751 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); |
748 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); | 752 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); |
749 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); | 753 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); |
750 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); | 754 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); |
751 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); | 755 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); |
752 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); | 756 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); |
753 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); | 757 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); |
754 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); | 758 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); |
755 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); | 759 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); |
756 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); | 760 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); |
757 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); | 761 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); |
758 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); | 762 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); |
759 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); | 763 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); |
760 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); | 764 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); |
761 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); | 765 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); |
762 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); | 766 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); |
763 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); | 767 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); |
764 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); | 768 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); |
765 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); | 769 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); |
766 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); | 770 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); |
767 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); | 771 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); |
768 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); | 772 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); |
769 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); | 773 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); |
770 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); | 774 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); |
771 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); | 775 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); |
772 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); | 776 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); |
773 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); | 777 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); |
774 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); | 778 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); |
775 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); | 779 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); |
776 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); | 780 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); |
777 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); | 781 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); |
778 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); | 782 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); |
779 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); | 783 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); |
780 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); | 784 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); |
781 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); | 785 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); |
782 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); | 786 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); |
783 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); | 787 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); |
784 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); | 788 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); |
785 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); | 789 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); |
786 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); | 790 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); |
787 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); | 791 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); |
788 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); | 792 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); |
789 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); | 793 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); |
790 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); | 794 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); |
791 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); | 795 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); |
792 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); | 796 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); |
793 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); | 797 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); |
794 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); | 798 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); |
795 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); | 799 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); |
796 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); | 800 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); |
797 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); | 801 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); |
798 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); | 802 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); |
799 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | 803 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); |
804 | } | ||
800 | } | 805 | } |
801 | } | 806 | } |
802 | return nWP; | 807 | return nWP; |
@@ -842,9 +847,11 @@ namespace OpenSim.Data.MySQL | |||
842 | 847 | ||
843 | public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl) | 848 | public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl) |
844 | { | 849 | { |
845 | lock (m_Connection) | 850 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
846 | { | 851 | { |
847 | using (MySqlCommand cmd = m_Connection.CreateCommand()) | 852 | dbcon.Open(); |
853 | |||
854 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
848 | { | 855 | { |
849 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; | 856 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; |
850 | cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; | 857 | cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; |