Hi,
I have an STL list which holds references to a list of entities which are dynamic in my program. I am using an iterator to go through this list of items. I am trying to do the following which doesn't seem to be working
Code:
std::list<Entity *>::iterator itor = this->m_EntitiesList.begin();
while(itor != this->m_EntitiesList.end())
{
glPushMatrix();
if((*itor)->m_bIsPlayer)
{
vector3 view = m_pCamera->GetTarget();
(*itor)->SetPosition(view.x, 0.0f, view.y);
}
(*itor)->Render();
glPopMatrix();
++itor;
}
However when I call (*itor)->SetPosition it looks like instead of referencing its doing a copy so its not affecting the value at all. I suppose that its supposed to work that way. However I would like to know how to make the SetPosition to work.
Thanks