aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorUbitUmarov2017-01-06 03:45:47 +0000
committerUbitUmarov2017-01-06 03:45:47 +0000
commite5a3d85bc7618a023222a8120984999158a8bd43 (patch)
tree69a5d94ca57f3125437c1ee6667f6a679b2eabef /OpenSim/Framework
parentfix typo (diff)
downloadopensim-SC_OLD-e5a3d85bc7618a023222a8120984999158a8bd43.zip
opensim-SC_OLD-e5a3d85bc7618a023222a8120984999158a8bd43.tar.gz
opensim-SC_OLD-e5a3d85bc7618a023222a8120984999158a8bd43.tar.bz2
opensim-SC_OLD-e5a3d85bc7618a023222a8120984999158a8bd43.tar.xz
fix/simplify validation of god_data update field
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs34
1 files changed, 20 insertions, 14 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index b9d64b1..d6d8dde 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Framework
90 public Vector3 LeftAxis; 90 public Vector3 LeftAxis;
91 public Vector3 UpAxis; 91 public Vector3 UpAxis;
92 //public int GodLevel; 92 //public int GodLevel;
93 public OSD GodData = new OSDMap(); 93 public OSD GodData = null;
94 public bool ChangedGrid; 94 public bool ChangedGrid;
95 95
96 // This probably shouldn't be here 96 // This probably shouldn't be here
@@ -119,12 +119,15 @@ namespace OpenSim.Framework
119 args["far"] = OSD.FromReal(Far); 119 args["far"] = OSD.FromReal(Far);
120 args["changed_grid"] = OSD.FromBoolean(ChangedGrid); 120 args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
121 //args["god_level"] = OSD.FromString(GodLevel.ToString()); 121 //args["god_level"] = OSD.FromString(GodLevel.ToString());
122 args["god_data"] = GodData; 122 if(GodData != null)
123 OSDMap g = (OSDMap)GodData; 123 {
124 // Set legacy value 124 args["god_data"] = GodData;
125 // TODO: remove after 0.9 is superseded 125 OSDMap g = (OSDMap)GodData;
126 if (g.ContainsKey("ViewerUiIsGod")) 126 // Set legacy value
127 args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;; 127 // TODO: remove after 0.9 is superseded
128 if (g.ContainsKey("ViewerUiIsGod"))
129 args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;
130 }
128 131
129 if ((Throttles != null) && (Throttles.Length > 0)) 132 if ((Throttles != null) && (Throttles.Length > 0))
130 args["throttles"] = OSD.FromBinary(Throttles); 133 args["throttles"] = OSD.FromBinary(Throttles);
@@ -185,7 +188,7 @@ namespace OpenSim.Framework
185 188
186 //if (args["god_level"] != null) 189 //if (args["god_level"] != null)
187 // Int32.TryParse(args["god_level"].AsString(), out GodLevel); 190 // Int32.TryParse(args["god_level"].AsString(), out GodLevel);
188 if (args["god_data"] != null) 191 if (args.ContainsKey("god_data") && args["god_data"] != null)
189 GodData = args["god_data"]; 192 GodData = args["god_data"];
190 193
191 if (args["far"] != null) 194 if (args["far"] != null)
@@ -362,7 +365,7 @@ namespace OpenSim.Framework
362 public Quaternion BodyRotation; 365 public Quaternion BodyRotation;
363 public uint ControlFlags; 366 public uint ControlFlags;
364 public float EnergyLevel; 367 public float EnergyLevel;
365 public OSD GodData = new OSDMap(); 368 public OSD GodData = null;
366 //public Byte GodLevel; 369 //public Byte GodLevel;
367 public bool AlwaysRun; 370 public bool AlwaysRun;
368 public UUID PreyAgent; 371 public UUID PreyAgent;
@@ -438,10 +441,13 @@ namespace OpenSim.Framework
438 441
439 args["energy_level"] = OSD.FromReal(EnergyLevel); 442 args["energy_level"] = OSD.FromReal(EnergyLevel);
440 //args["god_level"] = OSD.FromString(GodLevel.ToString()); 443 //args["god_level"] = OSD.FromString(GodLevel.ToString());
441 args["god_data"] = GodData; 444 if(GodData != null)
442 OSDMap g = (OSDMap)GodData; 445 {
443 if (g.ContainsKey("ViewerUiIsGod")) 446 args["god_data"] = GodData;
444 args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;; 447 OSDMap g = (OSDMap)GodData;
448 if (g.ContainsKey("ViewerUiIsGod"))
449 args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;;
450 }
445 args["always_run"] = OSD.FromBoolean(AlwaysRun); 451 args["always_run"] = OSD.FromBoolean(AlwaysRun);
446 args["prey_agent"] = OSD.FromUUID(PreyAgent); 452 args["prey_agent"] = OSD.FromUUID(PreyAgent);
447 args["agent_access"] = OSD.FromString(AgentAccess.ToString()); 453 args["agent_access"] = OSD.FromString(AgentAccess.ToString());
@@ -622,7 +628,7 @@ namespace OpenSim.Framework
622 //if (args["god_level"] != null) 628 //if (args["god_level"] != null)
623 // Byte.TryParse(args["god_level"].AsString(), out GodLevel); 629 // Byte.TryParse(args["god_level"].AsString(), out GodLevel);
624 630
625 if (args["god_data"] != null) 631 if (args.ContainsKey("god_data") && args["god_data"] != null)
626 GodData = args["god_data"]; 632 GodData = args["god_data"];
627 633
628 if (args["always_run"] != null) 634 if (args["always_run"] != null)