From 599425c0380630197005c9ecc86604396d612f81 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 12 Jan 2016 08:49:12 -0500 Subject: inside? --- src/world.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src/world.cpp') diff --git a/src/world.cpp b/src/world.cpp index 451a022..19e9fbc 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -185,8 +185,6 @@ void World::load(std::ifstream *i){ } } -void *NULLPTR = NULL; - World::World(void){ bgm = NULL; @@ -1057,21 +1055,28 @@ LOOOOP: goto LOOOOP; } } -void World::addStructure(BUILD_SUB sub, float x,float y,World *inside){ +void World::addStructure(BUILD_SUB sub, float x,float y,World **inside){//,World **outside){ build.push_back(new Structures()); build.back()->spawn(sub,x,y,this); build.back()->inWorld=this; - build.back()->inside = (World *)inside; - ((IndoorWorld *)inside)->outside = this; + build.back()->inside = inside; + //std::cout<<"yo"<outside = outside; + + + //std::cout<<"yo"<loc.x > b->loc.x && - p->loc.x + p->width < b->loc.x + b->width ){ + p->loc.x + p->width < b->loc.x + b->width && + *b->inside != this ){ thing.push_back(this); ui::toggleBlackFast(); ui::waitForCover(); ui::toggleBlackFast(); - return (World *)b->inside; + return (World *)*b->inside; } } }else{ for(auto &b : ((World *)thing.back())->build){ - if(b->inside == this){ - World *tmp = (World *)thing.back(); + if(*b->inside == this){ + //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 tmp; + return ((IndoorWorld *)(*b->inside))->outside; } } } -- cgit v1.2.3