MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / hasLineToUnit

Method hasLineToUnit

game/state/battle/battleunit.cpp:989–1001  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

987}
988
989bool BattleUnit::hasLineToUnit(const sp<BattleUnit> unit, bool useLOS) const
990{
991 auto muzzleLocation = getMuzzleLocation();
992 auto targetPosition = unit->tileObject->getVoxelCentrePosition();
993 if (unit->isLarge())
994 {
995 // Offset search for large units as they can get caught up in ground
996 // that is supposed to allow units to go through it but blocks LOS
997 auto targetvVectorDelta = glm::normalize(targetPosition - muzzleLocation) * 0.75f;
998 targetPosition -= targetvVectorDelta;
999 }
1000 return hasLineToPosition(targetPosition, useLOS);
1001}
1002
1003bool BattleUnit::hasLineToPosition(Vec3<float> targetPosition, bool useLOS) const
1004{

Callers 2

thinkMethod · 0.80
orderFireMethod · 0.80

Calls 2

isLargeMethod · 0.80

Tested by

no test coverage detected