mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final2.git
synced 2024-11-08 09:50:38 +00:00
Do not allow reset if game not started once
This commit is contained in:
parent
0c9ea4e0ba
commit
6cfc8c0a89
@ -4,7 +4,7 @@ Error, can not get buildings: game not started
|
||||
Error, can not get resources: game not started
|
||||
Error, invalid list-buildings argument: none expected
|
||||
Error, invalid list-resources argument: none expected
|
||||
OK
|
||||
Error, can not reset a game that is not started!
|
||||
Error, invalid reset argument: none expected
|
||||
Error, not expecting dice roll
|
||||
Error, invalid start argument value(s)
|
||||
|
@ -3,6 +3,18 @@ package edu.kit.informatik;
|
||||
import edu.kit.informatik.ui.CommandLine;
|
||||
|
||||
public final class Main {
|
||||
/**
|
||||
* Utility class -> private constructor.
|
||||
*/
|
||||
private Main() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Program entry point.
|
||||
*
|
||||
* @param args command-line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
CommandLine.startInteractive();
|
||||
}
|
||||
|
@ -203,11 +203,13 @@ public class CardGame {
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
if (cardStack != null) {
|
||||
if (cardStack == null) {
|
||||
throw new InvalidInputException("can not reset a game that is not started!");
|
||||
} else {
|
||||
this.currentCardStack = new ArrayDeque<>(cardStack);
|
||||
}
|
||||
this.resources = new ArrayDeque<>();
|
||||
this.items = new ArrayList<>();
|
||||
this.resources.clear();
|
||||
this.items.clear();
|
||||
this.fightingAnimal = false;
|
||||
this.awaitedDiceSize = null;
|
||||
this.minimumDiceRoll = null;
|
||||
|
Loading…
Reference in New Issue
Block a user