Only print buildable items that require a fireplace if one exists

This commit is contained in:
Arne Keller 2020-03-03 18:12:37 +01:00
parent 63d160fd1b
commit 58f30fbf39
3 changed files with 3 additions and 4 deletions

View File

@ -98,13 +98,11 @@ wood
wood
wood
axe
ballon
club
fireplace
hangglider
sailingraft
shack
steamboat
Error, need fireplace to build
OK
Error, already built

View File

@ -48,13 +48,11 @@ plastic
plastic
plastic
axe
ballon
club
fireplace
hangglider
sailingraft
shack
steamboat
OK
OK
OK

View File

@ -151,6 +151,9 @@ public class CardGame {
}
private boolean canBuild(Item item) {
if (item.requiresFireplace() && !items.contains(FIREPLACE)) {
return false;
}
final Card[] resourcesNeeded = item.resourcesNeeded();
for (final Card resource : resources) {
for (int j = 0; j < resourcesNeeded.length; j++) {