Fix issues with motionManager / bae258f9a1

Fixes bae258f9a1.

As reported by Freagarach, garrisoned units trigger error messages.
As reported by Vladislavbelov, noPCH was broken & there were some style
issues.


Differential Revision: https://code.wildfiregames.com/D3707
This was SVN commit r25078.
This commit is contained in:
wraitii
2021-03-18 16:40:34 +00:00
parent dc18d94030
commit 961ac314ad
4 changed files with 24 additions and 12 deletions
@@ -17,6 +17,7 @@
#include "precompiled.h"
#include "simulation2/system/Component.h"
#include "ICmpUnitMotionManager.h"
#include "simulation2/MessageTypes.h"
@@ -28,14 +29,6 @@
class CCmpUnitMotionManager : public ICmpUnitMotionManager
{
protected:
EntityMap<MotionState> m_Units;
EntityMap<MotionState> m_FormationControllers;
// Temporary vector, reconstructed each turn (stored here to avoid memory reallocations).
std::vector<EntityMap<MotionState>::iterator> m_MovingUnits;
bool m_ComputingMotion;
public:
static void ClassInit(CComponentManager& componentManager)
{
@@ -47,6 +40,19 @@ public:
DEFAULT_COMPONENT_ALLOCATOR(UnitMotionManager)
EntityMap<MotionState> m_Units;
EntityMap<MotionState> m_FormationControllers;
// Temporary vector, reconstructed each turn (stored here to avoid memory reallocations).
std::vector<EntityMap<MotionState>::iterator> m_MovingUnits;
bool m_ComputingMotion;
static std::string GetSchema()
{
return "<a:component type='system'/><empty/>";
}
virtual void Init(const CParamNode& UNUSED(paramNode))
{
m_MovingUnits.reserve(40);
@@ -76,7 +82,7 @@ public:
}
case MT_Update_MotionFormation:
{
fixed dt = static_cast<const CMessageUpdate_MotionFormation&> (msg).turnLength;
fixed dt = static_cast<const CMessageUpdate_MotionFormation&>(msg).turnLength;
m_ComputingMotion = true;
MoveFormations(dt);
m_ComputingMotion = false;
@@ -84,7 +90,7 @@ public:
}
case MT_Update_MotionUnit:
{
fixed dt = static_cast<const CMessageUpdate_MotionUnit&> (msg).turnLength;
fixed dt = static_cast<const CMessageUpdate_MotionUnit&>(msg).turnLength;
m_ComputingMotion = true;
MoveUnits(dt);
m_ComputingMotion = false;