use constants in llGetObjectDetails() rather than magic numbers

bulletsim
Justin Clark-Casey (justincc) 2011-07-16 00:08:11 +01:00
parent a9ba9d4a9e
commit 7247ca1644
1 changed files with 21 additions and 22 deletions

View File

@ -2523,10 +2523,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// negative (indicating end-relative) and may be inverted, /// negative (indicating end-relative) and may be inverted,
/// i.e. end < start. /// i.e. end < start.
/// </summary> /// </summary>
public LSL_String llDeleteSubString(string src, int start, int end) public LSL_String llDeleteSubString(string src, int start, int end)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// Normalize indices (if negative). // Normalize indices (if negative).
@ -2606,10 +2604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// which case it is end-relative. The index may exceed either /// which case it is end-relative. The index may exceed either
/// string bound, with the result being a concatenation. /// string bound, with the result being a concatenation.
/// </summary> /// </summary>
public LSL_String llInsertString(string dest, int index, string src) public LSL_String llInsertString(string dest, int index, string src)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// Normalize indices (if negative). // Normalize indices (if negative).
@ -9996,6 +9992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llGetObjectDetails(string id, LSL_List args) public LSL_List llGetObjectDetails(string id, LSL_List args)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
LSL_List ret = new LSL_List(); LSL_List ret = new LSL_List();
UUID key = new UUID(); UUID key = new UUID();
if (UUID.TryParse(id, out key)) if (UUID.TryParse(id, out key))
@ -10006,30 +10003,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
foreach (object o in args.Data) foreach (object o in args.Data)
{ {
switch (o.ToString()) switch (int.Parse(o.ToString()))
{ {
case "1": case ScriptBaseClass.OBJECT_NAME:
ret.Add(new LSL_String(av.Firstname + " " + av.Lastname)); ret.Add(new LSL_String(av.Firstname + " " + av.Lastname));
break; break;
case "2": case ScriptBaseClass.OBJECT_DESC:
ret.Add(new LSL_String("")); ret.Add(new LSL_String(""));
break; break;
case "3": case ScriptBaseClass.OBJECT_POS:
ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z));
break; break;
case "4": case ScriptBaseClass.OBJECT_ROT:
ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W));
break; break;
case "5": case ScriptBaseClass.OBJECT_VELOCITY:
ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z));
break; break;
case "6": case ScriptBaseClass.OBJECT_OWNER:
ret.Add(new LSL_String(id)); ret.Add(new LSL_String(id));
break; break;
case "7": case ScriptBaseClass.OBJECT_GROUP:
ret.Add(new LSL_String(UUID.Zero.ToString())); ret.Add(new LSL_String(UUID.Zero.ToString()));
break; break;
case "8": case ScriptBaseClass.OBJECT_CREATOR:
ret.Add(new LSL_String(UUID.Zero.ToString())); ret.Add(new LSL_String(UUID.Zero.ToString()));
break; break;
} }
@ -10043,37 +10040,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
foreach (object o in args.Data) foreach (object o in args.Data)
{ {
switch (o.ToString()) switch (int.Parse(o.ToString()))
{ {
case "1": case ScriptBaseClass.OBJECT_NAME:
ret.Add(new LSL_String(obj.Name)); ret.Add(new LSL_String(obj.Name));
break; break;
case "2": case ScriptBaseClass.OBJECT_DESC:
ret.Add(new LSL_String(obj.Description)); ret.Add(new LSL_String(obj.Description));
break; break;
case "3": case ScriptBaseClass.OBJECT_POS:
ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z));
break; break;
case "4": case ScriptBaseClass.OBJECT_ROT:
ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W));
break; break;
case "5": case ScriptBaseClass.OBJECT_VELOCITY:
ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z));
break; break;
case "6": case ScriptBaseClass.OBJECT_OWNER:
ret.Add(new LSL_String(obj.OwnerID.ToString())); ret.Add(new LSL_String(obj.OwnerID.ToString()));
break; break;
case "7": case ScriptBaseClass.OBJECT_GROUP:
ret.Add(new LSL_String(obj.GroupID.ToString())); ret.Add(new LSL_String(obj.GroupID.ToString()));
break; break;
case "8": case ScriptBaseClass.OBJECT_CREATOR:
ret.Add(new LSL_String(obj.CreatorID.ToString())); ret.Add(new LSL_String(obj.CreatorID.ToString()));
break; break;
} }
} }
return ret; return ret;
} }
} }
return new LSL_List(); return new LSL_List();
} }