Jump to content
  • Advertisement
Sign in to follow this  
jchmack

queue not removing objects with pop [solved]

This topic is 4122 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!