Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - stefanpunt

Pages: [1]
1
Graphics / Re: Tank doesn't Shoot Multiple Bullets
« on: May 04, 2012, 09:50:35 pm »
You sir, are indeed a Hero Member.

Thanks :)

2
Graphics / Re: Tank doesn't Shoot Multiple Bullets
« on: May 04, 2012, 03:16:44 pm »
:(?

3
Graphics / Re: Tank doesn't Shoot Multiple Bullets
« on: May 02, 2012, 07:06:45 pm »
Hi,

I know this is not my topic, and that it's probably in the wrong board, but I have exactly the same problem.

My gameobjects are managed by the GameObjectManager. This is the update iteration:

Code: [Select]
void GameObjectManager::UpdateAll(float elapsedTime)
{
std::map<int, GameObject*>::const_iterator itr = gameObjects.begin();

while (itr != gameObjects.end())
{
itr->second->Update(elapsedTime);
itr++;
}
}

It calls the Update() method of Block:

Code: [Select]
void Block::Update(float elapedTime)
{
sf::Time time = clock.getElapsedTime();

if (time.asSeconds() >= 5.0f)
{
Game::GetGameObjectManager().Remove(id);
}
}

After 5 seconds, it is giving me the 'debug assertion failed map set iterators incompatible' error.

Remove() method:

Code: [Select]
void GameObjectManager::Remove(int id)
{
std::map<int, GameObject*>::iterator result = gameObjects.find(id);

if (result != gameObjects.end())
{
delete result->second;
gameObjects.erase(result);
}
}

I've noticed that there is nothing wrong with the Remove() method. When I make Block delete not his own 'id' but e.g. 'id + 1' it deletes that block without any problem. It seems like these objects just can't delete itself.

Any help would be appreciated :)!

Pages: [1]