aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
diff options
context:
space:
mode:
authorAdam Johnson2008-06-07 17:43:07 +0000
committerAdam Johnson2008-06-07 17:43:07 +0000
commit990225a4ba79ca05bacc293c416bd4efb6954f48 (patch)
treeda6bdb8d8a48f6aad23458953303c2c48011194f /OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
parentMantis#1476. Thank you kindly, Melanie for a patch that: (diff)
downloadopensim-SC_OLD-990225a4ba79ca05bacc293c416bd4efb6954f48.zip
opensim-SC_OLD-990225a4ba79ca05bacc293c416bd4efb6954f48.tar.gz
opensim-SC_OLD-990225a4ba79ca05bacc293c416bd4efb6954f48.tar.bz2
opensim-SC_OLD-990225a4ba79ca05bacc293c416bd4efb6954f48.tar.xz
Patch for mantis#1493: Several patches to xengine. Thanks Melanie!
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs60
1 files changed, 53 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs b/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
index 107d493..a325629 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Script/LSL_Types.cs
@@ -425,6 +425,30 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
425 return new list(tmp); 425 return new list(tmp);
426 } 426 }
427 427
428 private void ExtendAndAdd(object o)
429 {
430 Array.Resize(ref m_data, Length + 1);
431 m_data.SetValue(o, Length - 1);
432 }
433
434 public static list operator +(list a, string s)
435 {
436 a.ExtendAndAdd(s);
437 return a;
438 }
439
440 public static list operator +(list a, int i)
441 {
442 a.ExtendAndAdd(i);
443 return a;
444 }
445
446 public static list operator +(list a, double d)
447 {
448 a.ExtendAndAdd(d);
449 return a;
450 }
451
428 public void Add(object o) 452 public void Add(object o)
429 { 453 {
430 object[] tmp; 454 object[] tmp;
@@ -1321,6 +1345,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1321 return (double)i.value; 1345 return (double)i.value;
1322 } 1346 }
1323 1347
1348 static public implicit operator LSLFloat(LSLInteger i)
1349 {
1350 return new LSLFloat((double)i.value);
1351 }
1352
1324 public static bool operator true(LSLInteger i) 1353 public static bool operator true(LSLInteger i)
1325 { 1354 {
1326 return i.value != 0; 1355 return i.value != 0;
@@ -1370,12 +1399,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1370 1399
1371 public LSLFloat(int i) 1400 public LSLFloat(int i)
1372 { 1401 {
1373 this.value = (double)i; 1402 value = (double)i;
1374 } 1403 }
1375 1404
1376 public LSLFloat(double d) 1405 public LSLFloat(double d)
1377 { 1406 {
1378 this.value = d; 1407 value = d;
1408 }
1409
1410 public LSLFloat(string s)
1411 {
1412 value = double.Parse(s);
1413 }
1414
1415 public LSLFloat(Object o)
1416 {
1417 if(!((o is double) || (o is float)))
1418 {
1419 value = 0.0;
1420 return;
1421 }
1422
1423 value = (double)o;
1379 } 1424 }
1380 1425
1381 #endregion 1426 #endregion
@@ -1445,11 +1490,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Script
1445 { 1490 {
1446 return f.value; 1491 return f.value;
1447 } 1492 }
1448 1493
1449 //static public implicit operator System.Int32(LSLFloat f) 1494 static public explicit operator LSLString(LSLFloat f)
1450 //{ 1495 {
1451 // return (int)f.value; 1496 string v = String.Format("{0:0.000000}", f.value);
1452 //} 1497 return new LSLString(v);
1498 }
1453 1499
1454 #endregion 1500 #endregion
1455 1501