Updated Status to prevent the stats from going negative

how ever this really more of a bandaid than a fix.

Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
2012-04-04 09:57:13 -04:00
parent c69b21bbf2
commit 77561aa328

View File

@@ -61,6 +61,7 @@ public class Status extends JPanel {
* @author ricky barrette * @author ricky barrette
*/ */
public synchronized void decrementAsteroidCount() { public synchronized void decrementAsteroidCount() {
if(this.mAsteroidCount > 0)
this.mAsteroidCount -= 1; this.mAsteroidCount -= 1;
} }
@@ -69,6 +70,7 @@ public class Status extends JPanel {
* @author ricky barrette * @author ricky barrette
*/ */
public void decrementLevel() { public void decrementLevel() {
if(this.mLevel > 0)
this.mLevel -= 1; this.mLevel -= 1;
} }
@@ -78,6 +80,7 @@ public class Status extends JPanel {
* @author ricky barrette * @author ricky barrette
*/ */
public synchronized void decrementScore(int score) { public synchronized void decrementScore(int score) {
if(this.mScore - mScore > 0)
this.mScore -= mScore; this.mScore -= mScore;
} }
@@ -86,6 +89,7 @@ public class Status extends JPanel {
* @author ricky barrette * @author ricky barrette
*/ */
public synchronized void decrementShipCount() { public synchronized void decrementShipCount() {
if(this.mShipCount > 0)
this.mShipCount -= 1; this.mShipCount -= 1;
} }
@@ -94,6 +98,7 @@ public class Status extends JPanel {
* @author ricky barrette * @author ricky barrette
*/ */
public synchronized void decrementShotCount() { public synchronized void decrementShotCount() {
if(this.mShotCount > 0)
this.mShotCount -= 1; this.mShotCount -= 1;
} }
@@ -103,6 +108,7 @@ public class Status extends JPanel {
* @author ricky barrette * @author ricky barrette
*/ */
public synchronized void decrementTime(long mTime) { public synchronized void decrementTime(long mTime) {
if(this.mTime - mTime > 0)
this.mTime -= mTime; this.mTime -= mTime;
} }