PageRenderTime 30ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llinventory/llparcel.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 700 lines | 460 code | 120 blank | 120 comment | 0 complexity | 1a2ed75f0b368511c0ac855ccf56ed2f MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llparcel.h
  3. *
  4. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  5. * Second Life Viewer Source Code
  6. * Copyright (C) 2010, Linden Research, Inc.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation;
  11. * version 2.1 of the License only.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. *
  22. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  23. * $/LicenseInfo$
  24. */
  25. #ifndef LL_LLPARCEL_H
  26. #define LL_LLPARCEL_H
  27. #include <time.h>
  28. #include <iostream>
  29. #include "lluuid.h"
  30. #include "llparcelflags.h"
  31. #include "llpermissions.h"
  32. #include "lltimer.h"
  33. #include "v3math.h"
  34. // Grid out of which parcels taken is stepped every 4 meters.
  35. const F32 PARCEL_GRID_STEP_METERS = 4.f;
  36. // Area of one "square" of parcel
  37. const S32 PARCEL_UNIT_AREA = 16;
  38. // Height _above_ground_ that parcel boundary ends
  39. const F32 PARCEL_HEIGHT = 50.f;
  40. //Height above ground which parcel boundries exist for explicitly banned avatars
  41. const F32 BAN_HEIGHT = 768.f;
  42. // Maximum number of entries in an access list
  43. const S32 PARCEL_MAX_ACCESS_LIST = 300;
  44. //Maximum number of entires in an update packet
  45. //for access/ban lists.
  46. const F32 PARCEL_MAX_ENTRIES_PER_PACKET = 48.f;
  47. // Weekly charge for listing a parcel in the directory
  48. const S32 PARCEL_DIRECTORY_FEE = 30;
  49. const S32 PARCEL_PASS_PRICE_DEFAULT = 10;
  50. const F32 PARCEL_PASS_HOURS_DEFAULT = 1.f;
  51. // Number of "chunks" in which parcel overlay data is sent
  52. // Chunk 0 = southern rows, entire width
  53. const S32 PARCEL_OVERLAY_CHUNKS = 4;
  54. // Bottom three bits are a color index for the land overlay
  55. const U8 PARCEL_COLOR_MASK = 0x07;
  56. const U8 PARCEL_PUBLIC = 0x00;
  57. const U8 PARCEL_OWNED = 0x01;
  58. const U8 PARCEL_GROUP = 0x02;
  59. const U8 PARCEL_SELF = 0x03;
  60. const U8 PARCEL_FOR_SALE = 0x04;
  61. const U8 PARCEL_AUCTION = 0x05;
  62. // unused 0x06
  63. // unused 0x07
  64. // flag, unused 0x08
  65. const U8 PARCEL_HIDDENAVS = 0x10; // avatars not visible outside of parcel. Used for 'see avs' feature, but must be off for compatibility
  66. const U8 PARCEL_SOUND_LOCAL = 0x20;
  67. const U8 PARCEL_WEST_LINE = 0x40; // flag, property line on west edge
  68. const U8 PARCEL_SOUTH_LINE = 0x80; // flag, property line on south edge
  69. // Transmission results for parcel properties
  70. const S32 PARCEL_RESULT_NO_DATA = -1;
  71. const S32 PARCEL_RESULT_SUCCESS = 0; // got exactly one parcel
  72. const S32 PARCEL_RESULT_MULTIPLE = 1; // got multiple parcels
  73. const S32 SELECTED_PARCEL_SEQ_ID = -10000;
  74. const S32 COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID = -20000;
  75. const S32 COLLISION_BANNED_PARCEL_SEQ_ID = -30000;
  76. const S32 COLLISION_NOT_ON_LIST_PARCEL_SEQ_ID = -40000;
  77. const S32 HOVERED_PARCEL_SEQ_ID = -50000;
  78. const U32 RT_NONE = 0x1 << 0;
  79. const U32 RT_OWNER = 0x1 << 1;
  80. const U32 RT_GROUP = 0x1 << 2;
  81. const U32 RT_OTHER = 0x1 << 3;
  82. const U32 RT_LIST = 0x1 << 4;
  83. const U32 RT_SELL = 0x1 << 5;
  84. // Timeouts for parcels
  85. // default is 21 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 1814400000000
  86. const U64 DEFAULT_USEC_CONVERSION_TIMEOUT = U64L(1814400000000);
  87. // ***** TESTING is 10 minutes
  88. //const U64 DEFAULT_USEC_CONVERSION_TIMEOUT = U64L(600000000);
  89. // group is 60 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 5184000000000
  90. const U64 GROUP_USEC_CONVERSION_TIMEOUT = U64L(5184000000000);
  91. // ***** TESTING is 10 minutes
  92. //const U64 GROUP_USEC_CONVERSION_TIMEOUT = U64L(600000000);
  93. // default sale timeout is 2 days -> 172800000000
  94. const U64 DEFAULT_USEC_SALE_TIMEOUT = U64L(172800000000);
  95. // ***** TESTING is 10 minutes
  96. //const U64 DEFAULT_USEC_SALE_TIMEOUT = U64L(600000000);
  97. // more grace period extensions.
  98. const U64 SEVEN_DAYS_IN_USEC = U64L(604800000000);
  99. // if more than 100,000s before sale revert, and no extra extension
  100. // has been given, go ahead and extend it more. That's about 1.2 days.
  101. const S32 EXTEND_GRACE_IF_MORE_THAN_SEC = 100000;
  102. class LLMessageSystem;
  103. class LLSD;
  104. class LLAccessEntry
  105. {
  106. public:
  107. LLAccessEntry()
  108. : mID(),
  109. mTime(0),
  110. mFlags(0)
  111. {}
  112. LLUUID mID; // Agent ID
  113. S32 mTime; // Time (unix seconds) when entry expires
  114. U32 mFlags; // Not used - currently should always be zero
  115. };
  116. typedef std::map<LLUUID,LLAccessEntry>::iterator access_map_iterator;
  117. typedef std::map<LLUUID,LLAccessEntry>::const_iterator access_map_const_iterator;
  118. class LLParcel
  119. {
  120. public:
  121. enum EOwnershipStatus
  122. {
  123. OS_LEASED = 0,
  124. OS_LEASE_PENDING = 1,
  125. OS_ABANDONED = 2,
  126. OS_COUNT = 3,
  127. OS_NONE = -1
  128. };
  129. enum ECategory
  130. {
  131. C_NONE = 0,
  132. C_LINDEN,
  133. C_ADULT,
  134. C_ARTS, // "arts & culture"
  135. C_BUSINESS, // was "store"
  136. C_EDUCATIONAL,
  137. C_GAMING, // was "game"
  138. C_HANGOUT, // was "gathering place"
  139. C_NEWCOMER,
  140. C_PARK, // "parks & nature"
  141. C_RESIDENTIAL, // was "homestead"
  142. C_SHOPPING,
  143. C_STAGE,
  144. C_OTHER,
  145. C_RENTAL,
  146. C_COUNT,
  147. C_ANY = -1 // only useful in queries
  148. };
  149. enum EAction
  150. {
  151. A_CREATE = 0,
  152. A_RELEASE = 1,
  153. A_ABSORB = 2,
  154. A_ABSORBED = 3,
  155. A_DIVIDE = 4,
  156. A_DIVISION = 5,
  157. A_ACQUIRE = 6,
  158. A_RELINQUISH = 7,
  159. A_CONFIRM = 8,
  160. A_COUNT = 9,
  161. A_UNKNOWN = -1
  162. };
  163. enum ELandingType
  164. {
  165. L_NONE = 0,
  166. L_LANDING_POINT = 1,
  167. L_DIRECT = 2
  168. };
  169. // CREATORS
  170. LLParcel();
  171. LLParcel(
  172. const LLUUID &owner_id,
  173. BOOL modify,
  174. BOOL terraform,
  175. BOOL damage,
  176. time_t claim_date,
  177. S32 claim_price,
  178. S32 rent_price,
  179. S32 area,
  180. S32 sim_object_limit,
  181. F32 parcel_object_bonus,
  182. BOOL is_group_owned = FALSE);
  183. virtual ~LLParcel();
  184. void init(
  185. const LLUUID &owner_id,
  186. BOOL modify,
  187. BOOL terraform,
  188. BOOL damage,
  189. time_t claim_date,
  190. S32 claim_price,
  191. S32 rent_price,
  192. S32 area,
  193. S32 sim_object_limit,
  194. F32 parcel_object_bonus,
  195. BOOL is_group_owned = FALSE);
  196. // TODO: make an actual copy constructor for this
  197. void overrideParcelFlags(U32 flags);
  198. // if you specify an agent id here, the group id will be zeroed
  199. void overrideOwner(
  200. const LLUUID& owner_id,
  201. BOOL is_group_owned = FALSE);
  202. void overrideSaleTimerExpires(F32 secs_left) { mSaleTimerExpires.setTimerExpirySec(secs_left); }
  203. // MANIPULATORS
  204. void generateNewID() { mID.generate(); }
  205. void setName(const std::string& name);
  206. void setDesc(const std::string& desc);
  207. void setMusicURL(const std::string& url);
  208. void setMediaURL(const std::string& url);
  209. void setMediaType(const std::string& type);
  210. void setMediaDesc(const std::string& desc);
  211. void setMediaID(const LLUUID& id) { mMediaID = id; }
  212. void setMediaAutoScale ( U8 flagIn ) { mMediaAutoScale = flagIn; }
  213. void setMediaLoop (U8 loop) { mMediaLoop = loop; }
  214. void setMediaWidth(S32 width);
  215. void setMediaHeight(S32 height);
  216. void setMediaCurrentURL(const std::string& url);
  217. void setMediaURLFilterEnable(U8 enable) { mMediaURLFilterEnable = enable; }
  218. void setMediaURLFilterList(LLSD list);
  219. void setMediaAllowNavigate(U8 enable) { mMediaAllowNavigate = enable; }
  220. void setMediaURLTimeout(F32 timeout) { mMediaURLTimeout = timeout; }
  221. void setMediaPreventCameraZoom(U8 enable) { mMediaPreventCameraZoom = enable; }
  222. void setMediaURLResetTimer(F32 time);
  223. virtual void setLocalID(S32 local_id);
  224. // blow away all the extra stuff lurking in parcels, including urls, access lists, etc
  225. void clearParcel();
  226. // This value is not persisted out to the parcel file, it is only
  227. // a per-process blocker for attempts to purchase.
  228. void setInEscrow(bool in_escrow) { mInEscrow = in_escrow; }
  229. void setAuthorizedBuyerID(const LLUUID& id) { mAuthBuyerID = id; }
  230. //void overrideBuyerID(const LLUUID& id) { mBuyerID = id; }
  231. void setCategory(ECategory category) { mCategory = category; }
  232. void setSnapshotID(const LLUUID& id) { mSnapshotID = id; }
  233. void setUserLocation(const LLVector3& pos) { mUserLocation = pos; }
  234. void setUserLookAt(const LLVector3& rot) { mUserLookAt = rot; }
  235. void setLandingType(const ELandingType type) { mLandingType = type; }
  236. void setSeeAVs(BOOL see_avs) { mSeeAVs = see_avs; }
  237. void setHaveNewParcelLimitData(bool have_new_parcel_data) { mHaveNewParcelLimitData = have_new_parcel_data; } // Remove this once hidden AV feature is fully available grid-wide
  238. void setAuctionID(U32 auction_id) { mAuctionID = auction_id;}
  239. void setAllParcelFlags(U32 flags);
  240. void setParcelFlag(U32 flag, BOOL b);
  241. virtual void setArea(S32 area, S32 sim_object_limit);
  242. void setDiscountRate(F32 rate);
  243. void setAllowModify(BOOL b) { setParcelFlag(PF_CREATE_OBJECTS, b); }
  244. void setAllowGroupModify(BOOL b) { setParcelFlag(PF_CREATE_GROUP_OBJECTS, b); }
  245. void setAllowAllObjectEntry(BOOL b) { setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, b); }
  246. void setAllowGroupObjectEntry(BOOL b) { setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, b); }
  247. void setAllowTerraform(BOOL b){setParcelFlag(PF_ALLOW_TERRAFORM, b); }
  248. void setAllowDamage(BOOL b) { setParcelFlag(PF_ALLOW_DAMAGE, b); }
  249. void setAllowFly(BOOL b) { setParcelFlag(PF_ALLOW_FLY, b); }
  250. void setAllowLandmark(BOOL b){ setParcelFlag(PF_ALLOW_LANDMARK, b); }
  251. void setAllowGroupScripts(BOOL b) { setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, b); }
  252. void setAllowOtherScripts(BOOL b) { setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, b); }
  253. void setAllowDeedToGroup(BOOL b) { setParcelFlag(PF_ALLOW_DEED_TO_GROUP, b); }
  254. void setContributeWithDeed(BOOL b) { setParcelFlag(PF_CONTRIBUTE_WITH_DEED, b); }
  255. void setForSale(BOOL b) { setParcelFlag(PF_FOR_SALE, b); }
  256. void setSoundOnly(BOOL b) { setParcelFlag(PF_SOUND_LOCAL, b); }
  257. void setDenyAnonymous(BOOL b) { setParcelFlag(PF_DENY_ANONYMOUS, b); }
  258. void setDenyAgeUnverified(BOOL b) { setParcelFlag(PF_DENY_AGEUNVERIFIED, b); }
  259. void setRestrictPushObject(BOOL b) { setParcelFlag(PF_RESTRICT_PUSHOBJECT, b); }
  260. void setAllowGroupAVSounds(BOOL b) { mAllowGroupAVSounds = b; }
  261. void setAllowAnyAVSounds(BOOL b) { mAllowAnyAVSounds = b; }
  262. void setDrawDistance(F32 dist) { mDrawDistance = dist; }
  263. void setSalePrice(S32 price) { mSalePrice = price; }
  264. void setGroupID(const LLUUID& id) { mGroupID = id; }
  265. //void setGroupName(const std::string& s) { mGroupName.assign(s); }
  266. void setPassPrice(S32 price) { mPassPrice = price; }
  267. void setPassHours(F32 hours) { mPassHours = hours; }
  268. // BOOL importStream(std::istream& input_stream);
  269. BOOL importAccessEntry(std::istream& input_stream, LLAccessEntry* entry);
  270. BOOL importMediaURLFilter(std::istream& input_stream, std::string& url);
  271. // BOOL exportStream(std::ostream& output_stream);
  272. void packMessage(LLMessageSystem* msg);
  273. void packMessage(LLSD& msg);
  274. void unpackMessage(LLMessageSystem* msg);
  275. void packAccessEntries(LLMessageSystem* msg,
  276. const std::map<LLUUID,LLAccessEntry>& list);
  277. void unpackAccessEntries(LLMessageSystem* msg,
  278. std::map<LLUUID,LLAccessEntry>* list);
  279. void setAABBMin(const LLVector3& min) { mAABBMin = min; }
  280. void setAABBMax(const LLVector3& max) { mAABBMax = max; }
  281. // Extend AABB to include rectangle from min to max.
  282. void extendAABB(const LLVector3& box_min, const LLVector3& box_max);
  283. void dump();
  284. // Scans the pass list and removes any items with an expiration
  285. // time earlier than "now".
  286. void expirePasses(S32 now);
  287. // Add to list, suppressing duplicates. Returns TRUE if added.
  288. BOOL addToAccessList(const LLUUID& agent_id, S32 time);
  289. BOOL addToBanList(const LLUUID& agent_id, S32 time);
  290. BOOL removeFromAccessList(const LLUUID& agent_id);
  291. BOOL removeFromBanList(const LLUUID& agent_id);
  292. // ACCESSORS
  293. const LLUUID& getID() const { return mID; }
  294. const std::string& getName() const { return mName; }
  295. const std::string& getDesc() const { return mDesc; }
  296. const std::string& getMusicURL() const { return mMusicURL; }
  297. const std::string& getMediaURL() const { return mMediaURL; }
  298. const std::string& getMediaDesc() const { return mMediaDesc; }
  299. const std::string& getMediaType() const { return mMediaType; }
  300. const LLUUID& getMediaID() const { return mMediaID; }
  301. S32 getMediaWidth() const { return mMediaWidth; }
  302. S32 getMediaHeight() const { return mMediaHeight; }
  303. U8 getMediaAutoScale() const { return mMediaAutoScale; }
  304. U8 getMediaLoop() const { return mMediaLoop; }
  305. const std::string& getMediaCurrentURL() const { return mMediaCurrentURL; }
  306. U8 getMediaURLFilterEnable() const { return mMediaURLFilterEnable; }
  307. LLSD getMediaURLFilterList() const { return mMediaURLFilterList; }
  308. U8 getMediaAllowNavigate() const { return mMediaAllowNavigate; }
  309. F32 getMediaURLTimeout() const { return mMediaURLTimeout; }
  310. U8 getMediaPreventCameraZoom() const { return mMediaPreventCameraZoom; }
  311. S32 getLocalID() const { return mLocalID; }
  312. const LLUUID& getOwnerID() const { return mOwnerID; }
  313. const LLUUID& getGroupID() const { return mGroupID; }
  314. S32 getPassPrice() const { return mPassPrice; }
  315. F32 getPassHours() const { return mPassHours; }
  316. BOOL getIsGroupOwned() const { return mGroupOwned; }
  317. U32 getAuctionID() const { return mAuctionID; }
  318. bool isInEscrow() const { return mInEscrow; }
  319. BOOL isPublic() const;
  320. // Region-local user-specified position
  321. const LLVector3& getUserLocation() const { return mUserLocation; }
  322. const LLVector3& getUserLookAt() const { return mUserLookAt; }
  323. ELandingType getLandingType() const { return mLandingType; }
  324. BOOL getSeeAVs() const { return mSeeAVs; }
  325. BOOL getHaveNewParcelLimitData() const { return mHaveNewParcelLimitData; }
  326. // User-specified snapshot
  327. const LLUUID& getSnapshotID() const { return mSnapshotID; }
  328. // the authorized buyer id is the person who is the only
  329. // agent/group that has authority to purchase. (ie, ui specified a
  330. // particular agent could buy the plot).
  331. const LLUUID& getAuthorizedBuyerID() const { return mAuthBuyerID; }
  332. // helper function
  333. BOOL isBuyerAuthorized(const LLUUID& buyer_id) const;
  334. // The buyer of a plot is set when someone indicates they want to
  335. // buy the plot, and the system is simply waiting for tier-up
  336. // approval
  337. //const LLUUID& getBuyerID() const { return mBuyerID; }
  338. // functions to deal with ownership status.
  339. EOwnershipStatus getOwnershipStatus() const { return mStatus; }
  340. static const std::string& getOwnershipStatusString(EOwnershipStatus status);
  341. void setOwnershipStatus(EOwnershipStatus status) { mStatus = status; }
  342. // dealing with parcel category information
  343. ECategory getCategory() const {return mCategory; }
  344. static const std::string& getCategoryString(ECategory category);
  345. static const std::string& getCategoryUIString(ECategory category);
  346. static ECategory getCategoryFromString(const std::string& string);
  347. static ECategory getCategoryFromUIString(const std::string& string);
  348. // functions for parcel action (used for logging)
  349. static const std::string& getActionString(EAction action);
  350. // dealing with sales and parcel conversion.
  351. //
  352. // the isSaleTimerExpired will trivially return FALSE if there is
  353. // no sale going on. Pass in the current time in usec which will
  354. // be used for comparison.
  355. BOOL isSaleTimerExpired(const U64& time);
  356. F32 getSaleTimerExpires() { return mSaleTimerExpires.getRemainingTimeF32(); }
  357. // should the parcel join on complete?
  358. //U32 getJoinNeighbors() const { return mJoinNeighbors; }
  359. // need to record a few things with the parcel when a sale
  360. // starts.
  361. void startSale(const LLUUID& buyer_id, BOOL is_buyer_group);
  362. // do the expiration logic, which needs to return values usable in
  363. // a L$ transaction.
  364. void expireSale(U32& type, U8& flags, LLUUID& from_id, LLUUID& to_id);
  365. void completeSale(U32& type, U8& flags, LLUUID& to_id);
  366. void clearSale();
  367. BOOL isMediaResetTimerExpired(const U64& time);
  368. // more accessors
  369. U32 getParcelFlags() const { return mParcelFlags; }
  370. BOOL getParcelFlag(U32 flag) const
  371. { return (mParcelFlags & flag) ? TRUE : FALSE; }
  372. // objects can be added or modified by anyone (only parcel owner if disabled)
  373. BOOL getAllowModify() const
  374. { return (mParcelFlags & PF_CREATE_OBJECTS) ? TRUE : FALSE; }
  375. // objects can be added or modified by group members
  376. BOOL getAllowGroupModify() const
  377. { return (mParcelFlags & PF_CREATE_GROUP_OBJECTS) ? TRUE : FALSE; }
  378. // the parcel can be deeded to the group
  379. BOOL getAllowDeedToGroup() const
  380. { return (mParcelFlags & PF_ALLOW_DEED_TO_GROUP) ? TRUE : FALSE; }
  381. // Does the owner want to make a contribution along with the deed.
  382. BOOL getContributeWithDeed() const
  383. { return (mParcelFlags & PF_CONTRIBUTE_WITH_DEED) ? TRUE : FALSE; }
  384. // heightfield can be modified
  385. BOOL getAllowTerraform() const
  386. { return (mParcelFlags & PF_ALLOW_TERRAFORM) ? TRUE : FALSE; }
  387. // avatars can be hurt here
  388. BOOL getAllowDamage() const
  389. { return (mParcelFlags & PF_ALLOW_DAMAGE) ? TRUE : FALSE; }
  390. BOOL getAllowFly() const
  391. { return (mParcelFlags & PF_ALLOW_FLY) ? TRUE : FALSE; }
  392. // Remove permission restrictions for creating landmarks.
  393. // We should eventually remove this flag completely.
  394. BOOL getAllowLandmark() const
  395. { return TRUE; }
  396. BOOL getAllowGroupScripts() const
  397. { return (mParcelFlags & PF_ALLOW_GROUP_SCRIPTS) ? TRUE : FALSE; }
  398. BOOL getAllowOtherScripts() const
  399. { return (mParcelFlags & PF_ALLOW_OTHER_SCRIPTS) ? TRUE : FALSE; }
  400. BOOL getAllowAllObjectEntry() const
  401. { return (mParcelFlags & PF_ALLOW_ALL_OBJECT_ENTRY) ? TRUE : FALSE; }
  402. BOOL getAllowGroupObjectEntry() const
  403. { return (mParcelFlags & PF_ALLOW_GROUP_OBJECT_ENTRY) ? TRUE : FALSE; }
  404. BOOL getForSale() const
  405. { return (mParcelFlags & PF_FOR_SALE) ? TRUE : FALSE; }
  406. BOOL getSoundLocal() const
  407. { return (mParcelFlags & PF_SOUND_LOCAL) ? TRUE : FALSE; }
  408. BOOL getParcelFlagAllowVoice() const
  409. { return (mParcelFlags & PF_ALLOW_VOICE_CHAT) ? TRUE : FALSE; }
  410. BOOL getParcelFlagUseEstateVoiceChannel() const
  411. { return (mParcelFlags & PF_USE_ESTATE_VOICE_CHAN) ? TRUE : FALSE; }
  412. BOOL getAllowPublish() const
  413. { return (mParcelFlags & PF_ALLOW_PUBLISH) ? TRUE : FALSE; }
  414. BOOL getMaturePublish() const
  415. { return (mParcelFlags & PF_MATURE_PUBLISH) ? TRUE : FALSE; }
  416. BOOL getRestrictPushObject() const
  417. { return (mParcelFlags & PF_RESTRICT_PUSHOBJECT) ? TRUE : FALSE; }
  418. BOOL getRegionPushOverride() const
  419. { return mRegionPushOverride; }
  420. BOOL getRegionDenyAnonymousOverride() const
  421. { return mRegionDenyAnonymousOverride; }
  422. BOOL getRegionDenyAgeUnverifiedOverride() const
  423. { return mRegionDenyAgeUnverifiedOverride; }
  424. BOOL getAllowGroupAVSounds() const { return mAllowGroupAVSounds; }
  425. BOOL getAllowAnyAVSounds() const { return mAllowAnyAVSounds; }
  426. F32 getDrawDistance() const { return mDrawDistance; }
  427. S32 getSalePrice() const { return mSalePrice; }
  428. time_t getClaimDate() const { return mClaimDate; }
  429. S32 getClaimPricePerMeter() const { return mClaimPricePerMeter; }
  430. S32 getRentPricePerMeter() const { return mRentPricePerMeter; }
  431. // Area is NOT automatically calculated. You must calculate it
  432. // and store it with setArea.
  433. S32 getArea() const { return mArea; }
  434. // deprecated 12/11/2003
  435. //F32 getDiscountRate() const { return mDiscountRate; }
  436. S32 getClaimPrice() const { return mClaimPricePerMeter * mArea; }
  437. // Can this agent create objects here?
  438. BOOL allowModifyBy(const LLUUID &agent_id, const LLUUID &group_id) const;
  439. // Can this agent change the shape of the land?
  440. BOOL allowTerraformBy(const LLUUID &agent_id) const;
  441. // Returns 0 if access is OK, otherwise a BA_ return code above.
  442. S32 blockAccess(const LLUUID& agent_id,
  443. const LLUUID& group_id,
  444. const BOOL is_agent_identified,
  445. const BOOL is_agent_transacted,
  446. const BOOL is_agent_ageverified) const;
  447. // Only checks if the agent is explicitly banned from this parcel
  448. BOOL isAgentBanned(const LLUUID& agent_id) const;
  449. static bool isAgentBlockedFromParcel(LLParcel* parcelp,
  450. const LLUUID& agent_id,
  451. const uuid_vec_t& group_ids,
  452. const BOOL is_agent_identified,
  453. const BOOL is_agent_transacted,
  454. const BOOL is_agent_ageverified);
  455. bool operator==(const LLParcel &rhs) const;
  456. // Calculate rent - area * rent * discount rate
  457. S32 getTotalRent() const;
  458. F32 getAdjustedRentPerMeter() const;
  459. const LLVector3& getAABBMin() const { return mAABBMin; }
  460. const LLVector3& getAABBMax() const { return mAABBMax; }
  461. LLVector3 getCenterpoint() const;
  462. // simwide
  463. S32 getSimWideMaxPrimCapacity() const { return mSimWideMaxPrimCapacity; }
  464. S32 getSimWidePrimCount() const { return mSimWidePrimCount; }
  465. // this parcel only (not simwide)
  466. S32 getMaxPrimCapacity() const { return mMaxPrimCapacity; } // Does not include prim bonus
  467. S32 getPrimCount() const { return mOwnerPrimCount + mGroupPrimCount + mOtherPrimCount + mSelectedPrimCount; }
  468. S32 getOwnerPrimCount() const { return mOwnerPrimCount; }
  469. S32 getGroupPrimCount() const { return mGroupPrimCount; }
  470. S32 getOtherPrimCount() const { return mOtherPrimCount; }
  471. S32 getSelectedPrimCount() const{ return mSelectedPrimCount; }
  472. S32 getTempPrimCount() const { return mTempPrimCount; }
  473. F32 getParcelPrimBonus() const { return mParcelPrimBonus; }
  474. S32 getCleanOtherTime() const { return mCleanOtherTime; }
  475. void setMaxPrimCapacity(S32 max) { mMaxPrimCapacity = max; } // Does not include prim bonus
  476. // simwide
  477. void setSimWideMaxPrimCapacity(S32 current) { mSimWideMaxPrimCapacity = current; }
  478. void setSimWidePrimCount(S32 current) { mSimWidePrimCount = current; }
  479. // this parcel only (not simwide)
  480. void setOwnerPrimCount(S32 current) { mOwnerPrimCount = current; }
  481. void setGroupPrimCount(S32 current) { mGroupPrimCount = current; }
  482. void setOtherPrimCount(S32 current) { mOtherPrimCount = current; }
  483. void setSelectedPrimCount(S32 current) { mSelectedPrimCount = current; }
  484. void setTempPrimCount(S32 current) { mTempPrimCount = current; }
  485. void setParcelPrimBonus(F32 bonus) { mParcelPrimBonus = bonus; }
  486. void setCleanOtherTime(S32 time) { mCleanOtherTime = time; }
  487. void setRegionPushOverride(BOOL override) {mRegionPushOverride = override; }
  488. void setRegionDenyAnonymousOverride(BOOL override) { mRegionDenyAnonymousOverride = override; }
  489. void setRegionDenyAgeUnverifiedOverride(BOOL override) { mRegionDenyAgeUnverifiedOverride = override; }
  490. // Accessors for parcel sellWithObjects
  491. void setPreviousOwnerID(LLUUID prev_owner) { mPreviousOwnerID = prev_owner; }
  492. void setPreviouslyGroupOwned(BOOL b) { mPreviouslyGroupOwned = b; }
  493. void setSellWithObjects(BOOL b) { setParcelFlag(PF_SELL_PARCEL_OBJECTS, b); }
  494. LLUUID getPreviousOwnerID() const { return mPreviousOwnerID; }
  495. BOOL getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; }
  496. BOOL getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) ? TRUE : FALSE; }
  497. protected:
  498. LLUUID mID;
  499. LLUUID mOwnerID;
  500. LLUUID mGroupID;
  501. BOOL mGroupOwned; // TRUE if mOwnerID is a group_id
  502. LLUUID mPreviousOwnerID;
  503. BOOL mPreviouslyGroupOwned;
  504. EOwnershipStatus mStatus;
  505. ECategory mCategory;
  506. LLUUID mAuthBuyerID;
  507. LLUUID mSnapshotID;
  508. LLVector3 mUserLocation;
  509. LLVector3 mUserLookAt;
  510. ELandingType mLandingType;
  511. BOOL mSeeAVs; // Avatars on this parcel are visible from outside it
  512. BOOL mHaveNewParcelLimitData; // Remove once hidden AV feature is grid-wide
  513. LLTimer mSaleTimerExpires;
  514. LLTimer mMediaResetTimer;
  515. S32 mGraceExtension;
  516. // This value is non-zero if there is an auction associated with
  517. // the parcel.
  518. U32 mAuctionID;
  519. // value used to temporarily lock attempts to purchase the parcel.
  520. bool mInEscrow;
  521. time_t mClaimDate; // UTC Unix-format time
  522. S32 mClaimPricePerMeter; // meter squared
  523. S32 mRentPricePerMeter; // meter squared
  524. S32 mArea; // meter squared
  525. F32 mDiscountRate; // 0.0-1.0
  526. F32 mDrawDistance;
  527. U32 mParcelFlags;
  528. S32 mSalePrice; // linden dollars
  529. std::string mName;
  530. std::string mDesc;
  531. std::string mMusicURL;
  532. std::string mMediaURL;
  533. std::string mMediaDesc;
  534. std::string mMediaType;
  535. S32 mMediaWidth;
  536. S32 mMediaHeight;
  537. U8 mMediaAutoScale;
  538. U8 mMediaLoop;
  539. std::string mMediaCurrentURL;
  540. LLUUID mMediaID;
  541. U8 mMediaURLFilterEnable;
  542. LLSD mMediaURLFilterList;
  543. U8 mMediaAllowNavigate;
  544. U8 mMediaPreventCameraZoom;
  545. F32 mMediaURLTimeout;
  546. S32 mPassPrice;
  547. F32 mPassHours;
  548. LLVector3 mAABBMin;
  549. LLVector3 mAABBMax;
  550. S32 mMaxPrimCapacity; // Prims allowed on parcel, does not include prim bonus
  551. S32 mSimWidePrimCount;
  552. S32 mSimWideMaxPrimCapacity;
  553. //S32 mSimWidePrimCorrection;
  554. S32 mOwnerPrimCount;
  555. S32 mGroupPrimCount;
  556. S32 mOtherPrimCount;
  557. S32 mSelectedPrimCount;
  558. S32 mTempPrimCount;
  559. F32 mParcelPrimBonus;
  560. S32 mCleanOtherTime;
  561. BOOL mRegionPushOverride;
  562. BOOL mRegionDenyAnonymousOverride;
  563. BOOL mRegionDenyAgeUnverifiedOverride;
  564. BOOL mAllowGroupAVSounds;
  565. BOOL mAllowAnyAVSounds;
  566. public:
  567. // HACK, make private
  568. S32 mLocalID;
  569. LLUUID mBanListTransactionID;
  570. LLUUID mAccessListTransactionID;
  571. std::map<LLUUID,LLAccessEntry> mAccessList;
  572. std::map<LLUUID,LLAccessEntry> mBanList;
  573. std::map<LLUUID,LLAccessEntry> mTempBanList;
  574. std::map<LLUUID,LLAccessEntry> mTempAccessList;
  575. };
  576. const std::string& ownership_status_to_string(LLParcel::EOwnershipStatus status);
  577. LLParcel::EOwnershipStatus ownership_string_to_status(const std::string& s);
  578. LLParcel::ECategory category_string_to_category(const std::string& s);
  579. const std::string& category_to_string(LLParcel::ECategory category);
  580. #endif