summaryrefslogtreecommitdiff
path: root/indra/newview/llnetmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnetmap.cpp')
-rw-r--r--indra/newview/llnetmap.cpp69
1 files changed, 62 insertions, 7 deletions
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index af472c4259..a2a0731256 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -47,6 +47,9 @@
#include "llagent.h"
#include "llagentcamera.h"
#include "llappviewer.h" // for gDisconnected
+#include "llavataractions.h"
+#include "llgroupcolormap.h" // group-based dot tinting
+#include "llvoavatar.h" // group-based dot tinting
#include "llcallingcard.h" // LLAvatarTracker
#include "llfloaterland.h"
#include "llfloaterworldmap.h"
@@ -397,20 +400,59 @@ void LLNetMap::draw()
LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgentCamera.getCameraPositionGlobal());
- // Draw avatars
+ std::vector<std::pair<U32, bool>> indexed_avatars;
+ indexed_avatars.reserve(avatar_ids.size());
for (U32 i = 0; i < avatar_ids.size(); i++)
{
- LLUUID uuid = avatar_ids[i];
+ indexed_avatars.emplace_back(i, LLAvatarActions::isFriend(avatar_ids[i]));
+ }
+
+ // Sort avatars so non-friends are drawn first and friend dots will appear on top
+ std::sort(indexed_avatars.begin(), indexed_avatars.end(),
+ [](const auto& a, const auto& b) { return a.second < b.second; });
+
+ uuid_vec_t sorted_avatar_ids;
+ std::vector<LLVector3d> sorted_positions;
+ sorted_avatar_ids.reserve(avatar_ids.size());
+ sorted_positions.reserve(positions.size());
+
+ // Reorder avatar_ids and positions based on sorted indices
+ for (const auto& indexed_avatar : indexed_avatars)
+ {
+ sorted_avatar_ids.push_back(avatar_ids[indexed_avatar.first]);
+ sorted_positions.push_back(positions[indexed_avatar.first]);
+ }
+
+ // Draw avatars
+ for (U32 i = 0; i < sorted_avatar_ids.size(); i++)
+ {
+ LLUUID uuid = sorted_avatar_ids[i];
// Skip self, we'll draw it later
if (uuid == gAgent.getID()) continue;
- pos_map = globalPosToView(positions[i]);
+ pos_map = globalPosToView(sorted_positions[i]);
- bool show_as_friend = (LLAvatarTracker::instance().getBuddyInfo(uuid) != NULL);
+ LLColor4 color = LLAvatarActions::isFriend(uuid) ? map_avatar_friend_color : map_avatar_color;
- LLColor4 color = show_as_friend ? map_avatar_friend_color : map_avatar_color;
+ // Group-based dot tinting: override with group color if one is set.
+ // Look up the avatar's active group UUID from the LLVOAvatar object.
+ if (LLViewerObject* obj = gObjectList.findObject(uuid))
+ {
+ if (LLVOAvatar* av = dynamic_cast<LLVOAvatar*>(obj))
+ {
+ LLUUID active_group = av->getActiveGroupID();
+ if (active_group.notNull())
+ {
+ LLColor4 group_color = LLGroupColorMap::getInstance()->getGroupColor(active_group);
+ if (group_color.mV[VW] >= 0.01f)
+ {
+ color = group_color;
+ }
+ }
+ }
+ }
- unknown_relative_z = positions[i].mdV[VZ] >= COARSEUPDATE_MAX_Z &&
+ unknown_relative_z = sorted_positions[i].mdV[VZ] >= COARSEUPDATE_MAX_Z &&
camera_position.mV[VZ] >= COARSEUPDATE_MAX_Z;
LLWorldMapView::drawAvatar(
@@ -483,10 +525,23 @@ void LLNetMap::draw()
LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage;
if (you)
{
+ // Group-based dot tinting for self: use gAgent.getGroupID() directly
+ LLColor4 self_color = UI_VERTEX_COLOR;
+ LLUUID self_group = gAgent.getGroupID();
+ if (self_group.notNull())
+ {
+ LLColor4 group_color = LLGroupColorMap::getInstance()->getGroupColor(self_group);
+ if (group_color.mV[VW] >= 0.01f)
+ {
+ self_color = group_color;
+ }
+ }
+
you->draw(ll_round(pos_map.mV[VX] - mDotRadius),
ll_round(pos_map.mV[VY] - mDotRadius),
dot_width,
- dot_width);
+ dot_width,
+ self_color);
F32 dist_to_cursor_squared = dist_vec_squared(LLVector2(pos_map.mV[VX], pos_map.mV[VY]),
LLVector2((F32)local_mouse_x, (F32)local_mouse_y));