From: Arvid Sjöblom Date: Mon, 13 Nov 2023 10:26:18 +0000 (+0100) Subject: Added removal of bottles, arvid, stina X-Git-Url: https://gitweb.forssennils.se/?a=commitdiff_plain;h=a8f664c00ef959fa78c2a38f4aa3470d4748a189;p=TDDC76_proj.git Added removal of bottles, arvid, stina --- diff --git a/src/States.cc b/src/States.cc index 659d4b7..217c459 100644 --- a/src/States.cc +++ b/src/States.cc @@ -25,6 +25,10 @@ void Game_state::update(Context& context) std::cout << std::fixed << std::setprecision(3) << time_since_last_bottle << std::endl; if (time_since_last_bottle >= 2) { + if (bottles.size() > 10) + { + bottles.erase(bottles.begin()); + } Bottle* bottle = new Bottle {}; bottles.push_back(bottle); std::cout << "placed bottle"<< std::endl;