From ae109e01799d9270e9caa54761c7e3496b87ad1f Mon Sep 17 00:00:00 2001
From: McCabe Maxsted
Date: Tue, 22 Sep 2009 08:18:22 -0700
Subject: Applied Jacek's patch to show number of avatars in world map

---
 ChangeLog.txt                                  |  6 +++++
 linden/indra/newview/app_settings/settings.xml | 11 +++++++++
 linden/indra/newview/llworldmapview.cpp        | 31 ++++++++++++++++++++++++--
 3 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/ChangeLog.txt b/ChangeLog.txt
index 003ea0b..ad83d48 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -6,6 +6,12 @@
         modified:   linden/indra/newview/skins/default/xui/en-us/panel_windlight_controls.xml
         modified:   linden/indra/newview/skins/default/xui/en-us/panel_windlight_remote.xml
         modified:   linden/indra/newview/skins/default/xui/en-us/panel_windlight_remote_expanded.xml
+		
+		
+	* Applied Jacek's patch to show number of avatars in world map.
+	
+		modified:   linden/indra/newview/app_settings/settings.xml
+		modified:   linden/indra/newview/llworldmapview.cpp
 
 		
 2009-09-20 McCabe Maxsted  <hakushakukun@gmail.com>
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index f4d853b..5fed08e 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -4808,6 +4808,17 @@
       <key>Value</key>
       <real>128.0</real>
     </map>
+    <key>MapShowAgentCount</key>
+    <map>
+      <key>Comment</key>
+      <string>Show number of agents next to region names on world map</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>MapShowEvents</key>
     <map>
       <key>Comment</key>
diff --git a/linden/indra/newview/llworldmapview.cpp b/linden/indra/newview/llworldmapview.cpp
index 5e51e6f..2b22b9d 100644
--- a/linden/indra/newview/llworldmapview.cpp
+++ b/linden/indra/newview/llworldmapview.cpp
@@ -651,6 +651,33 @@ void LLWorldMapView::draw()
 			{
 				mesg = llformat( "%s (%s)", info->mName.c_str(), sStringsMap["offline"].c_str());
 			}
+			else if (gSavedSettings.getBOOL("MapShowAgentCount") && gSavedSettings.getBOOL("MapShowPeople"))
+			{
+				// Display the agent count after the region name
+				S32 agent_count = LLWorldMap::getInstance()->mNumAgents[handle];
+				LLViewerRegion *region = gAgent.getRegion();
+
+				if (region && region->getHandle() == info->mHandle)
+				{
+					++agent_count; // Bump by 1 if we're in this region
+				}
+
+				if (agent_count > 0)
+				{
+					//TODO: move this and the tooltip strings into XML
+					std::string count = llformat("%d %s", agent_count, agent_count > 1 ? "avatars" : "avatar");
+					font->renderUTF8(
+						count, 0,
+						llfloor(left + 3), 
+						llfloor(bottom + 20),
+						LLColor4::white,
+						LLFontGL::LEFT,
+						LLFontGL::BASELINE,
+						LLFontGL::DROP_SHADOW);
+
+					mesg = info->mName;
+				}
+			}
 			else
 			{
 				mesg = info->mName;
@@ -1161,11 +1188,11 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* stic
 
 				if (agent_count == 1)
 				{
-					message += "person";
+					message += "avatar";
 				}
 				else
 				{
-					message += "people";
+					message += "avatars";
 				}
 			}
 		}
-- 
cgit v1.1