Changeset 110 for trunk/src/game/Unit.cpp
- Timestamp:
- 11/19/08 13:36:54 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Unit.cpp
r102 r110 3447 3447 { 3448 3448 return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI - arc, target ); 3449 } 3450 3451 bool Unit::isInLine(Unit const* target, float distance) const 3452 { 3453 if(!HasInArc(M_PI, target) || !IsWithinDistInMap(target, distance)) return false; 3454 float width = (GetObjectSize() / 2 + target->GetObjectSize()) / 2; 3455 float angle = GetAngle(target); 3456 angle -= GetOrientation(); 3457 return abs(sin(angle)) * distance < width; 3449 3458 } 3450 3459