Browse Source

cosmetics

UbitUmarov 4 years ago
parent
commit
fe72b54652

+ 7 - 6
OpenSim/Framework/Animation.cs

@@ -112,12 +112,13 @@ namespace OpenSim.Framework
         /// <param name="args"></param>
         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)

+ 4 - 4
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);
                     }

+ 2 - 4
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];