diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llviewerparcelmgr.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llviewerparcelmgr.h | 346 |
1 files changed, 346 insertions, 0 deletions
diff --git a/linden/indra/newview/llviewerparcelmgr.h b/linden/indra/newview/llviewerparcelmgr.h new file mode 100644 index 0000000..781ba15 --- /dev/null +++ b/linden/indra/newview/llviewerparcelmgr.h | |||
@@ -0,0 +1,346 @@ | |||
1 | /** | ||
2 | * @file llviewerparcelmgr.h | ||
3 | * @brief Viewer-side representation of owned land | ||
4 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_LLVIEWERPARCELMGR_H | ||
29 | #define LL_LLVIEWERPARCELMGR_H | ||
30 | |||
31 | #include "v3dmath.h" | ||
32 | #include "lldarray.h" | ||
33 | #include "llframetimer.h" | ||
34 | #include "llmemory.h" | ||
35 | #include "llviewerimage.h" | ||
36 | |||
37 | class LLUUID; | ||
38 | class LLMessageSystem; | ||
39 | class LLParcel; | ||
40 | class LLViewerRegion; | ||
41 | |||
42 | // Constants for sendLandOwner | ||
43 | //const U32 NO_NEIGHBOR_JOIN = 0x0; | ||
44 | //const U32 ALL_NEIGHBOR_JOIN = U32( NORTH_MASK | ||
45 | // | SOUTH_MASK | ||
46 | // | EAST_MASK | ||
47 | // | WEST_MASK); | ||
48 | |||
49 | const F32 PARCEL_POST_HEIGHT = 0.666f; | ||
50 | //const F32 PARCEL_POST_HEIGHT = 20.f; | ||
51 | |||
52 | // Specify the type of land transfer taking place | ||
53 | //enum ELandTransferType | ||
54 | //{ | ||
55 | // LTT_RELEASE_LAND = 0x1, | ||
56 | // LTT_CLAIM_LAND = 0x2, | ||
57 | // LTT_BUY_LAND = 0x4, | ||
58 | // LTT_DEED_LAND = 0x8, | ||
59 | // LTT_FOR_GROUP = 0x16 | ||
60 | //}; | ||
61 | |||
62 | // Base class for people who want to "observe" changes in the viewer | ||
63 | // parcel selection. | ||
64 | class LLParcelObserver | ||
65 | { | ||
66 | public: | ||
67 | virtual ~LLParcelObserver() {}; | ||
68 | virtual void changed() = 0; | ||
69 | }; | ||
70 | |||
71 | class LLViewerParcelMgr | ||
72 | { | ||
73 | public: | ||
74 | LLViewerParcelMgr(); | ||
75 | ~LLViewerParcelMgr(); | ||
76 | |||
77 | void destroyGL(); | ||
78 | void restoreGL(); | ||
79 | |||
80 | BOOL selectionEmpty() const; | ||
81 | F32 getSelectionWidth() const { return F32(mEastNorth.mdV[VX] - mWestSouth.mdV[VX]); } | ||
82 | F32 getSelectionHeight() const { return F32(mEastNorth.mdV[VY] - mWestSouth.mdV[VY]); } | ||
83 | BOOL getSelection(LLVector3d &min, LLVector3d &max) { min = mWestSouth; max = mEastNorth; return !selectionEmpty();} | ||
84 | LLViewerRegion* getSelectionRegion(); | ||
85 | |||
86 | void getDisplayInfo(S32* area, S32* claim, S32* rent, BOOL* for_sale, F32* dwell); | ||
87 | |||
88 | void getPrimInfo(S32 &sw_max, S32 &sw_total, S32 &max, S32 &total, S32 &owner, S32 &group, S32 &other, S32& selected, F32 &parcel_object_bonus, S32 &other_clean); | ||
89 | |||
90 | // Does the selection have multiple land owners in it? | ||
91 | BOOL getMultipleOwners() const; | ||
92 | |||
93 | // Is the entire parcel selected, or just a part? | ||
94 | BOOL getWholeParcelSelected() const; | ||
95 | |||
96 | // Returns area that will actually be claimed in meters squared. | ||
97 | S32 getClaimableArea() const; | ||
98 | bool hasOthersSelected() const; | ||
99 | |||
100 | // Returns selected area | ||
101 | S32 getSelectedArea() const; | ||
102 | |||
103 | void resetSegments(U8* segments); | ||
104 | |||
105 | // write a rectangle's worth of line segments into the highlight array | ||
106 | void writeHighlightSegments(F32 west, F32 south, F32 east, F32 north); | ||
107 | |||
108 | // Write highlight segments from a packed bitmap of the appropriate | ||
109 | // parcel. | ||
110 | void writeSegmentsFromBitmap(U8* bitmap, U8* segments); | ||
111 | |||
112 | void writeAgentParcelFromBitmap(U8* bitmap); | ||
113 | |||
114 | // Select the collision parcel | ||
115 | void selectCollisionParcel(); | ||
116 | |||
117 | // Select the parcel at a specific point | ||
118 | void selectParcelAt(const LLVector3d& pos_global); | ||
119 | |||
120 | // Take the current rectangle select, and select the parcel contained | ||
121 | // within it. | ||
122 | void selectParcelInRectangle(); | ||
123 | |||
124 | // Select a piece of land | ||
125 | void selectLand(const LLVector3d &corner1, const LLVector3d &corner2, | ||
126 | BOOL snap_to_parcel); | ||
127 | |||
128 | // Clear the selection, and stop drawing the highlight. | ||
129 | void deselectLand(); | ||
130 | |||
131 | void addObserver(LLParcelObserver* observer); | ||
132 | void removeObserver(LLParcelObserver* observer); | ||
133 | void notifyObservers(); | ||
134 | |||
135 | void setSelectionVisible(BOOL visible) { mRenderSelection = visible; } | ||
136 | |||
137 | BOOL isOwnedAt(const LLVector3d& pos_global) const; | ||
138 | BOOL isOwnedSelfAt(const LLVector3d& pos_global) const; | ||
139 | BOOL isOwnedOtherAt(const LLVector3d& pos_global) const; | ||
140 | BOOL isSoundLocal(const LLVector3d &pos_global) const; | ||
141 | |||
142 | BOOL canHearSound(const LLVector3d &pos_global) const; | ||
143 | |||
144 | LLParcel *getSelectedParcel() const; | ||
145 | LLParcel *getAgentParcel() const; | ||
146 | |||
147 | BOOL inAgentParcel(const LLVector3d &pos_global) const; | ||
148 | |||
149 | // Return the number of grid units that are owned by you within | ||
150 | // the selection (computed by server). | ||
151 | S32 getSelfCount() const { return mSelectedSelfCount; } | ||
152 | |||
153 | // Returns a pointer only when it has valid data. | ||
154 | LLParcel* getHoverParcel() const; | ||
155 | |||
156 | LLParcel* getCollisionParcel() const; | ||
157 | |||
158 | BOOL agentCanTakeDamage() const; | ||
159 | BOOL agentCanFly() const; | ||
160 | F32 agentDrawDistance() const; | ||
161 | BOOL agentCanBuild() const; | ||
162 | |||
163 | F32 getHoverParcelWidth() const | ||
164 | { return F32(mHoverEastNorth.mdV[VX] - mHoverWestSouth.mdV[VX]); } | ||
165 | |||
166 | F32 getHoverParcelHeight() const | ||
167 | { return F32(mHoverEastNorth.mdV[VY] - mHoverWestSouth.mdV[VY]); } | ||
168 | |||
169 | // UTILITIES | ||
170 | void render(); | ||
171 | void renderParcelCollision(); | ||
172 | |||
173 | void renderRect( const LLVector3d &west_south_bottom, | ||
174 | const LLVector3d &east_north_top ); | ||
175 | void renderOneSegment(F32 x1, F32 y1, F32 x2, F32 y2, F32 height, U8 direction, LLViewerRegion* regionp); | ||
176 | void renderHighlightSegments(const U8* segments, LLViewerRegion* regionp); | ||
177 | void renderCollisionSegments(U8* segments, BOOL use_pass, LLViewerRegion* regionp); | ||
178 | |||
179 | void sendParcelGodForceOwner(const LLUUID& owner_id); | ||
180 | |||
181 | // make the selected parcel a content parcel. | ||
182 | void sendParcelGodForceToContent(); | ||
183 | |||
184 | // Take the selected parcel, and toggle it's 'reserved for newbie' | ||
185 | // status. | ||
186 | // *NOTE: There is no longer a newbie toggle. It is a linden sale | ||
187 | // for newbie now. | ||
188 | //void toggleParcelGodReserveForNewbie(); | ||
189 | |||
190 | // Pack information about this parcel and send it to the region | ||
191 | // containing the southwest corner of the selection. | ||
192 | // If want_reply_to_update, simulator will send back a ParcelProperties | ||
193 | // message. | ||
194 | void sendParcelPropertiesUpdate(LLParcel* parcel, BOOL want_reply_to_update); | ||
195 | |||
196 | // Takes an Access List flag, like AL_ACCESS or AL_BAN | ||
197 | void sendParcelAccessListUpdate(U32 which); | ||
198 | |||
199 | // Takes an Access List flag, like AL_ACCESS or AL_BAN | ||
200 | void sendParcelAccessListRequest(U32 flags); | ||
201 | |||
202 | // Dwell is not part of the usual parcel update information because the | ||
203 | // simulator doesn't actually know the per-parcel dwell. Ack! We have | ||
204 | // to get it out of the database. | ||
205 | void sendParcelDwellRequest(); | ||
206 | |||
207 | // If the point is outside the current hover parcel, request more data | ||
208 | void requestHoverParcelProperties(const LLVector3d& pos_global); | ||
209 | |||
210 | bool canAgentBuyParcel(LLParcel*, bool forGroup) const; | ||
211 | |||
212 | // void startClaimLand(BOOL is_for_group = FALSE); | ||
213 | void startBuyLand(BOOL is_for_group = FALSE); | ||
214 | void startSellLand(); | ||
215 | void startReleaseLand(); | ||
216 | void startDivideLand(); | ||
217 | void startJoinLand(); | ||
218 | void startDeedLandToGroup(); | ||
219 | void reclaimParcel(); | ||
220 | |||
221 | void buyPass(); | ||
222 | |||
223 | // Buying Land | ||
224 | |||
225 | class ParcelBuyInfo; | ||
226 | ParcelBuyInfo* setupParcelBuy(const LLUUID& agent_id, | ||
227 | const LLUUID& session_id, | ||
228 | const LLUUID& group_id, | ||
229 | BOOL is_group_owned, | ||
230 | BOOL is_claim, | ||
231 | BOOL remove_contribution); | ||
232 | // callers responsibility to call deleteParcelBuy() on return value | ||
233 | void sendParcelBuy(ParcelBuyInfo*); | ||
234 | void deleteParcelBuy(ParcelBuyInfo*&); | ||
235 | |||
236 | void sendParcelDeed(const LLUUID& group_id); | ||
237 | |||
238 | // Send the ParcelRelease message | ||
239 | void sendParcelRelease(); | ||
240 | |||
241 | // accessors for mAgentParcel | ||
242 | const char *getAgentParcelName() const; | ||
243 | |||
244 | // Create a landmark at the "appropriate" location for the | ||
245 | // currently selected parcel. | ||
246 | // *NOTE: Taken out 2005-03-21. Phoenix. | ||
247 | //void makeLandmarkAtSelection(); | ||
248 | |||
249 | static void processParcelOverlay(LLMessageSystem *msg, void **user_data); | ||
250 | static void processParcelProperties(LLMessageSystem *msg, void **user_data); | ||
251 | static void processParcelAccessListReply(LLMessageSystem *msg, void **user); | ||
252 | static void processParcelDwellReply(LLMessageSystem *msg, void **user); | ||
253 | |||
254 | void dump(); | ||
255 | |||
256 | // Whether or not the collision border around the parcel is there because | ||
257 | // the agent is banned or not in the allowed group | ||
258 | BOOL isCollisionBanned(); | ||
259 | |||
260 | static BOOL isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_proxy_power); | ||
261 | static BOOL isParcelModifiableByAgent(const LLParcel* parcelp, U64 group_proxy_power); | ||
262 | |||
263 | protected: | ||
264 | static void releaseAlertCB(S32 option, void *data); | ||
265 | |||
266 | // If the user is claiming land and the current selection | ||
267 | // borders a piece of land the user already owns, ask if he | ||
268 | // wants to join this land to the other piece. | ||
269 | //void askJoinIfNecessary(ELandTransferType land_transfer_type); | ||
270 | //static void joinAlertCB(S32 option, void* data); | ||
271 | |||
272 | //void buyAskMoney(ELandTransferType land_transfer_type); | ||
273 | |||
274 | // move land from current owner to it's group. | ||
275 | void deedLandToGroup(); | ||
276 | |||
277 | static void claimAlertCB(S32 option, void* data); | ||
278 | static void buyAlertCB(S32 option, void* data); | ||
279 | static void deedAlertCB(S32 option, void*); | ||
280 | |||
281 | static void callbackDivideLand(S32 option, void* data); | ||
282 | static void callbackJoinLand(S32 option, void* data); | ||
283 | |||
284 | //void finishClaim(BOOL user_to_user_sale, U32 join); | ||
285 | |||
286 | private: | ||
287 | BOOL mSelected; | ||
288 | BOOL mSelectedMultipleOwners; | ||
289 | BOOL mWholeParcelSelected; | ||
290 | S32 mSelectedSelfCount; | ||
291 | S32 mSelectedOtherCount; | ||
292 | S32 mSelectedPublicCount; | ||
293 | |||
294 | LLParcel *mParcel; // selected parcel info | ||
295 | S32 mRequestResult; // result of last parcel request | ||
296 | LLVector3d mWestSouth; | ||
297 | LLVector3d mEastNorth; | ||
298 | F32 mSelectedDwell; | ||
299 | |||
300 | LLParcel *mAgentParcel; // info for parcel agent is in | ||
301 | S32 mAgentParcelSequenceID; // incrementing counter to suppress out of order updates | ||
302 | |||
303 | LLParcel* mHoverParcel; | ||
304 | S32 mHoverRequestResult; | ||
305 | LLVector3d mHoverWestSouth; | ||
306 | LLVector3d mHoverEastNorth; | ||
307 | |||
308 | LLDynamicArray<LLParcelObserver*> mObservers; | ||
309 | |||
310 | // Array of pieces of parcel edges to potentially draw | ||
311 | // Has (parcels_per_edge + 1) * (parcels_per_edge + 1) elements so | ||
312 | // we can represent edges of the grid. | ||
313 | // WEST_MASK = draw west edge | ||
314 | // SOUTH_MASK = draw south edge | ||
315 | S32 mParcelsPerEdge; | ||
316 | U8* mHighlightSegments; | ||
317 | U8* mAgentParcelOverlay; | ||
318 | |||
319 | // Raw data buffer for unpacking parcel overlay chunks | ||
320 | // Size = parcels_per_edge * parcels_per_edge / parcel_overlay_chunks | ||
321 | static U8* sPackedOverlay; | ||
322 | |||
323 | // Watch for pending collisions with a parcel you can't access. | ||
324 | // If it's coming, draw the parcel's boundaries. | ||
325 | LLParcel* mCollisionParcel; | ||
326 | U8* mCollisionSegments; | ||
327 | BOOL mRenderCollision; | ||
328 | BOOL mRenderSelection; | ||
329 | S32 mCollisionBanned; | ||
330 | LLFrameTimer mCollisionTimer; | ||
331 | LLUUID mBlockedImageID; | ||
332 | LLUUID mPassImageID; | ||
333 | LLPointer<LLViewerImage> mBlockedImage; | ||
334 | LLPointer<LLViewerImage> mPassImage; | ||
335 | |||
336 | // Media | ||
337 | S32 mMediaParcelId; | ||
338 | U64 mMediaRegionId; | ||
339 | }; | ||
340 | |||
341 | extern LLViewerParcelMgr *gParcelMgr; | ||
342 | |||
343 | void sanitize_corners(const LLVector3d &corner1, const LLVector3d &corner2, | ||
344 | LLVector3d &west_south_bottom, LLVector3d &east_north_top); | ||
345 | |||
346 | #endif | ||