diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 239 |
1 files changed, 171 insertions, 68 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 9cc6f40..537ec85 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Data.MySQL | |||
52 | private string m_connectionString; | 52 | private string m_connectionString; |
53 | private object m_dbLock = new object(); | 53 | private object m_dbLock = new object(); |
54 | 54 | ||
55 | protected Assembly Assembly | 55 | protected virtual Assembly Assembly |
56 | { | 56 | { |
57 | get { return GetType().Assembly; } | 57 | get { return GetType().Assembly; } |
58 | } | 58 | } |
@@ -66,7 +66,7 @@ namespace OpenSim.Data.MySQL | |||
66 | Initialise(connectionString); | 66 | Initialise(connectionString); |
67 | } | 67 | } |
68 | 68 | ||
69 | public void Initialise(string connectionString) | 69 | public virtual void Initialise(string connectionString) |
70 | { | 70 | { |
71 | m_connectionString = connectionString; | 71 | m_connectionString = connectionString; |
72 | 72 | ||
@@ -113,7 +113,7 @@ namespace OpenSim.Data.MySQL | |||
113 | 113 | ||
114 | public void Dispose() {} | 114 | public void Dispose() {} |
115 | 115 | ||
116 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 116 | public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
117 | { | 117 | { |
118 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | 118 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); |
119 | 119 | ||
@@ -173,9 +173,10 @@ namespace OpenSim.Data.MySQL | |||
173 | "ParticleSystem, ClickAction, Material, " + | 173 | "ParticleSystem, ClickAction, Material, " + |
174 | "CollisionSound, CollisionSoundVolume, " + | 174 | "CollisionSound, CollisionSoundVolume, " + |
175 | "PassTouches, " + | 175 | "PassTouches, " + |
176 | "LinkNumber, MediaURL, DynAttrs, " + | 176 | "PassCollisions, " + |
177 | "LinkNumber, MediaURL, KeyframeMotion, " + | ||
177 | "PhysicsShapeType, Density, GravityModifier, " + | 178 | "PhysicsShapeType, Density, GravityModifier, " + |
178 | "Friction, Restitution " + | 179 | "Friction, Restitution, Vehicle, DynAttrs " + |
179 | ") values (" + "?UUID, " + | 180 | ") values (" + "?UUID, " + |
180 | "?CreationDate, ?Name, ?Text, " + | 181 | "?CreationDate, ?Name, ?Text, " + |
181 | "?Description, ?SitName, ?TouchName, " + | 182 | "?Description, ?SitName, ?TouchName, " + |
@@ -207,10 +208,10 @@ namespace OpenSim.Data.MySQL | |||
207 | "?SaleType, ?ColorR, ?ColorG, " + | 208 | "?SaleType, ?ColorR, ?ColorG, " + |
208 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 209 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
209 | "?ClickAction, ?Material, ?CollisionSound, " + | 210 | "?ClickAction, ?Material, ?CollisionSound, " + |
210 | "?CollisionSoundVolume, ?PassTouches, " + | 211 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
211 | "?LinkNumber, ?MediaURL, ?DynAttrs, " + | 212 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + |
212 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | 213 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + |
213 | "?Friction, ?Restitution)"; | 214 | "?Friction, ?Restitution, ?Vehicle, ?DynAttrs)"; |
214 | 215 | ||
215 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 216 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
216 | 217 | ||
@@ -250,7 +251,7 @@ namespace OpenSim.Data.MySQL | |||
250 | } | 251 | } |
251 | } | 252 | } |
252 | 253 | ||
253 | public void RemoveObject(UUID obj, UUID regionUUID) | 254 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
254 | { | 255 | { |
255 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 256 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
256 | 257 | ||
@@ -399,7 +400,7 @@ namespace OpenSim.Data.MySQL | |||
399 | } | 400 | } |
400 | } | 401 | } |
401 | 402 | ||
402 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 403 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
403 | { | 404 | { |
404 | const int ROWS_PER_QUERY = 5000; | 405 | const int ROWS_PER_QUERY = 5000; |
405 | 406 | ||
@@ -455,7 +456,9 @@ namespace OpenSim.Data.MySQL | |||
455 | foreach (SceneObjectPart prim in prims.Values) | 456 | foreach (SceneObjectPart prim in prims.Values) |
456 | { | 457 | { |
457 | if (prim.ParentUUID == UUID.Zero) | 458 | if (prim.ParentUUID == UUID.Zero) |
459 | { | ||
458 | objects[prim.UUID] = new SceneObjectGroup(prim); | 460 | objects[prim.UUID] = new SceneObjectGroup(prim); |
461 | } | ||
459 | } | 462 | } |
460 | 463 | ||
461 | // Add all of the children objects to the SOGs | 464 | // Add all of the children objects to the SOGs |
@@ -568,36 +571,51 @@ namespace OpenSim.Data.MySQL | |||
568 | } | 571 | } |
569 | } | 572 | } |
570 | 573 | ||
571 | public void StoreTerrain(double[,] ter, UUID regionID) | 574 | public virtual void StoreTerrain(double[,] ter, UUID regionID) |
572 | { | 575 | { |
573 | m_log.Info("[REGION DB]: Storing terrain"); | 576 | Util.FireAndForget(delegate(object x) |
574 | |||
575 | lock (m_dbLock) | ||
576 | { | 577 | { |
577 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 578 | double[,] oldTerrain = LoadTerrain(regionID); |
578 | { | ||
579 | dbcon.Open(); | ||
580 | 579 | ||
581 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 580 | m_log.Info("[REGION DB]: Storing terrain"); |
581 | |||
582 | lock (m_dbLock) | ||
583 | { | ||
584 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
582 | { | 585 | { |
583 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | 586 | dbcon.Open(); |
584 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
585 | 587 | ||
586 | ExecuteNonQuery(cmd); | 588 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
589 | { | ||
590 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | ||
591 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
587 | 592 | ||
588 | cmd.CommandText = "insert into terrain (RegionUUID, " + | 593 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) |
589 | "Revision, Heightfield) values (?RegionUUID, " + | 594 | { |
590 | "1, ?Heightfield)"; | 595 | try |
591 | 596 | { | |
592 | cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); | 597 | cmd2.CommandText = "insert into terrain (RegionUUID, " + |
598 | "Revision, Heightfield) values (?RegionUUID, " + | ||
599 | "1, ?Heightfield)"; | ||
593 | 600 | ||
594 | ExecuteNonQuery(cmd); | 601 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); |
602 | cmd2.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter, oldTerrain)); | ||
603 | |||
604 | ExecuteNonQuery(cmd); | ||
605 | ExecuteNonQuery(cmd2); | ||
606 | } | ||
607 | catch (Exception e) | ||
608 | { | ||
609 | m_log.ErrorFormat(e.ToString()); | ||
610 | } | ||
611 | } | ||
612 | } | ||
595 | } | 613 | } |
596 | } | 614 | } |
597 | } | 615 | }); |
598 | } | 616 | } |
599 | 617 | ||
600 | public double[,] LoadTerrain(UUID regionID) | 618 | public virtual double[,] LoadTerrain(UUID regionID) |
601 | { | 619 | { |
602 | double[,] terrain = null; | 620 | double[,] terrain = null; |
603 | 621 | ||
@@ -647,7 +665,7 @@ namespace OpenSim.Data.MySQL | |||
647 | return terrain; | 665 | return terrain; |
648 | } | 666 | } |
649 | 667 | ||
650 | public void RemoveLandObject(UUID globalID) | 668 | public virtual void RemoveLandObject(UUID globalID) |
651 | { | 669 | { |
652 | lock (m_dbLock) | 670 | lock (m_dbLock) |
653 | { | 671 | { |
@@ -666,7 +684,7 @@ namespace OpenSim.Data.MySQL | |||
666 | } | 684 | } |
667 | } | 685 | } |
668 | 686 | ||
669 | public void StoreLandObject(ILandObject parcel) | 687 | public virtual void StoreLandObject(ILandObject parcel) |
670 | { | 688 | { |
671 | lock (m_dbLock) | 689 | lock (m_dbLock) |
672 | { | 690 | { |
@@ -723,7 +741,7 @@ namespace OpenSim.Data.MySQL | |||
723 | } | 741 | } |
724 | } | 742 | } |
725 | 743 | ||
726 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 744 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
727 | { | 745 | { |
728 | RegionLightShareData nWP = new RegionLightShareData(); | 746 | RegionLightShareData nWP = new RegionLightShareData(); |
729 | nWP.OnSave += StoreRegionWindlightSettings; | 747 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -824,7 +842,7 @@ namespace OpenSim.Data.MySQL | |||
824 | return nWP; | 842 | return nWP; |
825 | } | 843 | } |
826 | 844 | ||
827 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 845 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
828 | { | 846 | { |
829 | RegionSettings rs = null; | 847 | RegionSettings rs = null; |
830 | 848 | ||
@@ -864,7 +882,7 @@ namespace OpenSim.Data.MySQL | |||
864 | return rs; | 882 | return rs; |
865 | } | 883 | } |
866 | 884 | ||
867 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 885 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
868 | { | 886 | { |
869 | lock (m_dbLock) | 887 | lock (m_dbLock) |
870 | { | 888 | { |
@@ -970,7 +988,7 @@ namespace OpenSim.Data.MySQL | |||
970 | } | 988 | } |
971 | } | 989 | } |
972 | 990 | ||
973 | public void RemoveRegionWindlightSettings(UUID regionID) | 991 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
974 | { | 992 | { |
975 | lock (m_dbLock) | 993 | lock (m_dbLock) |
976 | { | 994 | { |
@@ -1059,7 +1077,7 @@ namespace OpenSim.Data.MySQL | |||
1059 | } | 1077 | } |
1060 | #endregion | 1078 | #endregion |
1061 | 1079 | ||
1062 | public void StoreRegionSettings(RegionSettings rs) | 1080 | public virtual void StoreRegionSettings(RegionSettings rs) |
1063 | { | 1081 | { |
1064 | lock (m_dbLock) | 1082 | lock (m_dbLock) |
1065 | { | 1083 | { |
@@ -1086,7 +1104,7 @@ namespace OpenSim.Data.MySQL | |||
1086 | "use_estate_sun, fixed_sun, sun_position, " + | 1104 | "use_estate_sun, fixed_sun, sun_position, " + |
1087 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + | 1105 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + |
1088 | "sunvectorz, loaded_creation_datetime, " + | 1106 | "sunvectorz, loaded_creation_datetime, " + |
1089 | "loaded_creation_id, map_tile_ID, " + | 1107 | "loaded_creation_id, map_tile_ID, block_search, casino, " + |
1090 | "TelehubObject, parcel_tile_ID) " + | 1108 | "TelehubObject, parcel_tile_ID) " + |
1091 | "values (?RegionUUID, ?BlockTerraform, " + | 1109 | "values (?RegionUUID, ?BlockTerraform, " + |
1092 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1110 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
@@ -1103,7 +1121,7 @@ namespace OpenSim.Data.MySQL | |||
1103 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + | 1121 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + |
1104 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1122 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1105 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1123 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1106 | "?TerrainImageID, " + | 1124 | "?TerrainImageID, ?block_search, ?casino, " + |
1107 | "?TelehubObject, ?ParcelImageID)"; | 1125 | "?TelehubObject, ?ParcelImageID)"; |
1108 | 1126 | ||
1109 | FillRegionSettingsCommand(cmd, rs); | 1127 | FillRegionSettingsCommand(cmd, rs); |
@@ -1115,7 +1133,7 @@ namespace OpenSim.Data.MySQL | |||
1115 | SaveSpawnPoints(rs); | 1133 | SaveSpawnPoints(rs); |
1116 | } | 1134 | } |
1117 | 1135 | ||
1118 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1136 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1119 | { | 1137 | { |
1120 | List<LandData> landData = new List<LandData>(); | 1138 | List<LandData> landData = new List<LandData>(); |
1121 | 1139 | ||
@@ -1297,6 +1315,7 @@ namespace OpenSim.Data.MySQL | |||
1297 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; | 1315 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; |
1298 | 1316 | ||
1299 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); | 1317 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); |
1318 | prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); | ||
1300 | prim.LinkNum = (int)row["LinkNumber"]; | 1319 | prim.LinkNum = (int)row["LinkNumber"]; |
1301 | 1320 | ||
1302 | if (!(row["MediaURL"] is System.DBNull)) | 1321 | if (!(row["MediaURL"] is System.DBNull)) |
@@ -1307,12 +1326,34 @@ namespace OpenSim.Data.MySQL | |||
1307 | else | 1326 | else |
1308 | prim.DynAttrs = new DAMap(); | 1327 | prim.DynAttrs = new DAMap(); |
1309 | 1328 | ||
1329 | if (!(row["KeyframeMotion"] is DBNull)) | ||
1330 | { | ||
1331 | Byte[] data = (byte[])row["KeyframeMotion"]; | ||
1332 | if (data.Length > 0) | ||
1333 | prim.KeyframeMotion = KeyframeMotion.FromData(null, data); | ||
1334 | else | ||
1335 | prim.KeyframeMotion = null; | ||
1336 | } | ||
1337 | else | ||
1338 | { | ||
1339 | prim.KeyframeMotion = null; | ||
1340 | } | ||
1341 | |||
1310 | prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString()); | 1342 | prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString()); |
1311 | prim.Density = (float)(double)row["Density"]; | 1343 | prim.Density = (float)(double)row["Density"]; |
1312 | prim.GravityModifier = (float)(double)row["GravityModifier"]; | 1344 | prim.GravityModifier = (float)(double)row["GravityModifier"]; |
1313 | prim.Friction = (float)(double)row["Friction"]; | 1345 | prim.Friction = (float)(double)row["Friction"]; |
1314 | prim.Restitution = (float)(double)row["Restitution"]; | 1346 | prim.Restitution = (float)(double)row["Restitution"]; |
1315 | 1347 | ||
1348 | SOPVehicle vehicle = null; | ||
1349 | |||
1350 | if (row["Vehicle"].ToString() != String.Empty) | ||
1351 | { | ||
1352 | vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString()); | ||
1353 | if (vehicle != null) | ||
1354 | prim.VehicleParams = vehicle; | ||
1355 | } | ||
1356 | |||
1316 | return prim; | 1357 | return prim; |
1317 | } | 1358 | } |
1318 | 1359 | ||
@@ -1323,32 +1364,40 @@ namespace OpenSim.Data.MySQL | |||
1323 | /// <returns></returns> | 1364 | /// <returns></returns> |
1324 | private static TaskInventoryItem BuildItem(IDataReader row) | 1365 | private static TaskInventoryItem BuildItem(IDataReader row) |
1325 | { | 1366 | { |
1326 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1367 | try |
1327 | 1368 | { | |
1328 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); | 1369 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1329 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); | 1370 | |
1330 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | 1371 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1331 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); | 1372 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1332 | 1373 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | |
1333 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1374 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1334 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1375 | |
1335 | 1376 | taskItem.InvType = Convert.ToInt32(row["invType"]); | |
1336 | taskItem.Name = (String)row["name"]; | 1377 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
1337 | taskItem.Description = (String)row["description"]; | 1378 | |
1338 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1379 | taskItem.Name = (String)row["name"]; |
1339 | taskItem.CreatorIdentification = (String)row["creatorID"]; | 1380 | taskItem.Description = (String)row["description"]; |
1340 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); | 1381 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1341 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | 1382 | taskItem.CreatorIdentification = (String)row["creatorID"]; |
1342 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); | 1383 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1343 | 1384 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | |
1344 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1385 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1345 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1386 | |
1346 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | 1387 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1347 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | 1388 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
1348 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | 1389 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); |
1349 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | 1390 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); |
1350 | 1391 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | |
1351 | return taskItem; | 1392 | taskItem.Flags = Convert.ToUInt32(row["flags"]); |
1393 | |||
1394 | return taskItem; | ||
1395 | } | ||
1396 | catch | ||
1397 | { | ||
1398 | m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString()); | ||
1399 | throw; | ||
1400 | } | ||
1352 | } | 1401 | } |
1353 | 1402 | ||
1354 | private static RegionSettings BuildRegionSettings(IDataReader row) | 1403 | private static RegionSettings BuildRegionSettings(IDataReader row) |
@@ -1406,6 +1455,9 @@ namespace OpenSim.Data.MySQL | |||
1406 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); | 1455 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); |
1407 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | 1456 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); |
1408 | 1457 | ||
1458 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1459 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1460 | |||
1409 | return newSettings; | 1461 | return newSettings; |
1410 | } | 1462 | } |
1411 | 1463 | ||
@@ -1503,7 +1555,7 @@ namespace OpenSim.Data.MySQL | |||
1503 | /// </summary> | 1555 | /// </summary> |
1504 | /// <param name="val"></param> | 1556 | /// <param name="val"></param> |
1505 | /// <returns></returns> | 1557 | /// <returns></returns> |
1506 | private static Array SerializeTerrain(double[,] val) | 1558 | private static Array SerializeTerrain(double[,] val, double[,] oldTerrain) |
1507 | { | 1559 | { |
1508 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); | 1560 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); |
1509 | BinaryWriter bw = new BinaryWriter(str); | 1561 | BinaryWriter bw = new BinaryWriter(str); |
@@ -1512,7 +1564,11 @@ namespace OpenSim.Data.MySQL | |||
1512 | for (int x = 0; x < (int)Constants.RegionSize; x++) | 1564 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
1513 | for (int y = 0; y < (int)Constants.RegionSize; y++) | 1565 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
1514 | { | 1566 | { |
1515 | double height = val[x, y]; | 1567 | double height = 20.0; |
1568 | if (oldTerrain != null) | ||
1569 | height = oldTerrain[x, y]; | ||
1570 | if (!double.IsNaN(val[x, y])) | ||
1571 | height = val[x, y]; | ||
1516 | if (height == 0.0) | 1572 | if (height == 0.0) |
1517 | height = double.Epsilon; | 1573 | height = double.Epsilon; |
1518 | 1574 | ||
@@ -1656,9 +1712,23 @@ namespace OpenSim.Data.MySQL | |||
1656 | else | 1712 | else |
1657 | cmd.Parameters.AddWithValue("PassTouches", 0); | 1713 | cmd.Parameters.AddWithValue("PassTouches", 0); |
1658 | 1714 | ||
1715 | if (prim.PassCollisions) | ||
1716 | cmd.Parameters.AddWithValue("PassCollisions", 1); | ||
1717 | else | ||
1718 | cmd.Parameters.AddWithValue("PassCollisions", 0); | ||
1719 | |||
1659 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); | 1720 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); |
1660 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); | 1721 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); |
1661 | 1722 | ||
1723 | if (prim.KeyframeMotion != null) | ||
1724 | cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize()); | ||
1725 | else | ||
1726 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | ||
1727 | |||
1728 | if (prim.VehicleParams != null) | ||
1729 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1730 | else | ||
1731 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1662 | 1732 | ||
1663 | if (prim.DynAttrs.Count > 0) | 1733 | if (prim.DynAttrs.Count > 0) |
1664 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); | 1734 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); |
@@ -1748,6 +1818,8 @@ namespace OpenSim.Data.MySQL | |||
1748 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1818 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1749 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1819 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1750 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1820 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1821 | cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch); | ||
1822 | cmd.Parameters.AddWithValue("casino", settings.Casino); | ||
1751 | 1823 | ||
1752 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); | 1824 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); |
1753 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | 1825 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); |
@@ -1909,7 +1981,7 @@ namespace OpenSim.Data.MySQL | |||
1909 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 1981 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1910 | } | 1982 | } |
1911 | 1983 | ||
1912 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 1984 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1913 | { | 1985 | { |
1914 | lock (m_dbLock) | 1986 | lock (m_dbLock) |
1915 | { | 1987 | { |
@@ -1953,6 +2025,37 @@ namespace OpenSim.Data.MySQL | |||
1953 | } | 2025 | } |
1954 | } | 2026 | } |
1955 | 2027 | ||
2028 | public UUID[] GetObjectIDs(UUID regionID) | ||
2029 | { | ||
2030 | List<UUID> uuids = new List<UUID>(); | ||
2031 | |||
2032 | lock (m_dbLock) | ||
2033 | { | ||
2034 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
2035 | { | ||
2036 | dbcon.Open(); | ||
2037 | |||
2038 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
2039 | { | ||
2040 | cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID"; | ||
2041 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
2042 | |||
2043 | using (IDataReader reader = ExecuteReader(cmd)) | ||
2044 | { | ||
2045 | while (reader.Read()) | ||
2046 | { | ||
2047 | UUID id = new UUID(reader["UUID"].ToString()); | ||
2048 | |||
2049 | uuids.Add(id); | ||
2050 | } | ||
2051 | } | ||
2052 | } | ||
2053 | } | ||
2054 | } | ||
2055 | |||
2056 | return uuids.ToArray(); | ||
2057 | } | ||
2058 | |||
1956 | private void LoadSpawnPoints(RegionSettings rs) | 2059 | private void LoadSpawnPoints(RegionSettings rs) |
1957 | { | 2060 | { |
1958 | rs.ClearSpawnPoints(); | 2061 | rs.ClearSpawnPoints(); |