Change semantics of FromXML on vehicle data to make the serializer a bit cleaner

avinationmerge
Melanie 2012-07-07 19:59:55 +02:00
parent 6d5693a866
commit 470019b52a
2 changed files with 19 additions and 7 deletions

View File

@ -599,7 +599,20 @@ namespace OpenSim.Region.Framework.Scenes
return v; return v;
} }
public void FromXml2(XmlTextReader _reader, out bool errors) public static SOPVehicle FromXml2(XmlTextReader reader)
{
SOPVehicle vehicle = new SOPVehicle();
bool errors = false;
vehicle.FromXml2(reader, out errors);
if (errors)
return null;
return vehicle;
}
private void FromXml2(XmlTextReader _reader, out bool errors)
{ {
errors = false; errors = false;
reader = _reader; reader = _reader;

View File

@ -623,12 +623,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader)
{ {
bool errors = false; SOPVehicle vehicle = SOPVehicle.FromXml2(reader);
SOPVehicle _vehicle = new SOPVehicle();
_vehicle.FromXml2(reader, out errors); if (vehicle == null)
if (errors)
{ {
obj.VehicleParams = null; obj.VehicleParams = null;
m_log.DebugFormat( m_log.DebugFormat(
@ -636,7 +633,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
obj.Name, obj.UUID); obj.Name, obj.UUID);
} }
else else
obj.VehicleParams = _vehicle; {
obj.VehicleParams = vehicle;
}
} }
private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)