clamp maximum wearables types to Max suported by region (physics type still not supported)

0.8.2-post-fixes
UbitUmarov 2015-12-01 16:34:38 +00:00
parent dc46089054
commit 46cd2da82c
2 changed files with 16 additions and 3 deletions

View File

@ -208,7 +208,10 @@ namespace OpenSim.Framework
if (copyWearables && (appearance.Wearables != null)) if (copyWearables && (appearance.Wearables != null))
{ {
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) int len = appearance.Wearables.Length;
if(len > AvatarWearable.MAX_WEARABLES)
len = AvatarWearable.MAX_WEARABLES;
for (int i = 0; i < len; i++)
SetWearable(i,appearance.Wearables[i]); SetWearable(i,appearance.Wearables[i]);
} }
@ -760,7 +763,12 @@ namespace OpenSim.Framework
if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
{ {
OSDArray wears = (OSDArray)(data["wearables"]); OSDArray wears = (OSDArray)(data["wearables"]);
for (int i = 0; i < wears.Count; i++)
int count = wears.Count;
if (count > AvatarWearable.MAX_WEARABLES)
count = AvatarWearable.MAX_WEARABLES;
for (int i = 0; i < count; i++)
m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
} }
else else

View File

@ -665,7 +665,12 @@ namespace OpenSim.Framework
if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
{ {
OSDArray wears = (OSDArray)(args["wearables"]); OSDArray wears = (OSDArray)(args["wearables"]);
for (int i = 0; i < wears.Count / 2; i++)
int count = wears.Count;
if (count > AvatarWearable.MAX_WEARABLES)
count = AvatarWearable.MAX_WEARABLES;
for (int i = 0; i < count / 2; i++)
{ {
AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
Appearance.SetWearable(i,awear); Appearance.SetWearable(i,awear);