瀏覽代碼

:bug: removed existing targets from potential new target postitions

Felix Bytow 1 年之前
父節點
當前提交
f2d174f6c6
共有 2 個文件被更改,包括 4 次插入1 次删除
  1. 1 1
      CMakeLists.txt
  2. 3 0
      game/PlayingState.cxx

+ 1 - 1
CMakeLists.txt

@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.27)
 cmake_minimum_required(VERSION 3.27)
-project(Snake VERSION 1.0.0.0)
+project(Snake VERSION 1.1.0.0)
 
 
 set(CMAKE_CXX_STANDARD 23)
 set(CMAKE_CXX_STANDARD 23)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)

+ 3 - 0
game/PlayingState.cxx

@@ -214,6 +214,9 @@ bool PlayingState::place_target()
   for (auto const& particle: tail_) {
   for (auto const& particle: tail_) {
     field.erase(particle);
     field.erase(particle);
   }
   }
+  for (auto const& target: target_) {
+    field.erase(target);
+  }
 
 
   if (field.empty()) {
   if (field.empty()) {
     return false;
     return false;