diff options
author | Melanie Thielker | 2008-07-28 01:33:21 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-07-28 01:33:21 +0000 |
commit | 40bb4edf8ce1014d0fd7526518a443737d4833e7 (patch) | |
tree | 6e24bb1e28768199f9d45513bc1e32b94b7589a1 /OpenSim | |
parent | * Added a check for Infinite or NaN values before updating a heightfield. Thi... (diff) | |
download | opensim-SC-40bb4edf8ce1014d0fd7526518a443737d4833e7.zip opensim-SC-40bb4edf8ce1014d0fd7526518a443737d4833e7.tar.gz opensim-SC-40bb4edf8ce1014d0fd7526518a443737d4833e7.tar.bz2 opensim-SC-40bb4edf8ce1014d0fd7526518a443737d4833e7.tar.xz |
Refresh LSLTypes.cs in Shared/ from the one in Common/, which was
more complete.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 145 |
1 files changed, 45 insertions, 100 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index ea2a551..398e73d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -141,9 +141,9 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
141 | return new Vector3(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z); | 141 | return new Vector3(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z); |
142 | } | 142 | } |
143 | 143 | ||
144 | public static Vector3 operator *(Vector3 lhs, Vector3 rhs) | 144 | public static LSLFloat operator *(Vector3 lhs, Vector3 rhs) |
145 | { | 145 | { |
146 | return new Vector3(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z); | 146 | return Dot(lhs, rhs); |
147 | } | 147 | } |
148 | 148 | ||
149 | public static Vector3 operator %(Vector3 v1, Vector3 v2) | 149 | public static Vector3 operator %(Vector3 v1, Vector3 v2) |
@@ -989,22 +989,22 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
989 | // BELOW IS WORK IN PROGRESS... IT WILL CHANGE, SO DON'T USE YET! :) | 989 | // BELOW IS WORK IN PROGRESS... IT WILL CHANGE, SO DON'T USE YET! :) |
990 | // | 990 | // |
991 | 991 | ||
992 | // public struct StringTest | 992 | public struct StringTest |
993 | // { | 993 | { |
994 | // // Our own little string | 994 | // Our own little string |
995 | // internal string actualString; | 995 | internal string actualString; |
996 | // public static implicit operator bool(StringTest mString) | 996 | public static implicit operator bool(StringTest mString) |
997 | // { | 997 | { |
998 | // if (mString.actualString.Length == 0) | 998 | if (mString.actualString.Length == 0) |
999 | // return true; | 999 | return true; |
1000 | // return false; | 1000 | return false; |
1001 | // } | 1001 | } |
1002 | // public override string ToString() | 1002 | public override string ToString() |
1003 | // { | 1003 | { |
1004 | // return actualString; | 1004 | return actualString; |
1005 | // } | 1005 | } |
1006 | // | 1006 | |
1007 | // } | 1007 | } |
1008 | 1008 | ||
1009 | [Serializable] | 1009 | [Serializable] |
1010 | public struct key | 1010 | public struct key |
@@ -1106,11 +1106,6 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1106 | m_string = s; | 1106 | m_string = s; |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | public LSLString(int i) | ||
1110 | { | ||
1111 | m_string=i.ToString(); | ||
1112 | } | ||
1113 | |||
1114 | public LSLString(double d) | 1109 | public LSLString(double d) |
1115 | { | 1110 | { |
1116 | string s=String.Format("{0:0.000000}", d); | 1111 | string s=String.Format("{0:0.000000}", d); |
@@ -1180,11 +1175,6 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1180 | return new LSLInteger(Convert.ToInt32(s.m_string)); | 1175 | return new LSLInteger(Convert.ToInt32(s.m_string)); |
1181 | } | 1176 | } |
1182 | 1177 | ||
1183 | public static explicit operator LSLString(int i) | ||
1184 | { | ||
1185 | return new LSLString(i); | ||
1186 | } | ||
1187 | |||
1188 | public static explicit operator LSLString(double d) | 1178 | public static explicit operator LSLString(double d) |
1189 | { | 1179 | { |
1190 | return new LSLString(d); | 1180 | return new LSLString(d); |
@@ -1250,19 +1240,6 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1250 | value = (int)d; | 1240 | value = (int)d; |
1251 | } | 1241 | } |
1252 | 1242 | ||
1253 | public LSLInteger(Object o) | ||
1254 | { | ||
1255 | if (!(o is Int32)) | ||
1256 | value = 0; | ||
1257 | else | ||
1258 | value = (int)o; | ||
1259 | } | ||
1260 | |||
1261 | public LSLInteger(string s) | ||
1262 | { | ||
1263 | value = int.Parse(s); | ||
1264 | } | ||
1265 | |||
1266 | #endregion | 1243 | #endregion |
1267 | 1244 | ||
1268 | #region Operators | 1245 | #region Operators |
@@ -1282,11 +1259,6 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1282 | return new LSLString(i.ToString()); | 1259 | return new LSLString(i.ToString()); |
1283 | } | 1260 | } |
1284 | 1261 | ||
1285 | static public explicit operator string(LSLInteger i) | ||
1286 | { | ||
1287 | return i.ToString(); | ||
1288 | } | ||
1289 | |||
1290 | static public implicit operator Boolean(LSLInteger i) | 1262 | static public implicit operator Boolean(LSLInteger i) |
1291 | { | 1263 | { |
1292 | if (i.value == 0) | 1264 | if (i.value == 0) |
@@ -1376,6 +1348,18 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1376 | return new LSLInteger(-i.value); | 1348 | return new LSLInteger(-i.value); |
1377 | } | 1349 | } |
1378 | 1350 | ||
1351 | public override bool Equals(Object o) | ||
1352 | { | ||
1353 | if (!(o is LSLInteger)) | ||
1354 | return false; | ||
1355 | return value == ((LSLInteger)o).value; | ||
1356 | } | ||
1357 | |||
1358 | public override int GetHashCode() | ||
1359 | { | ||
1360 | return value; | ||
1361 | } | ||
1362 | |||
1379 | static public LSLInteger operator &(LSLInteger i1, LSLInteger i2) | 1363 | static public LSLInteger operator &(LSLInteger i1, LSLInteger i2) |
1380 | { | 1364 | { |
1381 | int ret = i1.value & i2.value; | 1365 | int ret = i1.value & i2.value; |
@@ -1400,11 +1384,6 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1400 | return (double)i.value; | 1384 | return (double)i.value; |
1401 | } | 1385 | } |
1402 | 1386 | ||
1403 | static public implicit operator LSLFloat(LSLInteger i) | ||
1404 | { | ||
1405 | return new LSLFloat((double)i.value); | ||
1406 | } | ||
1407 | |||
1408 | public static bool operator true(LSLInteger i) | 1387 | public static bool operator true(LSLInteger i) |
1409 | { | 1388 | { |
1410 | return i.value != 0; | 1389 | return i.value != 0; |
@@ -1424,24 +1403,6 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1424 | return this.value.ToString(); | 1403 | return this.value.ToString(); |
1425 | } | 1404 | } |
1426 | 1405 | ||
1427 | public override bool Equals(object o) | ||
1428 | { | ||
1429 | if (o is Int32) | ||
1430 | { | ||
1431 | return value == (Int32)o; | ||
1432 | } | ||
1433 | if (o is LSLInteger) | ||
1434 | { | ||
1435 | return value == ((LSLInteger)o).value; | ||
1436 | } | ||
1437 | return false; | ||
1438 | } | ||
1439 | |||
1440 | public override int GetHashCode() | ||
1441 | { | ||
1442 | return value.GetHashCode(); | ||
1443 | } | ||
1444 | |||
1445 | #endregion | 1406 | #endregion |
1446 | } | 1407 | } |
1447 | 1408 | ||
@@ -1454,28 +1415,12 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1454 | 1415 | ||
1455 | public LSLFloat(int i) | 1416 | public LSLFloat(int i) |
1456 | { | 1417 | { |
1457 | value = (double)i; | 1418 | this.value = (double)i; |
1458 | } | 1419 | } |
1459 | 1420 | ||
1460 | public LSLFloat(double d) | 1421 | public LSLFloat(double d) |
1461 | { | 1422 | { |
1462 | value = d; | 1423 | this.value = d; |
1463 | } | ||
1464 | |||
1465 | public LSLFloat(string s) | ||
1466 | { | ||
1467 | value = double.Parse(s); | ||
1468 | } | ||
1469 | |||
1470 | public LSLFloat(Object o) | ||
1471 | { | ||
1472 | if (!((o is double) || (o is float))) | ||
1473 | { | ||
1474 | value = 0.0; | ||
1475 | return; | ||
1476 | } | ||
1477 | |||
1478 | value = (double)o; | ||
1479 | } | 1424 | } |
1480 | 1425 | ||
1481 | #endregion | 1426 | #endregion |
@@ -1534,19 +1479,6 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1534 | return f1.value != f2.value; | 1479 | return f1.value != f2.value; |
1535 | } | 1480 | } |
1536 | 1481 | ||
1537 | public override bool Equals(Object o) | ||
1538 | { | ||
1539 | if (!(o is LSLFloat)) | ||
1540 | return false; | ||
1541 | |||
1542 | return value == ((LSLFloat)o).value; | ||
1543 | } | ||
1544 | |||
1545 | public override int GetHashCode() | ||
1546 | { | ||
1547 | return (int)value; | ||
1548 | } | ||
1549 | |||
1550 | static public LSLFloat operator ++(LSLFloat f) | 1482 | static public LSLFloat operator ++(LSLFloat f) |
1551 | { | 1483 | { |
1552 | f.value++; | 1484 | f.value++; |
@@ -1618,6 +1550,19 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1618 | return String.Format("{0:0.000000}", this.value); | 1550 | return String.Format("{0:0.000000}", this.value); |
1619 | } | 1551 | } |
1620 | 1552 | ||
1553 | public override bool Equals(Object o) | ||
1554 | { | ||
1555 | if (!(o is LSLFloat)) | ||
1556 | return false; | ||
1557 | return value == ((LSLFloat)o).value; | ||
1558 | } | ||
1559 | |||
1560 | public override int GetHashCode() | ||
1561 | { | ||
1562 | return Convert.ToInt32(value); | ||
1563 | } | ||
1564 | |||
1565 | |||
1621 | #endregion | 1566 | #endregion |
1622 | } | 1567 | } |
1623 | } | 1568 | } |