Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpObstruction.cpp
Show First 20 Lines • Show All 238 Lines • ▼ Show 20 Lines | virtual void Init(const CParamNode& paramNode) | ||||
{ | { | ||||
m_Type = CLUSTER; | m_Type = CLUSTER; | ||||
CFixedVector2D max = CFixedVector2D(fixed::FromInt(0), fixed::FromInt(0)); | CFixedVector2D max = CFixedVector2D(fixed::FromInt(0), fixed::FromInt(0)); | ||||
CFixedVector2D min = CFixedVector2D(fixed::FromInt(0), fixed::FromInt(0)); | CFixedVector2D min = CFixedVector2D(fixed::FromInt(0), fixed::FromInt(0)); | ||||
const CParamNode::ChildrenMap& clusterMap = paramNode.GetChild("Obstructions").GetChildren(); | const CParamNode::ChildrenMap& clusterMap = paramNode.GetChild("Obstructions").GetChildren(); | ||||
for(CParamNode::ChildrenMap::const_iterator it = clusterMap.begin(); it != clusterMap.end(); ++it) | for(CParamNode::ChildrenMap::const_iterator it = clusterMap.begin(); it != clusterMap.end(); ++it) | ||||
{ | { | ||||
Shape b; | Shape b; | ||||
b.size0 = it->second.GetChild("@width").ToFixed(); | b.size0 = it->GetChild("@width").ToFixed(); | ||||
b.size1 = it->second.GetChild("@depth").ToFixed(); | b.size1 = it->GetChild("@depth").ToFixed(); | ||||
ENSURE(b.size0 > minObstruction); | ENSURE(b.size0 > minObstruction); | ||||
ENSURE(b.size1 > minObstruction); | ENSURE(b.size1 > minObstruction); | ||||
b.dx = it->second.GetChild("@x").ToFixed(); | b.dx = it->GetChild("@x").ToFixed(); | ||||
b.dz = it->second.GetChild("@z").ToFixed(); | b.dz = it->GetChild("@z").ToFixed(); | ||||
b.da = entity_angle_t::FromInt(0); | b.da = entity_angle_t::FromInt(0); | ||||
b.flags = m_Flags; | b.flags = m_Flags; | ||||
m_Shapes.push_back(b); | m_Shapes.push_back(b); | ||||
max.X = std::max(max.X, b.dx + b.size0/2); | max.X = std::max(max.X, b.dx + b.size0/2); | ||||
max.Y = std::max(max.Y, b.dz + b.size1/2); | max.Y = std::max(max.Y, b.dz + b.size1/2); | ||||
min.X = std::min(min.X, b.dx - b.size0/2); | min.X = std::min(min.X, b.dx - b.size0/2); | ||||
min.Y = std::min(min.Y, b.dz - b.size1/2); | min.Y = std::min(min.Y, b.dz - b.size1/2); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 601 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator