diff options
author | Justin Clark-Casey (justincc) | 2014-02-27 00:23:24 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-02-27 00:23:24 +0000 |
commit | 91333b926770dd4d7a2938fee6de11d082be6c76 (patch) | |
tree | 3a5d381fc92eb876ea6daf51be50bb41c30cf13c /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | minor: remove unused variable from recent commit 0e23374 (diff) | |
download | opensim-SC-91333b926770dd4d7a2938fee6de11d082be6c76.zip opensim-SC-91333b926770dd4d7a2938fee6de11d082be6c76.tar.gz opensim-SC-91333b926770dd4d7a2938fee6de11d082be6c76.tar.bz2 opensim-SC-91333b926770dd4d7a2938fee6de11d082be6c76.tar.xz |
Stop LSL_Api.GetLinkEntities() from creating an unused list on every parameter except LINK_THIS. Simplify code.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index dd8cff7..2e8b053 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -435,8 +435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
435 | 435 | ||
436 | public List<ISceneEntity> GetLinkEntities(SceneObjectPart part, int linkType) | 436 | public List<ISceneEntity> GetLinkEntities(SceneObjectPart part, int linkType) |
437 | { | 437 | { |
438 | List<ISceneEntity> ret = new List<ISceneEntity>(); | 438 | List<ISceneEntity> ret; |
439 | ret.Add(part); | ||
440 | 439 | ||
441 | switch (linkType) | 440 | switch (linkType) |
442 | { | 441 | { |
@@ -444,9 +443,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
444 | return new List<ISceneEntity>(part.ParentGroup.Parts); | 443 | return new List<ISceneEntity>(part.ParentGroup.Parts); |
445 | 444 | ||
446 | case ScriptBaseClass.LINK_ROOT: | 445 | case ScriptBaseClass.LINK_ROOT: |
447 | ret = new List<ISceneEntity>(); | 446 | return new List<ISceneEntity>() { part.ParentGroup.RootPart }; |
448 | ret.Add(part.ParentGroup.RootPart); | ||
449 | return ret; | ||
450 | 447 | ||
451 | case ScriptBaseClass.LINK_ALL_OTHERS: | 448 | case ScriptBaseClass.LINK_ALL_OTHERS: |
452 | ret = new List<ISceneEntity>(part.ParentGroup.Parts); | 449 | ret = new List<ISceneEntity>(part.ParentGroup.Parts); |
@@ -461,10 +458,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
461 | 458 | ||
462 | if (ret.Contains(part.ParentGroup.RootPart)) | 459 | if (ret.Contains(part.ParentGroup.RootPart)) |
463 | ret.Remove(part.ParentGroup.RootPart); | 460 | ret.Remove(part.ParentGroup.RootPart); |
461 | |||
464 | return ret; | 462 | return ret; |
465 | 463 | ||
466 | case ScriptBaseClass.LINK_THIS: | 464 | case ScriptBaseClass.LINK_THIS: |
467 | return ret; | 465 | return new List<ISceneEntity>() { part }; |
468 | 466 | ||
469 | default: | 467 | default: |
470 | if (linkType < 0) | 468 | if (linkType < 0) |
@@ -473,9 +471,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
473 | ISceneEntity target = GetLinkEntity(part, linkType); | 471 | ISceneEntity target = GetLinkEntity(part, linkType); |
474 | if (target == null) | 472 | if (target == null) |
475 | return new List<ISceneEntity>(); | 473 | return new List<ISceneEntity>(); |
476 | ret = new List<ISceneEntity>(); | 474 | |
477 | ret.Add(target); | 475 | return new List<ISceneEntity>() { target }; |
478 | return ret; | ||
479 | } | 476 | } |
480 | } | 477 | } |
481 | 478 | ||