if(!strcmp(l.name,wxml->Attribute("outside"))){
for(auto &b : l.ptr->build){
if(*b->inside == earth.back()){
- ((IndoorWorld *)*b->inside)->outside = l.ptr;
+ ((IndoorWorld *)*b->inside)->outside = &l.ptr;
}
}
break;
else if(e->vel.x > 0)e->left = false;
}
}
- uint oh = 0;
- for(auto &pa : particles){
- if(pa->kill(deltaTime)){
- delete pa;
- particles.erase(particles.begin()+oh);
- }else if(pa->canMove){
- pa->loc.y += pa->vely * deltaTime;
- pa->loc.x += pa->velx * deltaTime;
+
+ for(unsigned int i=0;i<particles.size();i++){
+ if(particles[i]->kill(deltaTime)){
+ delete particles[i];
+ particles.erase(particles.begin()+i);
+ }else if(particles[i]->canMove){
+ particles[i]->loc.y += particles[i]->vely * deltaTime;
+ particles[i]->loc.x += particles[i]->velx * deltaTime;
for(auto &b : build){
if(b->bsubtype==FOUNTAIN){
- if(pa->loc.x >= b->loc.x && pa->loc.x <= b->loc.x+b->width){
- if(pa->loc.y <= b->loc.y + b->height*.25){
- delete pa;
- particles.erase(particles.begin()+oh);
+ if(particles[i]->loc.x >= b->loc.x && particles[i]->loc.x <= b->loc.x + b->width){
+ if(particles[i]->loc.y <= b->loc.y + b->height * .25){
+ delete particles[i];
+ particles.erase(particles.begin()+i);
}
}
}
}
}
- oh++;
- }oh=0;
+ }
if(ui::dialogImportant){
Mix_FadeOutMusic(2000);
}else{
for(auto &b : ((World *)thing.back())->build){
if(*b->inside == this){
- //World *tmp = (World *)thing.back();
+ World *tmp = (World *)thing.back();
p->loc.x = b->loc.x + (b->width / 2) - (p->width / 2);
thing.erase(thing.end()-1);
ui::toggleBlackFast();
ui::waitForCover();
ui::toggleBlackFast();
- return ((IndoorWorld *)(*b->inside))->outside;
+ return tmp;
}
}
}