diff options
author | McCabe Maxsted | 2009-10-04 09:12:16 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-10-04 14:02:02 -0700 |
commit | b5f977a6b3757aa785346d20a8f7b29858506d42 (patch) | |
tree | ec7bc3f7a01d1cda43ff5d9f0e614f7ba02b2b05 /linden/indra/newview/llfloatermap.cpp | |
parent | Fixed layout of debug permissions in tools window (diff) | |
download | meta-impy-b5f977a6b3757aa785346d20a8f7b29858506d42.zip meta-impy-b5f977a6b3757aa785346d20a8f7b29858506d42.tar.gz meta-impy-b5f977a6b3757aa785346d20a8f7b29858506d42.tar.bz2 meta-impy-b5f977a6b3757aa785346d20a8f7b29858506d42.tar.xz |
Mini-map radar now notifies when someone enters chat range, and how far away they are
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloatermap.cpp | 89 |
1 files changed, 81 insertions, 8 deletions
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 @@ | |||
43 | #include "lluictrlfactory.h" | 43 | #include "lluictrlfactory.h" |
44 | 44 | ||
45 | // radar | 45 | // radar |
46 | #include "llchat.h" | ||
46 | #include "llfirstuse.h" | 47 | #include "llfirstuse.h" |
47 | #include "llfloateravatarinfo.h" | 48 | #include "llfloateravatarinfo.h" |
49 | #include "llfloaterchat.h" | ||
48 | #include "llfloaterfriends.h" | 50 | #include "llfloaterfriends.h" |
49 | #include "llfloatergroupinvite.h" | 51 | #include "llfloatergroupinvite.h" |
50 | #include "llfloatergroups.h" | 52 | #include "llfloatergroups.h" |
@@ -69,13 +71,15 @@ LLFloaterMap::LLFloaterMap(const LLSD& key) | |||
69 | : | 71 | : |
70 | LLFloater(std::string("minimap")), | 72 | LLFloater(std::string("minimap")), |
71 | mPanelMap(NULL), | 73 | mPanelMap(NULL), |
72 | mUpdate(TRUE) | 74 | mUpdate(TRUE), |
75 | mSelectedAvatar(LLUUID::null) | ||
76 | |||
73 | { | 77 | { |
74 | LLCallbackMap::map_t factory_map; | 78 | LLCallbackMap::map_t factory_map; |
75 | factory_map["mini_mapview"] = LLCallbackMap(createPanelMiniMap, this); | 79 | factory_map["mini_mapview"] = LLCallbackMap(createPanelMiniMap, this); |
76 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE); | 80 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE); |
77 | 81 | ||
78 | mSelectedAvatar.setNull(); | 82 | mChatAvatars.clear(); |
79 | } | 83 | } |
80 | 84 | ||
81 | 85 | ||
@@ -262,6 +266,33 @@ void LLFloaterMap::populateRadar() | |||
262 | } | 266 | } |
263 | // [/RLVa:KB] | 267 | // [/RLVa:KB] |
264 | 268 | ||
269 | // check if they're in chat range and notify user | ||
270 | LLVector3d temp = positions[i] - current_pos; | ||
271 | F32 distance = llround((F32)temp.magVec(), 0.1f); | ||
272 | std::stringstream dist; | ||
273 | dist.str(""); | ||
274 | dist << distance; | ||
275 | |||
276 | if (gSavedSettings.getBOOL("MiniMapNotify")) | ||
277 | { | ||
278 | if (distance <= 20.0f) | ||
279 | { | ||
280 | if (!getInChatList(avatar_ids[i])) | ||
281 | { | ||
282 | addToChatList(avatar_ids[i], dist.str()); | ||
283 | } | ||
284 | } | ||
285 | else | ||
286 | { | ||
287 | if (getInChatList(avatar_ids[i])) | ||
288 | { | ||
289 | removeFromChatList(avatar_ids[i]); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | updateChatList(avatar_ids); | ||
294 | } | ||
295 | |||
265 | std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : ""; | 296 | std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : ""; |
266 | element["id"] = avatar_ids[i]; | 297 | element["id"] = avatar_ids[i]; |
267 | element["columns"][0]["column"] = "avatar_name"; | 298 | element["columns"][0]["column"] = "avatar_name"; |
@@ -269,12 +300,7 @@ void LLFloaterMap::populateRadar() | |||
269 | element["columns"][0]["value"] = fullname + " " + mute_text; | 300 | element["columns"][0]["value"] = fullname + " " + mute_text; |
270 | element["columns"][1]["column"] = "avatar_distance"; | 301 | element["columns"][1]["column"] = "avatar_distance"; |
271 | element["columns"][1]["type"] = "text"; | 302 | element["columns"][1]["type"] = "text"; |
272 | 303 | element["columns"][1]["value"] = dist.str()+"m"; | |
273 | LLVector3d temp = positions[i] - current_pos; | ||
274 | F32 distance = (F32)temp.magVec(); | ||
275 | char dist[32]; | ||
276 | snprintf(dist, sizeof(dist), "%.1f", distance); | ||
277 | element["columns"][1]["value"] = strcat(dist,"m"); | ||
278 | 304 | ||
279 | mRadarList->addElement(element, ADD_BOTTOM); | 305 | mRadarList->addElement(element, ADD_BOTTOM); |
280 | } | 306 | } |
@@ -306,6 +332,53 @@ void LLFloaterMap::populateRadar() | |||
306 | //llinfos << "mSelectedAvatar: " << mSelectedAvatar.asString() << llendl; | 332 | //llinfos << "mSelectedAvatar: " << mSelectedAvatar.asString() << llendl; |
307 | } | 333 | } |
308 | 334 | ||
335 | void LLFloaterMap::updateChatList(std::vector<LLUUID> agent_ids) | ||
336 | { | ||
337 | std::set<LLUUID>::iterator it; | ||
338 | std::vector<LLUUID>::iterator result; | ||
339 | for (it = mChatAvatars.begin(); it != mChatAvatars.end(); ) | ||
340 | { | ||
341 | result = find(agent_ids.begin(), agent_ids.end(), *it); | ||
342 | if (result == agent_ids.end()) | ||
343 | { | ||
344 | mChatAvatars.erase(it++); | ||
345 | } | ||
346 | else | ||
347 | { | ||
348 | it++; | ||
349 | } | ||
350 | } | ||
351 | } | ||
352 | |||
353 | bool LLFloaterMap::getInChatList(LLUUID agent_id) | ||
354 | { | ||
355 | if (mChatAvatars.count(agent_id) > 0) | ||
356 | { | ||
357 | return true; | ||
358 | } | ||
359 | return false; | ||
360 | } | ||
361 | |||
362 | void LLFloaterMap::addToChatList(LLUUID agent_id, std::string distance) | ||
363 | { | ||
364 | mChatAvatars.insert(agent_id); | ||
365 | LLChat chat; | ||
366 | |||
367 | LLUIString notify = getString("entering_chat_range"); | ||
368 | notify.setArg("[NAME]", getSelectedName(agent_id)); | ||
369 | notify.setArg("[DISTANCE]", distance); | ||
370 | |||
371 | chat.mText = notify; | ||
372 | chat.mSourceType = CHAT_SOURCE_SYSTEM; | ||
373 | LLFloaterChat::addChat(chat, FALSE, FALSE); | ||
374 | } | ||
375 | |||
376 | void LLFloaterMap::removeFromChatList(LLUUID agent_id) | ||
377 | { | ||
378 | // Do we want to add a notice? | ||
379 | mChatAvatars.erase(agent_id); | ||
380 | } | ||
381 | |||
309 | void LLFloaterMap::toggleButtons() | 382 | void LLFloaterMap::toggleButtons() |
310 | { | 383 | { |
311 | BOOL enable = FALSE; | 384 | BOOL enable = FALSE; |