diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llhudeffectpointat.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/linden/indra/newview/llhudeffectpointat.cpp b/linden/indra/newview/llhudeffectpointat.cpp index c47705b..97e3bd7 100644 --- a/linden/indra/newview/llhudeffectpointat.cpp +++ b/linden/indra/newview/llhudeffectpointat.cpp | |||
@@ -232,7 +232,11 @@ BOOL LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *ob | |||
232 | return FALSE; | 232 | return FALSE; |
233 | } | 233 | } |
234 | 234 | ||
235 | llassert(target_type < POINTAT_NUM_TARGETS); | 235 | if (target_type >= POINTAT_NUM_TARGETS) |
236 | { | ||
237 | llwarns << "Bad target_type " << (int)target_type << " - ignoring." << llendl; | ||
238 | return FALSE; | ||
239 | } | ||
236 | 240 | ||
237 | // must be same or higher priority than existing effect | 241 | // must be same or higher priority than existing effect |
238 | if (POINTAT_PRIORITIES[target_type] < POINTAT_PRIORITIES[mTargetType]) | 242 | if (POINTAT_PRIORITIES[target_type] < POINTAT_PRIORITIES[mTargetType]) |
@@ -379,17 +383,19 @@ void LLHUDEffectPointAt::update() | |||
379 | } | 383 | } |
380 | else | 384 | else |
381 | { | 385 | { |
382 | calcTargetPosition(); | 386 | if (calcTargetPosition()) |
383 | 387 | { | |
384 | ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->startMotion(ANIM_AGENT_EDITING); | 388 | ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->startMotion(ANIM_AGENT_EDITING); |
389 | } | ||
385 | } | 390 | } |
386 | } | 391 | } |
387 | } | 392 | } |
388 | 393 | ||
389 | //----------------------------------------------------------------------------- | 394 | //----------------------------------------------------------------------------- |
390 | // calcTargetPosition() | 395 | // calcTargetPosition() |
396 | // returns whether we successfully calculated a finite target position. | ||
391 | //----------------------------------------------------------------------------- | 397 | //----------------------------------------------------------------------------- |
392 | void LLHUDEffectPointAt::calcTargetPosition() | 398 | bool LLHUDEffectPointAt::calcTargetPosition() |
393 | { | 399 | { |
394 | LLViewerObject *targetObject = (LLViewerObject *)mTargetObject; | 400 | LLViewerObject *targetObject = (LLViewerObject *)mTargetObject; |
395 | LLVector3 local_offset; | 401 | LLVector3 local_offset; |
@@ -435,10 +441,15 @@ void LLHUDEffectPointAt::calcTargetPosition() | |||
435 | 441 | ||
436 | mTargetPos -= mSourceObject->getRenderPosition(); | 442 | mTargetPos -= mSourceObject->getRenderPosition(); |
437 | 443 | ||
444 | if (!mTargetPos.isFinite()) | ||
445 | return false; | ||
446 | |||
438 | if (mSourceObject->isAvatar()) | 447 | if (mSourceObject->isAvatar()) |
439 | { | 448 | { |
440 | ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->setAnimationData("PointAtPoint", (void *)&mTargetPos); | 449 | ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->setAnimationData("PointAtPoint", (void *)&mTargetPos); |
441 | } | 450 | } |
451 | |||
452 | return true; | ||
442 | } | 453 | } |
443 | 454 | ||
444 | const LLVector3d LLHUDEffectPointAt::getPointAtPosGlobal() | 455 | const LLVector3d LLHUDEffectPointAt::getPointAtPosGlobal() |