Hi guys I'm having a problem in my Ogre problem. I'm not sure if this is the best place to ask this but I may as well. Here is the sample of the code I made in order to create a 2D array of enemies(for a space invaders game
for(int i = 0; i < 5; i++) //Manages the YPOS coordinate of the enemy
{
for(int j = 0; j < 5; j++) //Manages the YPOS coordinate of the enemy
{
stringstream ss;
ss << j;
std::string pos = ss.str();
ss.clear();
ss << i;
pos += "," + ss.str();
std::string enemyName = "Enemy " + pos;
Ogre::Entity * enemyEnt = mSceneMgr->createEntity(enemyName, "razor.mesh");
Ogre::SceneNode *node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode (enemyName+"ParentNode");
Ogre::SceneNode *node2 = node1->createChildSceneNode(enemyName+"Node");
enemyEnt->setMaterialName("Examples/Chrome");
mSceneMgr->getSceneNode(enemyName+"Node")->attachObject(ent);
int multiplier = 100;
if(j < 3)
{
multiplier *= -1;
}
if(j == 3)
{
multiplier = 0;
}
Vector3 initialPos;
initialPos.x = (j+1) * multiplier;
initialPos.y = 0;
initialPos.z = 3000 - ((i+1) * multiplier);
enemyVec.push_back(new Enemy(mSceneMgr,node2, initialPos, j, i, 200 ));
}
}
enem->setEnemies(enemyVec);
}
The following is there error I'm getting
Unhandled exception at 0x59a6ad4e (msvcp100d.dll) in C00146012 Project - 3D Space Invaders.exe: 0xC0000005: Access violation reading location 0xcccccd24.
When debugging it brings it to this segment of code in xutility
#if _ITERATOR_DEBUG_LEVEL == 2
if (_Myproxy != 0)
{ // proxy allocated, drain it
_Lockit _Lock(_LOCK_DEBUG);
for (_Iterator_base12 **_Pnext = &_Myproxy->_Myfirstiter; *_Pnext != 0; *_Pnext = (*_Pnext)->_Mynextiter)
(*_Pnext)->_Myproxy = 0;
_Myproxy->_Myfirstiter = 0;
}
#endif /* _ITERATOR_DEBUG_LEVEL == 2 */
However I know the error is in the line:
enem->setEnemies(enemyVec);
Any and all help would be greatly appreciated :)