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.cs81
1 files changed, 78 insertions, 3 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 6d14b82..3123edf 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, parcel_tile_ID) " +
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, ?ParcelImageID) ";
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,8 @@ 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.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]);
1305 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]);
1299 1306
1300 return newSettings; 1307 return newSettings;
1301 } 1308 }
@@ -1626,7 +1633,8 @@ namespace OpenSim.Data.MySQL
1626 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); 1633 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
1627 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); 1634 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1628 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); 1635 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
1629 1636 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
1637 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
1630 } 1638 }
1631 1639
1632 /// <summary> 1640 /// <summary>
@@ -1828,5 +1836,72 @@ namespace OpenSim.Data.MySQL
1828 } 1836 }
1829 } 1837 }
1830 } 1838 }
1839
1840 private void LoadSpawnPoints(RegionSettings rs)
1841 {
1842 rs.ClearSpawnPoints();
1843
1844 lock (m_dbLock)
1845 {
1846 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1847 {
1848 dbcon.Open();
1849
1850 using (MySqlCommand cmd = dbcon.CreateCommand())
1851 {
1852 cmd.CommandText = "select Yaw, Pitch, Distance from spawn_points where RegionID = ?RegionID";
1853 cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
1854
1855 using (IDataReader r = cmd.ExecuteReader())
1856 {
1857 while (r.Read())
1858 {
1859 SpawnPoint sp = new SpawnPoint();
1860
1861 sp.Yaw = (float)r["Yaw"];
1862 sp.Pitch = (float)r["Pitch"];
1863 sp.Distance = (float)r["Distance"];
1864
1865 rs.AddSpawnPoint(sp);
1866 }
1867 }
1868 }
1869 }
1870 }
1871 }
1872
1873 private void SaveSpawnPoints(RegionSettings rs)
1874 {
1875 lock (m_dbLock)
1876 {
1877 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1878 {
1879 dbcon.Open();
1880
1881 using (MySqlCommand cmd = dbcon.CreateCommand())
1882 {
1883 cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID";
1884 cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
1885
1886 cmd.ExecuteNonQuery();
1887
1888 cmd.Parameters.Clear();
1889
1890 cmd.CommandText = "insert into spawn_points (RegionID, Yaw, Pitch, Distance) values ( ?RegionID, ?Yaw, ?Pitch, ?Distance)";
1891
1892 foreach (SpawnPoint p in rs.SpawnPoints())
1893 {
1894 cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
1895 cmd.Parameters.AddWithValue("?Yaw", p.Yaw);
1896 cmd.Parameters.AddWithValue("?Pitch", p.Pitch);
1897 cmd.Parameters.AddWithValue("?Distance", p.Distance);
1898
1899 cmd.ExecuteNonQuery();
1900 cmd.Parameters.Clear();
1901 }
1902 }
1903 }
1904 }
1905 }
1831 } 1906 }
1832} 1907}