diff options
Diffstat (limited to 'linden/indra/newview/llfloatermap.cpp')
-rw-r--r-- | linden/indra/newview/llfloatermap.cpp | 141 |
1 files changed, 124 insertions, 17 deletions
diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index e90e3b4..49563a6 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp | |||
@@ -80,6 +80,7 @@ LLFloaterMap::LLFloaterMap(const LLSD& key) | |||
80 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE); | 80 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE); |
81 | 81 | ||
82 | mChatAvatars.clear(); | 82 | mChatAvatars.clear(); |
83 | mTypingAvatars.clear(); | ||
83 | } | 84 | } |
84 | 85 | ||
85 | 86 | ||
@@ -95,6 +96,7 @@ BOOL LLFloaterMap::postBuild() | |||
95 | { | 96 | { |
96 | // Send the drag handle to the back, but make sure close stays on top | 97 | // Send the drag handle to the back, but make sure close stays on top |
97 | sendChildToBack(getDragHandle()); | 98 | sendChildToBack(getDragHandle()); |
99 | sendChildToFront(getChild<LLButton>("llfloater_minimize_btn")); | ||
98 | sendChildToFront(getChild<LLButton>("llfloater_close_btn")); | 100 | sendChildToFront(getChild<LLButton>("llfloater_close_btn")); |
99 | setIsChrome(TRUE); | 101 | setIsChrome(TRUE); |
100 | 102 | ||
@@ -236,16 +238,16 @@ void LLFloaterMap::populateRadar() | |||
236 | 238 | ||
237 | S32 scroll_pos = mRadarList->getScrollPos(); | 239 | S32 scroll_pos = mRadarList->getScrollPos(); |
238 | 240 | ||
239 | LLVector3d current_pos = gAgent.getPositionGlobal(); | ||
240 | |||
241 | // clear count | 241 | // clear count |
242 | std::stringstream avatar_count; | 242 | std::stringstream avatar_count; |
243 | avatar_count.str(""); | 243 | avatar_count.str(""); |
244 | 244 | ||
245 | // find what avatars you can see | 245 | // find what avatars you can see |
246 | F32 range = gSavedSettings.getF32("NearMeRange"); | ||
247 | LLVector3d current_pos = gAgent.getPositionGlobal(); | ||
246 | std::vector<LLUUID> avatar_ids; | 248 | std::vector<LLUUID> avatar_ids; |
247 | std::vector<LLVector3d> positions; | 249 | std::vector<LLVector3d> positions; |
248 | LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, current_pos, gSavedSettings.getF32("NearMeRange")); | 250 | LLWorld::getInstance()->getAvatars(&avatar_ids, &positions); |
249 | 251 | ||
250 | LLSD element; | 252 | LLSD element; |
251 | 253 | ||
@@ -265,21 +267,26 @@ void LLFloaterMap::populateRadar() | |||
265 | std::string fullname = getSelectedName(avatar_ids[i]); | 267 | std::string fullname = getSelectedName(avatar_ids[i]); |
266 | if (!fullname.empty()) | 268 | if (!fullname.empty()) |
267 | { | 269 | { |
270 | bool notify_chat = gSavedSettings.getBOOL("MiniMapNotifyChatRange"); | ||
271 | bool notify_sim = gSavedSettings.getBOOL("MiniMapNotifySimRange"); | ||
268 | // [RLVa:KB] - Alternate: Imprudence-1.2.0 | 272 | // [RLVa:KB] - Alternate: Imprudence-1.2.0 |
269 | if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) | 273 | if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) |
270 | { | 274 | { |
271 | fullname = gRlvHandler.getAnonym(fullname); | 275 | fullname = gRlvHandler.getAnonym(fullname); |
276 | notify_chat = false; | ||
277 | notify_sim = false; | ||
272 | } | 278 | } |
273 | // [/RLVa:KB] | 279 | // [/RLVa:KB] |
274 | 280 | ||
275 | // check if they're in chat range and notify user | 281 | // check if they're in certain ranges and notify user if we've enabled that |
276 | LLVector3d temp = positions[i] - current_pos; | 282 | LLVector3d temp = positions[i] - current_pos; |
277 | F32 distance = llround((F32)temp.magVec(), 0.1f); | 283 | F32 distance = llround((F32)temp.magVec(), 0.1f); |
278 | char dist[32]; | 284 | /*char dist[32]; |
279 | sprintf(dist, "%.1f", distance); | 285 | sprintf(dist, "%.1f", distance); |
280 | std::string dist_string = dist; | 286 | std::string dist_string = dist;*/ |
287 | std::string dist_string = llformat("%.1f", distance); | ||
281 | 288 | ||
282 | if (gSavedSettings.getBOOL("MiniMapNotify")) | 289 | if (notify_chat) |
283 | { | 290 | { |
284 | if (distance < 20.0f) | 291 | if (distance < 20.0f) |
285 | { | 292 | { |
@@ -295,7 +302,6 @@ void LLFloaterMap::populateRadar() | |||
295 | removeFromChatList(avatar_ids[i]); | 302 | removeFromChatList(avatar_ids[i]); |
296 | } | 303 | } |
297 | } | 304 | } |
298 | |||
299 | updateChatList(avatar_ids); | 305 | updateChatList(avatar_ids); |
300 | } | 306 | } |
301 | else if (!mChatAvatars.empty()) | 307 | else if (!mChatAvatars.empty()) |
@@ -303,16 +309,51 @@ void LLFloaterMap::populateRadar() | |||
303 | mChatAvatars.clear(); | 309 | mChatAvatars.clear(); |
304 | } | 310 | } |
305 | 311 | ||
306 | std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : ""; | 312 | if (notify_sim) |
307 | element["id"] = avatar_ids[i]; | 313 | { |
308 | element["columns"][0]["column"] = "avatar_name"; | 314 | if (!getInChatList(avatar_ids[i]) && !getInSimAvList(avatar_ids[i])) |
309 | element["columns"][0]["type"] = "text"; | 315 | { |
310 | element["columns"][0]["value"] = fullname + " " + mute_text; | 316 | LLViewerObject *av_obj = gObjectList.findObject(avatar_ids[i]); |
311 | element["columns"][1]["column"] = "avatar_distance"; | 317 | if (av_obj != NULL && av_obj->isAvatar()) |
312 | element["columns"][1]["type"] = "text"; | 318 | { |
313 | element["columns"][1]["value"] = dist_string+"m"; | 319 | LLVOAvatar* avatarp = (LLVOAvatar*)av_obj; |
320 | if (avatarp != NULL) | ||
321 | { | ||
322 | if (avatarp->getRegion() == gAgent.getRegion()) | ||
323 | { | ||
324 | addToSimAvList(avatar_ids[i], dist_string); | ||
325 | } | ||
326 | } | ||
327 | } | ||
328 | } | ||
329 | updateSimAvList(avatar_ids); | ||
330 | } | ||
331 | else if (!mSimAvatars.empty()) | ||
332 | { | ||
333 | mSimAvatars.clear(); | ||
334 | } | ||
335 | |||
336 | // only display avatars in range | ||
337 | if (distance <= range) | ||
338 | { | ||
339 | // append typing string | ||
340 | std::string typing = ""; | ||
341 | if (getIsTyping(avatar_ids[i])) | ||
342 | { | ||
343 | typing = getString("is_typing")+ " "; | ||
344 | } | ||
345 | |||
346 | std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("is_muted") : ""; | ||
347 | element["id"] = avatar_ids[i]; | ||
348 | element["columns"][0]["column"] = "avatar_name"; | ||
349 | element["columns"][0]["type"] = "text"; | ||
350 | element["columns"][0]["value"] = typing + fullname + " " + mute_text; | ||
351 | element["columns"][1]["column"] = "avatar_distance"; | ||
352 | element["columns"][1]["type"] = "text"; | ||
353 | element["columns"][1]["value"] = dist_string+"m"; | ||
314 | 354 | ||
315 | mRadarList->addElement(element, ADD_BOTTOM); | 355 | mRadarList->addElement(element, ADD_BOTTOM); |
356 | } | ||
316 | } | 357 | } |
317 | } | 358 | } |
318 | 359 | ||
@@ -326,6 +367,7 @@ void LLFloaterMap::populateRadar() | |||
326 | } | 367 | } |
327 | else | 368 | else |
328 | { | 369 | { |
370 | mTypingAvatars.clear(); | ||
329 | mRadarList->addCommentText(getString("no_one_near"), ADD_TOP); | 371 | mRadarList->addCommentText(getString("no_one_near"), ADD_TOP); |
330 | avatar_count << "0"; | 372 | avatar_count << "0"; |
331 | } | 373 | } |
@@ -384,6 +426,71 @@ void LLFloaterMap::removeFromChatList(LLUUID agent_id) | |||
384 | mChatAvatars.erase(agent_id); | 426 | mChatAvatars.erase(agent_id); |
385 | } | 427 | } |
386 | 428 | ||
429 | bool LLFloaterMap::getIsTyping(LLUUID agent_id) | ||
430 | { | ||
431 | if (mTypingAvatars.count(agent_id) > 0) | ||
432 | { | ||
433 | return true; | ||
434 | } | ||
435 | return false; | ||
436 | } | ||
437 | |||
438 | void LLFloaterMap::updateTypingList(LLUUID agent_id, bool remove) | ||
439 | { | ||
440 | if (remove) | ||
441 | { | ||
442 | if (getIsTyping(agent_id)) | ||
443 | { | ||
444 | mTypingAvatars.erase(agent_id); | ||
445 | } | ||
446 | } | ||
447 | else | ||
448 | { | ||
449 | mTypingAvatars.insert(agent_id); | ||
450 | } | ||
451 | } | ||
452 | |||
453 | void LLFloaterMap::updateSimAvList(std::vector<LLUUID> agent_ids) | ||
454 | { | ||
455 | std::set<LLUUID>::iterator it; | ||
456 | std::vector<LLUUID>::iterator result; | ||
457 | for (it = mSimAvatars.begin(); it != mSimAvatars.end(); ) | ||
458 | { | ||
459 | result = find(agent_ids.begin(), agent_ids.end(), *it); | ||
460 | if (result == agent_ids.end()) | ||
461 | { | ||
462 | mSimAvatars.erase(it++); | ||
463 | } | ||
464 | else | ||
465 | { | ||
466 | it++; | ||
467 | } | ||
468 | } | ||
469 | } | ||
470 | |||
471 | void LLFloaterMap::addToSimAvList(LLUUID agent_id, std::string distance) | ||
472 | { | ||
473 | mSimAvatars.insert(agent_id); | ||
474 | LLChat chat; | ||
475 | |||
476 | LLUIString notify = getString("entering_sim_range"); | ||
477 | notify.setArg("[NAME]", getSelectedName(agent_id)); | ||
478 | notify.setArg("[DISTANCE]", distance); | ||
479 | |||
480 | chat.mText = notify; | ||
481 | chat.mSourceType = CHAT_SOURCE_SYSTEM; | ||
482 | LLFloaterChat::addChat(chat, FALSE, FALSE); | ||
483 | } | ||
484 | |||
485 | bool LLFloaterMap::getInSimAvList(LLUUID agent_id) | ||
486 | { | ||
487 | if (mSimAvatars.count(agent_id) > 0) | ||
488 | { | ||
489 | return true; | ||
490 | } | ||
491 | return false; | ||
492 | } | ||
493 | |||
387 | void LLFloaterMap::toggleButtons() | 494 | void LLFloaterMap::toggleButtons() |
388 | { | 495 | { |
389 | BOOL enable = FALSE; | 496 | BOOL enable = FALSE; |