diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llurldispatcher.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llurldispatcher.cpp')
-rw-r--r-- | linden/indra/newview/llurldispatcher.cpp | 65 |
1 files changed, 59 insertions, 6 deletions
diff --git a/linden/indra/newview/llurldispatcher.cpp b/linden/indra/newview/llurldispatcher.cpp index 6c1514c..658cf39 100644 --- a/linden/indra/newview/llurldispatcher.cpp +++ b/linden/indra/newview/llurldispatcher.cpp | |||
@@ -89,6 +89,11 @@ private: | |||
89 | 89 | ||
90 | static void regionHandleCallback(U64 handle, const std::string& url, | 90 | static void regionHandleCallback(U64 handle, const std::string& url, |
91 | const LLUUID& snapshot_id, bool teleport); | 91 | const LLUUID& snapshot_id, bool teleport); |
92 | // Called by LLWorldMap when a location has been resolved to a | ||
93 | // region name | ||
94 | |||
95 | static void regionNameCallback(U64 handle, const std::string& url, | ||
96 | const LLUUID& snapshot_id, bool teleport); | ||
92 | // Called by LLWorldMap when a region name has been resolved to a | 97 | // Called by LLWorldMap when a region name has been resolved to a |
93 | // location in-world, used by places-panel display. | 98 | // location in-world, used by places-panel display. |
94 | 99 | ||
@@ -219,15 +224,15 @@ bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, BOOL right_mous | |||
219 | url_displayp->setName(region_name); | 224 | url_displayp->setName(region_name); |
220 | 225 | ||
221 | // Request a region handle by name | 226 | // Request a region handle by name |
222 | gWorldMap->sendNamedRegionRequest(region_name, | 227 | LLWorldMap::getInstance()->sendNamedRegionRequest(region_name, |
223 | LLURLDispatcherImpl::regionHandleCallback, | 228 | LLURLDispatcherImpl::regionNameCallback, |
224 | url, | 229 | url, |
225 | false); // don't teleport | 230 | false); // don't teleport |
226 | return true; | 231 | return true; |
227 | } | 232 | } |
228 | 233 | ||
229 | /*static*/ | 234 | /*static*/ |
230 | void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport) | 235 | void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport) |
231 | { | 236 | { |
232 | std::string sim_string = stripProtocol(url); | 237 | std::string sim_string = stripProtocol(url); |
233 | std::string region_name; | 238 | std::string region_name; |
@@ -241,6 +246,54 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::str | |||
241 | local_pos.mV[VY] = (F32)y; | 246 | local_pos.mV[VY] = (F32)y; |
242 | local_pos.mV[VZ] = (F32)z; | 247 | local_pos.mV[VZ] = (F32)z; |
243 | 248 | ||
249 | |||
250 | // determine whether the point is in this region | ||
251 | if ((x >= 0) && (x < REGION_WIDTH_UNITS) && | ||
252 | (y >= 0) && (y < REGION_WIDTH_UNITS)) | ||
253 | { | ||
254 | // if so, we're done | ||
255 | regionHandleCallback(region_handle, url, snapshot_id, teleport); | ||
256 | } | ||
257 | |||
258 | else | ||
259 | { | ||
260 | // otherwise find the new region from the location | ||
261 | |||
262 | // add the position to get the new region | ||
263 | LLVector3d global_pos = from_region_handle(region_handle) + LLVector3d(local_pos); | ||
264 | |||
265 | U64 new_region_handle = to_region_handle(global_pos); | ||
266 | LLWorldMap::getInstance()->sendHandleRegionRequest(new_region_handle, | ||
267 | LLURLDispatcherImpl::regionHandleCallback, | ||
268 | url, teleport); | ||
269 | } | ||
270 | } | ||
271 | |||
272 | /* static */ | ||
273 | void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport) | ||
274 | { | ||
275 | std::string sim_string = stripProtocol(url); | ||
276 | std::string region_name; | ||
277 | S32 x = 128; | ||
278 | S32 y = 128; | ||
279 | S32 z = 0; | ||
280 | LLURLSimString::parse(sim_string, ®ion_name, &x, &y, &z); | ||
281 | |||
282 | // remap x and y to local coordinates | ||
283 | S32 local_x = x % REGION_WIDTH_UNITS; | ||
284 | S32 local_y = y % REGION_WIDTH_UNITS; | ||
285 | if (local_x < 0) | ||
286 | local_x += REGION_WIDTH_UNITS; | ||
287 | if (local_y < 0) | ||
288 | local_y += REGION_WIDTH_UNITS; | ||
289 | |||
290 | LLVector3 local_pos; | ||
291 | local_pos.mV[VX] = (F32)local_x; | ||
292 | local_pos.mV[VY] = (F32)local_y; | ||
293 | local_pos.mV[VZ] = (F32)z; | ||
294 | |||
295 | |||
296 | |||
244 | if (teleport) | 297 | if (teleport) |
245 | { | 298 | { |
246 | LLVector3d global_pos = from_region_handle(region_handle); | 299 | LLVector3d global_pos = from_region_handle(region_handle); |
@@ -322,7 +375,7 @@ public: | |||
322 | { | 375 | { |
323 | url += tokens[i].asString() + "/"; | 376 | url += tokens[i].asString() + "/"; |
324 | } | 377 | } |
325 | gWorldMap->sendNamedRegionRequest(region_name, | 378 | LLWorldMap::getInstance()->sendNamedRegionRequest(region_name, |
326 | LLURLDispatcherImpl::regionHandleCallback, | 379 | LLURLDispatcherImpl::regionHandleCallback, |
327 | url, | 380 | url, |
328 | true); // teleport | 381 | true); // teleport |