开发者

incompatible vector iterator

I'm getting a "incompatible vector iterator" error to what i believe is a invalid iterator

void Bomb::CreateExplosion(Game_Manager* EGame_Manager)
{
for(irr::f32 iteration = 0; iteration < BlastRadius; iteration++) //up direction blast
{
   ***//PROGRAM CRASHES AT THIS LINE-->*** for(EGame_Manager->getEntityManager()->GetEntityIterator() = EGame_Manager->getEntityManager()->GetEntityList().begin(); EGame_Manager->getEntityManager()->GetEntityIterator() != EGame_Manager->getEntityManager()->GetEntityList().end(); ++EGame_Manager->getEntityManager()->GetEntityIterator())
    {
        if(CheckForCollision(UpExplosion->getTransformedBoundingBox(), (*EGame_Manager->getEntityManager()->GetEntityIterator())->GetEntityNode()->getTransformedBoundingBox()) == true)//check for collision against the unbreakable blocks (entity.type equals 0)
        {
            if((*EGame_Manager->getEntityManager()->GetEntityIterator())->GetType() == unbreakableblock)
            {
                break;
            }
            else if((*EGame_Manager->getEntityManager()->GetEntityIterator())->GetType() == gameplayer)
            {
                (*EGame_Manager->getEntityManager()->GetEntityIterator())->SetLives(this->GetLives() -1);
                break;
            }
            else if((*EGame_Manager->getEntityManager()->GetEntityIterator())->GetType() == gameitem)
            {
                break;
            }
        }
        else
        {
            UpExplosion->setScale(irr::core::vector3df(1,1,iteration)); //standard width of UpExplosion, iterated height of the UpExplosion
        }
    }
}

CreateExplosion is called by Bomb::UpdateEntity() which is called by EntityManager::UpdateList() which then loops through the vector<*Entity> List calling each Entity's respective Update function.

This function adds the Entities to the vector I'm not sure if it causes the problem

EntityManager::AddEntity(Entity* addtoList)
{
    List.push_back(addtolist);
    addtolist->GetEntityNode()->setID(List.size())开发者_如何学JAVA;
    EntityIterator = List.begin();
}

Also the instance of the Bomb class that calls these functions is declared in the Player class if that helps with anything. And I can post more code if needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜