diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2016-01-13 07:31:16 -0500 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2016-01-13 07:31:16 -0500 |
commit | 23a4b0cc3ab09d58127a73b12c43aff37e5056ef (patch) | |
tree | 0e7d2f923311804c6a9e4270812174de45f2f7d2 /src/world.cpp | |
parent | 1574754cdaca14d68459cc520b63b6b3c449ecbd (diff) |
Fire Pit
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/src/world.cpp b/src/world.cpp index 451a022..e56720d 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -231,9 +231,12 @@ void World::deleteEntities(void){ entity.pop_back(); } while(!particles.empty()){ - delete particles.back(); + //delete particles.back(); particles.pop_back(); } + while(!light.empty()){ + light.pop_back(); + } } World::~World(void){ @@ -426,14 +429,13 @@ void World::update(Player *p,unsigned int delta){ uint oh = 0; for(auto &pa : particles){ if(pa->kill(deltaTime)){ - delete pa; + //delete pa; particles.erase(particles.begin()+oh); }else if(pa->canMove){ pa->loc.y += pa->vely * deltaTime; pa->loc.x += pa->velx * deltaTime; - for(auto &b : build){ - if(b->bsubtype==FOUNTAIN){ + if(b->bsubtype==FOUNTAIN && pa->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; @@ -442,8 +444,7 @@ void World::update(Player *p,unsigned int delta){ } } } - } - oh++; + }oh++; }oh=0; if(ui::dialogImportant){ @@ -1048,7 +1049,7 @@ LOOOOP: part->velx = 0; part->canMove = false; }else{ - if(part->vely > -2)part->vely-=.003 * deltaTime; + if(!part->gravity && part->vely > -2)part->vely-=.003 * deltaTime; } what++; }what=0; @@ -1067,21 +1068,12 @@ void World::addStructure(BUILD_SUB sub, float x,float y,World *inside){ entity.push_back(build.back()); } -void World::addVillage(int bCount, int npcMin, int npcMax,World *inside){ +void World::addVillage(int x, int y, int bCount, int npcMin, int npcMax,World *inside){ std::cout << npcMin << ", " << npcMax << std::endl; - //int xwasd; - for(int i = 0; i < bCount; i++){ - addStructure(HOUSE,x_start + (i * 300),100,inside); - /*std::cout<<"1\n"; - HERE: - xwasd = (rand()%(int)x+1000*HLINE); - for(auto &bu : build){ - if(xwasd > bu->loc.x && xwasd < bu->loc.x+bu->width)goto HERE; - } - std::cout<<"2\n"; - addStructure(t,HOUSE,xwasd,y,inside); - std::cout<<"3\n";*/ - } + this->addStructure(TOWN_HALL, x,y, inside); + bCount--; + this->addStructure(LAMP_POST, x-3*HLINE,y, this); + this->addStructure(LAMP_POST, x+53*HLINE,y, this); } void World::addMob(int t,float x,float y){ mob.push_back(new Mob(t)); |