From 42db64f1f61f1b037f3fd38284535f052dcd058a Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 23 Nov 2015 19:39:49 +0100 Subject: [PATCH] Fix worldmap in FS not showing correctly --- indra/newview/llworldmap.cpp | 31 +++++++++++++++++++++++++++++-- indra/newview/llworldmap.h | 4 ++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index 8ba91990c7..f31518e1b5 100755 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -44,6 +44,7 @@ // Timers to temporise database requests const F32 AGENTS_UPDATE_TIMER = 60.0; // Seconds between 2 agent requests for a region const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // Seconds before we consider re-requesting item data for the grid +const F64 BLOCK_UPDATE_TIMER = 60.0; // Periodically update sim info //--------------------------------------------------------------------------- // LLItemInfo @@ -249,7 +250,8 @@ LLWorldMap::LLWorldMap() : mIsTrackingDoubleClick( false ), mIsTrackingCommit( false ), mTrackingLocation( 0, 0, 0 ), - mFirstRequest(true) + mFirstRequest(true), + mMapBlockLastUpdate(0.0) // Periodically update sim info { //LL_INFOS("World Map") << "Creating the World Map -> LLWorldMap::LLWorldMap()" << LL_ENDL; mMapBlockLoaded = new bool[MAP_BLOCK_RES*MAP_BLOCK_RES]; @@ -323,6 +325,10 @@ void LLWorldMap::clearSimFlags() for (S32 idx=0; idx Periodically update sim info + mMapBlockLastUpdate = 0.0; + mMapBlockLastUpdateOffsets.clear(); + // } } @@ -647,20 +653,41 @@ void LLWorldMap::updateRegions(S32 x0, S32 y0, S32 x1, S32 y1) y0 = y0 / MAP_BLOCK_SIZE; y1 = y1 / MAP_BLOCK_SIZE; + // Periodically update sim info + std::set new_offsets; + bool did_update = false; + F64 time_now = LLTimer::getElapsedSeconds(); + // + // 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_y = llmax(y0, 0); block_y <= llmin(y1, MAP_BLOCK_RES-1); ++block_y) { S32 offset = block_x | (block_y * MAP_BLOCK_RES); - if (!mMapBlockLoaded[offset]) + // Periodically update sim info + //if (!mMapBlockLoaded[offset]) + if (!mMapBlockLoaded[offset] || (time_now - mMapBlockLastUpdate) > BLOCK_UPDATE_TIMER || mMapBlockLastUpdateOffsets.find(offset) == mMapBlockLastUpdateOffsets.end()) + // { //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); mMapBlockLoaded[offset] = true; + // Periodically update sim info + new_offsets.insert(offset); + did_update = true; + // } } } + + // Periodically update sim info + if (did_update) + { + mMapBlockLastUpdate = time_now; + mMapBlockLastUpdateOffsets.swap(new_offsets); + } + // } void LLWorldMap::dump() diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index 69ea08636e..25d3d7dd61 100755 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -293,6 +293,10 @@ private: // cases where a block is never retrieved and, because of this boolean being set, never re-requested bool * mMapBlockLoaded; // Telling us if the block of regions has been requested or not + // Periodically update sim info + F64 mMapBlockLastUpdate; + std::set mMapBlockLastUpdateOffsets; + // Track location data : used while there's nothing tracked yet by LLTracker bool mIsTrackingLocation; // True when we're tracking a point bool mIsTrackingFound; // True when the tracking position has been found, valid or not