Added removal of bottles, arvid, stina
authorArvid Sjöblom <arvsj277@student.liu.se>
Mon, 13 Nov 2023 10:26:18 +0000 (11:26 +0100)
committerArvid Sjöblom <arvsj277@student.liu.se>
Mon, 13 Nov 2023 10:26:18 +0000 (11:26 +0100)
src/States.cc

index 659d4b79412702ad2fa9aae4f57712069d64e4e5..217c45913793adaf25f13db14e82f1074e990f3e 100644 (file)
@@ -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;