void LLWorldMap::dump() { for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) { U64 handle = (*it).first; LLSimInfo* info = (*it).second; U32 x_pos, y_pos; from_region_handle(handle, &x_pos, &y_pos); llinfos << x_pos << "," << y_pos << " " << info->getName() << " " << (S32)info->getAccess() << " " << std::hex << info->getRegionFlags() << std::dec << " " << info->getWaterHeight() //<< " " << info->mTelehubName //<< " " << info->mTelehubPosition << llendl; if (info->mCurrentImage) { llinfos << "image discard " << (S32)info->mCurrentImage->getDiscardLevel() << " fullwidth " << info->mCurrentImage->getWidth(0) << " fullheight " << info->mCurrentImage->getHeight(0) << " maxvirt " << info->mCurrentImage->getMaxVirtualSize() << " maxdisc " << (S32)info->mCurrentImage->getMaxDiscardLevel() << llendl; } } }
LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle) { sim_info_map_t::const_iterator it = mSimInfoMap.find(handle); if (it != mSimInfoMap.end()) { return it->second; } // <FS:CR> Aurora Sim U32 x = 0, y = 0; from_region_handle(handle, &x, &y); for (it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) { U32 checkRegionX, checkRegionY; from_region_handle((*it).first, &checkRegionX, &checkRegionY); LLSimInfo* info = (*it).second; if (x >= checkRegionX && x < (checkRegionX + info->getSizeX()) && y >= checkRegionY && y < (checkRegionY + info->getSizeY())) { return info; } } // </FS:CR> Aurora Sim return NULL; }
void LLFloaterWorldMap::updateSims(bool found_null_sim) { if (mCompletingRegionName == "") { return; } LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results"); list->operateOnAll(LLCtrlListInterface::OP_DELETE); S32 name_length = mCompletingRegionName.length(); LLSD match; S32 num_results = 0; std::map<U64, LLSimInfo*>::const_iterator it; for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) { LLSimInfo* info = it->second; std::string sim_name_lower = info->getName(); LLStringUtil::toLower(sim_name_lower); if (sim_name_lower.substr(0, name_length) == mCompletingRegionName) { if (sim_name_lower == mCompletingRegionName) { match = info->getName(); } LLSD value; value["id"] = info->getName(); value["columns"][0]["column"] = "sim_name"; value["columns"][0]["value"] = info->getName(); list->addElement(value); num_results++; } } if (found_null_sim) { mCompletingRegionName = ""; } // if match found, highlight it and go if (!match.isUndefined()) { list->selectByValue(match); childSetFocus("search_results"); onCommitSearchResult(); } // if we found nothing, say "none" if (num_results == 0) { list->setCommentText(LLTrans::getString("worldmap_results_none_found")); list->operateOnAll(LLCtrlListInterface::OP_DESELECT); } }
// Drop priority of all images being fetched by the map void LLWorldMap::dropImagePriorities() { // Drop the download of tiles priority to nil mWorldMipmap.dropBoostLevels(); // Same for the "land for sale" tiles per region for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) { LLSimInfo* info = it->second; info->dropImagePriority(); } }
void LLWorldMap::dump() { LL_INFOS("World Map") << "LLWorldMap::dump()" << LL_ENDL; for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) { LLSimInfo* info = it->second; if (info) { info->dump(); } } }
void LLFloaterWorldMap::onCommitSearchResult() { LLCtrlListInterface *list = childGetListInterface("search_results"); if (!list) return; LLSD selected_value = list->getSelectedValue(); std::string sim_name = selected_value.asString(); if (sim_name.empty()) { return; } LLStringUtil::toLower(sim_name); std::map<U64, LLSimInfo*>::const_iterator it; for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) { LLSimInfo* info = it->second; if (info->isName(sim_name)) { LLVector3d pos_global = info->getGlobalOrigin(); const F64 SIM_COORD_DEFAULT = 128.0; LLVector3 pos_local(SIM_COORD_DEFAULT, SIM_COORD_DEFAULT, 0.0f); // Did this value come from a trackURL() request? if (!mCompletingRegionPos.isExactlyZero()) { pos_local = mCompletingRegionPos; mCompletingRegionPos.clear(); } pos_global.mdV[VX] += (F64)pos_local.mV[VX]; pos_global.mdV[VY] += (F64)pos_local.mV[VY]; pos_global.mdV[VZ] = (F64)pos_local.mV[VZ]; childSetValue("location", sim_name); trackLocation(pos_global); setDefaultBtn("Teleport"); break; } } onShowTargetBtn(); }
// static public // Insert a region in the region map // returns true if region inserted, false otherwise bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, U32 x_size, U32 y_size, U32 agent_flags, std::string& name, LLUUID& image_id, U32 accesscode, U32 region_flags) { // This region doesn't exist if (accesscode == 255) { // Checks if the track point is in it and invalidates it if it is if (LLWorldMap::getInstance()->isTrackingInRectangle( x_world, y_world, x_world + REGION_WIDTH_UNITS, y_world + REGION_WIDTH_UNITS)) { LLWorldMap::getInstance()->setTrackingInvalid(); } // return failure to insert return false; } else { U64 handle = to_region_handle(x_world, y_world); //LL_INFOS("World Map") << "Map sim : " << name << ", ID : " << image_id.getString() << LL_ENDL; // Insert the region in the region map of the world map // Loading the LLSimInfo object with what we got and insert it in the map LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); if (siminfo == NULL) { siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } siminfo->setName( name ); siminfo->setAccess( accesscode ); siminfo->setRegionFlags( region_flags ); //siminfo->setWaterHeight((F32) water_height); U32 layer = flagsToLayer(agent_flags); if (layer == SIM_LAYER_OVERLAY) siminfo->setLandForSaleImage(image_id); else if(layer < SIM_LAYER_COUNT) siminfo->setMapImageID( image_id, layer ); siminfo->setSize( x_size, y_size ); // Handle the location tracking (for teleport, UI feedback and info display) if (LLWorldMap::getInstance()->isTrackingInRectangle( x_world, y_world, x_world + REGION_WIDTH_UNITS, y_world + REGION_WIDTH_UNITS)) { if (siminfo->isDown()) { // We were tracking this location, but it's no available LLWorldMap::getInstance()->setTrackingInvalid(); } else { // We were tracking this location, and it does exist and is available LLWorldMap::getInstance()->setTrackingValid(); } } // return insert region success return true; } }
// static void LLFloaterWorldMap::onCommitSearchResult(LLUICtrl*, void* userdata) { LLFloaterWorldMap* self = (LLFloaterWorldMap*) userdata; LLCtrlListInterface *list = self->childGetListInterface("search_results"); if (!list) return; LLSD selected_value = list->getSelectedValue(); std::string sim_name = selected_value.asString(); if (sim_name.empty()) { return; } LLStringUtil::toLower(sim_name); std::map<U64, LLSimInfo*>::const_iterator it; for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) { LLSimInfo* info = it->second; if (info->isName(sim_name)) { LLVector3d pos_global = info->getGlobalOrigin(); F64 local_x = self->childGetValue("spin x"); F64 local_y = self->childGetValue("spin y"); F64 local_z = self->childGetValue("spin z"); pos_global.mdV[VX] += local_x; pos_global.mdV[VY] += local_y; pos_global.mdV[VZ] = local_z; self->childSetValue("location", sim_name); self->trackLocation(pos_global); self->setDefaultBtn("Teleport"); break; } } onShowTargetBtn(self); }
LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 findhandle) { std::map<U64, LLSimInfo*>::const_iterator it; for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) { const U64 handle = (*it).first; LLSimInfo* info = (*it).second; if(handle == findhandle) { return info; } U32 x = 0, y = 0; from_region_handle(findhandle, &x, &y); U32 checkRegionX, checkRegionY; from_region_handle(handle, &checkRegionX, &checkRegionY); if(x >= checkRegionX && x < (checkRegionX + info->getSizeX()) && y >= checkRegionY && y < (checkRegionY + info->getSizeY())) { return info; } } return NULL; }
// static public // Insert an item in the relevant region map // returns true if item inserted, false otherwise bool LLWorldMap::insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2) { // Create an item record for the received object LLItemInfo new_item((F32)x_world, (F32)y_world, name, uuid); // Compute a region handle based on the objects coordinates LLVector3d pos((F32)x_world, (F32)y_world, 40.0); U64 handle = to_region_handle(pos); // Get the region record for that handle or NULL if we haven't browsed it yet LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); if (siminfo == NULL) { siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } //LL_INFOS("World Map") << "Process item : type = " << type << LL_ENDL; switch (type) { case MAP_ITEM_TELEHUB: // telehubs { /* Merov: we are not using the hub color anymore for display so commenting that out // Telehub color U32 X = x_world / REGION_WIDTH_UNITS; U32 Y = y_world / REGION_WIDTH_UNITS; F32 red = fmod((F32)X * 0.11f, 1.f) * 0.8f; F32 green = fmod((F32)Y * 0.11f, 1.f) * 0.8f; F32 blue = fmod(1.5f * (F32)(X + Y) * 0.11f, 1.f) * 0.8f; F32 add_amt = (X % 2) ? 0.15f : -0.15f; add_amt += (Y % 2) ? -0.15f : 0.15f; LLColor4 color(red + add_amt, green + add_amt, blue + add_amt); new_item.setColor(color); */ // extra2 specifies whether this is an infohub or a telehub. if (extra2) { siminfo->insertInfoHub(new_item); } else { siminfo->insertTeleHub(new_item); } break; } case MAP_ITEM_PG_EVENT: // events case MAP_ITEM_MATURE_EVENT: case MAP_ITEM_ADULT_EVENT: { struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(extra, gPacificDaylightTime); S32 display_hour = timep->tm_hour % 12; if (display_hour == 0) display_hour = 12; std::string tooltip = llformat( "%d:%02d %s", display_hour, timep->tm_min, (timep->tm_hour < 12 ? "AM" : "PM") ); new_item.setTooltip(tooltip); // HACK: store Z in extra2 new_item.setElevation((F64)extra2); if (type == MAP_ITEM_PG_EVENT) { siminfo->insertPGEvent(new_item); } else if (type == MAP_ITEM_MATURE_EVENT) { siminfo->insertMatureEvent(new_item); } else if (type == MAP_ITEM_ADULT_EVENT) { siminfo->insertAdultEvent(new_item); } break; } case MAP_ITEM_LAND_FOR_SALE: // land for sale case MAP_ITEM_LAND_FOR_SALE_ADULT: // adult land for sale { F32 cost_per_sqm = 0.0f; if (extra > 0) { cost_per_sqm = (F32)extra2 / (F32)extra; } std::string tooltip = llformat("%d sq.m. L$%d (L$ %.1f/sq.m.)", extra, extra2, cost_per_sqm); new_item.setTooltip(tooltip); if (type == MAP_ITEM_LAND_FOR_SALE) { siminfo->insertLandForSale(new_item); } else if (type == MAP_ITEM_LAND_FOR_SALE_ADULT) { siminfo->insertLandForSaleAdult(new_item); } break; } case MAP_ITEM_CLASSIFIED: // classifieds { //DEPRECATED: no longer used break; } case MAP_ITEM_AGENT_LOCATIONS: // agent locations { // LL_INFOS("World Map") << "New Location " << new_item.mName << LL_ENDL; if (extra > 0) { new_item.setCount(extra); siminfo->insertAgentLocation(new_item); } break; } default: break; } return true; }
void LLFloaterWorldMap::updateSims(bool found_null_sim) { if (mCompletingRegionName == "") { return; } LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results"); list->operateOnAll(LLCtrlListInterface::OP_DELETE); LLSD selected_value = list->getSelectedValue(); S32 name_length = mCompletingRegionName.length(); BOOL match_found = FALSE; S32 num_results = 0; std::map<U64, LLSimInfo*>::const_iterator it; for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) { LLSimInfo* info = (*it).second; std::string sim_name = info->getName(); std::string sim_name_lower = sim_name; LLStringUtil::toLower(sim_name_lower); if (sim_name_lower.substr(0, name_length) == mCompletingRegionName) { if (LLWorldMap::getInstance()->mIsTrackingCommit) { if (sim_name_lower == mCompletingRegionName) { selected_value = sim_name; match_found = TRUE; } } LLSD value; value["id"] = sim_name; value["columns"][0]["column"] = "sim_name"; value["columns"][0]["value"] = sim_name; list->addElement(value); num_results++; } } list->selectByValue(selected_value); if (found_null_sim) { mCompletingRegionName = ""; } if (match_found) { mExactMatch = TRUE; childSetFocus("search_results"); onCommitSearchResult(NULL, this); } else if (!mExactMatch && num_results > 0) { list->selectFirstItem(); // select first item by default childSetFocus("search_results"); onCommitSearchResult(NULL, this); } else { list->addCommentText(std::string("None found.")); list->operateOnAll(LLCtrlListInterface::OP_DESELECT); } }
// public static void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) { U32 agent_flags; msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); if ((S32)agent_flags < 0 || agent_flags >= MAP_SIM_IMAGE_TYPES) { llwarns << "Invalid map image type returned! " << agent_flags << llendl; return; } S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_Data); bool found_null_sim = false; #ifdef IMMEDIATE_IMAGE_LOAD bool use_web_map_tiles = useWebMapTiles(); #endif BOOL adjust = FALSE; for (S32 block=0; block<num_blocks; ++block) { U16 x_regions; U16 y_regions; U16 x_size = 256; U16 y_size = 256; std::string name; U8 accesscode; U32 region_flags; U8 water_height; U8 agents; LLUUID image_id; msg->getU16Fast(_PREHASH_Data, _PREHASH_X, x_regions, block); msg->getU16Fast(_PREHASH_Data, _PREHASH_Y, y_regions, block); msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, accesscode, block); msg->getU32Fast(_PREHASH_Data, _PREHASH_RegionFlags, region_flags, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block); msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block); msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block); if(msg->getNumberOfBlocksFast(_PREHASH_Size) > 0) { msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeX, x_size, block); msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeY, y_size, block); } if(x_size == 0 || (x_size % 16) != 0|| (y_size % 16) != 0) { x_size = 256; y_size = 256; } U32 x_meters = x_regions * REGION_WIDTH_UNITS; U32 y_meters = y_regions * REGION_WIDTH_UNITS; U64 handle = to_region_handle(x_meters, y_meters); if (accesscode == 255) { // This region doesn't exist 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 LLWorldMap::getInstance()->mInvalidLocation = TRUE; } found_null_sim = true; } else { adjust = LLWorldMap::getInstance()->extendAABB(x_meters, y_meters, x_meters+REGION_WIDTH_UNITS, y_meters+REGION_WIDTH_UNITS) || adjust; //LL_INFOS("World Map") << "Map sim : " << name << ", ID : " << image_id.getString() << LL_ENDL; // Insert the region in the region map of the world map // Loading the LLSimInfo object with what we got and insert it in the map LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); if (siminfo == NULL) { siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } siminfo->setName( name ); siminfo->setAccess( accesscode ); siminfo->setRegionFlags( region_flags ); siminfo->setWaterHeight((F32) water_height); siminfo->setMapImageID( image_id, agent_flags ); siminfo->setSize( x_size, y_size ); #ifdef IMMEDIATE_IMAGE_LOAD if (use_web_map_tiles) { siminfo->mCurrentImage = loadObjectsTile((U32)x_regions, (U32)y_regions); } else { siminfo->mCurrentImage = LLViewerTextureManager::getFetchedTexture(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); } gGL.getTexUnit(0)->bind(siminfo->mCurrentImage.get()); siminfo->mCurrentImage->setAddressMode(LLTexUnit::TAM_CLAMP); #endif if (siminfo->mMapImageID[2].notNull()) { #ifdef IMMEDIATE_IMAGE_LOAD siminfo->mOverlayImage = LLViewerTextureManager::getFetchedTextureURL(siminfo->mMapImageID[2]); #endif } else { siminfo->mOverlayImage = NULL; } 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->isDown()) { // We were tracking this location, but it doesn't exist LLWorldMap::getInstance()->mInvalidLocation = true; } else { // We were tracking this location, and it does exist bool is_tracking_dbl = LLWorldMap::getInstance()->mIsTrackingDoubleClick == TRUE; gFloaterWorldMap->trackLocation(LLWorldMap::getInstance()->mUnknownLocation); if (is_tracking_dbl) { LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); gAgent.teleportViaLocation( pos_global ); } } } } if(LLWorldMap::getInstance()->mSLURLCallback != NULL) { // Server returns definitive capitalization, SLURL might not have that. if ((LLStringUtil::compareInsensitive(LLWorldMap::getInstance()->mSLURLRegionName, name)==0) || (LLWorldMap::getInstance()->mSLURLRegionHandle == handle)) { url_callback_t callback = LLWorldMap::getInstance()->mSLURLCallback; LLWorldMap::getInstance()->mSLURLCallback = NULL; LLWorldMap::getInstance()->mSLURLRegionName.clear(); LLWorldMap::getInstance()->mSLURLRegionHandle = 0; callback(handle, LLWorldMap::getInstance()->mSLURL, image_id, LLWorldMap::getInstance()->mSLURLTeleport); } } if( gAgent.mPendingLure && (U16)(gAgent.mPendingLure->mPosGlobal.mdV[0] / REGION_WIDTH_UNITS) == x_regions && (U16)(gAgent.mPendingLure->mPosGlobal.mdV[1] / REGION_WIDTH_UNITS) == y_regions ) { gAgent.onFoundLureDestination(); } } if(adjust) gFloaterWorldMap->adjustZoomSliderBounds(); gFloaterWorldMap->updateSims(found_null_sim); }
void LLFloaterWorldMap::updateSims(bool found_null_sim) { if (mCompletingRegionName == "") { return; } LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results"); list->operateOnAll(LLCtrlListInterface::OP_DELETE); S32 name_length = mCompletingRegionName.length(); LLSD match; S32 num_results = 0; 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()); for (std::vector<std::pair <U64, LLSimInfo*> >::const_iterator it = sim_info_vec.begin(); it != sim_info_vec.end(); ++it) { LLSimInfo* info = it->second; std::string sim_name_lower = info->getName(); LLStringUtil::toLower(sim_name_lower); if (sim_name_lower.substr(0, name_length) == mCompletingRegionName) { if (sim_name_lower == mCompletingRegionName) { match = info->getName(); } LLSD value; value["id"] = info->getName(); value["columns"][0]["column"] = "sim_name"; value["columns"][0]["value"] = info->getName(); list->addElement(value); num_results++; } } if (found_null_sim) { mCompletingRegionName = ""; } if (num_results > 0) { // Ansariel: Let's sort the list to make it more user-friendly list->sortByColumn("sim_name", TRUE); // if match found, highlight it and go if (!match.isUndefined()) { list->selectByValue(match); } // else select first found item else { list->selectFirstItem(); } getChild<LLUICtrl>("search_results")->setFocus(TRUE); onCommitSearchResult(); } else { // if we found nothing, say "none" list->setCommentText(LLTrans::getString("worldmap_results_none_found")); list->operateOnAll(LLCtrlListInterface::OP_DESELECT); } }
LLPointer<LLViewerImage> LLWorldMipmap::getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load) { // Check the input data llassert(level <= MAP_LEVELS); llassert(level >= 1); // If the *loading* level changed, cleared the new level from "missed" tiles // so that we get a chance to reload them if (load && (level != mCurrentLevel)) { cleanMissedTilesFromLevel(level); mCurrentLevel = level; } // Build the region handle U64 handle = convertGridToHandle(grid_x, grid_y); // Check if the image is around already sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level-1]; sublevel_tiles_t::iterator found = level_mipmap.find(handle); // If not there and load on, go load it if (found == level_mipmap.end()) { if (load) { // Load it LLPointer<LLViewerImage> img; // <edit> //this is a hack for opensims. if(LLViewerLogin::getInstance()->getGridChoice() < GRID_INFO_OTHER) img = loadObjectsTile(grid_x, grid_y, level); else { LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle); if(info) { img = gImageList.getImage(info->getMapImageID(), MIPMAP_TRUE, FALSE); img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP); } else return NULL; } // </edit> // Insert the image in the map level_mipmap.insert(sublevel_tiles_t::value_type( handle, img )); // Find the element again in the map (it's there now...) found = level_mipmap.find(handle); } else { // Return with NULL if not found and we're not trying to load return NULL; } } // Get the image pointer and check if this asset is missing LLPointer<LLViewerImage> img = found->second; if (img->isMissingAsset()) { // Return NULL if asset missing return NULL; } else { // Boost the tile level so to mark it's in use *if* load on if (load) { img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP_VISIBLE); } return img; } }
// static public // Insert an item in the relevant region map // returns true if item inserted, false otherwise bool LLWorldMap::insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2) { // Create an item record for the received object LLItemInfo new_item((F32)x_world, (F32)y_world, name, uuid); // Compute a region handle based on the objects coordinates LLVector3d pos((F32)x_world, (F32)y_world, 40.0); U64 handle = to_region_handle(pos); // Get the region record for that handle or NULL if we haven't browsed it yet LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); if (siminfo == NULL) { siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } //LL_INFOS("World Map") << "Process item : type = " << type << LL_ENDL; switch (type) { case MAP_ITEM_TELEHUB: // telehubs { /* Merov: we are not using the hub color anymore for display so commenting that out // Telehub color U32 X = x_world / REGION_WIDTH_UNITS; U32 Y = y_world / REGION_WIDTH_UNITS; F32 red = fmod((F32)X * 0.11f, 1.f) * 0.8f; F32 green = fmod((F32)Y * 0.11f, 1.f) * 0.8f; F32 blue = fmod(1.5f * (F32)(X + Y) * 0.11f, 1.f) * 0.8f; F32 add_amt = (X % 2) ? 0.15f : -0.15f; add_amt += (Y % 2) ? -0.15f : 0.15f; LLColor4 color(red + add_amt, green + add_amt, blue + add_amt); new_item.setColor(color); */ // extra2 specifies whether this is an infohub or a telehub. if (extra2) { siminfo->insertInfoHub(new_item); } else { siminfo->insertTeleHub(new_item); } break; } case MAP_ITEM_PG_EVENT: // events case MAP_ITEM_MATURE_EVENT: case MAP_ITEM_ADULT_EVENT: { std::string timeStr = "["+ LLTrans::getString ("TimeHour")+"]:[" +LLTrans::getString ("TimeMin")+"] [" +LLTrans::getString ("TimeAMPM")+"]"; LLSD substitution; substitution["datetime"] = (S32) extra; LLStringUtil::format (timeStr, substitution); new_item.setTooltip(timeStr); // HACK: store Z in extra2 new_item.setElevation((F64)extra2); if (type == MAP_ITEM_PG_EVENT) { siminfo->insertPGEvent(new_item); } else if (type == MAP_ITEM_MATURE_EVENT) { siminfo->insertMatureEvent(new_item); } else if (type == MAP_ITEM_ADULT_EVENT) { siminfo->insertAdultEvent(new_item); } break; } case MAP_ITEM_LAND_FOR_SALE: // land for sale case MAP_ITEM_LAND_FOR_SALE_ADULT: // adult land for sale { static LLUIString tooltip_fmt = LLTrans::getString("worldmap_item_tooltip_format"); std::string type_currency = LLGridManager::getInstance()->getCurrency(); tooltip_fmt.setArg("[AREA]", llformat("%d", extra)); tooltip_fmt.setArg("[PRICE]", llformat("%d", extra2)); tooltip_fmt.setArg("[CUR]", type_currency); new_item.setTooltip(tooltip_fmt.getString()); if (type == MAP_ITEM_LAND_FOR_SALE) { siminfo->insertLandForSale(new_item); } else if (type == MAP_ITEM_LAND_FOR_SALE_ADULT) { siminfo->insertLandForSaleAdult(new_item); } break; } case MAP_ITEM_CLASSIFIED: // classifieds { //DEPRECATED: no longer used break; } case MAP_ITEM_AGENT_LOCATIONS: // agent locations { // LL_INFOS("World Map") << "New Location " << new_item.mName << LL_ENDL; if (extra > 0) { new_item.setCount(extra); siminfo->insertAgentLocation(new_item); } break; } default: break; } return true; }