Sign in to follow this  
jchmack

queue not removing objects with pop [solved]

Recommended Posts

i have a queue of pointers to projectile objects: queue<Projectile*> InactiveProjectiles; and i want to remove an object after it has been reactivated. this works the way i would like:

projectile *temp;

if(!InactiveProjectiles.empty())
{
        
	temp = InactiveProjectiles.front();
	//temp->Reactivate(mScene,GunNode,Target,Target2);
	InactiveProjectiles.pop();
}




but the instant i uncomment that reactivate line the pop doesnt seem to work (the queue doesn't get any shorter)... for now all reactivate() is:
void Projectile::Reactivate(scene *_mScene,SceneNode* GunNode,Vector3 Target,Vector3 Target2)
{
	Active=true;
}




what is going on....... why is it that if i change one thing in this object i can't pop it from my queue? [Edited by - jchmack on March 11, 2007 4:45:46 AM]

Share this post


Link to post
Share on other sites
even if i change the order of things:


if(!InactiveProjectiles.empty())
{

temp = InactiveProjectiles.front();
InactiveProjectiles.pop();
temp->Reactivate(mScene,GunNode,Target,Target2);

}



it doesn't pop even before i call reactivate... can i not pop an object if i change its data or something? and even if i couldn't shouldnt popping it before i change its data fix the problem? Im not even changing the pointer itself just the stuff thats being pointed too. Sigh im really confused by this.

Share this post


Link to post
Share on other sites
bah was being dumb it was changing active back to false and re adding it to the queue because it was over a certain age.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this