1

無効な反復子であると思われるものに対して「互換性のないベクトル反復子」エラーが発生します

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 は Bomb::UpdateEntity() によって呼び出され、これは EntityManager::UpdateList() によって呼び出され、次に vector<*Entity> List をループして、各エンティティのそれぞれの Update 関数を呼び出します。

この関数はエンティティをベクトルに追加します。問題が発生するかどうかはわかりません

EntityManager::AddEntity(Entity* addtoList)
{
    List.push_back(addtolist);
    addtolist->GetEntityNode()->setID(List.size());
    EntityIterator = List.begin();
}

また、これらの関数を呼び出す Bomb クラスのインスタンスは、何かに役立つ場合は Player クラスで宣言されます。また、必要に応じてさらにコードを投稿できます。

4

0 に答える 0