I have a city node which houses many building nodes, each of these I wish to grant a new child-node. which tells the house what role and sign they have/role. Which can later be used for other functions. for now all get the same .mesh (will later make a sign) to identify which house is what. it shall be randomly assigned. If I try to run this I get the following error. I am very new to ogre , which adds to some weird code
int CityManager::assignBuildingRole(Ogre::SceneNode * _cityNode, int _numberOfBuildings)
{
std::stringstream nodename("buildingRoleNode");
Ogre::SceneNode::ChildNodeIterator cNode = _cityNode->getChildIterator();
std::vector <Ogre::SceneNode*> detachable;
while (cNode.hasMoreElements()) {
detachable.push_back((Ogre::SceneNode *)cNode.getNext());
}
for (int i = 0; i < detachable.size(); i++) {
nodename << childIteration << "_" << parentIteration << "_" << i;
switch (rand() % 5) // assign building random proffessions by giving them a rolenode
{
case 0:
_roleNode = ( Ogre::SceneNode *)cNode.getNext()->createChild(nodename.str());
_signEntity = manager->createEntity("Barrel.mesh");
_roleNode->attachObject(_signEntity);
break;
case 1:
_roleNode = (Ogre::SceneNode *)cNode.getNext()->createChild(nodename.str());
_signEntity = manager->createEntity("Barrel.mesh");
_roleNode->attachObject(_signEntity);
break;
case 2:
_roleNode = (Ogre::SceneNode *)cNode.getNext()->createChild(nodename.str());
_signEntity = manager->createEntity("Barrel.mesh");
_roleNode->attachObject(_signEntity);
break;
case 3:
_roleNode = (Ogre::SceneNode *)cNode.getNext()->createChild(nodename.str());
_signEntity = manager->createEntity("Barrel.mesh");
_roleNode->attachObject(_signEntity);
break;
case 4:
_roleNode = (Ogre::SceneNode *)cNode.getNext()->createChild(nodename.str());
_signEntity = manager->createEntity("Barrel.mesh");
_roleNode->attachObject(_signEntity);
break;
default:
break;
}
}
return role;
}