diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 79 |
1 files changed, 76 insertions, 3 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 6d14b82..31d17f1 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 | ||
@@ -994,7 +996,9 @@ namespace OpenSim.Data.MySQL | |||
994 | "use_estate_sun, fixed_sun, sun_position, " + | 996 | "use_estate_sun, fixed_sun, sun_position, " + |
995 | "covenant, Sandbox, sunvectorx, sunvectory, " + | 997 | "covenant, Sandbox, sunvectorx, sunvectory, " + |
996 | "sunvectorz, loaded_creation_datetime, " + | 998 | "sunvectorz, loaded_creation_datetime, " + |
997 | "loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " + | 999 | "loaded_creation_id, map_tile_ID, " + |
1000 | "TelehubObject) " + | ||
1001 | "values (?RegionUUID, ?BlockTerraform, " + | ||
998 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1002 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
999 | "?AllowLandResell, ?AllowLandJoinDivide, " + | 1003 | "?AllowLandResell, ?AllowLandJoinDivide, " + |
1000 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + | 1004 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + |
@@ -1009,7 +1013,7 @@ namespace OpenSim.Data.MySQL | |||
1009 | "?SunPosition, ?Covenant, ?Sandbox, " + | 1013 | "?SunPosition, ?Covenant, ?Sandbox, " + |
1010 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1014 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1011 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1015 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1012 | "?TerrainImageID)"; | 1016 | "?TerrainImageID, ?TelehubObject) "; |
1013 | 1017 | ||
1014 | FillRegionSettingsCommand(cmd, rs); | 1018 | FillRegionSettingsCommand(cmd, rs); |
1015 | 1019 | ||
@@ -1017,6 +1021,7 @@ namespace OpenSim.Data.MySQL | |||
1017 | } | 1021 | } |
1018 | } | 1022 | } |
1019 | } | 1023 | } |
1024 | SaveSpawnPoints(rs); | ||
1020 | } | 1025 | } |
1021 | 1026 | ||
1022 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1027 | public List<LandData> LoadLandObjects(UUID regionUUID) |
@@ -1296,6 +1301,7 @@ namespace OpenSim.Data.MySQL | |||
1296 | newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; | 1301 | newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; |
1297 | 1302 | ||
1298 | newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); | 1303 | newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); |
1304 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | ||
1299 | 1305 | ||
1300 | return newSettings; | 1306 | return newSettings; |
1301 | } | 1307 | } |
@@ -1626,7 +1632,7 @@ namespace OpenSim.Data.MySQL | |||
1626 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1632 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1627 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1633 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1628 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1634 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1629 | 1635 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | |
1630 | } | 1636 | } |
1631 | 1637 | ||
1632 | /// <summary> | 1638 | /// <summary> |
@@ -1828,5 +1834,72 @@ namespace OpenSim.Data.MySQL | |||
1828 | } | 1834 | } |
1829 | } | 1835 | } |
1830 | } | 1836 | } |
1837 | |||
1838 | private void LoadSpawnPoints(RegionSettings rs) | ||
1839 | { | ||
1840 | rs.ClearSpawnPoints(); | ||
1841 | |||
1842 | lock (m_dbLock) | ||
1843 | { | ||
1844 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1845 | { | ||
1846 | dbcon.Open(); | ||
1847 | |||
1848 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1849 | { | ||
1850 | cmd.CommandText = "select Yaw, Pitch, Distance from spawn_points where RegionID = ?RegionID"; | ||
1851 | cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); | ||
1852 | |||
1853 | using (IDataReader r = cmd.ExecuteReader()) | ||
1854 | { | ||
1855 | while (r.Read()) | ||
1856 | { | ||
1857 | SpawnPoint sp = new SpawnPoint(); | ||
1858 | |||
1859 | sp.Yaw = (float)r["Yaw"]; | ||
1860 | sp.Pitch = (float)r["Pitch"]; | ||
1861 | sp.Distance = (float)r["Distance"]; | ||
1862 | |||
1863 | rs.AddSpawnPoint(sp); | ||
1864 | } | ||
1865 | } | ||
1866 | } | ||
1867 | } | ||
1868 | } | ||
1869 | } | ||
1870 | |||
1871 | private void SaveSpawnPoints(RegionSettings rs) | ||
1872 | { | ||
1873 | lock (m_dbLock) | ||
1874 | { | ||
1875 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1876 | { | ||
1877 | dbcon.Open(); | ||
1878 | |||
1879 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1880 | { | ||
1881 | cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID"; | ||
1882 | cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); | ||
1883 | |||
1884 | cmd.ExecuteNonQuery(); | ||
1885 | |||
1886 | cmd.Parameters.Clear(); | ||
1887 | |||
1888 | cmd.CommandText = "insert into spawn_points (RegionID, Yaw, Pitch, Distance) values ( ?RegionID, ?Yaw, ?Pitch, ?Distance)"; | ||
1889 | |||
1890 | foreach (SpawnPoint p in rs.SpawnPoints()) | ||
1891 | { | ||
1892 | cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); | ||
1893 | cmd.Parameters.AddWithValue("?Yaw", p.Yaw); | ||
1894 | cmd.Parameters.AddWithValue("?Pitch", p.Pitch); | ||
1895 | cmd.Parameters.AddWithValue("?Distance", p.Distance); | ||
1896 | |||
1897 | cmd.ExecuteNonQuery(); | ||
1898 | cmd.Parameters.Clear(); | ||
1899 | } | ||
1900 | } | ||
1901 | } | ||
1902 | } | ||
1903 | } | ||
1831 | } | 1904 | } |
1832 | } | 1905 | } |