Optimizations to rez_prop()
Compensate for the code added in the previous commit, by removing a bunch of locals and forcing long common substrings to appear once.
This commit is contained in:
parent
aea700fc3f
commit
c13b14df07
1 changed files with 17 additions and 15 deletions
|
@ -120,18 +120,6 @@ rez_prop(integer index)
|
||||||
{
|
{
|
||||||
vector pos = llList2Vector(prop_positions, index) * llGetRot() + llGetPos();
|
vector pos = llList2Vector(prop_positions, index) * llGetRot() + llGetPos();
|
||||||
rotation rot = llEuler2Rot(llList2Vector(prop_rotations, index) * DEG_TO_RAD) * llGetRot();
|
rotation rot = llEuler2Rot(llList2Vector(prop_rotations, index) * DEG_TO_RAD) * llGetRot();
|
||||||
integer pt = get_point(llList2String(prop_points, index));
|
|
||||||
string point = (string)pt;
|
|
||||||
if (llStringLength(point) == 1)
|
|
||||||
{
|
|
||||||
point = "0" + point;
|
|
||||||
}
|
|
||||||
string prop_id = (string)index;
|
|
||||||
if (llStringLength(prop_id) == 1)
|
|
||||||
{
|
|
||||||
prop_id = "0" + prop_id;
|
|
||||||
}
|
|
||||||
integer int = (integer)((string)comm_channel + prop_id + point + (string)type);
|
|
||||||
if (llGetInventoryType(object) != INVENTORY_OBJECT)
|
if (llGetInventoryType(object) != INVENTORY_OBJECT)
|
||||||
{
|
{
|
||||||
llSay(0, "Could not find prop '" + object + "'.");
|
llSay(0, "Could not find prop '" + object + "'.");
|
||||||
|
@ -150,7 +138,7 @@ rez_prop(integer index)
|
||||||
{
|
{
|
||||||
if (!(perms & PERM_COPY))
|
if (!(perms & PERM_COPY))
|
||||||
{
|
{
|
||||||
llSay(0, "Can't rez '" + object + "'. Props and their content must be COPY-OK" + next);
|
llSay(0, "Can't rez '" + object + ("'. P"+("rops and their content must be COPY-"+("OK" + next))));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,11 +146,25 @@ rez_prop(integer index)
|
||||||
{
|
{
|
||||||
if ((!(perms & PERM_COPY)) || (!(perms & PERM_TRANSFER)))
|
if ((!(perms & PERM_COPY)) || (!(perms & PERM_TRANSFER)))
|
||||||
{
|
{
|
||||||
llSay(0, "Can't rez '" + object + "'. Attachment props and their content must be COPY-TRANSFER" + next);
|
llSay(0, "Can't rez '" + object + ("'. Attachment p"+("rops and their content must be COPY-"+("TRANSFER" + next))));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
llRezAtRoot(object, pos, ZERO_VECTOR, rot, int);
|
// Param must be:
|
||||||
|
// - Negative
|
||||||
|
// - 4 digits comm_channel
|
||||||
|
// - 2 digits prop_id (index)
|
||||||
|
// - 2 digits attachment point
|
||||||
|
// - 1 digit prop_type
|
||||||
|
// HACK: reuse 'perms' rather than calling the function in the
|
||||||
|
// expression, to reduce stack usage
|
||||||
|
perms = get_point(llList2String(prop_points, index));
|
||||||
|
llRezAtRoot(object, pos, ZERO_VECTOR, rot,
|
||||||
|
comm_channel * 100000 // negative, so we subtract everything else instead of adding
|
||||||
|
- (index * 1000
|
||||||
|
+ perms * 10
|
||||||
|
+ type)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue