From 58aab90cbff6035a2e31bde404b8ceda1fc3ca66 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 2 Oct 2009 05:17:31 -0700 Subject: Draw Imprudence developers as purple dots in the mini-map (name list in LLFloaterMap) --- linden/indra/newview/llfloatermap.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'linden/indra/newview/llfloatermap.cpp') diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index 6d23ab4..c60f07f 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp @@ -194,6 +194,21 @@ void LLFloaterMap::open() */ //static +bool LLFloaterMap::isImpDev(LLUUID agent_id) +{ + // We use strings here as avatar keys change across grids. + // Feel free to add/remove yourself. + std::string agent_name = getSelectedName(agent_id); + if (agent_name == "McCabe Maxsted" || + agent_name == "Jacek Antonelli" || + agent_name == "Armin Weatherwax") + { + return true; + } + return false; +} + +//static void LLFloaterMap::updateRadar() { LLFloaterMap::getInstance()->populateRadar(); -- cgit v1.1 From b5f977a6b3757aa785346d20a8f7b29858506d42 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 4 Oct 2009 09:12:16 -0700 Subject: Mini-map radar now notifies when someone enters chat range, and how far away they are --- linden/indra/newview/llfloatermap.cpp | 89 +++++++++++++++++++++++++++++++---- 1 file changed, 81 insertions(+), 8 deletions(-) (limited to 'linden/indra/newview/llfloatermap.cpp') diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index c60f07f..9992d9c 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp @@ -43,8 +43,10 @@ #include "lluictrlfactory.h" // radar +#include "llchat.h" #include "llfirstuse.h" #include "llfloateravatarinfo.h" +#include "llfloaterchat.h" #include "llfloaterfriends.h" #include "llfloatergroupinvite.h" #include "llfloatergroups.h" @@ -69,13 +71,15 @@ LLFloaterMap::LLFloaterMap(const LLSD& key) : LLFloater(std::string("minimap")), mPanelMap(NULL), - mUpdate(TRUE) + mUpdate(TRUE), + mSelectedAvatar(LLUUID::null) + { LLCallbackMap::map_t factory_map; factory_map["mini_mapview"] = LLCallbackMap(createPanelMiniMap, this); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE); - mSelectedAvatar.setNull(); + mChatAvatars.clear(); } @@ -262,6 +266,33 @@ void LLFloaterMap::populateRadar() } // [/RLVa:KB] + // check if they're in chat range and notify user + LLVector3d temp = positions[i] - current_pos; + F32 distance = llround((F32)temp.magVec(), 0.1f); + std::stringstream dist; + dist.str(""); + dist << distance; + + if (gSavedSettings.getBOOL("MiniMapNotify")) + { + if (distance <= 20.0f) + { + if (!getInChatList(avatar_ids[i])) + { + addToChatList(avatar_ids[i], dist.str()); + } + } + else + { + if (getInChatList(avatar_ids[i])) + { + removeFromChatList(avatar_ids[i]); + } + } + + updateChatList(avatar_ids); + } + std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : ""; element["id"] = avatar_ids[i]; element["columns"][0]["column"] = "avatar_name"; @@ -269,12 +300,7 @@ void LLFloaterMap::populateRadar() element["columns"][0]["value"] = fullname + " " + mute_text; element["columns"][1]["column"] = "avatar_distance"; element["columns"][1]["type"] = "text"; - - LLVector3d temp = positions[i] - current_pos; - F32 distance = (F32)temp.magVec(); - char dist[32]; - snprintf(dist, sizeof(dist), "%.1f", distance); - element["columns"][1]["value"] = strcat(dist,"m"); + element["columns"][1]["value"] = dist.str()+"m"; mRadarList->addElement(element, ADD_BOTTOM); } @@ -306,6 +332,53 @@ void LLFloaterMap::populateRadar() //llinfos << "mSelectedAvatar: " << mSelectedAvatar.asString() << llendl; } +void LLFloaterMap::updateChatList(std::vector agent_ids) +{ + std::set::iterator it; + std::vector::iterator result; + for (it = mChatAvatars.begin(); it != mChatAvatars.end(); ) + { + result = find(agent_ids.begin(), agent_ids.end(), *it); + if (result == agent_ids.end()) + { + mChatAvatars.erase(it++); + } + else + { + it++; + } + } +} + +bool LLFloaterMap::getInChatList(LLUUID agent_id) +{ + if (mChatAvatars.count(agent_id) > 0) + { + return true; + } + return false; +} + +void LLFloaterMap::addToChatList(LLUUID agent_id, std::string distance) +{ + mChatAvatars.insert(agent_id); + LLChat chat; + + LLUIString notify = getString("entering_chat_range"); + notify.setArg("[NAME]", getSelectedName(agent_id)); + notify.setArg("[DISTANCE]", distance); + + chat.mText = notify; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + LLFloaterChat::addChat(chat, FALSE, FALSE); +} + +void LLFloaterMap::removeFromChatList(LLUUID agent_id) +{ + // Do we want to add a notice? + mChatAvatars.erase(agent_id); +} + void LLFloaterMap::toggleButtons() { BOOL enable = FALSE; -- cgit v1.1 From 2c7ec0675ebfa21c548fd7eba4e13b01a7171be3 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 4 Oct 2009 14:25:33 -0700 Subject: Clear list of avs in chat range when setting disabled --- linden/indra/newview/llfloatermap.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'linden/indra/newview/llfloatermap.cpp') diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index 9992d9c..4e3ffa3 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp @@ -292,6 +292,10 @@ void LLFloaterMap::populateRadar() updateChatList(avatar_ids); } + else if (!mChatAvatars.empty()) + { + mChatAvatars.clear(); + } std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : ""; element["id"] = avatar_ids[i]; -- cgit v1.1 From f41ffc75aaebbbd122b36443ffb4813948d682aa Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 4 Oct 2009 16:15:52 -0700 Subject: Fixed mini-map distance label and rounding --- linden/indra/newview/llfloatermap.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'linden/indra/newview/llfloatermap.cpp') diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index 4e3ffa3..200c60d 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp @@ -269,17 +269,17 @@ void LLFloaterMap::populateRadar() // check if they're in chat range and notify user LLVector3d temp = positions[i] - current_pos; F32 distance = llround((F32)temp.magVec(), 0.1f); - std::stringstream dist; - dist.str(""); - dist << distance; + char dist[32]; + sprintf(dist, "%.1f", distance); + std::string dist_string = dist; if (gSavedSettings.getBOOL("MiniMapNotify")) { - if (distance <= 20.0f) + if (distance < 20.0f) { if (!getInChatList(avatar_ids[i])) { - addToChatList(avatar_ids[i], dist.str()); + addToChatList(avatar_ids[i], dist_string); } } else @@ -304,7 +304,7 @@ void LLFloaterMap::populateRadar() element["columns"][0]["value"] = fullname + " " + mute_text; element["columns"][1]["column"] = "avatar_distance"; element["columns"][1]["type"] = "text"; - element["columns"][1]["value"] = dist.str()+"m"; + element["columns"][1]["value"] = dist_string+"m"; mRadarList->addElement(element, ADD_BOTTOM); } -- cgit v1.1 From baff7828246eefe8a79da2a7daff7afe6863147e Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 5 Oct 2009 07:09:51 -0700 Subject: Tiny improvement to radar code --- linden/indra/newview/llfloatermap.cpp | 123 +++++++++++++++++----------------- 1 file changed, 62 insertions(+), 61 deletions(-) (limited to 'linden/indra/newview/llfloatermap.cpp') diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index 200c60d..e90e3b4 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp @@ -238,6 +238,10 @@ void LLFloaterMap::populateRadar() LLVector3d current_pos = gAgent.getPositionGlobal(); + // clear count + std::stringstream avatar_count; + avatar_count.str(""); + // find what avatars you can see std::vector avatar_ids; std::vector positions; @@ -247,88 +251,85 @@ void LLFloaterMap::populateRadar() mRadarList->deleteAllItems(); - for (U32 i=0; iisMuted(avatar_ids[i]) ? getString("muted") : ""; - element["id"] = avatar_ids[i]; - element["columns"][0]["column"] = "avatar_name"; - element["columns"][0]["type"] = "text"; - element["columns"][0]["value"] = fullname + " " + mute_text; - element["columns"][1]["column"] = "avatar_distance"; - element["columns"][1]["type"] = "text"; - element["columns"][1]["value"] = dist_string+"m"; + std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : ""; + element["id"] = avatar_ids[i]; + element["columns"][0]["column"] = "avatar_name"; + element["columns"][0]["type"] = "text"; + element["columns"][0]["value"] = fullname + " " + mute_text; + element["columns"][1]["column"] = "avatar_distance"; + element["columns"][1]["type"] = "text"; + element["columns"][1]["value"] = dist_string+"m"; - mRadarList->addElement(element, ADD_BOTTOM); + mRadarList->addElement(element, ADD_BOTTOM); + } } - } - mRadarList->sortItems(); - mRadarList->setScrollPos(scroll_pos); - if (mSelectedAvatar.notNull()) - { - mRadarList->selectByID(mSelectedAvatar); + mRadarList->sortItems(); + mRadarList->setScrollPos(scroll_pos); + if (mSelectedAvatar.notNull()) + { + mRadarList->selectByID(mSelectedAvatar); + } + avatar_count << (int)avatar_ids.size(); } - - // set count - std::stringstream avatar_count; - avatar_count.str(""); - if (avatar_ids.empty()) + else { mRadarList->addCommentText(getString("no_one_near"), ADD_TOP); avatar_count << "0"; } - else - { - avatar_count << (int)avatar_ids.size(); - } + childSetText("lblAvatarCount", avatar_count.str()); toggleButtons(); -- cgit v1.1 From 4bd4150d06bfd3a47bdcd2b47d388a6453980e70 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 7 Oct 2009 22:31:02 -0700 Subject: Added typing info to mini-map radar --- linden/indra/newview/llfloatermap.cpp | 36 +++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'linden/indra/newview/llfloatermap.cpp') diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index e90e3b4..ae5b2b6 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp @@ -80,6 +80,7 @@ LLFloaterMap::LLFloaterMap(const LLSD& key) LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE); mChatAvatars.clear(); + mTypingAvatars.clear(); } @@ -303,11 +304,18 @@ void LLFloaterMap::populateRadar() mChatAvatars.clear(); } - std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : ""; + // append typing string + std::string typing = ""; + if (getIsTyping(avatar_ids[i])) + { + typing = getString("is_typing")+ " "; + } + + std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("is_muted") : ""; element["id"] = avatar_ids[i]; element["columns"][0]["column"] = "avatar_name"; element["columns"][0]["type"] = "text"; - element["columns"][0]["value"] = fullname + " " + mute_text; + element["columns"][0]["value"] = typing + fullname + " " + mute_text; element["columns"][1]["column"] = "avatar_distance"; element["columns"][1]["type"] = "text"; element["columns"][1]["value"] = dist_string+"m"; @@ -384,6 +392,30 @@ void LLFloaterMap::removeFromChatList(LLUUID agent_id) mChatAvatars.erase(agent_id); } +bool LLFloaterMap::getIsTyping(LLUUID agent_id) +{ + if (mTypingAvatars.count(agent_id) > 0) + { + return true; + } + return false; +} + +void LLFloaterMap::updateTypingList(LLUUID agent_id, bool remove) +{ + if (remove) + { + if (getIsTyping(agent_id)) + { + mTypingAvatars.erase(agent_id); + } + } + else + { + mTypingAvatars.insert(agent_id); + } +} + void LLFloaterMap::toggleButtons() { BOOL enable = FALSE; -- cgit v1.1 From 64d298ac17b47805f3deec99fc911bd8f73a9d2d Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Thu, 8 Oct 2009 02:01:55 -0700 Subject: Mini-map radar now can notify you when someone enters the sim --- linden/indra/newview/llfloatermap.cpp | 73 ++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) (limited to 'linden/indra/newview/llfloatermap.cpp') diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index ae5b2b6..142d8fe 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp @@ -266,10 +266,14 @@ void LLFloaterMap::populateRadar() std::string fullname = getSelectedName(avatar_ids[i]); if (!fullname.empty()) { + bool notify_chat = gSavedSettings.getBOOL("MiniMapNotifyChatRange"); + bool notify_sim = gSavedSettings.getBOOL("MiniMapNotifySimRange"); // [RLVa:KB] - Alternate: Imprudence-1.2.0 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { fullname = gRlvHandler.getAnonym(fullname); + notify_chat = false; + notify_sim = false; } // [/RLVa:KB] @@ -280,7 +284,7 @@ void LLFloaterMap::populateRadar() sprintf(dist, "%.1f", distance); std::string dist_string = dist; - if (gSavedSettings.getBOOL("MiniMapNotify")) + if (notify_chat) { if (distance < 20.0f) { @@ -304,6 +308,31 @@ void LLFloaterMap::populateRadar() mChatAvatars.clear(); } + // announce their presence in the sim if we've enabled that + if (notify_sim) + { + if (!getInChatList(avatar_ids[i]) && !getInSimAvList(avatar_ids[i])) + { + LLViewerObject *av_obj = gObjectList.findObject(avatar_ids[i]); + if (av_obj != NULL && av_obj->isAvatar()) + { + LLVOAvatar* avatarp = (LLVOAvatar*)av_obj; + if (avatarp != NULL) + { + if (avatarp->getRegion() == gAgent.getRegion()) + { + addToSimAvList(avatar_ids[i], dist_string); + } + } + } + } + updateSimAvList(avatar_ids); + } + else if (!mSimAvatars.empty()) + { + mSimAvatars.clear(); + } + // append typing string std::string typing = ""; if (getIsTyping(avatar_ids[i])) @@ -334,6 +363,7 @@ void LLFloaterMap::populateRadar() } else { + mTypingAvatars.clear(); mRadarList->addCommentText(getString("no_one_near"), ADD_TOP); avatar_count << "0"; } @@ -416,6 +446,47 @@ void LLFloaterMap::updateTypingList(LLUUID agent_id, bool remove) } } +void LLFloaterMap::updateSimAvList(std::vector agent_ids) +{ + std::set::iterator it; + std::vector::iterator result; + for (it = mSimAvatars.begin(); it != mSimAvatars.end(); ) + { + result = find(agent_ids.begin(), agent_ids.end(), *it); + if (result == agent_ids.end()) + { + mSimAvatars.erase(it++); + } + else + { + it++; + } + } +} + +void LLFloaterMap::addToSimAvList(LLUUID agent_id, std::string distance) +{ + mSimAvatars.insert(agent_id); + LLChat chat; + + LLUIString notify = getString("entering_sim_range"); + notify.setArg("[NAME]", getSelectedName(agent_id)); + notify.setArg("[DISTANCE]", distance); + + chat.mText = notify; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + LLFloaterChat::addChat(chat, FALSE, FALSE); +} + +bool LLFloaterMap::getInSimAvList(LLUUID agent_id) +{ + if (mSimAvatars.count(agent_id) > 0) + { + return true; + } + return false; +} + void LLFloaterMap::toggleButtons() { BOOL enable = FALSE; -- cgit v1.1 From f9bf7355ba74bbff8b043a35cdab2bb7bac7a2cb Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Thu, 8 Oct 2009 11:47:03 -0700 Subject: Fixed entering sim notification being tied to radar range --- linden/indra/newview/llfloatermap.cpp | 47 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'linden/indra/newview/llfloatermap.cpp') diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index 142d8fe..0ee0f2b 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp @@ -237,16 +237,16 @@ void LLFloaterMap::populateRadar() S32 scroll_pos = mRadarList->getScrollPos(); - LLVector3d current_pos = gAgent.getPositionGlobal(); - // clear count std::stringstream avatar_count; avatar_count.str(""); // find what avatars you can see + F32 range = gSavedSettings.getF32("NearMeRange"); + LLVector3d current_pos = gAgent.getPositionGlobal(); std::vector avatar_ids; std::vector positions; - LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, current_pos, gSavedSettings.getF32("NearMeRange")); + LLWorld::getInstance()->getAvatars(&avatar_ids, &positions); LLSD element; @@ -277,12 +277,13 @@ void LLFloaterMap::populateRadar() } // [/RLVa:KB] - // check if they're in chat range and notify user + // check if they're in certain ranges and notify user if we've enabled that LLVector3d temp = positions[i] - current_pos; F32 distance = llround((F32)temp.magVec(), 0.1f); - char dist[32]; + /*char dist[32]; sprintf(dist, "%.1f", distance); - std::string dist_string = dist; + std::string dist_string = dist;*/ + std::string dist_string = llformat("%.1f", distance); if (notify_chat) { @@ -300,7 +301,6 @@ void LLFloaterMap::populateRadar() removeFromChatList(avatar_ids[i]); } } - updateChatList(avatar_ids); } else if (!mChatAvatars.empty()) @@ -308,7 +308,6 @@ void LLFloaterMap::populateRadar() mChatAvatars.clear(); } - // announce their presence in the sim if we've enabled that if (notify_sim) { if (!getInChatList(avatar_ids[i]) && !getInSimAvList(avatar_ids[i])) @@ -333,23 +332,27 @@ void LLFloaterMap::populateRadar() mSimAvatars.clear(); } - // append typing string - std::string typing = ""; - if (getIsTyping(avatar_ids[i])) + // only display avatars in range + if (distance <= range) { - typing = getString("is_typing")+ " "; - } + // append typing string + std::string typing = ""; + if (getIsTyping(avatar_ids[i])) + { + typing = getString("is_typing")+ " "; + } - std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("is_muted") : ""; - element["id"] = avatar_ids[i]; - element["columns"][0]["column"] = "avatar_name"; - element["columns"][0]["type"] = "text"; - element["columns"][0]["value"] = typing + fullname + " " + mute_text; - element["columns"][1]["column"] = "avatar_distance"; - element["columns"][1]["type"] = "text"; - element["columns"][1]["value"] = dist_string+"m"; + std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("is_muted") : ""; + element["id"] = avatar_ids[i]; + element["columns"][0]["column"] = "avatar_name"; + element["columns"][0]["type"] = "text"; + element["columns"][0]["value"] = typing + fullname + " " + mute_text; + element["columns"][1]["column"] = "avatar_distance"; + element["columns"][1]["type"] = "text"; + element["columns"][1]["value"] = dist_string+"m"; - mRadarList->addElement(element, ADD_BOTTOM); + mRadarList->addElement(element, ADD_BOTTOM); + } } } -- cgit v1.1