Don't send PositionChanged messages in TurnTo when not actually turning

FaceTowardsTarget is called quite often by UnitAI, and we can skip some
un-necessary messages as an optimisation.

Differential Revision: https://code.wildfiregames.com/D5005
This was SVN commit r27695.
This commit is contained in:
wraitii 2023-06-14 07:23:05 +00:00
parent 44611294de
commit 080599442f

View File

@ -556,6 +556,10 @@ public:
if (cmpPosition)
y -= cmpPosition->GetRotation().Y;
}
// Don't send messages if we don't actually rotate.
if ((y - m_RotY).Absolute() <= fixed::Epsilon())
return;
m_RotY = y;
AdvertisePositionChanges();