From 1721d59e3852e6dd1394e7defed7c49d55004831 Mon Sep 17 00:00:00 2001
From: David Lin <dllin@student.unimelb.edu.au>
Date: Sat, 13 Jun 2020 16:54:50 +1000
Subject: [PATCH] fixed error where placing stays as status

---
 res/levels/waves.txt  | 16 ----------------
 src/ShadowDefend.java | 19 +++++++++++++------
 2 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/res/levels/waves.txt b/res/levels/waves.txt
index f38c84a..82a0d7a 100644
--- a/res/levels/waves.txt
+++ b/res/levels/waves.txt
@@ -3,19 +3,3 @@
 2,delay,2500
 2,spawn,20,slicer,750
 3,spawn,5,superslicer,1000
-4,spawn,5,slicer,500
-4,delay,1000
-4,spawn,5,superslicer,500
-5,spawn,50,slicer,500
-5,delay,1000
-5,spawn,5,megaslicer,1000
-6,spawn,25,superslicer,500
-6,spawn,10,megaslicer,100
-6,delay,5000
-6,spawn,3,apexslicer,3000
-6,spawn,3,apexslicer,3000
-7,spawn,20,superslicer,250
-7,delay,1750
-7,spawn,10,megaslicer,2000
-7,delay,500
-7,spawn,5,apexslicer,1500
\ No newline at end of file
diff --git a/src/ShadowDefend.java b/src/ShadowDefend.java
index afeddf1..2d1e33a 100644
--- a/src/ShadowDefend.java
+++ b/src/ShadowDefend.java
@@ -421,8 +421,10 @@ public class ShadowDefend extends AbstractGame {
                 // Create image of tank and set wave state to Placing
                 placingIcon = new Image(TANK_FILE);
                 placedImage = "tank";
-                prevWaveState = waveState;
-                waveState = 2;
+                if(waveState != 2){
+                    prevWaveState = waveState;
+                    waveState = 2;
+                }
             }
 
             // Checks if mouse above the super tank icon when left clicked and if enough gold
@@ -431,8 +433,10 @@ public class ShadowDefend extends AbstractGame {
                 // Create image of super tank and set wave state to Placing
                 placingIcon = new Image(STANK_FILE);
                 placedImage = "stank";
-                prevWaveState = waveState;
-                waveState = 2;
+                if(waveState != 2){
+                    prevWaveState = waveState;
+                    waveState = 2;
+                }
             }
 
             // Checks if mouse above the plane icon when left clicked and if enough gold
@@ -441,8 +445,11 @@ public class ShadowDefend extends AbstractGame {
                 // Create image of plane and set wave state to Placing
                 placingIcon = new Image(PLANE_FILE);
                 placedImage = "plane";
-                prevWaveState = waveState;
-                waveState = 2;
+                if(waveState != 2){
+                    prevWaveState = waveState;
+                    waveState = 2;
+                }
+
             }
         }
 
-- 
GitLab