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
wood wood
axe axe
ballon
club club
fireplace fireplace
hangglider hangglider
sailingraft sailingraft
shack shack
steamboat
Error, need fireplace to build Error, need fireplace to build
OK OK
Error, already built Error, already built

View File

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

View File

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