aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-10-05 07:09:51 -0700
committerMcCabe Maxsted2009-10-05 07:09:51 -0700
commitbaff7828246eefe8a79da2a7daff7afe6863147e (patch)
treef29aadd5ea93f57b7b8139c5e827646596cba262 /linden/indra
parentRenamed 'Create' in object pie to 'Build,' moved it to top right and switched... (diff)
downloadmeta-impy-baff7828246eefe8a79da2a7daff7afe6863147e.zip
meta-impy-baff7828246eefe8a79da2a7daff7afe6863147e.tar.gz
meta-impy-baff7828246eefe8a79da2a7daff7afe6863147e.tar.bz2
meta-impy-baff7828246eefe8a79da2a7daff7afe6863147e.tar.xz
Tiny improvement to radar code
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llfloatermap.cpp123
1 files changed, 62 insertions, 61 deletions
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()
238 238
239 LLVector3d current_pos = gAgent.getPositionGlobal(); 239 LLVector3d current_pos = gAgent.getPositionGlobal();
240 240
241 // clear count
242 std::stringstream avatar_count;
243 avatar_count.str("");
244
241 // find what avatars you can see 245 // find what avatars you can see
242 std::vector<LLUUID> avatar_ids; 246 std::vector<LLUUID> avatar_ids;
243 std::vector<LLVector3d> positions; 247 std::vector<LLVector3d> positions;
@@ -247,88 +251,85 @@ void LLFloaterMap::populateRadar()
247 251
248 mRadarList->deleteAllItems(); 252 mRadarList->deleteAllItems();
249 253
250 for (U32 i=0; i<avatar_ids.size(); i++) 254 if (!avatar_ids.empty())
251 { 255 {
252 if (avatar_ids[i] == gAgent.getID() || 256 for (U32 i=0; i<avatar_ids.size(); i++)
253 avatar_ids[i].isNull())
254 {
255 continue;
256 }
257
258 // Add to list only if we get their name
259 std::string fullname = getSelectedName(avatar_ids[i]);
260 if (!fullname.empty())
261 { 257 {
262// [RLVa:KB] - Alternate: Imprudence-1.2.0 258 if (avatar_ids[i] == gAgent.getID() ||
263 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) 259 avatar_ids[i].isNull())
264 { 260 {
265 fullname = gRlvHandler.getAnonym(fullname); 261 continue;
266 } 262 }
267// [/RLVa:KB]
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 char dist[32];
273 sprintf(dist, "%.1f", distance);
274 std::string dist_string = dist;
275 263
276 if (gSavedSettings.getBOOL("MiniMapNotify")) 264 // Add to list only if we get their name
265 std::string fullname = getSelectedName(avatar_ids[i]);
266 if (!fullname.empty())
277 { 267 {
278 if (distance < 20.0f) 268 // [RLVa:KB] - Alternate: Imprudence-1.2.0
269 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
279 { 270 {
280 if (!getInChatList(avatar_ids[i])) 271 fullname = gRlvHandler.getAnonym(fullname);
281 {
282 addToChatList(avatar_ids[i], dist_string);
283 }
284 } 272 }
285 else 273 // [/RLVa:KB]
274
275 // check if they're in chat range and notify user
276 LLVector3d temp = positions[i] - current_pos;
277 F32 distance = llround((F32)temp.magVec(), 0.1f);
278 char dist[32];
279 sprintf(dist, "%.1f", distance);
280 std::string dist_string = dist;
281
282 if (gSavedSettings.getBOOL("MiniMapNotify"))
286 { 283 {
287 if (getInChatList(avatar_ids[i])) 284 if (distance < 20.0f)
288 { 285 {
289 removeFromChatList(avatar_ids[i]); 286 if (!getInChatList(avatar_ids[i]))
287 {
288 addToChatList(avatar_ids[i], dist_string);
289 }
290 }
291 else
292 {
293 if (getInChatList(avatar_ids[i]))
294 {
295 removeFromChatList(avatar_ids[i]);
296 }
290 } 297 }
291 }
292 298
293 updateChatList(avatar_ids); 299 updateChatList(avatar_ids);
294 } 300 }
295 else if (!mChatAvatars.empty()) 301 else if (!mChatAvatars.empty())
296 { 302 {
297 mChatAvatars.clear(); 303 mChatAvatars.clear();
298 } 304 }
299 305
300 std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : ""; 306 std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : "";
301 element["id"] = avatar_ids[i]; 307 element["id"] = avatar_ids[i];
302 element["columns"][0]["column"] = "avatar_name"; 308 element["columns"][0]["column"] = "avatar_name";
303 element["columns"][0]["type"] = "text"; 309 element["columns"][0]["type"] = "text";
304 element["columns"][0]["value"] = fullname + " " + mute_text; 310 element["columns"][0]["value"] = fullname + " " + mute_text;
305 element["columns"][1]["column"] = "avatar_distance"; 311 element["columns"][1]["column"] = "avatar_distance";
306 element["columns"][1]["type"] = "text"; 312 element["columns"][1]["type"] = "text";
307 element["columns"][1]["value"] = dist_string+"m"; 313 element["columns"][1]["value"] = dist_string+"m";
308 314
309 mRadarList->addElement(element, ADD_BOTTOM); 315 mRadarList->addElement(element, ADD_BOTTOM);
316 }
310 } 317 }
311 }
312 318
313 mRadarList->sortItems(); 319 mRadarList->sortItems();
314 mRadarList->setScrollPos(scroll_pos); 320 mRadarList->setScrollPos(scroll_pos);
315 if (mSelectedAvatar.notNull()) 321 if (mSelectedAvatar.notNull())
316 { 322 {
317 mRadarList->selectByID(mSelectedAvatar); 323 mRadarList->selectByID(mSelectedAvatar);
324 }
325 avatar_count << (int)avatar_ids.size();
318 } 326 }
319 327 else
320 // set count
321 std::stringstream avatar_count;
322 avatar_count.str("");
323 if (avatar_ids.empty())
324 { 328 {
325 mRadarList->addCommentText(getString("no_one_near"), ADD_TOP); 329 mRadarList->addCommentText(getString("no_one_near"), ADD_TOP);
326 avatar_count << "0"; 330 avatar_count << "0";
327 } 331 }
328 else 332
329 {
330 avatar_count << (int)avatar_ids.size();
331 }
332 childSetText("lblAvatarCount", avatar_count.str()); 333 childSetText("lblAvatarCount", avatar_count.str());
333 334
334 toggleButtons(); 335 toggleButtons();