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