Removing unnecessary null checks on structs in AgentsData pack/unpack.
parent
e4c7bdc730
commit
f08f11fe60
|
@ -150,25 +150,15 @@ namespace OpenSim.Framework
|
|||
OSDMap args = new OSDMap();
|
||||
args["region_handle"] = OSD.FromString(RegionHandle.ToString());
|
||||
args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
|
||||
if (AgentID != null)
|
||||
args["agent_uuid"] = OSD.FromUUID(AgentID);
|
||||
if (SessionID != null)
|
||||
args["session_uuid"] = OSD.FromUUID(SessionID);
|
||||
|
||||
if (Position != null)
|
||||
args["position"] = OSD.FromString(Position.ToString());
|
||||
|
||||
if (Velocity != null)
|
||||
args["velocity"] = OSD.FromString(Velocity.ToString());
|
||||
if (Center != null)
|
||||
args["center"] = OSD.FromString(Center.ToString());
|
||||
if (Size != null)
|
||||
args["size"] = OSD.FromString(Size.ToString());
|
||||
if (AtAxis != null)
|
||||
args["at_axis"] = OSD.FromString(AtAxis.ToString());
|
||||
if (LeftAxis != null)
|
||||
args["left_axis"] = OSD.FromString(LeftAxis.ToString());
|
||||
if (UpAxis != null)
|
||||
args["up_axis"] = OSD.FromString(UpAxis.ToString());
|
||||
|
||||
args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
|
||||
|
@ -179,16 +169,13 @@ namespace OpenSim.Framework
|
|||
args["throttles"] = OSD.FromBinary(Throttles);
|
||||
|
||||
args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
|
||||
if (HeadRotation != null)
|
||||
args["head_rotation"] = OSD.FromString(HeadRotation.ToString());
|
||||
if (BodyRotation != null)
|
||||
args["body_rotation"] = OSD.FromString(BodyRotation.ToString());
|
||||
args["control_flags"] = OSD.FromString(ControlFlags.ToString());
|
||||
|
||||
args["energy_level"] = OSD.FromReal(EnergyLevel);
|
||||
args["god_level"] = OSD.FromString(GodLevel.ToString());
|
||||
args["always_run"] = OSD.FromBoolean(AlwaysRun);
|
||||
if (PreyAgent != null)
|
||||
args["prey_agent"] = OSD.FromUUID(PreyAgent);
|
||||
args["agent_access"] = OSD.FromString(AgentAccess.ToString());
|
||||
|
||||
|
@ -200,7 +187,6 @@ namespace OpenSim.Framework
|
|||
args["agent_textures"] = textures;
|
||||
}
|
||||
|
||||
if (ActiveGroupID != null)
|
||||
args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
|
||||
|
||||
// Last few fields are still missing
|
||||
|
@ -315,10 +301,8 @@ namespace OpenSim.Framework
|
|||
/// <param name="cAgent"></param>
|
||||
public void CopyFrom(ChildAgentDataUpdate cAgent)
|
||||
{
|
||||
if (cAgent.ActiveGroupID != null)
|
||||
ActiveGroupID = new UUID(cAgent.ActiveGroupID);
|
||||
|
||||
if (cAgent.AgentID != null)
|
||||
AgentID = new UUID(cAgent.AgentID);
|
||||
|
||||
AlwaysRun = cAgent.alwaysrun;
|
||||
|
@ -327,7 +311,6 @@ namespace OpenSim.Framework
|
|||
Size = new Vector3();
|
||||
Size.Z = cAgent.AVHeight;
|
||||
|
||||
if (cAgent.cameraPosition != null)
|
||||
Center = new Vector3(cAgent.cameraPosition.x, cAgent.cameraPosition.y, cAgent.cameraPosition.z);
|
||||
|
||||
Far = cAgent.drawdistance;
|
||||
|
@ -335,20 +318,15 @@ namespace OpenSim.Framework
|
|||
// downcasting ???
|
||||
GodLevel = (byte)(cAgent.godlevel);
|
||||
|
||||
if (cAgent.ActiveGroupID != null)
|
||||
{
|
||||
Groups = new AgentGroupData[1];
|
||||
Groups[0] = new AgentGroupData(new UUID(cAgent.ActiveGroupID), cAgent.GroupAccess, true);
|
||||
}
|
||||
|
||||
if (cAgent.Position != null)
|
||||
Position = new Vector3(cAgent.Position.x, cAgent.Position.y, cAgent.Position.z);
|
||||
|
||||
RegionHandle = cAgent.regionHandle;
|
||||
|
||||
Throttles = cAgent.throttles;
|
||||
|
||||
if (cAgent.Velocity != null)
|
||||
Velocity = new Vector3(cAgent.Velocity.x, cAgent.Velocity.y, cAgent.Velocity.z);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue