aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLSimulationData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs70
1 files changed, 70 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 40619de..afd42d7 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -861,6 +861,8 @@ namespace OpenSim.Data.MySQL
861 } 861 }
862 } 862 }
863 863
864 LoadSpawnPoints(rs);
865
864 return rs; 866 return rs;
865 } 867 }
866 868
@@ -1032,6 +1034,7 @@ namespace OpenSim.Data.MySQL
1032 } 1034 }
1033 } 1035 }
1034 } 1036 }
1037 SaveSpawnPoints(rs);
1035 } 1038 }
1036 1039
1037 public virtual List<LandData> LoadLandObjects(UUID regionUUID) 1040 public virtual List<LandData> LoadLandObjects(UUID regionUUID)
@@ -1852,5 +1855,72 @@ namespace OpenSim.Data.MySQL
1852 } 1855 }
1853 } 1856 }
1854 } 1857 }
1858
1859 private void LoadSpawnPoints(RegionSettings rs)
1860 {
1861 rs.ClearSpawnPoints();
1862
1863 lock (m_dbLock)
1864 {
1865 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1866 {
1867 dbcon.Open();
1868
1869 using (MySqlCommand cmd = dbcon.CreateCommand())
1870 {
1871 cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where RegionID = ?RegionID";
1872 cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
1873
1874 using (IDataReader r = cmd.ExecuteReader())
1875 {
1876 while (r.Read())
1877 {
1878 Vector3 point = new Vector3();
1879
1880 point.X = (float)r["PointX"];
1881 point.Y = (float)r["PointY"];
1882 point.Z = (float)r["PointZ"];
1883
1884 rs.AddSpawnPoint(point);
1885 }
1886 }
1887 }
1888 }
1889 }
1890 }
1891
1892 private void SaveSpawnPoints(RegionSettings rs)
1893 {
1894 lock (m_dbLock)
1895 {
1896 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1897 {
1898 dbcon.Open();
1899
1900 using (MySqlCommand cmd = dbcon.CreateCommand())
1901 {
1902 cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID";
1903 cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
1904
1905 cmd.ExecuteNonQuery();
1906
1907 cmd.Parameters.Clear();
1908
1909 cmd.CommandText = "insert into spawn_points (RegionID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)";
1910
1911 foreach (Vector3 p in rs.SpawnPoints())
1912 {
1913 cmd.Parameters.AddWithValue("?EstateID", rs.RegionUUID.ToString());
1914 cmd.Parameters.AddWithValue("?PointX", p.X);
1915 cmd.Parameters.AddWithValue("?PointY", p.Y);
1916 cmd.Parameters.AddWithValue("?PointZ", p.Z);
1917
1918 cmd.ExecuteNonQuery();
1919 cmd.Parameters.Clear();
1920 }
1921 }
1922 }
1923 }
1924 }
1855 } 1925 }
1856} 1926}