diff options
author | Melanie | 2009-12-24 18:18:14 +0100 |
---|---|---|
committer | Melanie | 2009-12-24 18:18:14 +0100 |
commit | 7f699fca9a34cd0f3525534bdbc04c8b8ee975fe (patch) | |
tree | 0c1f3cbd142153262ac4fdb48657c7a2e2da1d1e | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-7f699fca9a34cd0f3525534bdbc04c8b8ee975fe.zip opensim-SC_OLD-7f699fca9a34cd0f3525534bdbc04c8b8ee975fe.tar.gz opensim-SC_OLD-7f699fca9a34cd0f3525534bdbc04c8b8ee975fe.tar.bz2 opensim-SC_OLD-7f699fca9a34cd0f3525534bdbc04c8b8ee975fe.tar.xz |
Add the body to the LSL List Size property
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 1fc31c5..faf9c40 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -422,7 +422,8 @@ 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; |
@@ -431,7 +432,40 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
431 | 432 | ||
432 | public int Size | 433 | public int Size |
433 | { | 434 | { |
434 | get { return 0; } | 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 | } | ||
435 | } | 469 | } |
436 | 470 | ||
437 | public object[] Data | 471 | public object[] Data |