From fe72b54652944b377f15553c705513045cbc8813 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 May 2020 17:16:29 +0100 Subject: [PATCH] cosmetics --- OpenSim/Framework/Animation.cs | 13 +++++++------ OpenSim/Framework/ChildAgentDataUpdate.cs | 8 ++++---- .../Framework/Scenes/Animation/AnimationSet.cs | 6 ++---- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/OpenSim/Framework/Animation.cs b/OpenSim/Framework/Animation.cs index e958b75e8e..7d53d82f4e 100644 --- a/OpenSim/Framework/Animation.cs +++ b/OpenSim/Framework/Animation.cs @@ -112,12 +112,13 @@ namespace OpenSim.Framework /// public void UnpackUpdateMessage(OSDMap args) { - if (args["animation"] != null) - animID = args["animation"].AsUUID(); - if (args["object_id"] != null) - objectID = args["object_id"].AsUUID(); - if (args["seq_num"] != null) - sequenceNum = args["seq_num"].AsInteger(); + OSD tmp; + if (args.TryGetValue("animation", out tmp)) + animID = tmp.AsUUID(); + if (args.TryGetValue("object_id", out tmp)) + objectID = tmp.AsUUID(); + if (args.TryGetValue("seq_num", out tmp)) + sequenceNum = tmp.AsInteger(); } public override bool Equals(object obj) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index fe9b495067..6097cf3cc9 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -676,11 +676,11 @@ namespace OpenSim.Framework ulong handle = 0; string seed = ""; OSDMap pair = (OSDMap)o; - if (pair["handle"] != null) - if (!UInt64.TryParse(pair["handle"].AsString(), out handle)) + if (pair.TryGetValue("handle", out tmp)) + if (!UInt64.TryParse(tmp.AsString(), out handle)) continue; - if (pair["seed"] != null) - seed = pair["seed"].AsString(); + if (pair.TryGetValue("seed", out tmp)) + seed = tmp.AsString(); if (!ChildrenCapSeeds.ContainsKey(handle)) ChildrenCapSeeds.Add(handle, seed); } diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index f4ca464252..17d242c99f 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -115,7 +115,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation else ResetDefaultAnimation(); } - else if (HasAnimation(animID)) + else { for (int i = 0; i < m_animations.Count; i++) { @@ -182,9 +182,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation { lock (m_animations) { - int j = 0; - if (m_defaultAnimation.AnimID != UUID.Zero) - ++j; + int j = m_defaultAnimation.AnimID == UUID.Zero ? 0 : 1; int defaultSize = m_animations.Count + j; animIDs = new UUID[defaultSize];