diff options
Diffstat (limited to 'indra/newview/llworldmap.cpp')
-rw-r--r-- | indra/newview/llworldmap.cpp | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index 6d0853a6dc..6c5118ed9d 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -46,8 +46,6 @@ #include "llviewerregion.h" #include "llregionflags.h" -LLWorldMap* gWorldMap = NULL; - const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // 10 minutes LLItemInfo::LLItemInfo(F32 global_x, F32 global_y, @@ -485,7 +483,7 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**) U32 agent_flags; msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); - if (agent_flags != (U32)gWorldMap->mCurrentMap) + if (agent_flags != (U32)LLWorldMap::getInstance()->mCurrentMap) { llwarns << "Invalid or out of date map image type returned!" << llendl; return; @@ -496,7 +494,7 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**) S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_LayerData); - gWorldMap->mMapLayers[agent_flags].clear(); + LLWorldMap::getInstance()->mMapLayers[agent_flags].clear(); BOOL adjust = FALSE; for (S32 block=0; block<num_blocks; ++block) @@ -521,14 +519,14 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**) F32 x_meters = F32(left*REGION_WIDTH_UNITS); F32 y_meters = F32(bottom*REGION_WIDTH_UNITS); - adjust = gWorldMap->extendAABB(U32(x_meters), U32(y_meters), + adjust = LLWorldMap::getInstance()->extendAABB(U32(x_meters), U32(y_meters), U32(x_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getWidth()), U32(y_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getHeight())) || adjust; - gWorldMap->mMapLayers[agent_flags].push_back(new_layer); + LLWorldMap::getInstance()->mMapLayers[agent_flags].push_back(new_layer); } - gWorldMap->mMapLoaded[agent_flags] = TRUE; + LLWorldMap::getInstance()->mMapLoaded[agent_flags] = TRUE; if(adjust) gFloaterWorldMap->adjustZoomSliderBounds(); } @@ -576,21 +574,21 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) if (access == 255) { // This region doesn't exist - if (gWorldMap->mIsTrackingUnknownLocation && - gWorldMap->mUnknownLocation.mdV[0] >= x_meters && - gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && - gWorldMap->mUnknownLocation.mdV[1] >= y_meters && - gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) + if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation && + LLWorldMap::getInstance()->mUnknownLocation.mdV[0] >= x_meters && + LLWorldMap::getInstance()->mUnknownLocation.mdV[0] < x_meters + 256 && + LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters && + LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256) { // We were tracking this location, but it doesn't exist - gWorldMap->mInvalidLocation = TRUE; + LLWorldMap::getInstance()->mInvalidLocation = TRUE; } found_null_sim = true; } else { - adjust = gWorldMap->extendAABB(x_meters, + adjust = LLWorldMap::getInstance()->extendAABB(x_meters, y_meters, x_meters+REGION_WIDTH_UNITS, y_meters+REGION_WIDTH_UNITS) || adjust; @@ -598,8 +596,8 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) // llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl; LLSimInfo* siminfo = new LLSimInfo(); - sim_info_map_t::iterator iter = gWorldMap->mSimInfoMap.find(handle); - if (iter != gWorldMap->mSimInfoMap.end()) + sim_info_map_t::iterator iter = LLWorldMap::getInstance()->mSimInfoMap.find(handle); + if (iter != LLWorldMap::getInstance()->mSimInfoMap.end()) { LLSimInfo* oldinfo = iter->second; for (S32 image=0; image<MAP_SIM_IMAGE_TYPES; ++image) @@ -608,7 +606,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) } delete oldinfo; } - gWorldMap->mSimInfoMap[handle] = siminfo; + LLWorldMap::getInstance()->mSimInfoMap[handle] = siminfo; siminfo->mHandle = handle; siminfo->mName.assign( name ); @@ -616,7 +614,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) siminfo->mRegionFlags = region_flags; siminfo->mWaterHeight = (F32) water_height; siminfo->mMapImageID[agent_flags] = image_id; - siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[gWorldMap->mCurrentMap], MIPMAP_TRUE, FALSE); + siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); siminfo->mCurrentImage->bindTexture(0); siminfo->mCurrentImage->setClamp(TRUE, TRUE); @@ -629,22 +627,22 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) siminfo->mOverlayImage = NULL; } - if (gWorldMap->mIsTrackingUnknownLocation && - gWorldMap->mUnknownLocation.mdV[0] >= x_meters && - gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && - gWorldMap->mUnknownLocation.mdV[1] >= y_meters && - gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) + if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation && + LLWorldMap::getInstance()->mUnknownLocation.mdV[0] >= x_meters && + LLWorldMap::getInstance()->mUnknownLocation.mdV[0] < x_meters + 256 && + LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters && + LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256) { if (siminfo->mAccess == SIM_ACCESS_DOWN) { // We were tracking this location, but it doesn't exist - gWorldMap->mInvalidLocation = true; + LLWorldMap::getInstance()->mInvalidLocation = true; } else { // We were tracking this location, and it does exist - bool is_tracking_dbl = gWorldMap->mIsTrackingDoubleClick == TRUE; - gFloaterWorldMap->trackLocation(gWorldMap->mUnknownLocation); + bool is_tracking_dbl = LLWorldMap::getInstance()->mIsTrackingDoubleClick == TRUE; + gFloaterWorldMap->trackLocation(LLWorldMap::getInstance()->mUnknownLocation); if (is_tracking_dbl) { LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); @@ -654,19 +652,19 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) } } - if(gWorldMap->mSLURLCallback != NULL) + if(LLWorldMap::getInstance()->mSLURLCallback != NULL) { // Server returns definitive capitalization, SLURL might // not have that. - if (!stricmp(gWorldMap->mSLURLRegionName.c_str(), name) || (gWorldMap->mSLURLRegionHandle == handle)) + if (!stricmp(LLWorldMap::getInstance()->mSLURLRegionName.c_str(), name) || (LLWorldMap::getInstance()->mSLURLRegionHandle == handle)) { - url_callback_t callback = gWorldMap->mSLURLCallback; + url_callback_t callback = LLWorldMap::getInstance()->mSLURLCallback; - gWorldMap->mSLURLCallback = NULL; - gWorldMap->mSLURLRegionName.clear(); - gWorldMap->mSLURLRegionHandle = 0; + LLWorldMap::getInstance()->mSLURLCallback = NULL; + LLWorldMap::getInstance()->mSLURLRegionName.clear(); + LLWorldMap::getInstance()->mSLURLRegionHandle = 0; - callback(handle, gWorldMap->mSLURL, image_id, gWorldMap->mSLURLTeleport); + callback(handle, LLWorldMap::getInstance()->mSLURL, image_id, LLWorldMap::getInstance()->mSLURLTeleport); } } } @@ -702,7 +700,7 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) Y /= REGION_WIDTH_UNITS; LLItemInfo new_item(world_x, world_y, name, uuid, extra, extra2); - LLSimInfo* siminfo = gWorldMap->simInfoFromHandle(new_item.mRegionHandle); + LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(new_item.mRegionHandle); switch (type) { @@ -724,11 +722,11 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) // extra2 specifies whether this is an infohub or a telehub. if (extra2) { - gWorldMap->mInfohubs.push_back(new_item); + LLWorldMap::getInstance()->mInfohubs.push_back(new_item); } else { - gWorldMap->mTelehubs.push_back(new_item); + LLWorldMap::getInstance()->mTelehubs.push_back(new_item); } break; @@ -755,31 +753,31 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) new_item.mPosGlobal.mdV[VZ] = (F64)extra2; if (type == MAP_ITEM_PG_EVENT) { - gWorldMap->mPGEvents.push_back(new_item); + LLWorldMap::getInstance()->mPGEvents.push_back(new_item); } else { - gWorldMap->mMatureEvents.push_back(new_item); + LLWorldMap::getInstance()->mMatureEvents.push_back(new_item); } break; } case MAP_ITEM_POPULAR: // popular { new_item.mPosGlobal.mdV[VZ] = (F64)extra2; - gWorldMap->mPopular.push_back(new_item); + LLWorldMap::getInstance()->mPopular.push_back(new_item); break; } case MAP_ITEM_LAND_FOR_SALE: // land for sale { new_item.mToolTip = llformat("%d sq. m. L$%d", new_item.mExtra, new_item.mExtra2); - gWorldMap->mLandForSale.push_back(new_item); + LLWorldMap::getInstance()->mLandForSale.push_back(new_item); break; } case MAP_ITEM_CLASSIFIED: // classifieds { // HACK: Z-height is in Extra2 field. new_item.mPosGlobal.mdV[VZ] = (F64)extra2; - gWorldMap->mClassifieds.push_back(new_item); + LLWorldMap::getInstance()->mClassifieds.push_back(new_item); break; } case MAP_ITEM_AGENT_LOCATIONS: // agent locations @@ -791,7 +789,7 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) } // llinfos << "New Location " << new_item.mName << llendl; - item_info_list_t& agentcounts = gWorldMap->mAgentLocationsMap[new_item.mRegionHandle]; + item_info_list_t& agentcounts = LLWorldMap::getInstance()->mAgentLocationsMap[new_item.mRegionHandle]; // Find the last item in the list with a different name and erase them item_info_list_t::iterator lastiter; |