diff options
author | Melanie | 2009-12-24 18:18:14 +0100 |
---|---|---|
committer | Melanie | 2009-12-24 16:44:12 +0000 |
commit | 86a429bc44b6fc503b3303a946d088d796d5c530 (patch) | |
tree | 9ad50a46cac28fabfed920b24dafa25f34e754ac /OpenSim/Region | |
parent | Fixes the broken build of the previous commit. (diff) | |
download | opensim-SC-86a429bc44b6fc503b3303a946d088d796d5c530.zip opensim-SC-86a429bc44b6fc503b3303a946d088d796d5c530.tar.gz opensim-SC-86a429bc44b6fc503b3303a946d088d796d5c530.tar.bz2 opensim-SC-86a429bc44b6fc503b3303a946d088d796d5c530.tar.xz |
Add the LSL List Size property
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 3f38bb6..faf9c40 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -422,13 +422,52 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
422 | 422 | ||
423 | public int Length | 423 | public int Length |
424 | { | 424 | { |
425 | get { | 425 | get |
426 | { | ||
426 | if (m_data == null) | 427 | if (m_data == null) |
427 | m_data=new Object[0]; | 428 | m_data=new Object[0]; |
428 | return m_data.Length; | 429 | return m_data.Length; |
429 | } | 430 | } |
430 | } | 431 | } |
431 | 432 | ||
433 | public int Size | ||
434 | { | ||
435 | get | ||
436 | { | ||
437 | if (m_data == null) | ||
438 | m_data=new Object[0]; | ||
439 | |||
440 | int size = 0; | ||
441 | |||
442 | foreach (Object o in m_data) | ||
443 | { | ||
444 | if (o is LSL_Types.LSLInteger) | ||
445 | size += 4; | ||
446 | else if (o is LSL_Types.LSLFloat) | ||
447 | size += 8; | ||
448 | else if (o is LSL_Types.LSLString) | ||
449 | size += ((LSL_Types.LSLString)o).m_string.Length; | ||
450 | else if (o is LSL_Types.key) | ||
451 | size += ((LSL_Types.key)o).value.Length; | ||
452 | else if (o is LSL_Types.Vector3) | ||
453 | size += 32; | ||
454 | else if (o is LSL_Types.Quaternion) | ||
455 | size += 64; | ||
456 | else if (o is int) | ||
457 | size += 4; | ||
458 | else if (o is string) | ||
459 | size += ((string)o).Length; | ||
460 | else if (o is float) | ||
461 | size += 8; | ||
462 | else if (o is double) | ||
463 | size += 16; | ||
464 | else | ||
465 | throw new Exception("Unknown type in List.Size: " + o.GetType().ToString()); | ||
466 | } | ||
467 | return size; | ||
468 | } | ||
469 | } | ||
470 | |||
432 | public object[] Data | 471 | public object[] Data |
433 | { | 472 | { |
434 | get { | 473 | get { |