Switch access to SystemBody::m_children to IterationProxy interface.
parent
11a6f9597f
commit
4536a4889a
|
@ -227,7 +227,7 @@ void Space::AddSystemBodyToIndex(SystemBody *sbody)
|
|||
assert(sbody);
|
||||
m_sbodyIndex.push_back(sbody);
|
||||
for (Uint32 i = 0; i < sbody->GetNumChildren(); i++)
|
||||
AddSystemBodyToIndex(sbody->GetChild(i));
|
||||
AddSystemBodyToIndex(sbody->GetChildren()[i]);
|
||||
}
|
||||
|
||||
void Space::RebuildFrameIndex()
|
||||
|
@ -662,8 +662,8 @@ void Space::GenBody(double at_time, SystemBody *sbody, Frame *f)
|
|||
}
|
||||
f = MakeFrameFor(at_time, sbody, b, f);
|
||||
|
||||
for (auto i = sbody->ChildrenBegin(); i != sbody->ChildrenEnd(); ++i) {
|
||||
GenBody(at_time, *i, f);
|
||||
for (SystemBody* kid : sbody->GetChildren()) {
|
||||
GenBody(at_time, kid, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,9 +125,9 @@ void SystemInfoView::OnBodyViewed(SystemBody *b)
|
|||
}
|
||||
int numSurfaceStarports = 0;
|
||||
std::string nameList;
|
||||
for (auto i = b->ChildrenBegin(); i != b->ChildrenEnd(); ++i) {
|
||||
if ((*i)->GetType() == SystemBody::TYPE_STARPORT_SURFACE) {
|
||||
nameList += (numSurfaceStarports ? ", " : "") + (*i)->GetName();
|
||||
for (const SystemBody* kid : b->GetChildren()) {
|
||||
if (kid->GetType() == SystemBody::TYPE_STARPORT_SURFACE) {
|
||||
nameList += (numSurfaceStarports ? ", " : "") + kid->GetName();
|
||||
numSurfaceStarports++;
|
||||
}
|
||||
}
|
||||
|
@ -226,8 +226,8 @@ void SystemInfoView::PutBodies(SystemBody *body, Gui::Fixed *container, int dir,
|
|||
if (body->GetType() != SystemBody::TYPE_GRAVPOINT) {
|
||||
BodyIcon *ib = new BodyIcon(body->GetIcon(), m_renderer);
|
||||
if (body->GetSuperType() == SystemBody::SUPERTYPE_ROCKY_PLANET) {
|
||||
for (auto i = body->ChildrenBegin(); i != body->ChildrenEnd(); ++i) {
|
||||
if ((*i)->GetType() == SystemBody::TYPE_STARPORT_SURFACE) {
|
||||
for (const SystemBody* kid : body->GetChildren()) {
|
||||
if (kid->GetType() == SystemBody::TYPE_STARPORT_SURFACE) {
|
||||
ib->SetHasStarport();
|
||||
break;
|
||||
}
|
||||
|
@ -254,8 +254,8 @@ void SystemInfoView::PutBodies(SystemBody *body, Gui::Fixed *container, int dir,
|
|||
}
|
||||
|
||||
float prevSizeForKids = size[!dir];
|
||||
for (auto i = body->ChildrenBegin(); i != body->ChildrenEnd(); ++i) {
|
||||
PutBodies(*i, container, dir, myPos, majorBodies, starports, onSurface, prevSizeForKids);
|
||||
for (SystemBody* kid : body->GetChildren()) {
|
||||
PutBodies(kid, container, dir, myPos, majorBodies, starports, onSurface, prevSizeForKids);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -249,18 +249,18 @@ void SystemView::PutBody(const SystemBody *b, const vector3d &offset, const matr
|
|||
PutSelectionBox(offset + playerOrbit.OrbitalPosAtTime(m_time - t0)* double(m_zoom), Color::RED);
|
||||
}
|
||||
|
||||
if (b->GetNumChildren() > 0) {
|
||||
for(auto kid = b->ChildrenBegin(); kid != b->ChildrenEnd(); ++kid) {
|
||||
if (is_zero_general((*kid)->GetOrbit().GetSemiMajorAxis())) continue;
|
||||
if ((*kid)->GetOrbit().GetSemiMajorAxis() * m_zoom < ROUGH_SIZE_OF_TURD) {
|
||||
PutOrbit(&((*kid)->GetOrbit()), offset, Color(0, 255, 0, 255));
|
||||
if (b->HasChildren()) {
|
||||
for(const SystemBody* kid : b->GetChildren()) {
|
||||
if (is_zero_general(kid->GetOrbit().GetSemiMajorAxis())) continue;
|
||||
if (kid->GetOrbit().GetSemiMajorAxis() * m_zoom < ROUGH_SIZE_OF_TURD) {
|
||||
PutOrbit(&(kid->GetOrbit()), offset, Color(0, 255, 0, 255));
|
||||
}
|
||||
|
||||
// not using current time yet
|
||||
vector3d pos = (*kid)->GetOrbit().OrbitalPosAtTime(m_time);
|
||||
vector3d pos = kid->GetOrbit().OrbitalPosAtTime(m_time);
|
||||
pos *= double(m_zoom);
|
||||
|
||||
PutBody(*kid, offset + pos, trans);
|
||||
PutBody(kid, offset + pos, trans);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,14 +107,10 @@ public:
|
|||
const SystemPath& GetPath() const { return m_path; }
|
||||
SystemBody* GetParent() const { return m_parent; }
|
||||
|
||||
bool HasChildren() const { return !m_children.empty(); }
|
||||
unsigned GetNumChildren() const { return m_children.size(); }
|
||||
SystemBody* GetChild(unsigned i) { return m_children[i]; } // XXX Or should we better use m_children.at(i)?
|
||||
typedef std::vector<SystemBody*>::const_iterator ConstChildrenIterator;
|
||||
typedef std::vector<SystemBody*>::iterator ChildrenIterator;
|
||||
ConstChildrenIterator ChildrenBegin() const { return m_children.cbegin(); }
|
||||
ConstChildrenIterator ChildrenEnd() const { return m_children.cend(); }
|
||||
ChildrenIterator ChildrenBegin() { return m_children.begin(); }
|
||||
ChildrenIterator ChildrenEnd() { return m_children.end(); }
|
||||
IterationProxy<std::vector<SystemBody*> > GetChildren() { return MakeIterationProxy(m_children); }
|
||||
const IterationProxy<const std::vector<SystemBody*> > GetChildren() const { return MakeIterationProxy(m_children); }
|
||||
|
||||
std::string GetName() const { return m_name; }
|
||||
std::string GetAstroDescription() const;
|
||||
|
|
Loading…
Reference in New Issue