diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 6d14b82..3883e24 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -846,6 +846,8 @@ namespace OpenSim.Data.MySQL | |||
846 | } | 846 | } |
847 | } | 847 | } |
848 | 848 | ||
849 | LoadSpawnPoints(rs); | ||
850 | |||
849 | return rs; | 851 | return rs; |
850 | } | 852 | } |
851 | 853 | ||
@@ -1017,6 +1019,7 @@ namespace OpenSim.Data.MySQL | |||
1017 | } | 1019 | } |
1018 | } | 1020 | } |
1019 | } | 1021 | } |
1022 | SaveSpawnPoints(rs); | ||
1020 | } | 1023 | } |
1021 | 1024 | ||
1022 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1025 | public List<LandData> LoadLandObjects(UUID regionUUID) |
@@ -1828,5 +1831,72 @@ namespace OpenSim.Data.MySQL | |||
1828 | } | 1831 | } |
1829 | } | 1832 | } |
1830 | } | 1833 | } |
1834 | |||
1835 | private void LoadSpawnPoints(RegionSettings rs) | ||
1836 | { | ||
1837 | rs.ClearSpawnPoints(); | ||
1838 | |||
1839 | lock (m_dbLock) | ||
1840 | { | ||
1841 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1842 | { | ||
1843 | dbcon.Open(); | ||
1844 | |||
1845 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1846 | { | ||
1847 | cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where RegionID = ?RegionID"; | ||
1848 | cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); | ||
1849 | |||
1850 | using (IDataReader r = cmd.ExecuteReader()) | ||
1851 | { | ||
1852 | while (r.Read()) | ||
1853 | { | ||
1854 | Vector3 point = new Vector3(); | ||
1855 | |||
1856 | point.X = (float)r["PointX"]; | ||
1857 | point.Y = (float)r["PointY"]; | ||
1858 | point.Z = (float)r["PointZ"]; | ||
1859 | |||
1860 | rs.AddSpawnPoint(point); | ||
1861 | } | ||
1862 | } | ||
1863 | } | ||
1864 | } | ||
1865 | } | ||
1866 | } | ||
1867 | |||
1868 | private void SaveSpawnPoints(RegionSettings rs) | ||
1869 | { | ||
1870 | lock (m_dbLock) | ||
1871 | { | ||
1872 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1873 | { | ||
1874 | dbcon.Open(); | ||
1875 | |||
1876 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1877 | { | ||
1878 | cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID"; | ||
1879 | cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); | ||
1880 | |||
1881 | cmd.ExecuteNonQuery(); | ||
1882 | |||
1883 | cmd.Parameters.Clear(); | ||
1884 | |||
1885 | cmd.CommandText = "insert into spawn_points (RegionID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)"; | ||
1886 | |||
1887 | foreach (Vector3 p in rs.SpawnPoints()) | ||
1888 | { | ||
1889 | cmd.Parameters.AddWithValue("?EstateID", rs.RegionUUID.ToString()); | ||
1890 | cmd.Parameters.AddWithValue("?PointX", p.X); | ||
1891 | cmd.Parameters.AddWithValue("?PointY", p.Y); | ||
1892 | cmd.Parameters.AddWithValue("?PointZ", p.Z); | ||
1893 | |||
1894 | cmd.ExecuteNonQuery(); | ||
1895 | cmd.Parameters.Clear(); | ||
1896 | } | ||
1897 | } | ||
1898 | } | ||
1899 | } | ||
1900 | } | ||
1831 | } | 1901 | } |
1832 | } | 1902 | } |