aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authordiva2008-12-30 23:53:51 +0000
committerdiva2008-12-30 23:53:51 +0000
commitf08f11fe60b15dcef89f5edbd8a3139dca69e97a (patch)
tree4ac2e1ad92e8fdfc701cb3130691e02e45c9c726 /OpenSim/Framework
parent* Remove mono compiler warnings (diff)
downloadopensim-SC-f08f11fe60b15dcef89f5edbd8a3139dca69e97a.zip
opensim-SC-f08f11fe60b15dcef89f5edbd8a3139dca69e97a.tar.gz
opensim-SC-f08f11fe60b15dcef89f5edbd8a3139dca69e97a.tar.bz2
opensim-SC-f08f11fe60b15dcef89f5edbd8a3139dca69e97a.tar.xz
Removing unnecessary null checks on structs in AgentsData pack/unpack.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs64
1 files changed, 21 insertions, 43 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 2730c70..257f435 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -150,26 +150,16 @@ namespace OpenSim.Framework
150 OSDMap args = new OSDMap(); 150 OSDMap args = new OSDMap();
151 args["region_handle"] = OSD.FromString(RegionHandle.ToString()); 151 args["region_handle"] = OSD.FromString(RegionHandle.ToString());
152 args["circuit_code"] = OSD.FromString(CircuitCode.ToString()); 152 args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
153 if (AgentID != null) 153 args["agent_uuid"] = OSD.FromUUID(AgentID);
154 args["agent_uuid"] = OSD.FromUUID(AgentID); 154 args["session_uuid"] = OSD.FromUUID(SessionID);
155 if (SessionID != null) 155
156 args["session_uuid"] = OSD.FromUUID(SessionID); 156 args["position"] = OSD.FromString(Position.ToString());
157 157 args["velocity"] = OSD.FromString(Velocity.ToString());
158 if (Position != null) 158 args["center"] = OSD.FromString(Center.ToString());
159 args["position"] = OSD.FromString(Position.ToString()); 159 args["size"] = OSD.FromString(Size.ToString());
160 160 args["at_axis"] = OSD.FromString(AtAxis.ToString());
161 if (Velocity != null) 161 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
162 args["velocity"] = OSD.FromString(Velocity.ToString()); 162 args["up_axis"] = OSD.FromString(UpAxis.ToString());
163 if (Center != null)
164 args["center"] = OSD.FromString(Center.ToString());
165 if (Size != null)
166 args["size"] = OSD.FromString(Size.ToString());
167 if (AtAxis != null)
168 args["at_axis"] = OSD.FromString(AtAxis.ToString());
169 if (LeftAxis != null)
170 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
171 if (UpAxis != null)
172 args["up_axis"] = OSD.FromString(UpAxis.ToString());
173 163
174 args["changed_grid"] = OSD.FromBoolean(ChangedGrid); 164 args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
175 args["far"] = OSD.FromReal(Far); 165 args["far"] = OSD.FromReal(Far);
@@ -179,17 +169,14 @@ namespace OpenSim.Framework
179 args["throttles"] = OSD.FromBinary(Throttles); 169 args["throttles"] = OSD.FromBinary(Throttles);
180 170
181 args["locomotion_state"] = OSD.FromString(LocomotionState.ToString()); 171 args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
182 if (HeadRotation != null) 172 args["head_rotation"] = OSD.FromString(HeadRotation.ToString());
183 args["head_rotation"] = OSD.FromString(HeadRotation.ToString()); 173 args["body_rotation"] = OSD.FromString(BodyRotation.ToString());
184 if (BodyRotation != null)
185 args["body_rotation"] = OSD.FromString(BodyRotation.ToString());
186 args["control_flags"] = OSD.FromString(ControlFlags.ToString()); 174 args["control_flags"] = OSD.FromString(ControlFlags.ToString());
187 175
188 args["energy_level"] = OSD.FromReal(EnergyLevel); 176 args["energy_level"] = OSD.FromReal(EnergyLevel);
189 args["god_level"] = OSD.FromString(GodLevel.ToString()); 177 args["god_level"] = OSD.FromString(GodLevel.ToString());
190 args["always_run"] = OSD.FromBoolean(AlwaysRun); 178 args["always_run"] = OSD.FromBoolean(AlwaysRun);
191 if (PreyAgent != null) 179 args["prey_agent"] = OSD.FromUUID(PreyAgent);
192 args["prey_agent"] = OSD.FromUUID(PreyAgent);
193 args["agent_access"] = OSD.FromString(AgentAccess.ToString()); 180 args["agent_access"] = OSD.FromString(AgentAccess.ToString());
194 181
195 if ((AgentTextures != null) && (AgentTextures.Length > 0)) 182 if ((AgentTextures != null) && (AgentTextures.Length > 0))
@@ -200,8 +187,7 @@ namespace OpenSim.Framework
200 args["agent_textures"] = textures; 187 args["agent_textures"] = textures;
201 } 188 }
202 189
203 if (ActiveGroupID != null) 190 args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
204 args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
205 191
206 // Last few fields are still missing 192 // Last few fields are still missing
207 193
@@ -315,11 +301,9 @@ namespace OpenSim.Framework
315 /// <param name="cAgent"></param> 301 /// <param name="cAgent"></param>
316 public void CopyFrom(ChildAgentDataUpdate cAgent) 302 public void CopyFrom(ChildAgentDataUpdate cAgent)
317 { 303 {
318 if (cAgent.ActiveGroupID != null) 304 ActiveGroupID = new UUID(cAgent.ActiveGroupID);
319 ActiveGroupID = new UUID(cAgent.ActiveGroupID);
320 305
321 if (cAgent.AgentID != null) 306 AgentID = new UUID(cAgent.AgentID);
322 AgentID = new UUID(cAgent.AgentID);
323 307
324 AlwaysRun = cAgent.alwaysrun; 308 AlwaysRun = cAgent.alwaysrun;
325 309
@@ -327,29 +311,23 @@ namespace OpenSim.Framework
327 Size = new Vector3(); 311 Size = new Vector3();
328 Size.Z = cAgent.AVHeight; 312 Size.Z = cAgent.AVHeight;
329 313
330 if (cAgent.cameraPosition != null) 314 Center = new Vector3(cAgent.cameraPosition.x, cAgent.cameraPosition.y, cAgent.cameraPosition.z);
331 Center = new Vector3(cAgent.cameraPosition.x, cAgent.cameraPosition.y, cAgent.cameraPosition.z);
332 315
333 Far = cAgent.drawdistance; 316 Far = cAgent.drawdistance;
334 317
335 // downcasting ??? 318 // downcasting ???
336 GodLevel = (byte)(cAgent.godlevel); 319 GodLevel = (byte)(cAgent.godlevel);
337 320
338 if (cAgent.ActiveGroupID != null) 321 Groups = new AgentGroupData[1];
339 { 322 Groups[0] = new AgentGroupData(new UUID(cAgent.ActiveGroupID), cAgent.GroupAccess, true);
340 Groups = new AgentGroupData[1];
341 Groups[0] = new AgentGroupData(new UUID(cAgent.ActiveGroupID), cAgent.GroupAccess, true);
342 }
343 323
344 if (cAgent.Position != null) 324 Position = new Vector3(cAgent.Position.x, cAgent.Position.y, cAgent.Position.z);
345 Position = new Vector3(cAgent.Position.x, cAgent.Position.y, cAgent.Position.z);
346 325
347 RegionHandle = cAgent.regionHandle; 326 RegionHandle = cAgent.regionHandle;
348 327
349 Throttles = cAgent.throttles; 328 Throttles = cAgent.throttles;
350 329
351 if (cAgent.Velocity != null) 330 Velocity = new Vector3(cAgent.Velocity.x, cAgent.Velocity.y, cAgent.Velocity.z);
352 Velocity = new Vector3(cAgent.Velocity.x, cAgent.Velocity.y, cAgent.Velocity.z);
353 } 331 }
354 332
355 public void Dump() 333 public void Dump()