diff options
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/world.cpp b/src/world.cpp index dec9a64..b1eb12e 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -218,7 +218,6 @@ World:: Mix_FreeMusic(bgmObj); delete bgTex; - deleteEntities(); } @@ -772,22 +771,21 @@ singleDetect( Entity *e ) if ( e->loc.y < worldData[i].groundHeight ) { - if ( worldData[i].groundHeight - e->loc.y > 30 ) { - int dir = e->vel.x > 0 ? -1 : 1; - e->loc.x += HLINE * 8 * dir; - e->loc.y = worldData[i + 8 * dir].groundHeight; - } else { - e->loc.y = worldData[i].groundHeight - .001 * deltaTime; - e->ground = true; - e->vel.y = 0; - } + if ( worldData[i].groundHeight - e->loc.y > 30 ) { + int dir = e->vel.x > 0 ? -1 : 1; + e->loc.x += HLINE * 8 * dir; + e->loc.y = worldData[i + 8 * dir].groundHeight; + } else { + e->loc.y = worldData[i].groundHeight - .001 * deltaTime; + e->ground = true; + e->vel.y = 0; + } /* * Handle gravity if the entity is above the line. */ - } else { - + }else{ if(e->type == STRUCTURET && e->loc.y > 2000){ e->loc.y = worldData[i].groundHeight; e->vel.y = 0; @@ -988,6 +986,7 @@ setToRight( std::string file ) return (toRight = file); } +//what is this clyne why are they differnet World *World:: goWorldLeft( Player *p ) { @@ -1134,9 +1133,11 @@ void World::save(void){ } data.append("dOnE\0"); + std::cout << "Writing to the file" << std::endl; out.write(data.c_str(),data.size()); out.close(); + std::cout << "Done saving" << std::endl; } void World::load(void){ @@ -1506,8 +1507,6 @@ loadWorldFromXMLNoSave( std::string path ) { tmp->addMerchant(0,100); if(vil->FirstChildElement("buy")){ std::cout << "Buy" << std::endl; - //Trade goodMeme(1,"Dank MayMay",1,"Sword"); - //tmp->merchant.back()->trade.push_back(Trade()); }if(vil->FirstChildElement("sell")){ std::cout << "Sell" << std::endl; }if(vil->FirstChildElement("trade")){ @@ -1516,7 +1515,9 @@ loadWorldFromXMLNoSave( std::string path ) { vil->FirstChildElement("trade")->Attribute("item"), vil->FirstChildElement("trade")->IntAttribute("quantity1"), vil->FirstChildElement("trade")->Attribute("item1"))); + tmp->merchant.back()->trade.push_back(Trade(1,"Wood Sword", 420, "Dank MayMay")); } + std::cout << "new trade" << std::endl; strcpy(tmp->merchant.back()->name,"meme"); }else if(!strcmp(vil->Attribute("type"),"trader")){ |