From bf7d1d29029ca0afa4369bf95b8bd67c73fd5c45 Mon Sep 17 00:00:00 2001
From: Clyne Sullivan <tullivan99@gmail.com>
Date: Wed, 13 Jan 2016 07:55:06 -0500
Subject: fixed particles / indoors

---
 src/world.cpp | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

(limited to 'src/world.cpp')

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;
 			}
 		}
 	}
-- 
cgit v1.2.3