i'm using the core::list and have a litte problem with the pointers. i have 2 classes the first one is a planet and the second one is a planetlist.
here is the CPlanetList.h:
Code: Select all
class CPlanetList
{
private:
core::list<CPlanet> pList;
core::list<CPlanet>::Iterator it;
public:
CPlanetList()
{
it = pList.begin();
}
void FrameControl()
{
for(it = pList.begin(); it != pList.end(); ++it)
it->Orbit();
}
void AddPlanet(CPlanet &planet)
{
pList.push_back(planet);
}
};
Code: Select all
//PlanetList
CPlanetList Planets;
//Planets
CPlanet MySun;
MySun.Init(smgr, 0, 8, core::vector3df(0,0,0));
...
CPlanet MyPlanet;
MyPlanet.Init(smgr, 1, 5, core::vector3df(30,0,30));
...
Planets.AddPlanet(MySun);
Planets.AddPlanet(MyPlanet);
does anyone know how to solve this? i want it to be the same object in the list as i created before in main()?
thanks