aboutsummaryrefslogtreecommitdiffstats
path: root/src/world.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/world.cpp')
-rw-r--r--src/world.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/world.cpp b/src/world.cpp
index 19e9fbc..3d7027d 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -421,28 +421,27 @@ void World::update(Player *p,unsigned int delta){
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);
@@ -1214,13 +1213,13 @@ World *World::goInsideStructure(Player *p){
}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;
}
}
}