Properly handle offer TP check in people panel in case of multi-selections
parent
03f7dc92bb
commit
377f7e5818
|
|
@ -206,7 +206,7 @@ void FSFloaterRadar::onTeleportButtonClicked()
|
|||
{
|
||||
uuid_vec_t selected_uuids;
|
||||
mRadarPanel->getCurrentItemIDs(selected_uuids);
|
||||
LLAvatarActions::offerTeleport(LLAvatarActions::canOfferTeleport(selected_uuids));
|
||||
LLAvatarActions::offerTeleport(selected_uuids);
|
||||
}
|
||||
|
||||
void FSFloaterRadar::onShareButtonClicked()
|
||||
|
|
|
|||
|
|
@ -201,14 +201,10 @@ bool FSRadarMenu::enableContextMenuItem(const LLSD& userdata)
|
|||
return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id))
|
||||
|| gAgent.isGodlike();
|
||||
}
|
||||
// <FS> Prevent teleport button from being disabled when someone on your
|
||||
// friends list logs out but is still in the region and you have
|
||||
// multiple people selected.
|
||||
//else if(item == std::string("can_offer_teleport"))
|
||||
//{
|
||||
// return LLAvatarActions::canOfferTeleport(mUUIDs);
|
||||
//}
|
||||
// </FS>
|
||||
else if(item == std::string("can_offer_teleport"))
|
||||
{
|
||||
return LLAvatarActions::canOfferTeleport(mUUIDs);
|
||||
}
|
||||
else if (item == std::string("can_open_inventory"))
|
||||
{
|
||||
return (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV));
|
||||
|
|
|
|||
|
|
@ -192,7 +192,23 @@ void LLAvatarActions::offerTeleport(const uuid_vec_t& ids)
|
|||
if (ids.size() == 0)
|
||||
return;
|
||||
|
||||
handle_lure(ids);
|
||||
// <FS:Ansariel> Fix edge case with multi-selection containing offlines
|
||||
//handle_lure(ids);
|
||||
uuid_vec_t result;
|
||||
for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
|
||||
{
|
||||
if (canOfferTeleport(*it))
|
||||
{
|
||||
result.push_back(*it);
|
||||
// Maximum 250 lures
|
||||
if (result.size() == 250)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
handle_lure(result);
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
|
||||
static void on_avatar_name_cache_start_im(const LLUUID& agent_id,
|
||||
|
|
@ -1039,19 +1055,39 @@ bool LLAvatarActions::canOfferTeleport(const LLUUID& id)
|
|||
}
|
||||
|
||||
// static
|
||||
uuid_vec_t LLAvatarActions::canOfferTeleport(const uuid_vec_t& ids)
|
||||
bool LLAvatarActions::canOfferTeleport(const uuid_vec_t& ids)
|
||||
{
|
||||
uuid_vec_t result;
|
||||
// We can't send more than 250 lures in a single message, so disable this
|
||||
// button when there are too many id's selected.
|
||||
// <FS:Ansariel> Fix edge case with multi-selection containing offlines
|
||||
//if(ids.size() > 250) return false;
|
||||
//
|
||||
//bool result = true;
|
||||
//for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
|
||||
//{
|
||||
// if(!canOfferTeleport(*it))
|
||||
// {
|
||||
// result = false;
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
//return result;
|
||||
|
||||
if (ids.size() == 1)
|
||||
{
|
||||
return canOfferTeleport(ids.front());
|
||||
}
|
||||
|
||||
S32 valid_count = 0;
|
||||
for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
|
||||
{
|
||||
if(canOfferTeleport(*it))
|
||||
if (canOfferTeleport(*it))
|
||||
{
|
||||
result.push_back(*it);
|
||||
// We can't send more than 250 lures in a single message, so stop when we are full
|
||||
if(result.size() == 250) break;
|
||||
valid_count++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return (valid_count > 0 && valid_count <= 250);
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
|
||||
void LLAvatarActions::inviteToGroup(const LLUUID& id)
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ public:
|
|||
/**
|
||||
* @return a list of avatars that can be teleported from the input list
|
||||
*/
|
||||
static uuid_vec_t canOfferTeleport(const uuid_vec_t& ids);
|
||||
static bool canOfferTeleport(const uuid_vec_t& ids);
|
||||
|
||||
/**
|
||||
* Checks whether all items selected in the given inventory panel can be shared
|
||||
|
|
|
|||
|
|
@ -234,14 +234,10 @@ bool PeopleContextMenu::enableContextMenuItem(const LLSD& userdata)
|
|||
return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id))
|
||||
|| gAgent.isGodlike();
|
||||
}
|
||||
// <FS> Prevent teleport button from being disabled when someone on your
|
||||
// friends list logs out but is still in the region and you have
|
||||
// multiple people selected.
|
||||
//else if(item == std::string("can_offer_teleport"))
|
||||
//{
|
||||
// return LLAvatarActions::canOfferTeleport(mUUIDs);
|
||||
//}
|
||||
// </FS>
|
||||
else if(item == std::string("can_offer_teleport"))
|
||||
{
|
||||
return LLAvatarActions::canOfferTeleport(mUUIDs);
|
||||
}
|
||||
// <FS:Ansariel> FIRE-8804: Prevent opening inventory from using share in radar context menu
|
||||
else if (item == std::string("can_open_inventory"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@
|
|||
name="teleport">
|
||||
<menu_item_call.on_click
|
||||
function="Avatar.OfferTeleport"/>
|
||||
<menu_item_call.on_enable
|
||||
function="Avatar.EnableItem"
|
||||
parameter="can_offer_teleport"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Teleport To"
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@
|
|||
name="teleport">
|
||||
<menu_item_call.on_click
|
||||
function="Avatar.OfferTeleport"/>
|
||||
<menu_item_call.on_enable
|
||||
function="Avatar.EnableItem"
|
||||
parameter="can_offer_teleport"/>
|
||||
</menu_item_call>
|
||||
|
||||
<menu_item_separator />
|
||||
|
|
|
|||
|
|
@ -62,5 +62,8 @@
|
|||
name="offer_teleport">
|
||||
<menu_item_call.on_click
|
||||
function="Avatar.OfferTeleport"/>
|
||||
<menu_item_call.on_enable
|
||||
function="Avatar.EnableItem"
|
||||
parameter="can_offer_teleport"/>
|
||||
</menu_item_call>
|
||||
</context_menu>
|
||||
|
|
|
|||
Loading…
Reference in New Issue