void LLStatusBar::updateParcelIcons() { LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); LLViewerRegion* agent_region = gAgent.getRegion(); LLParcel* agent_parcel = vpm->getAgentParcel(); if (!agent_region || !agent_parcel) return; if (gSavedSettings.getBOOL("NavBarShowParcelProperties")) { LLParcel* current_parcel; LLViewerRegion* selection_region = vpm->getSelectionRegion(); LLParcel* selected_parcel = vpm->getParcelSelection()->getParcel(); // If agent is in selected parcel we use its properties because // they are updated more often by LLViewerParcelMgr than agent parcel properties. // See LLViewerParcelMgr::processParcelProperties(). // This is needed to reflect parcel restrictions changes without having to leave // the parcel and then enter it again. See EXT-2987 if (selected_parcel && selected_parcel->getLocalID() == agent_parcel->getLocalID() && selection_region == agent_region) { current_parcel = selected_parcel; } else { current_parcel = agent_parcel; } bool allow_voice = vpm->allowAgentVoice(agent_region, current_parcel); bool allow_fly = vpm->allowAgentFly(agent_region, current_parcel); bool allow_push = vpm->allowAgentPush(agent_region, current_parcel); bool allow_build = vpm->allowAgentBuild(current_parcel); // true when anyone is allowed to build. See EXT-4610. bool allow_scripts = vpm->allowAgentScripts(agent_region, current_parcel); bool allow_damage = vpm->allowAgentDamage(agent_region, current_parcel); //bool has_pwl = KCWindlightInterface::instance().WLset; // Most icons are "block this ability" mParcelIcon[VOICE_ICON]->setVisible( !allow_voice ); mParcelIcon[FLY_ICON]->setVisible( !allow_fly ); mParcelIcon[PUSH_ICON]->setVisible( !allow_push ); mParcelIcon[BUILD_ICON]->setVisible( !allow_build ); mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts ); mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage ); mDamageText->setVisible(allow_damage); //mPWLBtn->setVisible(has_pwl); //mPWLBtn->setEnabled(has_pwl); layoutParcelIcons(); } else { for (S32 i = 0; i < ICON_COUNT; ++i) { mParcelIcon[i]->setVisible(false); } mDamageText->setVisible(false); } }
void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, LLViewerRegion* region, const LLVector3d& pos_global, bool is_current_parcel) { if (!region || !parcel) return; // send EstateCovenantInfo message LLMessageSystem *msg = gMessageSystem; msg->newMessage("EstateCovenantRequest"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); msg->sendReliable(region->getHost()); LLParcelData parcel_data; // HACK: Converting sim access flags to the format // returned by remote parcel response. U8 sim_access = region->getSimAccess(); switch(sim_access) { case SIM_ACCESS_MATURE: parcel_data.flags = 0x1; mParcelRatingIcon->setValue(icon_m); mRegionRatingIcon->setValue(icon_m); break; case SIM_ACCESS_ADULT: parcel_data.flags = 0x2; mParcelRatingIcon->setValue(icon_r); mRegionRatingIcon->setValue(icon_r); break; default: parcel_data.flags = 0; mParcelRatingIcon->setValue(icon_pg); mRegionRatingIcon->setValue(icon_pg); } std::string rating = LLViewerRegion::accessToString(sim_access); mParcelRatingText->setText(rating); mRegionRatingText->setText(rating); parcel_data.desc = parcel->getDesc(); parcel_data.name = parcel->getName(); parcel_data.sim_name = region->getName(); parcel_data.snapshot_id = parcel->getSnapshotID(); mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), (F32)pos_global.mdV[VZ]); parcel_data.global_x = pos_global.mdV[VX]; parcel_data.global_y = pos_global.mdV[VY]; parcel_data.global_z = pos_global.mdV[VZ]; std::string on = getString("on"); std::string off = getString("off"); LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); // Processing parcel characteristics if (vpm->allowAgentVoice(region, parcel)) { mVoiceIcon->setValue(icon_voice); mVoiceText->setText(on); } else { mVoiceIcon->setValue(icon_voice_no); mVoiceText->setText(off); } if (vpm->allowAgentFly(region, parcel)) { mFlyIcon->setValue(icon_fly); mFlyText->setText(on); } else { mFlyIcon->setValue(icon_fly_no); mFlyText->setText(off); } if (vpm->allowAgentPush(region, parcel)) { mPushIcon->setValue(icon_push); mPushText->setText(on); } else { mPushIcon->setValue(icon_push_no); mPushText->setText(off); } if (vpm->allowAgentBuild(parcel)) { mBuildIcon->setValue(icon_build); mBuildText->setText(on); } else { mBuildIcon->setValue(icon_build_no); mBuildText->setText(off); } if (vpm->allowAgentScripts(region, parcel)) { mScriptsIcon->setValue(icon_scripts); mScriptsText->setText(on); } else { mScriptsIcon->setValue(icon_scripts_no); mScriptsText->setText(off); } if (vpm->allowAgentDamage(region, parcel)) { mDamageIcon->setValue(icon_damage); mDamageText->setText(on); } else { mDamageIcon->setValue(icon_damage_no); mDamageText->setText(off); } mRegionNameText->setText(region->getName()); mRegionTypeText->setText(region->getSimProductName()); // Determine parcel owner if (parcel->isPublic()) { mParcelOwner->setText(getString("public")); mRegionOwnerText->setText(getString("public")); } else { if (parcel->getIsGroupOwned()) { mRegionOwnerText->setText(getString("group_owned_text")); if(!parcel->getGroupID().isNull()) { // FIXME: Using parcel group as region group. gCacheName->get(parcel->getGroupID(), TRUE, boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mRegionGroupText, _2, _3)); gCacheName->get(parcel->getGroupID(), TRUE, boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mParcelOwner, _2, _3)); } else { std::string owner = getString("none_text"); mRegionGroupText->setText(owner); mParcelOwner->setText(owner); } } else { // Figure out the owner's name gCacheName->get(parcel->getOwnerID(), FALSE, boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mParcelOwner, _2, _3)); gCacheName->get(region->getOwner(), FALSE, boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mRegionOwnerText, _2, _3)); } if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus()) { mRegionOwnerText->setText(mRegionOwnerText->getText() + getString("sale_pending_text")); } } mEstateRatingText->setText(region->getSimAccessString()); S32 area; S32 claim_price; S32 rent_price; F32 dwell; BOOL for_sale; vpm->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell); if (for_sale) { const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); if(auth_buyer_id.notNull()) { gCacheName->get(auth_buyer_id, TRUE, boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mSaleToText, _2, _3)); // Show sales info to a specific person or a group he belongs to. if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id)) { for_sale = FALSE; } } else { mSaleToText->setText(getString("anyone")); } mForSalePanel->setVisible(for_sale); const U8* sign = (U8*)getString("price_text").c_str(); const U8* sqm = (U8*)getString("area_text").c_str(); mSalesPriceText->setText(llformat("%s%d ", sign, parcel->getSalePrice())); mAreaText->setText(llformat("%d %s", area, sqm)); mTrafficText->setText(llformat("%.0f", dwell)); // Can't have more than region max tasks, regardless of parcel // object bonus factor. S32 primitives = llmin(llround(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()), (S32)region->getMaxTasks()); const U8* available = (U8*)getString("available").c_str(); const U8* allocated = (U8*)getString("allocated").c_str(); mPrimitivesText->setText(llformat("%d %s, %d %s", primitives, available, parcel->getPrimCount(), allocated)); if (parcel->getAllowOtherScripts()) { mParcelScriptsText->setText(getString("all_residents_text")); } else if (parcel->getAllowGroupScripts()) { mParcelScriptsText->setText(getString("group_text")); } else { mParcelScriptsText->setText(off); } mTerraformLimitsText->setText(parcel->getAllowTerraform() ? on : off); if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) { mSubdivideText->setText(getString("can_change")); } else { mSubdivideText->setText(getString("can_not_change")); } if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) { mResaleText->setText(getString("can_not_resell")); } else { mResaleText->setText(getString("can_resell")); } } mSelectedParcelID = parcel->getLocalID(); mLastSelectedRegionID = region->getRegionID(); LLPanelPlaceInfo::processParcelInfo(parcel_data); mYouAreHerePanel->setVisible(is_current_parcel); getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(for_sale); }
void LLLocationInputCtrl::refreshParcelIcons() { // Our "cursor" moving right to left S32 x = mAddLandmarkBtn->getRect().mLeft; LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); LLViewerRegion* agent_region = gAgent.getRegion(); LLParcel* agent_parcel = vpm->getAgentParcel(); if (!agent_region || !agent_parcel) return; mForSaleBtn->setVisible(vpm->canAgentBuyParcel(agent_parcel, false)); x = layout_widget(mForSaleBtn, x); if (gSavedSettings.getBOOL("NavBarShowParcelProperties")) { LLParcel* current_parcel; LLViewerRegion* selection_region = vpm->getSelectionRegion(); LLParcel* selected_parcel = vpm->getParcelSelection()->getParcel(); // If agent is in selected parcel we use its properties because // they are updated more often by LLViewerParcelMgr than agent parcel properties. // See LLViewerParcelMgr::processParcelProperties(). // This is needed to reflect parcel restrictions changes without having to leave // the parcel and then enter it again. See EXT-2987 if (selected_parcel && selected_parcel->getLocalID() == agent_parcel->getLocalID() && selection_region == agent_region) { current_parcel = selected_parcel; } else { current_parcel = agent_parcel; } bool allow_voice = vpm->allowAgentVoice(agent_region, current_parcel); bool allow_fly = vpm->allowAgentFly(agent_region, current_parcel); bool allow_push = vpm->allowAgentPush(agent_region, current_parcel); bool allow_build = vpm->allowAgentBuild(current_parcel); // true when anyone is allowed to build. See EXT-4610. bool allow_scripts = vpm->allowAgentScripts(agent_region, current_parcel); bool allow_damage = vpm->allowAgentDamage(agent_region, current_parcel); // Most icons are "block this ability" mParcelIcon[VOICE_ICON]->setVisible( !allow_voice ); mParcelIcon[FLY_ICON]->setVisible( !allow_fly ); mParcelIcon[PUSH_ICON]->setVisible( !allow_push ); mParcelIcon[BUILD_ICON]->setVisible( !allow_build ); mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts ); mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage ); mDamageText->setVisible(allow_damage); // Padding goes to left of both landmark star and for sale btn x -= mAddLandmarkHPad; // Slide the parcel icons rect from right to left, adjusting rectangles for (S32 i = 0; i < ICON_COUNT; ++i) { x = layout_widget(mParcelIcon[i], x); x -= mIconHPad; } x = layout_widget(mDamageText, x); x -= mIconHPad; } else { for (S32 i = 0; i < ICON_COUNT; ++i) { mParcelIcon[i]->setVisible(false); } mDamageText->setVisible(false); } if (mTextEntry) { S32 left_pad, right_pad; mTextEntry->getTextPadding(&left_pad, &right_pad); right_pad = mTextEntry->getRect().mRight - x; mTextEntry->setTextPadding(left_pad, right_pad); } }