From a8f664c00ef959fa78c2a38f4aa3470d4748a189 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arvid=20Sj=C3=B6blom?= Date: Mon, 13 Nov 2023 11:26:18 +0100 Subject: [PATCH] Added removal of bottles, arvid, stina --- src/States.cc | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.30.2