aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/SQLite/SQLiteEstateData.cs4
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs123
8 files changed, 104 insertions, 61 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index 9dd4a2e..fcf041e 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -328,7 +328,7 @@ namespace OpenSim.Data.SQLite
328 328
329 public EstateSettings LoadEstateSettings(int estateID) 329 public EstateSettings LoadEstateSettings(int estateID)
330 { 330 {
331 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID"; 331 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
332 332
333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
334 334
@@ -342,7 +342,7 @@ namespace OpenSim.Data.SQLite
342 { 342 {
343 List<int> result = new List<int>(); 343 List<int> result = new List<int>();
344 344
345 string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName"; 345 string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
346 346
347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
348 348
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
index e135eaa..bf8ee14 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
@@ -328,7 +328,7 @@ namespace OpenSim.Data.SQLiteLegacy
328 328
329 public EstateSettings LoadEstateSettings(int estateID) 329 public EstateSettings LoadEstateSettings(int estateID)
330 { 330 {
331 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID"; 331 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
332 332
333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
334 334
@@ -342,7 +342,7 @@ namespace OpenSim.Data.SQLiteLegacy
342 { 342 {
343 List<int> result = new List<int>(); 343 List<int> result = new List<int>();
344 344
345 string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName"; 345 string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
346 346
347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
348 348
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 0c9759d..e060c05 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -183,7 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
183 public event ScriptChangedEvent OnScriptChangedEvent; 183 public event ScriptChangedEvent OnScriptChangedEvent;
184 public delegate void ScriptChangedEvent(uint localID, uint change); 184 public delegate void ScriptChangedEvent(uint localID, uint change);
185 185
186 public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed); 186 public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed);
187 public event ScriptControlEvent OnScriptControlEvent; 187 public event ScriptControlEvent OnScriptControlEvent;
188 188
189 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); 189 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
@@ -1619,7 +1619,7 @@ namespace OpenSim.Region.Framework.Scenes
1619 } 1619 }
1620 } 1620 }
1621 1621
1622 internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) 1622 internal void TriggerControlEvent(UUID scriptUUID, UUID avatarID, uint held, uint _changed)
1623 { 1623 {
1624 ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent; 1624 ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent;
1625 if (handlerScriptControlEvent != null) 1625 if (handlerScriptControlEvent != null)
@@ -1628,7 +1628,7 @@ namespace OpenSim.Region.Framework.Scenes
1628 { 1628 {
1629 try 1629 try
1630 { 1630 {
1631 d(p, scriptUUID, avatarID, held, _changed); 1631 d(scriptUUID, avatarID, held, _changed);
1632 } 1632 }
1633 catch (Exception e) 1633 catch (Exception e)
1634 { 1634 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e51d9ee..5ac7755 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -61,7 +61,6 @@ namespace OpenSim.Region.Framework.Scenes
61 struct ScriptControllers 61 struct ScriptControllers
62 { 62 {
63 public UUID itemID; 63 public UUID itemID;
64 public uint objID;
65 public ScriptControlled ignoreControls; 64 public ScriptControlled ignoreControls;
66 public ScriptControlled eventControls; 65 public ScriptControlled eventControls;
67 } 66 }
@@ -3945,7 +3944,6 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
3945 obj.eventControls = ScriptControlled.CONTROL_ZERO; 3944 obj.eventControls = ScriptControlled.CONTROL_ZERO;
3946 3945
3947 obj.itemID = Script_item_UUID; 3946 obj.itemID = Script_item_UUID;
3948 obj.objID = Obj_localID;
3949 if (pass_on == 0 && accept == 0) 3947 if (pass_on == 0 && accept == 0)
3950 { 3948 {
3951 IgnoredControls |= (ScriptControlled)controls; 3949 IgnoredControls |= (ScriptControlled)controls;
@@ -4088,7 +4086,7 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
4088 if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) 4086 if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO)
4089 { 4087 {
4090 // only send if still pressed or just changed 4088 // only send if still pressed or just changed
4091 m_scene.EventManager.TriggerControlEvent(scriptControlData.objID, scriptUUID, UUID, (uint)localHeld, (uint)localChange); 4089 m_scene.EventManager.TriggerControlEvent(scriptUUID, UUID, (uint)localHeld, (uint)localChange);
4092 } 4090 }
4093 } 4091 }
4094 } 4092 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f996ff4..5492266 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -518,7 +518,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
518 518
519 public LSL_Vector llVecNorm(LSL_Vector v) 519 public LSL_Vector llVecNorm(LSL_Vector v)
520 { 520 {
521 m_host.AddScriptLPS(1); 521 m_host.AddScriptLPS(1);
522 return LSL_Vector.Norm(v); 522 return LSL_Vector.Norm(v);
523 } 523 }
524 524
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 01141ee..c9049e2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -259,15 +259,15 @@ namespace OpenSim.Region.ScriptEngine.Shared
259 return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); 259 return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
260 } 260 }
261 261
262 public static Vector3 Norm(Vector3 vector) 262 public static Vector3 Norm(Vector3 vector)
263 { 263 {
264 double mag = Mag(vector); 264 double mag = Mag(vector);
265 if (mag > 0.0) 265 if (mag > 0.0)
266 { 266 {
267 double invMag = 1.0 / mag; 267 double invMag = 1.0 / mag;
268 return vector * invMag; 268 return vector * invMag;
269 } 269 }
270 return new Vector3(0, 0, 0); 270 return new Vector3(0, 0, 0);
271 } 271 }
272 272
273 #endregion 273 #endregion
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 09b79d0..0ac8b5c 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -356,9 +356,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
356 // timer: not handled here 356 // timer: not handled here
357 // listen: not handled here 357 // listen: not handled here
358 358
359 public void control(uint localID, UUID itemID, UUID agentID, uint held, uint change) 359 public void control(UUID itemID, UUID agentID, uint held, uint change)
360 { 360 {
361 myScriptEngine.PostObjectEvent(localID, new EventParams( 361 myScriptEngine.PostScriptEvent(itemID, new EventParams(
362 "control",new object[] { 362 "control",new object[] {
363 new LSL_Types.LSLString(agentID.ToString()), 363 new LSL_Types.LSLString(agentID.ToString()),
364 new LSL_Types.LSLInteger(held), 364 new LSL_Types.LSLInteger(held),
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index a6ab5e9..d4c1727 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1425,10 +1425,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1425 1425
1426 try 1426 try
1427 { 1427 {
1428 FileStream tfs = File.Open(assemName + ".text", 1428 using (FileStream tfs = File.Open(assemName + ".text",
1429 FileMode.Open, FileAccess.Read); 1429 FileMode.Open, FileAccess.Read))
1430 tfs.Read(tdata, 0, tdata.Length); 1430 {
1431 tfs.Close(); 1431 tfs.Read(tdata, 0, tdata.Length);
1432 tfs.Close();
1433 }
1432 1434
1433 assem = new System.Text.ASCIIEncoding().GetString(tdata); 1435 assem = new System.Text.ASCIIEncoding().GetString(tdata);
1434 } 1436 }
@@ -1448,9 +1450,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1448 1450
1449 try 1451 try
1450 { 1452 {
1451 FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read); 1453 using (FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read))
1452 fs.Read(data, 0, data.Length); 1454 {
1453 fs.Close(); 1455 fs.Read(data, 0, data.Length);
1456 fs.Close();
1457 }
1454 1458
1455 assem = System.Convert.ToBase64String(data); 1459 assem = System.Convert.ToBase64String(data);
1456 } 1460 }
@@ -1466,13 +1470,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1466 1470
1467 if (File.Exists(fn + ".map")) 1471 if (File.Exists(fn + ".map"))
1468 { 1472 {
1469 FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read); 1473 using (FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read))
1470 StreamReader msr = new StreamReader(mfs); 1474 {
1471 1475 using (StreamReader msr = new StreamReader(mfs))
1472 map = msr.ReadToEnd(); 1476 {
1473 1477 map = msr.ReadToEnd();
1474 msr.Close(); 1478 msr.Close();
1475 mfs.Close(); 1479 }
1480 mfs.Close();
1481 }
1476 } 1482 }
1477 1483
1478 XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); 1484 XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
@@ -1560,30 +1566,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1560 { 1566 {
1561 Byte[] filedata = Convert.FromBase64String(base64); 1567 Byte[] filedata = Convert.FromBase64String(base64);
1562 1568
1563 FileStream fs = File.Create(path); 1569 try
1564 fs.Write(filedata, 0, filedata.Length); 1570 {
1565 fs.Close(); 1571 using (FileStream fs = File.Create(path))
1566 1572 {
1567 fs = File.Create(path + ".text"); 1573 fs.Write(filedata, 0, filedata.Length);
1568 StreamWriter sw = new StreamWriter(fs); 1574 fs.Close();
1569 1575 }
1570 sw.Write(base64); 1576 }
1571 1577 catch (IOException ex)
1572 sw.Close(); 1578 {
1573 fs.Close(); 1579 // if there already exists a file at that location, it may be locked.
1580 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
1581 }
1582 try
1583 {
1584 using (FileStream fs = File.Create(path + ".text"))
1585 {
1586 using (StreamWriter sw = new StreamWriter(fs))
1587 {
1588 sw.Write(base64);
1589 sw.Close();
1590 }
1591 fs.Close();
1592 }
1593 }
1594 catch (IOException ex)
1595 {
1596 // if there already exists a file at that location, it may be locked.
1597 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
1598 }
1574 } 1599 }
1575 } 1600 }
1576 1601
1577 string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); 1602 string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1578 statepath = Path.Combine(statepath, itemID.ToString() + ".state"); 1603 statepath = Path.Combine(statepath, itemID.ToString() + ".state");
1579 1604
1580 FileStream sfs = File.Create(statepath); 1605 try
1581 StreamWriter ssw = new StreamWriter(sfs); 1606 {
1582 1607 using (FileStream sfs = File.Create(statepath))
1583 ssw.Write(stateE.OuterXml); 1608 {
1584 1609 using (StreamWriter ssw = new StreamWriter(sfs))
1585 ssw.Close(); 1610 {
1586 sfs.Close(); 1611 ssw.Write(stateE.OuterXml);
1612 ssw.Close();
1613 }
1614 sfs.Close();
1615 }
1616 }
1617 catch (IOException ex)
1618 {
1619 // if there already exists a file at that location, it may be locked.
1620 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
1621 }
1587 1622
1588 XmlNodeList mapL = rootE.GetElementsByTagName("LineMap"); 1623 XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
1589 if (mapL.Count > 0) 1624 if (mapL.Count > 0)
@@ -1593,13 +1628,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1593 string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); 1628 string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1594 mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); 1629 mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
1595 1630
1596 FileStream mfs = File.Create(mappath); 1631 try
1597 StreamWriter msw = new StreamWriter(mfs); 1632 {
1598 1633 using (FileStream mfs = File.Create(mappath))
1599 msw.Write(mapE.InnerText); 1634 {
1600 1635 using (StreamWriter msw = new StreamWriter(mfs))
1601 msw.Close(); 1636 {
1602 mfs.Close(); 1637 msw.Write(mapE.InnerText);
1638 msw.Close();
1639 }
1640 mfs.Close();
1641 }
1642 }
1643 catch (IOException ex)
1644 {
1645 // if there already exists a file at that location, it may be locked.
1646 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
1647 }
1603 } 1648 }
1604 1649
1605 return true; 1650 return true;