Commit a4f32f56 authored by Drake Arconis's avatar Drake Arconis
Browse files

Optimize and cleanup some for loops and various other code

parent 30036884
...@@ -76,9 +76,9 @@ void LLAvatarList::toggleIcons() ...@@ -76,9 +76,9 @@ void LLAvatarList::toggleIcons()
// Show/hide icons for all existing items. // Show/hide icons for all existing items.
std::vector<LLPanel*> items; std::vector<LLPanel*> items;
getItems(items); getItems(items);
for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++) for (auto item : items)
{ {
static_cast<LLAvatarListItem*>(*it)->setAvatarIconVisible(mShowIcons); static_cast<LLAvatarListItem*>(item)->setAvatarIconVisible(mShowIcons);
} }
} }
...@@ -90,9 +90,9 @@ void LLAvatarList::setSpeakingIndicatorsVisible(bool visible) ...@@ -90,9 +90,9 @@ void LLAvatarList::setSpeakingIndicatorsVisible(bool visible)
// Show/hide icons for all existing items. // Show/hide icons for all existing items.
std::vector<LLPanel*> items; std::vector<LLPanel*> items;
getItems(items); getItems(items);
for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++) for (auto item : items)
{ {
static_cast<LLAvatarListItem*>(*it)->showSpeakingIndicator(mShowSpeakingIndicator); static_cast<LLAvatarListItem*>(item)->showSpeakingIndicator(mShowSpeakingIndicator);
} }
} }
...@@ -104,9 +104,9 @@ void LLAvatarList::showPermissions(bool visible) ...@@ -104,9 +104,9 @@ void LLAvatarList::showPermissions(bool visible)
// Enable or disable showing permissions icons for all existing items. // Enable or disable showing permissions icons for all existing items.
std::vector<LLPanel*> items; std::vector<LLPanel*> items;
getItems(items); getItems(items);
for(std::vector<LLPanel*>::const_iterator it = items.begin(), end_it = items.end(); it != end_it; ++it) for (auto item : items)
{ {
static_cast<LLAvatarListItem*>(*it)->setShowPermissions(mShowPermissions); static_cast<LLAvatarListItem*>(item)->setShowPermissions(mShowPermissions);
} }
} }
...@@ -294,9 +294,8 @@ void LLAvatarList::refresh() ...@@ -294,9 +294,8 @@ void LLAvatarList::refresh()
unsigned nadded = 0; unsigned nadded = 0;
const std::string waiting_str = LLTrans::getString("AvatarNameWaiting"); const std::string waiting_str = LLTrans::getString("AvatarNameWaiting");
for (uuid_vec_t::const_iterator it=added.cbegin(); it != added.cend(); ++it) for (const auto& buddy_id : added)
{ {
const LLUUID& buddy_id = *it;
LLAvatarName av_name; LLAvatarName av_name;
have_names &= LLAvatarNameCache::get(buddy_id, &av_name); have_names &= LLAvatarNameCache::get(buddy_id, &av_name);
...@@ -331,9 +330,9 @@ void LLAvatarList::refresh() ...@@ -331,9 +330,9 @@ void LLAvatarList::refresh()
} }
// Handle removed items. // Handle removed items.
for (uuid_vec_t::const_iterator it = removed.cbegin(); it != removed.cend(); ++it) for (const auto& item : removed)
{ {
removeItemByUUID(*it); removeItemByUUID(item);
modified = true; modified = true;
} }
...@@ -343,9 +342,9 @@ void LLAvatarList::refresh() ...@@ -343,9 +342,9 @@ void LLAvatarList::refresh()
std::vector<LLSD> cur_values; std::vector<LLSD> cur_values;
getValues(cur_values); getValues(cur_values);
for (std::vector<LLSD>::const_iterator it = cur_values.cbegin(); it != cur_values.cend(); ++it) for (const auto& value : cur_values)
{ {
const LLUUID& buddy_id = it->asUUID(); const LLUUID& buddy_id = value.asUUID();
LLAvatarName av_name; LLAvatarName av_name;
have_names &= LLAvatarNameCache::get(buddy_id, &av_name); have_names &= LLAvatarNameCache::get(buddy_id, &av_name);
if (!findInsensitive(getAvatarName(av_name), mNameFilter)) if (!findInsensitive(getAvatarName(av_name), mNameFilter))
...@@ -380,9 +379,9 @@ void LLAvatarList::refresh() ...@@ -380,9 +379,9 @@ void LLAvatarList::refresh()
// Highlight items matching the filter. // Highlight items matching the filter.
std::vector<LLPanel*> items; std::vector<LLPanel*> items;
getItems(items); getItems(items);
for (std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); ++it) for (const auto& itemp : items)
{ {
static_cast<LLAvatarListItem*>(*it)->setHighlight(mNameFilter); static_cast<LLAvatarListItem*>(itemp)->setHighlight(mNameFilter);
} }
// Send refresh_complete signal. // Send refresh_complete signal.
...@@ -399,9 +398,9 @@ void LLAvatarList::updateAvatarNames() ...@@ -399,9 +398,9 @@ void LLAvatarList::updateAvatarNames()
std::vector<LLPanel*> items; std::vector<LLPanel*> items;
getItems(items); getItems(items);
for (std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); ++it) for (const auto& itemp : items)
{ {
LLAvatarListItem* item = static_cast<LLAvatarListItem*>(*it); LLAvatarListItem* item = static_cast<LLAvatarListItem*>(itemp);
item->setShowCompleteName(mShowCompleteName); item->setShowCompleteName(mShowCompleteName);
item->updateAvatarName(); item->updateAvatarName();
} }
...@@ -413,9 +412,8 @@ bool LLAvatarList::filterHasMatches() ...@@ -413,9 +412,8 @@ bool LLAvatarList::filterHasMatches()
{ {
uuid_vec_t values = getIDs(); uuid_vec_t values = getIDs();
for (uuid_vec_t::const_iterator it = values.cbegin(); it != values.cend(); ++it) for (const auto& buddy_id : values)
{ {
const LLUUID& buddy_id = *it;
LLAvatarName av_name; LLAvatarName av_name;
bool have_name = LLAvatarNameCache::get(buddy_id, &av_name); bool have_name = LLAvatarNameCache::get(buddy_id, &av_name);
...@@ -543,11 +541,10 @@ bool LLAvatarList::isAvalineItemSelected() const ...@@ -543,11 +541,10 @@ bool LLAvatarList::isAvalineItemSelected() const
{ {
std::vector<LLPanel*> selected_items; std::vector<LLPanel*> selected_items;
getSelectedItems(selected_items); getSelectedItems(selected_items);
std::vector<LLPanel*>::iterator it = selected_items.begin();
for (const auto& selected_item : selected_items)
for(; it != selected_items.end(); ++it)
{ {
if (dynamic_cast<LLAvalineListItem*>(*it)) if (dynamic_cast<LLAvalineListItem*>(selected_item))
return true; return true;
} }
...@@ -589,10 +586,10 @@ void LLAvatarList::updateLastInteractionTimes() ...@@ -589,10 +586,10 @@ void LLAvatarList::updateLastInteractionTimes()
std::vector<LLPanel*> items; std::vector<LLPanel*> items;
getItems(items); getItems(items);
for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++) for(auto itemp : items)
{ {
// *TODO: error handling // *TODO: error handling
LLAvatarListItem* item = static_cast<LLAvatarListItem*>(*it); LLAvatarListItem* item = static_cast<LLAvatarListItem*>(itemp);
S32 secs_since = now - (S32) LLRecentPeople::instance().getDate(item->getAvatarId()).secondsSinceEpoch(); S32 secs_since = now - (S32) LLRecentPeople::instance().getDate(item->getAvatarId()).secondsSinceEpoch();
if (secs_since >= 0) if (secs_since >= 0)
item->setLastInteractionTime(secs_since); item->setLastInteractionTime(secs_since);
...@@ -604,13 +601,15 @@ void LLAvatarList::updateDistances() ...@@ -604,13 +601,15 @@ void LLAvatarList::updateDistances()
std::vector<LLPanel*> items; std::vector<LLPanel*> items;
getItems(items); getItems(items);
for(std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); ++it) static LLCachedControl<F32> near_me_range(gSavedSettings, "NearMeRange");
LLWorld::pos_map_t positions;
LLWorld::getInstance()->getAvatars(&positions, gAgent.getPositionGlobal(), near_me_range);
for (auto itemp : items)
{ {
LLAvatarListItem* item = static_cast<LLAvatarListItem*>(*it); LLAvatarListItem* item = static_cast<LLAvatarListItem*>(itemp);
if (item->getAvatarId() == gAgentID) continue; if (item->getAvatarId() == gAgentID) continue;
LLWorld::pos_map_t positions;
LLWorld::getInstance()->getAvatars(&positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
LLWorld::pos_map_t::iterator iter = positions.find(item->getAvatarId()); LLWorld::pos_map_t::iterator iter = positions.find(item->getAvatarId());
if (iter != positions.end()) if (iter != positions.end())
item->setDistance((iter->second - gAgent.getPositionGlobal()).magVec()); item->setDistance((iter->second - gAgent.getPositionGlobal()).magVec());
......
...@@ -1591,9 +1591,9 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) ...@@ -1591,9 +1591,9 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim)
std::vector<std::pair <U64, LLSimInfo*> > sim_info_vec(LLWorldMap::getInstance()->getRegionMap().begin(), LLWorldMap::getInstance()->getRegionMap().end()); std::vector<std::pair <U64, LLSimInfo*> > sim_info_vec(LLWorldMap::getInstance()->getRegionMap().begin(), LLWorldMap::getInstance()->getRegionMap().end());
std::sort(sim_info_vec.begin(), sim_info_vec.end(), SortRegionNames()); std::sort(sim_info_vec.begin(), sim_info_vec.end(), SortRegionNames());
for (std::vector<std::pair <U64, LLSimInfo*> >::const_iterator it = sim_info_vec.begin(); it != sim_info_vec.end(); ++it) for (const auto& sim_info_pair : sim_info_vec)
{ {
LLSimInfo* info = it->second; LLSimInfo* info = sim_info_pair.second;
std::string sim_name_lower = info->getName(); std::string sim_name_lower = info->getName();
LLStringUtil::toLower(sim_name_lower); LLStringUtil::toLower(sim_name_lower);
...@@ -1655,10 +1655,9 @@ void LLFloaterWorldMap::onCommitSearchResult() ...@@ -1655,10 +1655,9 @@ void LLFloaterWorldMap::onCommitSearchResult()
} }
LLStringUtil::toLower(sim_name); LLStringUtil::toLower(sim_name);
std::map<U64, LLSimInfo*>::const_iterator it; for (auto map_pair : LLWorldMap::getInstance()->getRegionMap())
for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
{ {
LLSimInfo* info = it->second; LLSimInfo* info = map_pair.second;
if (info->isName(sim_name)) if (info->isName(sim_name))
{ {
......
...@@ -838,8 +838,8 @@ void LLPanelPeople::updateNearbyList() ...@@ -838,8 +838,8 @@ void LLPanelPeople::updateNearbyList()
return; return;
std::vector<LLVector3d> positions; std::vector<LLVector3d> positions;
static LLCachedControl<F32> near_me_range(gSavedSettings, "NearMeRange");
LLWorld::getInstance()->getAvatars(&mNearbyList->getIDs(), &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange")); LLWorld::getInstance()->getAvatars(&mNearbyList->getIDs(), &positions, gAgent.getPositionGlobal(), near_me_range);
mNearbyList->setDirty(); mNearbyList->setDirty();
DISTANCE_COMPARATOR.updateAvatarsPositions(positions, mNearbyList->getIDs()); DISTANCE_COMPARATOR.updateAvatarsPositions(positions, mNearbyList->getIDs());
......
...@@ -265,9 +265,9 @@ bool LLWorldMap::clearItems(bool force) ...@@ -265,9 +265,9 @@ bool LLWorldMap::clearItems(bool force)
mRequestTimer.reset(); mRequestTimer.reset();
LLSimInfo* sim_info = nullptr; LLSimInfo* sim_info = nullptr;
for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) for (const auto& sim_info_pair : mSimInfoMap)
{ {
sim_info = it->second; sim_info = sim_info_pair.second;
if (sim_info) if (sim_info)
{ {
sim_info->clearItems(); sim_info->clearItems();
...@@ -287,9 +287,9 @@ void LLWorldMap::clearImageRefs() ...@@ -287,9 +287,9 @@ void LLWorldMap::clearImageRefs()
// Images hold by the region map // Images hold by the region map
LLSimInfo* sim_info = nullptr; LLSimInfo* sim_info = nullptr;
for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) for (const auto& sim_info_pair : mSimInfoMap)
{ {
sim_info = it->second; sim_info = sim_info_pair.second;
if (sim_info) if (sim_info)
{ {
sim_info->clearImage(); sim_info->clearImage();
...@@ -331,12 +331,13 @@ LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle) ...@@ -331,12 +331,13 @@ LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle)
} }
U32 x = 0, y = 0; U32 x = 0, y = 0;
from_region_handle(handle, &x, &y); from_region_handle(handle, &x, &y);
for (it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
for (const auto& sim_info_pair : mSimInfoMap)
{ {
U32 checkRegionX, checkRegionY; U32 checkRegionX, checkRegionY;
from_region_handle((*it).first, &checkRegionX, &checkRegionY); from_region_handle(sim_info_pair.first, &checkRegionX, &checkRegionY);
LLSimInfo* info = (*it).second; LLSimInfo* info = sim_info_pair.second;
if (x >= checkRegionX && x < (checkRegionX + info->getSizeX()) && if (x >= checkRegionX && x < (checkRegionX + info->getSizeX()) &&
y >= checkRegionY && y < (checkRegionY + info->getSizeY())) y >= checkRegionY && y < (checkRegionY + info->getSizeY()))
{ {
...@@ -353,19 +354,16 @@ LLSimInfo* LLWorldMap::simInfoFromName(const std::string& sim_name) ...@@ -353,19 +354,16 @@ LLSimInfo* LLWorldMap::simInfoFromName(const std::string& sim_name)
if (!sim_name.empty()) if (!sim_name.empty())
{ {
// Iterate through the entire sim info map and compare the name // Iterate through the entire sim info map and compare the name
sim_info_map_t::iterator it; for (const auto& sim_info_pair : mSimInfoMap)
for (it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
{ {
sim_info = it->second; auto temp_sim_info = sim_info_pair.second;
if (sim_info && sim_info->isName(sim_name) ) if (temp_sim_info && temp_sim_info->isName(sim_name) )
{ {
sim_info = temp_sim_info;
// break out of loop if success // break out of loop if success
break; break;
} }
} }
// If we got to the end, we haven't found the sim. Reset the ouput value to NULL.
if (it == mSimInfoMap.end())
sim_info = nullptr;
} }
return sim_info; return sim_info;
} }
...@@ -594,9 +592,9 @@ void LLWorldMap::dropImagePriorities() ...@@ -594,9 +592,9 @@ void LLWorldMap::dropImagePriorities()
// Drop the download of tiles priority to nil // Drop the download of tiles priority to nil
mWorldMipmap.dropBoostLevels(); mWorldMipmap.dropBoostLevels();
// Same for the "land for sale" tiles per region // Same for the "land for sale" tiles per region
for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) for(const auto& sim_info_pair : mSimInfoMap)
{ {
LLSimInfo* info = it->second; LLSimInfo* info = sim_info_pair.second;
info->dropImagePriority(); info->dropImagePriority();
} }
} }
...@@ -610,6 +608,8 @@ void LLWorldMap::updateRegions(S32 x0, S32 y0, S32 x1, S32 y1) ...@@ -610,6 +608,8 @@ void LLWorldMap::updateRegions(S32 x0, S32 y0, S32 x1, S32 y1)
y0 = y0 / MAP_BLOCK_SIZE; y0 = y0 / MAP_BLOCK_SIZE;
y1 = y1 / MAP_BLOCK_SIZE; y1 = y1 / MAP_BLOCK_SIZE;
auto& world_map_inst = LLWorldMapMessage::instance();
// Load the region info those blocks // Load the region info those blocks
for (S32 block_x = llmax(x0, 0); block_x <= llmin(x1, MAP_BLOCK_RES-1); ++block_x) for (S32 block_x = llmax(x0, 0); block_x <= llmin(x1, MAP_BLOCK_RES-1); ++block_x)
{ {
...@@ -619,7 +619,7 @@ void LLWorldMap::updateRegions(S32 x0, S32 y0, S32 x1, S32 y1) ...@@ -619,7 +619,7 @@ void LLWorldMap::updateRegions(S32 x0, S32 y0, S32 x1, S32 y1)
if (!mMapBlockLoaded[offset]) if (!mMapBlockLoaded[offset])
{ {
//LL_INFOS("World Map") << "Loading Block (" << block_x << "," << block_y << ")" << LL_ENDL; //LL_INFOS("World Map") << "Loading Block (" << block_x << "," << block_y << ")" << LL_ENDL;
LLWorldMapMessage::getInstance()->sendMapBlockRequest(block_x * MAP_BLOCK_SIZE, block_y * MAP_BLOCK_SIZE, (block_x * MAP_BLOCK_SIZE) + MAP_BLOCK_SIZE - 1, (block_y * MAP_BLOCK_SIZE) + MAP_BLOCK_SIZE - 1); world_map_inst.sendMapBlockRequest(block_x * MAP_BLOCK_SIZE, block_y * MAP_BLOCK_SIZE, (block_x * MAP_BLOCK_SIZE) + MAP_BLOCK_SIZE - 1, (block_y * MAP_BLOCK_SIZE) + MAP_BLOCK_SIZE - 1);
mMapBlockLoaded[offset] = true; mMapBlockLoaded[offset] = true;
} }
} }
...@@ -629,9 +629,9 @@ void LLWorldMap::updateRegions(S32 x0, S32 y0, S32 x1, S32 y1) ...@@ -629,9 +629,9 @@ void LLWorldMap::updateRegions(S32 x0, S32 y0, S32 x1, S32 y1)
void LLWorldMap::dump() void LLWorldMap::dump()
{ {
LL_INFOS("World Map") << "LLWorldMap::dump()" << LL_ENDL; LL_INFOS("World Map") << "LLWorldMap::dump()" << LL_ENDL;
for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) for (const auto& sim_info_pair : mSimInfoMap)
{ {
LLSimInfo* info = it->second; LLSimInfo* info = sim_info_pair.second;
if (info) if (info)
{ {
info->dump(); info->dump();
......
...@@ -350,11 +350,10 @@ void LLWorldMapView::draw() ...@@ -350,11 +350,10 @@ void LLWorldMapView::draw()
gGL.setColorMask(true, true); gGL.setColorMask(true, true);
// Draw per sim overlayed information (names, mature, offline...) // Draw per sim overlayed information (names, mature, offline...)
for (LLWorldMap::sim_info_map_t::const_iterator it = LLWorldMap::getInstance()->getRegionMap().begin(); for (auto region_pair : LLWorldMap::getInstance()->getRegionMap())
it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
{ {
U64 handle = it->first; U64 handle = region_pair.first;
LLSimInfo* info = it->second; LLSimInfo* info = region_pair.second;
LLVector3d origin_global = from_region_handle(handle); LLVector3d origin_global = from_region_handle(handle);
...@@ -676,6 +675,8 @@ bool LLWorldMapView::drawMipmapLevel(S32 width, S32 height, S32 level, bool load ...@@ -676,6 +675,8 @@ bool LLWorldMapView::drawMipmapLevel(S32 width, S32 height, S32 level, bool load
pos_NE[VX] += tile_width; pos_NE[VX] += tile_width;
pos_NE[VY] += tile_width; pos_NE[VY] += tile_width;
auto& world_map_inst = LLWorldMap::instance();
// Iterate through the tiles on screen: we just need to ask for one tile every tile_width meters // Iterate through the tiles on screen: we just need to ask for one tile every tile_width meters
U32 grid_x, grid_y; U32 grid_x, grid_y;
for (F64 index_y = pos_SW[VY]; index_y < pos_NE[VY]; index_y += tile_width) for (F64 index_y = pos_SW[VY]; index_y < pos_NE[VY]; index_y += tile_width)
...@@ -687,7 +688,7 @@ bool LLWorldMapView::drawMipmapLevel(S32 width, S32 height, S32 level, bool load ...@@ -687,7 +688,7 @@ bool LLWorldMapView::drawMipmapLevel(S32 width, S32 height, S32 level, bool load
// Convert to the mipmap level coordinates for that point (i.e. which tile to we hit) // Convert to the mipmap level coordinates for that point (i.e. which tile to we hit)
LLWorldMipmap::globalToMipmap(pos_global[VX], pos_global[VY], level, &grid_x, &grid_y); LLWorldMipmap::globalToMipmap(pos_global[VX], pos_global[VY], level, &grid_x, &grid_y);
// Get the tile. Note: NULL means that the image does not exist (so it's considered "complete" as far as fetching is concerned) // Get the tile. Note: NULL means that the image does not exist (so it's considered "complete" as far as fetching is concerned)
LLPointer<LLViewerFetchedTexture> simimage = LLWorldMap::getInstance()->getObjectsTile(grid_x, grid_y, level, load); LLPointer<LLViewerFetchedTexture> simimage = world_map_inst.getObjectsTile(grid_x, grid_y, level, load);
if (simimage) if (simimage)
{ {
// Checks that the image has a valid texture // Checks that the image has a valid texture
...@@ -787,10 +788,9 @@ void LLWorldMapView::drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F ...@@ -787,10 +788,9 @@ void LLWorldMapView::drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F
void LLWorldMapView::drawGenericItems(const LLSimInfo::item_info_list_t& items, LLUIImagePtr image) void LLWorldMapView::drawGenericItems(const LLSimInfo::item_info_list_t& items, LLUIImagePtr image)
{ {
LLSimInfo::item_info_list_t::const_iterator e; for (auto item_info : items)
for (e = items.begin(); e != items.end(); ++e)
{ {
drawGenericItem(*e, image); drawGenericItem(item_info, image);
} }
} }
...@@ -811,7 +811,7 @@ void LLWorldMapView::drawImage(const LLVector3d& global_pos, LLUIImagePtr image, ...@@ -811,7 +811,7 @@ void LLWorldMapView::drawImage(const LLVector3d& global_pos, LLUIImagePtr image,
void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color) void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color)
{ {
LLVector3 pos_map = globalPosToView( global_pos ); LLVector3 pos_map = globalPosToView( global_pos );
for(U32 i=0; i<count; i++) for (U32 i=0; i<count; i++)
{ {
image->draw(ll_round(pos_map.mV[VX] - image->getWidth() /2.f), image->draw(ll_round(pos_map.mV[VX] - image->getWidth() /2.f),
ll_round(pos_map.mV[VY] - image->getHeight()/2.f + i*offset), ll_round(pos_map.mV[VY] - image->getHeight()/2.f + i*offset),
...@@ -827,10 +827,11 @@ void LLWorldMapView::drawItems() ...@@ -827,10 +827,11 @@ void LLWorldMapView::drawItems()
BOOL show_mature = mature_enabled && gSavedSettings.getBOOL("ShowMatureEvents"); BOOL show_mature = mature_enabled && gSavedSettings.getBOOL("ShowMatureEvents");
BOOL show_adult = adult_enabled && gSavedSettings.getBOOL("ShowAdultEvents"); BOOL show_adult = adult_enabled && gSavedSettings.getBOOL("ShowAdultEvents");
for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) auto& world_map_inst = LLWorldMap::instance();
for (auto vis_region_handle : mVisibleRegions)
{ {
U64 handle = *iter; U64 handle = vis_region_handle;
LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle); LLSimInfo* info = world_map_inst.simInfoFromHandle(handle);
if ((info == NULL) || (info->isDown())) if ((info == NULL) || (info->isDown()))
{ {
continue; continue;
...@@ -879,16 +880,17 @@ void LLWorldMapView::drawAgents() ...@@ -879,16 +880,17 @@ void LLWorldMapView::drawAgents()
{ {
static LLUIColor map_avatar_color = LLUIColorTable::instance().getColor("MapAvatarColor", LLColor4::white); static LLUIColor map_avatar_color = LLUIColorTable::instance().getColor("MapAvatarColor", LLColor4::white);
for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) auto& world_map_inst = LLWorldMap::instance();
for (auto vis_region_handle : mVisibleRegions)
{ {
U64 handle = *iter; U64 handle = vis_region_handle;
LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); LLSimInfo* siminfo = world_map_inst.simInfoFromHandle(handle);
if ((siminfo == NULL) || (siminfo->isDown())) if ((siminfo == NULL) || (siminfo->isDown()))
{ {
continue; continue;
} }
LLSimInfo::item_info_list_t::const_iterator it = siminfo->getAgentLocation().begin(); LLSimInfo::item_info_list_t::const_iterator it = siminfo->getAgentLocation().cbegin();
while (it != siminfo->getAgentLocation().end()) while (it != siminfo->getAgentLocation().cend())
{ {
// Show Individual agents (or little stacks where real agents are) // Show Individual agents (or little stacks where real agents are)
...@@ -1507,7 +1509,8 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, ...@@ -1507,7 +1509,8 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
*hit_type = 0; // hit nothing *hit_type = 0; // hit nothing
LLWorldMap::getInstance()->cancelTracking(); auto& world_map_inst = LLWorldMap::instance();
world_map_inst.cancelTracking();
LLFloaterWorldMap* floater_map = LLFloaterWorldMap::getInstance(); LLFloaterWorldMap* floater_map = LLFloaterWorldMap::getInstance();
...@@ -1522,10 +1525,10 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, ...@@ -1522,10 +1525,10 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
if (gSavedSettings.getBOOL("MapShowEvents") || show_mature || show_adult || gSavedSettings.getBOOL("MapShowLandForSale")) if (gSavedSettings.getBOOL("MapShowEvents") || show_mature || show_adult || gSavedSettings.getBOOL("MapShowLandForSale"))
{ {
// Iterate through the visible regions // Iterate through the visible regions
for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) for (auto vis_region_handle : mVisibleRegions)
{ {
U64 handle = *iter; U64 handle = vis_region_handle;
LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); LLSimInfo* siminfo = world_map_inst.simInfoFromHandle(handle);
if ((siminfo == NULL) || (siminfo->isDown())) if ((siminfo == NULL) || (siminfo->isDown()))
{ {
continue; continue;
......