llparcel.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. /**
  2. * @file llparcel.h
  3. *
  4. * $LicenseInfo:firstyear=2002&license=viewergpl$
  5. *
  6. * Copyright (c) 2002-2009, Linden Research, Inc.
  7. *
  8. * Second Life Viewer Source Code
  9. * The source code in this file ("Source Code") is provided by Linden Lab
  10. * to you under the terms of the GNU General Public License, version 2.0
  11. * ("GPL"), unless you have obtained a separate licensing agreement
  12. * ("Other License"), formally executed by you and Linden Lab. Terms of
  13. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  14. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  15. *
  16. * There are special exceptions to the terms and conditions of the GPL as
  17. * it is applied to this Source Code. View the full text of the exception
  18. * in the file doc/FLOSS-exception.txt in this software distribution, or
  19. * online at
  20. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  21. *
  22. * By copying, modifying or distributing this software, you acknowledge
  23. * that you have read and understood your obligations described above,
  24. * and agree to abide by those obligations.
  25. *
  26. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  27. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  28. * COMPLETENESS OR PERFORMANCE.
  29. * $/LicenseInfo$
  30. */
  31. #ifndef LL_LLPARCEL_H
  32. #define LL_LLPARCEL_H
  33. #include <iostream>
  34. #include <time.h>
  35. #include "hbfastmap.h"
  36. #include "llparcelflags.h"
  37. #include "llpermissions.h"
  38. #include "llpreprocessor.h"
  39. #include "lluuid.h"
  40. #include "llvector3.h"
  41. // Grid out of which parcels taken is stepped every 4 meters.
  42. constexpr F32 PARCEL_GRID_STEP_METERS = 4.f;
  43. // Area of one "square" of parcel
  44. constexpr S32 PARCEL_UNIT_AREA = 16;
  45. // Height _above_ground_ that parcel boundary ends
  46. constexpr F32 PARCEL_HEIGHT = 50.f;
  47. // Height above ground which parcel boundries exist for explicitly banned
  48. // avatars
  49. constexpr F32 BAN_HEIGHT = 5000.f;
  50. // Maximum number of entries in an access list
  51. constexpr S32 PARCEL_MAX_ACCESS_LIST = 300;
  52. // Maximum number of entires in an update packet for access/ban lists.
  53. constexpr F32 PARCEL_MAX_ENTRIES_PER_PACKET = 48.f;
  54. // Maximum number of experiences
  55. constexpr S32 PARCEL_MAX_EXPERIENCE_LIST = 24;
  56. // Weekly charge for listing a parcel in the directory
  57. constexpr S32 PARCEL_DIRECTORY_FEE = 30;
  58. constexpr S32 PARCEL_PASS_PRICE_DEFAULT = 10;
  59. constexpr F32 PARCEL_PASS_HOURS_DEFAULT = 1.f;
  60. // Number of "chunks" in which parcel overlay data is sent.
  61. // Chunk 0 = southern rows, entire width
  62. constexpr S32 PARCEL_OVERLAY_CHUNKS = 4;
  63. // Bottom three bits are a color index for the land overlay
  64. constexpr U8 PARCEL_COLOR_MASK = 0x07;
  65. constexpr U8 PARCEL_PUBLIC = 0x00;
  66. constexpr U8 PARCEL_OWNED = 0x01;
  67. constexpr U8 PARCEL_GROUP = 0x02;
  68. constexpr U8 PARCEL_SELF = 0x03;
  69. constexpr U8 PARCEL_FOR_SALE = 0x04;
  70. constexpr U8 PARCEL_AUCTION = 0x05;
  71. // Avatars not visible outside of parcel. Used for 'see avs' feature, but must
  72. // be off for compatibility.
  73. constexpr U8 PARCEL_HIDDENAVS = 0x10;
  74. constexpr U8 PARCEL_SOUND_LOCAL = 0x20;
  75. constexpr U8 PARCEL_WEST_LINE = 0x40; // Flag, property line on west edge
  76. constexpr U8 PARCEL_SOUTH_LINE = 0x80; // Flag, property line on south edge
  77. // Transmission results for parcel properties
  78. constexpr S32 PARCEL_RESULT_NO_DATA = -1;
  79. constexpr S32 PARCEL_RESULT_SUCCESS = 0; // Got exactly one parcel
  80. constexpr S32 PARCEL_RESULT_MULTIPLE = 1; // Got multiple parcels
  81. constexpr S32 UPDATE_AGENT_PARCEL_SEQ_ID = -1000;
  82. constexpr S32 SELECTED_PARCEL_SEQ_ID = -10000;
  83. constexpr S32 COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID = -20000;
  84. constexpr S32 COLLISION_BANNED_PARCEL_SEQ_ID = -30000;
  85. constexpr S32 COLLISION_NOT_ON_LIST_PARCEL_SEQ_ID = -40000;
  86. constexpr S32 HOVERED_PARCEL_SEQ_ID = -50000;
  87. constexpr U32 RT_NONE = 0x1 << 0;
  88. constexpr U32 RT_OWNER = 0x1 << 1;
  89. constexpr U32 RT_GROUP = 0x1 << 2;
  90. constexpr U32 RT_OTHER = 0x1 << 3;
  91. constexpr U32 RT_LIST = 0x1 << 4;
  92. constexpr U32 RT_SELL = 0x1 << 5;
  93. constexpr S32 INVALID_PARCEL_ID = -1;
  94. constexpr S32 INVALID_PARCEL_ENVIRONMENT_VERSION = -2;
  95. // When region settings are used, parcel environment version is -1
  96. constexpr S32 UNSET_PARCEL_ENVIRONMENT_VERSION = -1;
  97. // Timeouts for parcels.
  98. // Default is 21 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 1814400000000
  99. constexpr U64 DEFAULT_USEC_CONVERSION_TIMEOUT = 1814400000000UL;
  100. // Group is 60 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 5184000000000
  101. constexpr U64 GROUP_USEC_CONVERSION_TIMEOUT = 5184000000000UL;
  102. // Default sale timeout is 2 days -> 172800000000
  103. constexpr U64 DEFAULT_USEC_SALE_TIMEOUT = 172800000000UL;
  104. // More grace period extensions.
  105. constexpr U64 SEVEN_DAYS_IN_USEC = 604800000000UL;
  106. // If more than 100000s before sale revert, and no extra extension has been
  107. // given, go ahead and extend it more (about 1.2 days).
  108. constexpr S32 EXTEND_GRACE_IF_MORE_THAN_SEC = 100000;
  109. class LLMessageSystem;
  110. class LLSD;
  111. class LLAccessEntry
  112. {
  113. public:
  114. LL_INLINE LLAccessEntry()
  115. : mTime(0),
  116. mFlags(0)
  117. {
  118. }
  119. LL_INLINE LLAccessEntry(const LLUUID& id, S32 time, U32 flags)
  120. : mID(id),
  121. mTime(time),
  122. mFlags(flags)
  123. {
  124. }
  125. public:
  126. LLUUID mID; // Avatar ID
  127. S32 mTime; // Time (unix seconds) when entry expires
  128. U32 mFlags; // Not used - currently should always be zero
  129. };
  130. typedef fast_hmap<LLUUID, LLAccessEntry> access_map_t;
  131. class LLParcel final
  132. {
  133. protected:
  134. LOG_CLASS(LLParcel);
  135. public:
  136. enum EOwnershipStatus
  137. {
  138. OS_LEASED = 0,
  139. OS_LEASE_PENDING = 1,
  140. OS_ABANDONED = 2,
  141. OS_COUNT = 3,
  142. OS_NONE = -1
  143. };
  144. enum ECategory
  145. {
  146. C_NONE = 0,
  147. C_LINDEN,
  148. C_ADULT,
  149. C_ARTS, // "Arts & culture"
  150. C_BUSINESS, // Was "store"
  151. C_EDUCATIONAL,
  152. C_GAMING, // Was "game"
  153. C_HANGOUT, // Was "gathering place"
  154. C_NEWCOMER,
  155. C_PARK, // "Parks & nature"
  156. C_RESIDENTIAL, // Was "homestead"
  157. C_SHOPPING,
  158. C_STAGE,
  159. C_OTHER,
  160. C_RENTAL,
  161. C_COUNT,
  162. C_ANY = -1 // Only useful in queries
  163. };
  164. enum EAction
  165. {
  166. A_CREATE = 0,
  167. A_RELEASE = 1,
  168. A_ABSORB = 2,
  169. A_ABSORBED = 3,
  170. A_DIVIDE = 4,
  171. A_DIVISION = 5,
  172. A_ACQUIRE = 6,
  173. A_RELINQUISH = 7,
  174. A_CONFIRM = 8,
  175. A_COUNT = 9,
  176. A_UNKNOWN = -1
  177. };
  178. enum ELandingType
  179. {
  180. L_NONE = 0,
  181. L_LANDING_POINT = 1,
  182. L_DIRECT = 2
  183. };
  184. LLParcel();
  185. LLParcel(const LLUUID& owner_id, bool modify, bool terraform, bool damage,
  186. time_t claim_date, S32 claim_price, S32 rent_price, S32 area,
  187. S32 sim_object_limit, F32 parcel_object_bonus,
  188. bool is_group_owned = false);
  189. void init(const LLUUID& owner_id, bool modify, bool terraform, bool damage,
  190. time_t claim_date, S32 claim_price, S32 rent_price, S32 area,
  191. S32 sim_object_limit, F32 parcel_object_bonus,
  192. bool is_group_owned = false);
  193. // MANIPULATORS
  194. void setName(const std::string& name);
  195. void setDesc(const std::string& desc);
  196. void setMusicURL(const std::string& url);
  197. void setMediaURL(const std::string& url);
  198. void setMediaType(const std::string& type);
  199. void setMediaDesc(const std::string& desc);
  200. LL_INLINE void setMediaID(const LLUUID& id) { mMediaID = id; }
  201. LL_INLINE void setMediaAutoScale(bool b) { mMediaAutoScale = b; }
  202. LL_INLINE void setMediaLoop(bool b) { mMediaLoop = b; }
  203. LL_INLINE void setMediaWidth(S32 width) { mMediaWidth = width; }
  204. LL_INLINE void setMediaHeight(S32 height) { mMediaHeight = height; }
  205. void setMediaCurrentURL(const std::string& url);
  206. LL_INLINE void setMediaAllowNavigate(U8 enable) { mMediaAllowNavigate = enable; }
  207. LL_INLINE void setMediaURLTimeout(F32 timeout) { mMediaURLTimeout = timeout; }
  208. LL_INLINE void setLocalID(S32 local_id) { mLocalID = local_id; }
  209. LL_INLINE void setAuthorizedBuyerID(const LLUUID& id) { mAuthBuyerID = id; }
  210. LL_INLINE void setCategory(ECategory category) { mCategory = category; }
  211. LL_INLINE void setSnapshotID(const LLUUID& id) { mSnapshotID = id; }
  212. LL_INLINE void setUserLocation(const LLVector3& pos) { mUserLocation = pos; }
  213. LL_INLINE void setUserLookAt(const LLVector3& rot) { mUserLookAt = rot; }
  214. LL_INLINE void setLandingType(const ELandingType type) { mLandingType = type; }
  215. LL_INLINE void setSeeAVs(bool see_avs) { mSeeAVs = see_avs; }
  216. // Remove this once hidden AV feature is fully available grid-wide (rather
  217. // keep it for now and until OpenSim grids can cope... HB):
  218. LL_INLINE void setHaveNewParcelLimitData(bool b) { mHaveNewParcelLimitData = b; }
  219. LL_INLINE void setAuctionID(U32 auction_id) { mAuctionID = auction_id;}
  220. void setParcelFlag(U32 flag, bool b);
  221. LL_INLINE void setContributeWithDeed(bool b) { setParcelFlag(PF_CONTRIBUTE_WITH_DEED, b); }
  222. LL_INLINE void setForSale(bool b) { setParcelFlag(PF_FOR_SALE, b); }
  223. LL_INLINE void setSoundOnly(bool b) { setParcelFlag(PF_SOUND_LOCAL, b); }
  224. LL_INLINE void setAllowGroupAVSounds(bool b) { mAllowGroupAVSounds = b; }
  225. LL_INLINE void setAllowAnyAVSounds(bool b) { mAllowAnyAVSounds = b; }
  226. LL_INLINE void setObscureMOAP(bool b) { mObscureMOAP = b; }
  227. LL_INLINE void setSalePrice(S32 price) { mSalePrice = price; }
  228. LL_INLINE void setGroupID(const LLUUID& id) { mGroupID = id; }
  229. LL_INLINE void setPassPrice(S32 price) { mPassPrice = price; }
  230. LL_INLINE void setPassHours(F32 hours) { mPassHours = hours; }
  231. void packMessage(LLMessageSystem* msg);
  232. void packMessage(LLSD& msg);
  233. void unpackMessage(LLMessageSystem* msg);
  234. void unpackAccessEntries(LLMessageSystem* msg, access_map_t* list);
  235. // Experience tools support
  236. void unpackExperienceEntries(LLMessageSystem* msg, U32 type);
  237. void setExperienceKeyType(const LLUUID& experience_key, U32 type);
  238. U32 countExperienceKeyType(U32 type) const;
  239. U32 getExperienceKeyType(const LLUUID& experience_key) const;
  240. access_map_t getExperienceKeysByType(U32 type)const;
  241. void clearExperienceKeysByType(U32 type);
  242. LL_INLINE void setAABBMin(const LLVector3& min) { mAABBMin = min; }
  243. LL_INLINE void setAABBMax(const LLVector3& max) { mAABBMax = max; }
  244. void dump();
  245. // Add to list, suppressing duplicates. Return true if succesful.
  246. bool addToAccessList(const LLUUID& agent_id, S32 time);
  247. bool addToBanList(const LLUUID& agent_id, S32 time);
  248. // Remove from list. Return true if succesful.
  249. bool removeFromAccessList(const LLUUID& agent_id);
  250. bool removeFromBanList(const LLUUID& agent_id);
  251. // ACCESSORS
  252. LL_INLINE const LLUUID& getID() const { return mID; }
  253. LL_INLINE const std::string& getName() const { return mName; }
  254. LL_INLINE const std::string& getDesc() const { return mDesc; }
  255. LL_INLINE const std::string& getMusicURL() const { return mMusicURL; }
  256. LL_INLINE const std::string& getMediaURL() const { return mMediaURL; }
  257. LL_INLINE const std::string& getMediaDesc() const { return mMediaDesc; }
  258. LL_INLINE const std::string& getMediaType() const { return mMediaType; }
  259. LL_INLINE const LLUUID& getMediaID() const { return mMediaID; }
  260. LL_INLINE S32 getMediaWidth() const { return mMediaWidth; }
  261. LL_INLINE S32 getMediaHeight() const { return mMediaHeight; }
  262. LL_INLINE bool getMediaAutoScale() const { return mMediaAutoScale; }
  263. LL_INLINE bool getMediaLoop() const { return mMediaLoop; }
  264. LL_INLINE const std::string& getMediaCurrentURL() const { return mMediaCurrentURL; }
  265. LL_INLINE U8 getMediaAllowNavigate() const { return mMediaAllowNavigate; }
  266. LL_INLINE F32 getMediaURLTimeout() const { return mMediaURLTimeout; }
  267. LL_INLINE U8 getMediaPreventCameraZoom() const { return mMediaPreventCameraZoom; }
  268. LL_INLINE S32 getLocalID() const { return mLocalID; }
  269. LL_INLINE const LLUUID& getOwnerID() const { return mOwnerID; }
  270. LL_INLINE const LLUUID& getGroupID() const { return mGroupID; }
  271. LL_INLINE S32 getPassPrice() const { return mPassPrice; }
  272. LL_INLINE F32 getPassHours() const { return mPassHours; }
  273. LL_INLINE bool getIsGroupOwned() const { return mGroupOwned; }
  274. LL_INLINE U32 getAuctionID() const { return mAuctionID; }
  275. LL_INLINE bool isPublic() const { return mOwnerID.isNull(); }
  276. // Region-local user-specified position
  277. LL_INLINE const LLVector3& getUserLocation() const { return mUserLocation; }
  278. LL_INLINE const LLVector3& getUserLookAt() const { return mUserLookAt; }
  279. LL_INLINE ELandingType getLandingType() const { return mLandingType; }
  280. LL_INLINE bool getSeeAVs() const { return mSeeAVs; }
  281. LL_INLINE bool getHaveNewParcelLimitData() const { return mHaveNewParcelLimitData; }
  282. // User-specified snapshot
  283. LL_INLINE const LLUUID& getSnapshotID() const { return mSnapshotID; }
  284. // The authorized buyer id is the person who is the only agent/group that
  285. // has authority to purchase. (i.e. UI specified a particular agent could
  286. // buy the plot).
  287. LL_INLINE const LLUUID& getAuthorizedBuyerID() const { return mAuthBuyerID; }
  288. // helper function
  289. LL_INLINE bool isBuyerAuthorized(const LLUUID& buyer_id) const
  290. {
  291. return mAuthBuyerID.isNull() || mAuthBuyerID == buyer_id;
  292. }
  293. // Methods to deal with ownership status.
  294. LL_INLINE EOwnershipStatus getOwnershipStatus() const { return mStatus; }
  295. static const std::string& getOwnershipStatusString(EOwnershipStatus status);
  296. LL_INLINE void setOwnershipStatus(EOwnershipStatus s) { mStatus = s; }
  297. // Dealing with parcel category information
  298. LL_INLINE ECategory getCategory() const { return mCategory; }
  299. static const std::string& getCategoryString(ECategory category);
  300. static const std::string& getCategoryUIString(ECategory category);
  301. static ECategory getCategoryFromString(const std::string& string);
  302. static ECategory getCategoryFromUIString(const std::string& string);
  303. // functions for parcel action (used for logging)
  304. static const std::string& getActionString(EAction action);
  305. LL_INLINE U32 getParcelFlags() const { return mParcelFlags; }
  306. LL_INLINE bool getParcelFlag(U32 flag) const { return (mParcelFlags & flag) != 0; }
  307. // Objects can be added or modified by anyone (only parcel owner if
  308. // disabled)
  309. LL_INLINE bool getAllowModify() const { return (mParcelFlags & PF_CREATE_OBJECTS) != 0; }
  310. // Objects can be added or modified by group members
  311. LL_INLINE bool getAllowGroupModify() const { return (mParcelFlags & PF_CREATE_GROUP_OBJECTS) != 0; }
  312. // The parcel can be deeded to the group
  313. LL_INLINE bool getAllowDeedToGroup() const { return (mParcelFlags & PF_ALLOW_DEED_TO_GROUP) != 0; }
  314. // Does the owner want to make a contribution along with the deed.
  315. LL_INLINE bool getContributeWithDeed() const { return (mParcelFlags & PF_CONTRIBUTE_WITH_DEED) != 0; }
  316. // Heightfield can be modified
  317. LL_INLINE bool getAllowTerraform() const { return (mParcelFlags & PF_ALLOW_TERRAFORM) != 0; }
  318. // Avatars can be hurt here
  319. LL_INLINE bool getAllowDamage() const { return (mParcelFlags & PF_ALLOW_DAMAGE) != 0; }
  320. LL_INLINE bool getAllowFly() const { return (mParcelFlags & PF_ALLOW_FLY) != 0; }
  321. // For now kept, just in case of OpenSim compatibility issues. We should
  322. // eventually remove this flag completely.
  323. LL_INLINE bool getAllowLandmark() const { return (mParcelFlags & PF_ALLOW_LANDMARK) != 0; }
  324. LL_INLINE bool getAllowGroupScripts() const { return (mParcelFlags & PF_ALLOW_GROUP_SCRIPTS) != 0; }
  325. LL_INLINE bool getAllowOtherScripts() const { return (mParcelFlags & PF_ALLOW_OTHER_SCRIPTS) != 0; }
  326. LL_INLINE bool getAllowAllObjectEntry() const { return (mParcelFlags & PF_ALLOW_ALL_OBJECT_ENTRY) != 0; }
  327. LL_INLINE bool getAllowGroupObjectEntry() const { return (mParcelFlags & PF_ALLOW_GROUP_OBJECT_ENTRY) != 0; }
  328. LL_INLINE bool getForSale() const { return (mParcelFlags & PF_FOR_SALE) != 0; }
  329. LL_INLINE bool getSoundLocal() const { return (mParcelFlags & PF_SOUND_LOCAL) != 0; }
  330. LL_INLINE bool getParcelFlagAllowVoice() const { return (mParcelFlags & PF_ALLOW_VOICE_CHAT) != 0; }
  331. LL_INLINE bool getParcelFlagUseEstateVoiceChannel() const
  332. {
  333. return (mParcelFlags & PF_USE_ESTATE_VOICE_CHAN) != 0;
  334. }
  335. LL_INLINE bool getAllowPublish() const { return (mParcelFlags & PF_ALLOW_PUBLISH) != 0; }
  336. LL_INLINE bool getMaturePublish() const { return (mParcelFlags & PF_MATURE_PUBLISH) != 0; }
  337. LL_INLINE bool getRestrictPushObject() const { return (mParcelFlags & PF_RESTRICT_PUSHOBJECT) != 0; }
  338. LL_INLINE bool getRegionPushOverride() const { return mRegionPushOverride; }
  339. LL_INLINE bool getRegionDenyAnonymousOverride() const { return mRegionDenyAnonymousOverride; }
  340. LL_INLINE bool getRegionDenyAgeUnverifiedOverride() const
  341. {
  342. return mRegionDenyAgeUnverifiedOverride;
  343. }
  344. LL_INLINE bool getRegionAllowAccessOverride() const
  345. {
  346. return mRegionAllowAccessOverride;
  347. }
  348. LL_INLINE bool getRegionAllowEnvironmentOverride() const
  349. {
  350. return mRegionAllowEnvironmentOverride;
  351. }
  352. LL_INLINE S32 getParcelEnvironmentVersion() const
  353. {
  354. return mCurrentEnvironmentVersion;
  355. }
  356. LL_INLINE bool getAllowGroupAVSounds() const { return mAllowGroupAVSounds; }
  357. LL_INLINE bool getAllowAnyAVSounds() const { return mAllowAnyAVSounds; }
  358. LL_INLINE bool getObscureMOAP() const { return mObscureMOAP; }
  359. LL_INLINE S32 getSalePrice() const { return mSalePrice; }
  360. LL_INLINE time_t getClaimDate() const { return mClaimDate; }
  361. LL_INLINE S32 getClaimPricePerMeter() const { return mClaimPricePerMeter; }
  362. LL_INLINE S32 getRentPricePerMeter() const { return mRentPricePerMeter; }
  363. LL_INLINE S32 getArea() const { return mArea; }
  364. LL_INLINE S32 getClaimPrice() const { return mClaimPricePerMeter * mArea; }
  365. // Can this agent create objects here?
  366. bool allowModifyBy(const LLUUID& agent_id, const LLUUID& group_id) const;
  367. // Can this agent change the shape of the land?
  368. bool allowTerraformBy(const LLUUID& agent_id) const;
  369. bool operator==(const LLParcel& rhs) const;
  370. // Calculate rent - area * rent * discount rate
  371. S32 getTotalRent() const;
  372. F32 getAdjustedRentPerMeter() const;
  373. LL_INLINE const LLVector3& getAABBMin() const { return mAABBMin; }
  374. LL_INLINE const LLVector3& getAABBMax() const { return mAABBMax; }
  375. LLVector3 getCenterpoint() const;
  376. // Sim-wide
  377. LL_INLINE S32 getSimWideMaxPrimCapacity() const { return mSimWideMaxPrimCapacity; }
  378. LL_INLINE S32 getSimWidePrimCount() const { return mSimWidePrimCount; }
  379. // This parcel only (not sim-wide)
  380. // Does not include prim bonus
  381. LL_INLINE S32 getMaxPrimCapacity() const { return mMaxPrimCapacity; }
  382. LL_INLINE S32 getPrimCount() const
  383. {
  384. return mOwnerPrimCount + mGroupPrimCount + mOtherPrimCount +
  385. mSelectedPrimCount;
  386. }
  387. LL_INLINE S32 getOwnerPrimCount() const { return mOwnerPrimCount; }
  388. LL_INLINE S32 getGroupPrimCount() const { return mGroupPrimCount; }
  389. LL_INLINE S32 getOtherPrimCount() const { return mOtherPrimCount; }
  390. LL_INLINE S32 getSelectedPrimCount() const { return mSelectedPrimCount; }
  391. LL_INLINE S32 getTempPrimCount() const { return mTempPrimCount; }
  392. LL_INLINE F32 getParcelPrimBonus() const { return mParcelPrimBonus; }
  393. LL_INLINE S32 getCleanOtherTime() const { return mCleanOtherTime; }
  394. // Does not include prim bonus
  395. LL_INLINE void setMaxPrimCapacity(S32 max) { mMaxPrimCapacity = max; }
  396. // Sim-wide
  397. LL_INLINE void setSimWideMaxPrimCapacity(S32 c) { mSimWideMaxPrimCapacity = c; }
  398. LL_INLINE void setSimWidePrimCount(S32 c) { mSimWidePrimCount = c; }
  399. // This parcel only (not sim-wide)
  400. LL_INLINE void setOwnerPrimCount(S32 c) { mOwnerPrimCount = c; }
  401. LL_INLINE void setGroupPrimCount(S32 c) { mGroupPrimCount = c; }
  402. LL_INLINE void setOtherPrimCount(S32 c) { mOtherPrimCount = c; }
  403. LL_INLINE void setSelectedPrimCount(S32 c) { mSelectedPrimCount = c; }
  404. LL_INLINE void setTempPrimCount(S32 c) { mTempPrimCount = c; }
  405. LL_INLINE void setParcelPrimBonus(F32 b) { mParcelPrimBonus = b; }
  406. LL_INLINE void setCleanOtherTime(S32 time) { mCleanOtherTime = time; }
  407. LL_INLINE void setRegionPushOverride(bool b) { mRegionPushOverride = b; }
  408. LL_INLINE void setRegionDenyAnonymousOverride(bool b) { mRegionDenyAnonymousOverride = b; }
  409. LL_INLINE void setRegionDenyAgeUnverifiedOverride(bool b)
  410. {
  411. mRegionDenyAgeUnverifiedOverride = b;
  412. }
  413. LL_INLINE void setRegionAllowAccessOverride(bool b)
  414. {
  415. mRegionAllowAccessOverride = b;
  416. }
  417. LL_INLINE void setRegionAllowEnvironmentOverride(bool b)
  418. {
  419. mRegionAllowEnvironmentOverride = b;
  420. }
  421. LL_INLINE void setParcelEnvironmentVersion(S32 version)
  422. {
  423. mCurrentEnvironmentVersion = version;
  424. }
  425. // Accessors for parcel sellWithObjects
  426. LL_INLINE void setPreviousOwnerID(LLUUID id) { mPreviousOwnerID = id; }
  427. LL_INLINE void setPreviouslyGroupOwned(bool b) { mPreviouslyGroupOwned = b; }
  428. LL_INLINE void setSellWithObjects(bool b) { setParcelFlag(PF_SELL_PARCEL_OBJECTS, b); }
  429. LL_INLINE LLUUID getPreviousOwnerID() const { return mPreviousOwnerID; }
  430. LL_INLINE bool getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; }
  431. LL_INLINE bool getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) != 0; }
  432. public:
  433. S32 mLocalID;
  434. LLUUID mBanListTransactionID;
  435. LLUUID mAccessListTransactionID;
  436. access_map_t mAccessList;
  437. access_map_t mBanList;
  438. access_map_t mTempBanList;
  439. access_map_t mTempAccessList;
  440. protected:
  441. LLUUID mID;
  442. LLUUID mOwnerID;
  443. LLUUID mGroupID;
  444. LLUUID mPreviousOwnerID;
  445. LLUUID mAuthBuyerID;
  446. LLUUID mSnapshotID;
  447. LLVector3 mUserLocation;
  448. LLVector3 mUserLookAt;
  449. ELandingType mLandingType;
  450. std::string mName;
  451. std::string mDesc;
  452. std::string mMusicURL;
  453. std::string mMediaURL;
  454. std::string mMediaDesc;
  455. std::string mMediaType;
  456. typedef safe_hmap<LLUUID, U32> xp_type_map_t;
  457. xp_type_map_t mExperienceKeys;
  458. EOwnershipStatus mStatus;
  459. ECategory mCategory;
  460. S32 mGraceExtension;
  461. // This value is non-zero if there is an auction associated with
  462. // the parcel.
  463. U32 mAuctionID;
  464. time_t mClaimDate; // UTC Unix-format time
  465. S32 mClaimPricePerMeter; // meter squared
  466. S32 mRentPricePerMeter; // meter squared
  467. S32 mArea; // meter squared
  468. F32 mDiscountRate; // 0.0-1.0
  469. U32 mParcelFlags;
  470. S32 mSalePrice; // linden dollars
  471. S32 mMediaWidth;
  472. S32 mMediaHeight;
  473. U8 mMediaAllowNavigate;
  474. U8 mMediaPreventCameraZoom;
  475. LLUUID mMediaID;
  476. std::string mMediaCurrentURL;
  477. F32 mMediaURLTimeout;
  478. S32 mPassPrice;
  479. F32 mPassHours;
  480. LLVector3 mAABBMin;
  481. LLVector3 mAABBMax;
  482. // Prims allowed on parcel, does not include prim bonus:
  483. S32 mMaxPrimCapacity;
  484. S32 mSimWidePrimCount;
  485. S32 mSimWideMaxPrimCapacity;
  486. S32 mOwnerPrimCount;
  487. S32 mGroupPrimCount;
  488. S32 mOtherPrimCount;
  489. S32 mSelectedPrimCount;
  490. S32 mTempPrimCount;
  491. F32 mParcelPrimBonus;
  492. S32 mCleanOtherTime;
  493. S32 mCurrentEnvironmentVersion;
  494. bool mGroupOwned; // true if mOwnerID is a group_id
  495. bool mPreviouslyGroupOwned;
  496. // Avatars on this parcel are visible from outside it:
  497. bool mSeeAVs;
  498. // Remove once hidden AV feature is enabled in all OpenSim grids:
  499. bool mHaveNewParcelLimitData;
  500. bool mMediaAutoScale;
  501. bool mMediaLoop;
  502. bool mRegionPushOverride;
  503. bool mRegionDenyAnonymousOverride;
  504. bool mRegionDenyAgeUnverifiedOverride;
  505. bool mRegionAllowAccessOverride;
  506. bool mRegionAllowEnvironmentOverride;
  507. bool mIsDefaultDayCycle;
  508. bool mAllowGroupAVSounds;
  509. bool mAllowAnyAVSounds;
  510. bool mObscureMOAP;
  511. };
  512. const std::string& ownership_status_to_string(LLParcel::EOwnershipStatus status);
  513. LLParcel::EOwnershipStatus ownership_string_to_status(const std::string& s);
  514. LLParcel::ECategory category_string_to_category(const std::string& s);
  515. const std::string& category_to_string(LLParcel::ECategory category);
  516. #endif