diff options
author | Sean Dague | 2008-11-18 12:48:36 +0000 |
---|---|---|
committer | Sean Dague | 2008-11-18 12:48:36 +0000 |
commit | 5517ea3dfd9201217a829eadc38d20030bd65117 (patch) | |
tree | b6489909b3abba8fb76f20d070851ae7a0299730 /OpenSim/Data | |
parent | Extended Agent Tests (diff) | |
download | opensim-SC-5517ea3dfd9201217a829eadc38d20030bd65117.zip opensim-SC-5517ea3dfd9201217a829eadc38d20030bd65117.tar.gz opensim-SC-5517ea3dfd9201217a829eadc38d20030bd65117.tar.bz2 opensim-SC-5517ea3dfd9201217a829eadc38d20030bd65117.tar.xz |
Fixed MySQL and SQLite so they will save the
variable sun vector, adding 3 new fields on both.
From: Arthur Rodrigo S Valadares <arthursv@linux.vnet.ibm.com>
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 11 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/021_RegionStore.sql | 8 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/Resources/014_RegionStore.sql | 8 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 11 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicRegionTest.cs | 148 |
5 files changed, 177 insertions, 9 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index fcb4c0b..effe10b 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -868,6 +868,9 @@ namespace OpenSim.Data.MySQL | |||
868 | createCol(regionsettings, "terrain_lower_limit", typeof (Double)); | 868 | createCol(regionsettings, "terrain_lower_limit", typeof (Double)); |
869 | createCol(regionsettings, "use_estate_sun", typeof (Int32)); | 869 | createCol(regionsettings, "use_estate_sun", typeof (Int32)); |
870 | createCol(regionsettings, "sandbox", typeof (Int32)); | 870 | createCol(regionsettings, "sandbox", typeof (Int32)); |
871 | createCol(regionsettings, "sunvectorx",typeof (Double)); | ||
872 | createCol(regionsettings, "sunvectory",typeof (Double)); | ||
873 | createCol(regionsettings, "sunvectorz",typeof (Double)); | ||
871 | createCol(regionsettings, "fixed_sun", typeof (Int32)); | 874 | createCol(regionsettings, "fixed_sun", typeof (Int32)); |
872 | createCol(regionsettings, "sun_position", typeof (Double)); | 875 | createCol(regionsettings, "sun_position", typeof (Double)); |
873 | createCol(regionsettings, "covenant", typeof(String)); | 876 | createCol(regionsettings, "covenant", typeof(String)); |
@@ -1342,6 +1345,11 @@ namespace OpenSim.Data.MySQL | |||
1342 | newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); | 1345 | newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); |
1343 | newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); | 1346 | newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); |
1344 | newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); | 1347 | newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); |
1348 | newSettings.SunVector = new Vector3 ( | ||
1349 | Convert.ToSingle(row["sunvectorx"]), | ||
1350 | Convert.ToSingle(row["sunvectory"]), | ||
1351 | Convert.ToSingle(row["sunvectorz"]) | ||
1352 | ); | ||
1345 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); | 1353 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); |
1346 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); | 1354 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); |
1347 | newSettings.Covenant = new UUID((String) row["covenant"]); | 1355 | newSettings.Covenant = new UUID((String) row["covenant"]); |
@@ -1649,6 +1657,9 @@ namespace OpenSim.Data.MySQL | |||
1649 | row["terrain_lower_limit"] = settings.TerrainLowerLimit; | 1657 | row["terrain_lower_limit"] = settings.TerrainLowerLimit; |
1650 | row["use_estate_sun"] = settings.UseEstateSun; | 1658 | row["use_estate_sun"] = settings.UseEstateSun; |
1651 | row["sandbox"] = settings.Sandbox; | 1659 | row["sandbox"] = settings.Sandbox; |
1660 | row["sunvectorx"] = settings.SunVector.X; | ||
1661 | row["sunvectory"] = settings.SunVector.Y; | ||
1662 | row["sunvectorz"] = settings.SunVector.Z; | ||
1652 | row["fixed_sun"] = settings.FixedSun; | 1663 | row["fixed_sun"] = settings.FixedSun; |
1653 | row["sun_position"] = settings.SunPosition; | 1664 | row["sun_position"] = settings.SunPosition; |
1654 | row["covenant"] = settings.Covenant.ToString(); | 1665 | row["covenant"] = settings.Covenant.ToString(); |
diff --git a/OpenSim/Data/MySQL/Resources/021_RegionStore.sql b/OpenSim/Data/MySQL/Resources/021_RegionStore.sql new file mode 100644 index 0000000..c59b27e --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/021_RegionStore.sql | |||
@@ -0,0 +1,8 @@ | |||
1 | begin; | ||
2 | |||
3 | ALTER TABLE regionsettings ADD COLUMN sunvectorx double NOT NULL default 0; | ||
4 | ALTER TABLE regionsettings ADD COLUMN sunvectory double NOT NULL default 0; | ||
5 | ALTER TABLE regionsettings ADD COLUMN sunvectorz double NOT NULL default 0; | ||
6 | |||
7 | commit; | ||
8 | |||
diff --git a/OpenSim/Data/SQLite/Resources/014_RegionStore.sql b/OpenSim/Data/SQLite/Resources/014_RegionStore.sql new file mode 100644 index 0000000..c59b27e --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/014_RegionStore.sql | |||
@@ -0,0 +1,8 @@ | |||
1 | begin; | ||
2 | |||
3 | ALTER TABLE regionsettings ADD COLUMN sunvectorx double NOT NULL default 0; | ||
4 | ALTER TABLE regionsettings ADD COLUMN sunvectory double NOT NULL default 0; | ||
5 | ALTER TABLE regionsettings ADD COLUMN sunvectorz double NOT NULL default 0; | ||
6 | |||
7 | commit; | ||
8 | |||
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 9d6d500..4ce343a 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -1064,6 +1064,9 @@ namespace OpenSim.Data.SQLite | |||
1064 | createCol(regionsettings, "terrain_lower_limit", typeof (Double)); | 1064 | createCol(regionsettings, "terrain_lower_limit", typeof (Double)); |
1065 | createCol(regionsettings, "use_estate_sun", typeof (Int32)); | 1065 | createCol(regionsettings, "use_estate_sun", typeof (Int32)); |
1066 | createCol(regionsettings, "sandbox", typeof (Int32)); | 1066 | createCol(regionsettings, "sandbox", typeof (Int32)); |
1067 | createCol(regionsettings, "sunvectorx",typeof (Double)); | ||
1068 | createCol(regionsettings, "sunvectory",typeof (Double)); | ||
1069 | createCol(regionsettings, "sunvectorz",typeof (Double)); | ||
1067 | createCol(regionsettings, "fixed_sun", typeof (Int32)); | 1070 | createCol(regionsettings, "fixed_sun", typeof (Int32)); |
1068 | createCol(regionsettings, "sun_position", typeof (Double)); | 1071 | createCol(regionsettings, "sun_position", typeof (Double)); |
1069 | createCol(regionsettings, "covenant", typeof(String)); | 1072 | createCol(regionsettings, "covenant", typeof(String)); |
@@ -1373,6 +1376,11 @@ namespace OpenSim.Data.SQLite | |||
1373 | newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); | 1376 | newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); |
1374 | newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); | 1377 | newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); |
1375 | newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); | 1378 | newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); |
1379 | newSettings.SunVector = new Vector3 ( | ||
1380 | Convert.ToSingle(row["sunvectorx"]), | ||
1381 | Convert.ToSingle(row["sunvectory"]), | ||
1382 | Convert.ToSingle(row["sunvectorz"]) | ||
1383 | ); | ||
1376 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); | 1384 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); |
1377 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); | 1385 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); |
1378 | newSettings.Covenant = new UUID((String) row["covenant"]); | 1386 | newSettings.Covenant = new UUID((String) row["covenant"]); |
@@ -1681,6 +1689,9 @@ namespace OpenSim.Data.SQLite | |||
1681 | row["terrain_lower_limit"] = settings.TerrainLowerLimit; | 1689 | row["terrain_lower_limit"] = settings.TerrainLowerLimit; |
1682 | row["use_estate_sun"] = settings.UseEstateSun; | 1690 | row["use_estate_sun"] = settings.UseEstateSun; |
1683 | row["sandbox"] = settings.Sandbox; | 1691 | row["sandbox"] = settings.Sandbox; |
1692 | row["sunvectorx"] = settings.SunVector.X; | ||
1693 | row["sunvectory"] = settings.SunVector.Y; | ||
1694 | row["sunvectorz"] = settings.SunVector.Z; | ||
1684 | row["fixed_sun"] = settings.FixedSun; | 1695 | row["fixed_sun"] = settings.FixedSun; |
1685 | row["sun_position"] = settings.SunPosition; | 1696 | row["sun_position"] = settings.SunPosition; |
1686 | row["covenant"] = settings.Covenant.ToString(); | 1697 | row["covenant"] = settings.Covenant.ToString(); |
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index ff8f8c3..a7d62d0 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs | |||
@@ -467,7 +467,52 @@ namespace OpenSim.Data.Tests | |||
467 | Assert.That(clickaction,Is.EqualTo(p.ClickAction)); | 467 | Assert.That(clickaction,Is.EqualTo(p.ClickAction)); |
468 | Assert.That(scale,Is.EqualTo(p.Scale)); | 468 | Assert.That(scale,Is.EqualTo(p.Scale)); |
469 | } | 469 | } |
470 | 470 | ||
471 | [Test] | ||
472 | public void T015_LargeSceneObjects() | ||
473 | { | ||
474 | UUID id = UUID.Random(); | ||
475 | Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); | ||
476 | SceneObjectGroup sog = NewSOG("Test SOG",id); | ||
477 | mydic.Add(sog.RootPart.UUID,sog.RootPart); | ||
478 | Console.WriteLine("Let's Start!"); | ||
479 | for (int i=0;i<30;i++) | ||
480 | { | ||
481 | UUID tmp = UUID.Random(); | ||
482 | SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); | ||
483 | Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next()); | ||
484 | Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next()); | ||
485 | Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next()); | ||
486 | Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next()); | ||
487 | Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); | ||
488 | Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); | ||
489 | |||
490 | sop.GroupPosition = groupos; | ||
491 | sop.RotationOffset = rotoff; | ||
492 | sop.OffsetPosition = offset; | ||
493 | sop.Velocity = velocity; | ||
494 | sop.AngularVelocity = angvelo; | ||
495 | sop.Acceleration = accel; | ||
496 | |||
497 | mydic.Add(tmp,sop); | ||
498 | sog.AddPart(sop); | ||
499 | db.StoreObject(sog, region4); | ||
500 | } | ||
501 | |||
502 | SceneObjectGroup retsog = FindSOG("Test SOG", region4); | ||
503 | SceneObjectPart[] parts = retsog.GetParts(); | ||
504 | for (int i=0;i<30;i++) | ||
505 | { | ||
506 | SceneObjectPart cursop = mydic[parts[i].UUID]; | ||
507 | Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition)); | ||
508 | Assert.That(cursop.RotationOffset,Is.EqualTo(parts[i].RotationOffset)); | ||
509 | Assert.That(cursop.OffsetPosition,Is.EqualTo(parts[i].OffsetPosition)); | ||
510 | Assert.That(cursop.Velocity,Is.EqualTo(parts[i].Velocity)); | ||
511 | Assert.That(cursop.AngularVelocity,Is.EqualTo(parts[i].AngularVelocity)); | ||
512 | Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration)); | ||
513 | } | ||
514 | } | ||
515 | |||
471 | [Test] | 516 | [Test] |
472 | public void T020_PrimInventoryEmpty() | 517 | public void T020_PrimInventoryEmpty() |
473 | { | 518 | { |
@@ -660,21 +705,106 @@ namespace OpenSim.Data.Tests | |||
660 | [Test] | 705 | [Test] |
661 | public void T101_UpdateRegionInfo() | 706 | public void T101_UpdateRegionInfo() |
662 | { | 707 | { |
663 | bool blockfly = true; | 708 | int agentlimit = random.Next(); |
664 | double sunpos = 0.5; | 709 | double objectbonus = random.NextDouble(); |
710 | int maturity = random.Next(); | ||
711 | UUID tertex1 = UUID.Random(); | ||
712 | UUID tertex2 = UUID.Random(); | ||
713 | UUID tertex3 = UUID.Random(); | ||
714 | UUID tertex4 = UUID.Random(); | ||
715 | double elev1nw = random.NextDouble(); | ||
716 | double elev2nw = random.NextDouble(); | ||
717 | double elev1ne = random.NextDouble(); | ||
718 | double elev2ne = random.NextDouble(); | ||
719 | double elev1se = random.NextDouble(); | ||
720 | double elev2se = random.NextDouble(); | ||
721 | double elev1sw = random.NextDouble(); | ||
722 | double elev2sw = random.NextDouble(); | ||
723 | double waterh = random.NextDouble(); | ||
724 | double terrainraise = random.NextDouble(); | ||
725 | double terrainlower = random.NextDouble(); | ||
726 | Vector3 sunvector = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5)); | ||
727 | UUID terimgid = UUID.Random(); | ||
728 | double sunpos = random.NextDouble(); | ||
665 | UUID cov = UUID.Random(); | 729 | UUID cov = UUID.Random(); |
666 | 730 | ||
667 | RegionSettings r1 = db.LoadRegionSettings(region1); | 731 | RegionSettings r1 = db.LoadRegionSettings(region1); |
668 | r1.BlockFly = blockfly; | 732 | r1.BlockTerraform = true; |
733 | r1.BlockFly = true; | ||
734 | r1.AllowDamage = true; | ||
735 | r1.RestrictPushing = true; | ||
736 | r1.AllowLandResell = false; | ||
737 | r1.AllowLandJoinDivide = false; | ||
738 | r1.BlockShowInSearch = true; | ||
739 | r1.AgentLimit = agentlimit; | ||
740 | r1.ObjectBonus = objectbonus; | ||
741 | r1.Maturity = maturity; | ||
742 | r1.DisableScripts = true; | ||
743 | r1.DisableCollisions = true; | ||
744 | r1.DisablePhysics = true; | ||
745 | r1.TerrainTexture1 = tertex1; | ||
746 | r1.TerrainTexture2 = tertex2; | ||
747 | r1.TerrainTexture3 = tertex3; | ||
748 | r1.TerrainTexture4 = tertex4; | ||
749 | r1.Elevation1NW = elev1nw; | ||
750 | r1.Elevation2NW = elev2nw; | ||
751 | r1.Elevation1NE = elev1ne; | ||
752 | r1.Elevation2NE = elev2ne; | ||
753 | r1.Elevation1SE = elev1se; | ||
754 | r1.Elevation2SE = elev2se; | ||
755 | r1.Elevation1SW = elev1sw; | ||
756 | r1.Elevation2SW = elev2sw; | ||
757 | r1.WaterHeight = waterh; | ||
758 | r1.TerrainRaiseLimit = terrainraise; | ||
759 | r1.TerrainLowerLimit = terrainlower; | ||
760 | r1.UseEstateSun = false; | ||
761 | r1.Sandbox = true; | ||
762 | r1.SunVector = sunvector; | ||
763 | r1.TerrainImageID = terimgid; | ||
764 | r1.FixedSun = true; | ||
669 | r1.SunPosition = sunpos; | 765 | r1.SunPosition = sunpos; |
670 | r1.Covenant = cov; | 766 | r1.Covenant = cov; |
767 | |||
671 | db.StoreRegionSettings(r1); | 768 | db.StoreRegionSettings(r1); |
672 | 769 | ||
673 | RegionSettings r2 = db.LoadRegionSettings(region1); | 770 | RegionSettings r1a = db.LoadRegionSettings(region1); |
674 | Assert.That(r2.RegionUUID, Is.EqualTo(region1)); | 771 | Assert.That(r1a.RegionUUID, Is.EqualTo(region1)); |
675 | Assert.That(r2.SunPosition, Is.EqualTo(sunpos)); | 772 | Assert.That(r1a.BlockTerraform,Is.True); |
676 | Assert.That(r2.BlockFly, Is.EqualTo(blockfly)); | 773 | Assert.That(r1a.BlockFly,Is.True); |
677 | Assert.That(r2.Covenant, Is.EqualTo(cov)); | 774 | Assert.That(r1a.AllowDamage,Is.True); |
775 | Assert.That(r1a.RestrictPushing,Is.True); | ||
776 | Assert.That(r1a.AllowLandResell,Is.False); | ||
777 | Assert.That(r1a.AllowLandJoinDivide,Is.False); | ||
778 | Assert.That(r1a.BlockShowInSearch,Is.True); | ||
779 | Assert.That(r1a.AgentLimit,Is.EqualTo(agentlimit)); | ||
780 | Assert.That(r1a.ObjectBonus,Is.EqualTo(objectbonus)); | ||
781 | Assert.That(r1a.Maturity,Is.EqualTo(maturity)); | ||
782 | Assert.That(r1a.DisableScripts,Is.True); | ||
783 | Assert.That(r1a.DisableCollisions,Is.True); | ||
784 | Assert.That(r1a.DisablePhysics,Is.True); | ||
785 | Assert.That(r1a.TerrainTexture1,Is.EqualTo(tertex1)); | ||
786 | Assert.That(r1a.TerrainTexture2,Is.EqualTo(tertex2)); | ||
787 | Assert.That(r1a.TerrainTexture3,Is.EqualTo(tertex3)); | ||
788 | Assert.That(r1a.TerrainTexture4,Is.EqualTo(tertex4)); | ||
789 | Assert.That(r1a.Elevation1NW,Is.EqualTo(elev1nw)); | ||
790 | Assert.That(r1a.Elevation2NW,Is.EqualTo(elev2nw)); | ||
791 | Assert.That(r1a.Elevation1NE,Is.EqualTo(elev1ne)); | ||
792 | Assert.That(r1a.Elevation2NE,Is.EqualTo(elev2ne)); | ||
793 | Assert.That(r1a.Elevation1SE,Is.EqualTo(elev1se)); | ||
794 | Assert.That(r1a.Elevation2SE,Is.EqualTo(elev2se)); | ||
795 | Assert.That(r1a.Elevation1SW,Is.EqualTo(elev1sw)); | ||
796 | Assert.That(r1a.Elevation2SW,Is.EqualTo(elev2sw)); | ||
797 | Assert.That(r1a.WaterHeight,Is.EqualTo(waterh)); | ||
798 | Assert.That(r1a.TerrainRaiseLimit,Is.EqualTo(terrainraise)); | ||
799 | Assert.That(r1a.TerrainLowerLimit,Is.EqualTo(terrainlower)); | ||
800 | Assert.That(r1a.UseEstateSun,Is.False); | ||
801 | Assert.That(r1a.Sandbox,Is.True); | ||
802 | Assert.That(r1a.SunVector,Is.EqualTo(sunvector)); | ||
803 | //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid)); | ||
804 | Assert.That(r1a.FixedSun,Is.True); | ||
805 | Assert.That(r1a.SunPosition, Is.EqualTo(sunpos)); | ||
806 | Assert.That(r1a.Covenant, Is.EqualTo(cov)); | ||
807 | |||
678 | } | 808 | } |
679 | 809 | ||
680 | [Test] | 810 | [Test] |