From 0ca9047f8c1b5f60838a77854e2a6ab667eccd27 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Thu, 28 Mar 2019 02:43:32 -0400 Subject: [PATCH] Optimize the way we send top scripts/object disable/return --- indra/newview/llfloatertopobjects.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index a6013fbb3..05ba84c06 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -328,21 +328,11 @@ void LLFloaterTopObjects::doToObjects(int action, bool all) LLViewerRegion* region = gAgent.getRegion(); if (!region) return; - LLCtrlListInterface *list = getChild("objects_list")->getListInterface(); + const auto list = getChild("objects_list"); if (!list || list->getItemCount() == 0) return; - uuid_vec_t::iterator id_itor; - bool start_message = true; - - for (id_itor = mObjectListIDs.begin(); id_itor != mObjectListIDs.end(); ++id_itor) - { - LLUUID task_id = *id_itor; - if (!all && !list->isSelected(task_id)) - { - // Selected only - continue; - } + auto func = [&](const LLUUID& task_id){ if (start_message) { if (action == ACTION_RETURN) @@ -370,7 +360,10 @@ void LLFloaterTopObjects::doToObjects(int action, bool all) msg->sendReliable(region->getHost()); start_message = true; } - } + }; + + if (all) for (const auto& id : mObjectListIDs) func(id); + else for (const auto& item : list->getAllSelected()) func(item->getUUID()); if (!start_message) {