Fix some marginal bugs, and the version of [AV]faces.

- Bump version of [AV]faces to 2.2.
- With very bad luck, some channel numbers could overflow the range of an integer due to float rounding, and produce DEBUG_CHANNEL or PUBLIC_CHANNEL as output.
- If both CHANGED_INVENTORY and CHANGED_LINK came at the same time, [AV]prop would fail to handle both.
- There was code that did nothing in [AV]faces. While it caused no bug per se, if it was reused in future then it could be affected by the same problem as that in [AV]prop.
This commit is contained in:
Sei Lisa 2017-08-15 17:21:00 +02:00 committed by Sei-Lisa
parent 610890951d
commit 4278710ce8
11 changed files with 20 additions and 15 deletions

View file

@ -175,8 +175,8 @@ state running
product = llList2String(data, 2);
llListenRemove(menu_handle);
llListenRemove(GETSTATUShandle);
menu_handle = llListen(menu_channel = ((integer)llFrand(2147483646) + 1) * -1, "", CONTROLLER, "");
GETSTATUShandle = llListen(RELAY_GETSTATUS_CHANNEL = (integer)llFrand(999999999), "", "", "");
menu_handle = llListen(menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1, "", CONTROLLER, ""); // 7FFFFF80 = max float < 2^31
GETSTATUShandle = llListen(RELAY_GETSTATUS_CHANNEL = (integer)llFrand(999999936), "", "", ""); // 999999936 = max float < 1e9
if (num == 90208)
{
main_menu();

View file

@ -358,7 +358,7 @@ new_controller(key id)
CONTROLLER = id;
controllerName = llKey2Name(CONTROLLER);
llListenRemove(menu_handle);
menu_handle = llListen(menu_channel = ((integer)llFrand(2147483646) + 1) * -1, "", CONTROLLER, "");
menu_handle = llListen(menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1, "", CONTROLLER, ""); // 7FFFFF80 = max float < 2^31
}
no_sensor_results()
@ -374,10 +374,10 @@ no_sensor_results()
get_unique_channels()
{
RELAY_SEARCH_CHANNEL = (integer)llFrand(999999999) + 1;
RELAY_SEARCH_CHANNEL = (integer)llFrand(999999936) + 1; // 999999936 = max float < 1e9
RELAY_GETCAPTURESTATUSchannel = RELAY_SEARCH_CHANNEL + 2;
RELAY_CHECK_CHANNEL = RELAY_SEARCH_CHANNEL + 4;
ASKROLE_CHANEL = ((integer)llFrand(2147483646) + 1) * -1;
ASKROLE_CHANEL = ((integer)llFrand(0x7FFFFF80) + 1) * -1; // 7FFFFF80 = max float < 2^31
llListenRemove(relay_handle);
relay_handle = llListen(RELAY_CHANNEL, "", "", ping = "ping," + (string)llGetKey() + ",ping,ping");
}

View file

@ -112,7 +112,7 @@ controller_menu(key id)
dialog(string text, list menu_items, key id)
{
llListenRemove(menu_handle);
menu_handle = llListen(menu_channel = ((integer)llFrand(2147483646) + 1) * -1, "", id, "");
menu_handle = llListen(menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1, "", id, ""); // 7FFFFF80 = max float < 2^31
llDialog(id, product + " " + version + "\n\n" + text + "\n", order_buttons(menu_items), menu_channel);
llSetTimerEvent(120);
}

View file

@ -39,7 +39,8 @@ integer IsInteger(string data)
{
return llParseString2List((string)llParseString2List(data, ["8", "9"], []), ["0", "1", "2", "3", "4", "5", "6", "7"], []) == [] && data != "";
}
string version = "2.1";
string version = "2.2";
string notecard_name = "AVpos";
string main_script = "[AV]sitA";
key key_request;
@ -371,12 +372,16 @@ default
init_sitters();
}
}
else if (change & CHANGED_LINK)
/*
// If you uncomment this, don't make this an 'else if', as
// changed events may come several at a time.
if (change & CHANGED_LINK)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{
}
}
*/
}
dataserver(key query_id, string data)

View file

@ -285,7 +285,7 @@ integer prop_menu(integer return_pages, key av)
menu_items1 = ["[BACK]"] + menu_items1;
menu_items2 = llDeleteSubList(menu_items2, 0, 0);
}
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1; // 7FFFFF80 = max float < 2^31
llListenRemove(listen_handle);
listen_handle = llListen(menu_channel, "", av, "");
dialog(av, custom_text, menu_items1 + menu_items2);

View file

@ -519,7 +519,7 @@ default
init_sitters();
}
}
else if (change & CHANGED_LINK)
if (change & CHANGED_LINK)
{
if (llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())) == ZERO_VECTOR)
{

View file

@ -208,7 +208,7 @@ stop_sequence(integer stopSound)
sequence_control()
{
llListenRemove(menu_handle);
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1; // 7FFFFF80 = max float < 2^31
string pauseplay = "▶";
if (sequence_running)
{

View file

@ -109,7 +109,7 @@ main_menu()
dialog(string text, list menu_items)
{
llListenRemove(menu_handle);
menu_handle = llListen(menu_channel = ((integer)llFrand(2147483646) + 1) * -1, "", llGetOwner(), "");
menu_handle = llListen(menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1, "", llGetOwner(), ""); // 7FFFFF80 = max float < 2^31
llDialog(llGetOwner(), product + "\n\n" + text, order_buttons(menu_items), menu_channel);
llSetTimerEvent(600);
}

View file

@ -91,7 +91,7 @@ default
{
state_entry()
{
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1; // 7FFFFF80 = max float < 2^31
menu_handle = llListen(menu_channel, "", "", "");
llListenControl(menu_handle, FALSE);
integer i;

View file

@ -107,7 +107,7 @@ integer get_number_of_scripts()
dialog(string text, list menu_items)
{
llListenRemove(menu_handle);
menu_handle = llListen(menu_channel = ((integer)llFrand(2147483646) + 1) * -1, "", CONTROLLER, "");
menu_handle = llListen(menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1, "", CONTROLLER, ""); // 7FFFFF80 = max float < 2^31
llDialog(CONTROLLER, product + " " + version + "\n\n" + text, order_buttons(menu_items), menu_channel);
}

View file

@ -524,7 +524,7 @@ default
CONTROLLER = MY_SITTER = id;
menu_page = 0;
current_menu = -1;
menu_channel = ((integer)llFrand(2147483646) + 1) * -1;
menu_channel = ((integer)llFrand(0x7FFFFF80) + 1) * -1; // 7FFFFF80 = max float < 2^31
llListenRemove(menu_handle);
}
else if (num == 90065 && sender == llGetLinkNumber())