Fix precedence of the "!" logical NOT operator.

We knew that in OpenSim, the bitwise NOT "~" operator's precedence was broken (see <http://opensimulator.org/mantis/view.php?id=3268>), but it appears that the same bug affects the logical NOT operator "!" as well, so it needs parentheses when followed by more expressions.
This commit is contained in:
Sei Lisa 2017-08-29 12:56:15 +02:00 committed by Sei-Lisa
parent d8069cd1a9
commit 4ed043d823
8 changed files with 12 additions and 12 deletions

View file

@ -206,7 +206,7 @@ remove_sequences(key id)
running_pointers = llDeleteSubList(running_pointers, index, index); running_pointers = llDeleteSubList(running_pointers, index, index);
while (sequence != []) while (sequence != [])
{ {
if (!IsInteger(llList2String(sequence, 0)) && llList2String(sequence, 0) != "none") if ((!IsInteger(llList2String(sequence, 0))) && llList2String(sequence, 0) != "none")
{ {
llMessageLinked(LINK_THIS, 90002, llList2String(sequence, 0), id); llMessageLinked(LINK_THIS, 90002, llList2String(sequence, 0), id);
} }
@ -253,7 +253,7 @@ default
llMessageLinked(sender, 90101, llDumpList2String([llList2String(data, 0), "[ADJUST]", id], "|"), llList2String(data, 2)); llMessageLinked(sender, 90101, llDumpList2String([llList2String(data, 0), "[ADJUST]", id], "|"), llList2String(data, 2));
if (id == llGetOwner()) if (id == llGetOwner())
{ {
is_running = (!is_running); is_running = !is_running;
if (sender == llGetLinkNumber()) if (sender == llGetLinkNumber())
{ {
llRegionSayTo(id, 0, "Facial Expressions " + llList2String(["OFF", "ON"], is_running)); llRegionSayTo(id, 0, "Facial Expressions " + llList2String(["OFF", "ON"], is_running));

View file

@ -128,7 +128,7 @@ state prop
touch_start(integer touched) touch_start(integer touched)
{ {
if (!llGetAttached() && (prop_type == 2 || prop_type == 1)) if ((!llGetAttached()) && (prop_type == 2 || prop_type == 1))
{ {
llRequestExperiencePermissions(llDetectedKey(0), ""); llRequestExperiencePermissions(llDetectedKey(0), "");
} }

View file

@ -41,7 +41,7 @@ string FormatFloat(float f, integer num_decimals)
f -= rounding; f -= rounding;
else else
f += rounding; f += rounding;
string ret = llGetSubString((string)f, 0, num_decimals - !num_decimals - 7); string ret = llGetSubString((string)f, 0, num_decimals - (!num_decimals) - 7);
if (llSubStringIndex(ret, ".") != -1) if (llSubStringIndex(ret, ".") != -1)
{ {
while (llGetSubString(ret, -1, -1) == "0") while (llGetSubString(ret, -1, -1) == "0")

View file

@ -54,7 +54,7 @@ string FormatFloat(float f, integer num_decimals)
f -= rounding; f -= rounding;
else else
f += rounding; f += rounding;
string ret = llGetSubString((string)f, 0, num_decimals - !num_decimals - 7); string ret = llGetSubString((string)f, 0, num_decimals - (!num_decimals) - 7);
if (llSubStringIndex(ret, ".") != -1) if (llSubStringIndex(ret, ".") != -1)
{ {
while (llGetSubString(ret, -1, -1) == "0") while (llGetSubString(ret, -1, -1) == "0")
@ -784,7 +784,7 @@ default
if (adding == "[PROP]") if (adding == "[PROP]")
{ {
integer perms = llGetInventoryPermMask(choice, MASK_NEXT); integer perms = llGetInventoryPermMask(choice, MASK_NEXT);
if (!(perms & PERM_COPY)) if ((perms & PERM_COPY) == 0)
{ {
llSay(0, "Could not add prop '" + choice + "'. Props and their content must be COPY-OK for NEXT owner."); llSay(0, "Could not add prop '" + choice + "'. Props and their content must be COPY-OK for NEXT owner.");
} }

View file

@ -107,7 +107,7 @@ default
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <0,0,0>, 0, PRIM_FULLBRIGHT, ALL_SIDES, TRUE]); llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <0,0,0>, 0, PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
} }
integer everyonePerms = llGetObjectPermMask(MASK_EVERYONE); integer everyonePerms = llGetObjectPermMask(MASK_EVERYONE);
if (!(everyonePerms & PERM_MOVE) && llGetOwner() == llGetInventoryCreator(llGetScriptName())) if ((everyonePerms & PERM_MOVE) == 0 && llGetOwner() == llGetInventoryCreator(llGetScriptName()))
{ {
llOwnerSay("WARNING! AVhelper should be set to 'Anyone Can Move'"); llOwnerSay("WARNING! AVhelper should be set to 'Anyone Can Move'");
} }

View file

@ -60,7 +60,7 @@ menu(key av)
for (i = 0; i < llGetListLength(BUTTONS); i++) for (i = 0; i < llGetListLength(BUTTONS); i++)
{ {
string avname = llKey2Name(llList2Key(SITTERS, i)); string avname = llKey2Name(llList2Key(SITTERS, i));
if ((!select_type && llList2Integer(SYNCS, i) == FALSE || select_type == 2) && avname != "" && av != llList2Key(SITTERS, i)) if ((select_type == 0 && llList2Integer(SYNCS, i) == FALSE || select_type == 2) && avname != "" && av != llList2Key(SITTERS, i))
{ {
menu_buttons += "⊘" + llGetSubString(strReplace(avname, " Resident", " "), 0, 11); menu_buttons += "⊘" + llGetSubString(strReplace(avname, " Resident", " "), 0, 11);
} }
@ -115,7 +115,7 @@ default
{ {
llMessageLinked(LINK_SET, 90101, llDumpList2String(["X", message, id], "|"), id); llMessageLinked(LINK_SET, 90101, llDumpList2String(["X", message, id], "|"), id);
} }
else if (llGetSubString(message, 0, 0) == "⊘" || (!select_type && llList2Integer(SYNCS, button_index) == FALSE && llList2Key(SITTERS, button_index) != NULL_KEY && llList2Key(SITTERS, button_index) != id)) else if (llGetSubString(message, 0, 0) == "⊘" || (select_type == 0 && llList2Integer(SYNCS, button_index) == FALSE && llList2Key(SITTERS, button_index) != NULL_KEY && llList2Key(SITTERS, button_index) != id))
{ {
menu(id); menu(id);
} }

View file

@ -498,7 +498,7 @@ default
touch_end(integer touched) touch_end(integer touched)
{ {
if (!SCRIPT_CHANNEL && !has_security && MTYPE < 3) if (SCRIPT_CHANNEL == 0 && (!has_security) && MTYPE < 3)
{ {
llMessageLinked(LINK_SET, 90005, "", llDetectedKey(0)); // 90005=send menu to user llMessageLinked(LINK_SET, 90005, "", llDetectedKey(0)); // 90005=send menu to user
} }

View file

@ -79,7 +79,7 @@ memory()
integer animation_menu(integer animation_menu_function) integer animation_menu(integer animation_menu_function)
{ {
if ((animation_menu_function == -1 || llGetListLength(MENU_LIST) < 2) && !helper_mode && llGetInventoryType(select_script) == INVENTORY_SCRIPT) if ((animation_menu_function == -1 || llGetListLength(MENU_LIST) < 2) && (!helper_mode) && llGetInventoryType(select_script) == INVENTORY_SCRIPT)
{ {
llMessageLinked(LINK_SET, 90009, CONTROLLER, MY_SITTER); llMessageLinked(LINK_SET, 90009, CONTROLLER, MY_SITTER);
} }
@ -214,7 +214,7 @@ integer animation_menu(integer animation_menu_function)
if (animation_menu_function == 1) if (animation_menu_function == 1)
{ {
integer pages = total_items / (12 - llGetListLength(menu_items2) - llGetListLength(menu_items0)); integer pages = total_items / (12 - llGetListLength(menu_items2) - llGetListLength(menu_items0));
if (!(total_items % (12 - llGetListLength(menu_items2) - llGetListLength(menu_items0)))) if ((total_items % (12 - llGetListLength(menu_items2) - llGetListLength(menu_items0))) == 0)
{ {
pages--; pages--;
} }