Rename cmpPosition's IsFloating to CanFloat.

Reviewed By: fatherbushido
Differential Revision: https://code.wildfiregames.com/D916
This was SVN commit r20201.
This commit is contained in:
leper 2017-09-18 09:54:54 +00:00
parent b49ca424c7
commit 1c47c5ad44
7 changed files with 11 additions and 11 deletions

View File

@ -467,7 +467,7 @@ public:
AdvertiseInterpolatedPositionChanges();
}
virtual bool IsFloating() const
virtual bool CanFloat() const
{
return m_Floating;
}

View File

@ -1771,7 +1771,7 @@ void CCmpUnitMotion::RenderPath(const WaypointPath& path, std::vector<SOverlayLi
bool floating = false;
CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle());
if (cmpPosition)
floating = cmpPosition->IsFloating();
floating = cmpPosition->CanFloat();
lines.clear();
std::vector<float> waypointCoords;

View File

@ -35,7 +35,7 @@ DEFINE_INTERFACE_METHOD_1("SetHeightFixed", void, ICmpPosition, SetHeightFixed,
DEFINE_INTERFACE_METHOD_CONST_0("GetHeightFixed", entity_pos_t, ICmpPosition, GetHeightFixed)
DEFINE_INTERFACE_METHOD_CONST_0("IsHeightRelative", bool, ICmpPosition, IsHeightRelative)
DEFINE_INTERFACE_METHOD_1("SetHeightRelative", void, ICmpPosition, SetHeightRelative, bool)
DEFINE_INTERFACE_METHOD_CONST_0("IsFloating", bool, ICmpPosition, IsFloating)
DEFINE_INTERFACE_METHOD_CONST_0("CanFloat", bool, ICmpPosition, CanFloat)
DEFINE_INTERFACE_METHOD_1("SetFloating", void, ICmpPosition, SetFloating, bool)
DEFINE_INTERFACE_METHOD_1("SetConstructionProgress", void, ICmpPosition, SetConstructionProgress, fixed)
DEFINE_INTERFACE_METHOD_CONST_0("GetPosition", CFixedVector3D, ICmpPosition, GetPosition)

View File

@ -137,9 +137,9 @@ public:
virtual void SetHeightRelative(bool flag) = 0;
/**
* Returns whether the entity floats on water.
* Returns whether the entity can float on water.
*/
virtual bool IsFloating() const = 0;
virtual bool CanFloat() const = 0;
/**
* Set the entity to float on water

View File

@ -149,7 +149,7 @@ public:
// Move into the world, the fixed height uses the water level minus the float depth as a base
cmp->JumpTo(entity_pos_t::FromInt(0), entity_pos_t::FromInt(0));
TS_ASSERT(cmp->IsInWorld());
TS_ASSERT(cmp->IsFloating());
TS_ASSERT(cmp->CanFloat());
TS_ASSERT_EQUALS(cmp->GetHeightOffset(), entity_pos_t::FromInt(23));
TS_ASSERT_EQUALS(cmp->GetHeightFixed(), entity_pos_t::FromInt(122));
@ -173,7 +173,7 @@ public:
// The entity can't float anymore, the fixed height is computed from the terrain base
cmp->SetFloating(false);
TS_ASSERT(!cmp->IsFloating());
TS_ASSERT(!cmp->CanFloat());
TS_ASSERT_EQUALS(cmp->GetHeightFixed(), entity_pos_t::FromInt(73));
TS_ASSERT_EQUALS(cmp->GetHeightOffset(), entity_pos_t::FromInt(23));
TS_ASSERT_EQUALS(cmp->GetPosition(), fixedvec(100, 73, 200));
@ -201,7 +201,7 @@ public:
// The entity can't float anymore and height is not relative, fixed height doesn't change
cmp->SetFloating(false);
TS_ASSERT(!cmp->IsFloating());
TS_ASSERT(!cmp->CanFloat());
TS_ASSERT_EQUALS(cmp->GetHeightFixed(), entity_pos_t::FromInt(122));
TS_ASSERT_EQUALS(cmp->GetHeightOffset(), entity_pos_t::FromInt(72));
TS_ASSERT_EQUALS(cmp->GetPosition(), fixedvec(100, 122, 200));

View File

@ -54,7 +54,7 @@ public:
virtual entity_pos_t GetHeightFixed() const { return entity_pos_t::Zero(); }
virtual bool IsHeightRelative() const { return true; }
virtual void SetHeightRelative(bool UNUSED(relative)) { }
virtual bool IsFloating() const { return false; }
virtual bool CanFloat() const { return false; }
virtual void SetFloating(bool UNUSED(flag)) { }
virtual void SetActorFloating(bool UNUSED(flag)) { }
virtual void SetConstructionProgress(fixed UNUSED(progress)) { }

View File

@ -535,7 +535,7 @@ MESSAGEHANDLER(ObjectPreview)
CmpPtr<ICmpPosition> cmpPosition(*g_Game->GetSimulation2(), g_PreviewEntityID);
if (cmpPosition)
{
CVector3D pos = GetUnitPos(msg->pos, cmpPosition->IsFloating());
CVector3D pos = GetUnitPos(msg->pos, cmpPosition->CanFloat());
cmpPosition->JumpTo(entity_pos_t::FromFloat(pos.X), entity_pos_t::FromFloat(pos.Z));
float angle;
@ -730,7 +730,7 @@ BEGIN_COMMAND(MoveObjects)
CmpPtr<ICmpPosition> cmpPosition(*g_Game->GetSimulation2(), (entity_id_t)msg->pivot);
if (cmpPosition && cmpPosition->IsInWorld())
{
pivotFloating = cmpPosition->IsFloating();
pivotFloating = cmpPosition->CanFloat();
CFixedVector3D pivotFixed = cmpPosition->GetPosition();
pivotPos = CVector3D(pivotFixed.X.ToFloat(), pivotFixed.Y.ToFloat(), pivotFixed.Z.ToFloat());
}