Count inlets in structure veto

- Treat sea inlet columns as river water for the 10% surface structure rule
This commit is contained in:
Brian Fopiano committed 2026-11-03 19:50:33 -05:00
1 parent 8d18e0de7a
commit 8189215328
2 files changed
+12 -4

No files matched your search

@@ -44,8 +44,8 @@ public final class IrisStructureWater implements StructureWater {
static boolean river(WaterRole role) {
return switch (role) {
case CHANNEL, POND, CASCADE, WATERFALL -> true;
case NONE, BANK, SHORE, POND_SHORE, DAM, MOUTH, INLET -> false;
case CHANNEL, POND, CASCADE, WATERFALL, INLET -> true;
case NONE, BANK, SHORE, POND_SHORE, DAM, MOUTH -> false;
};
}
}
@@ -178,15 +178,23 @@ public class NativeStructurePlacementPlannerTest {
StructureWaterRules.admitsStart(plan, stageWater, VILLAGE));
roles.clear();
WaterRole[] dry = {WaterRole.MOUTH, WaterRole.INLET, WaterRole.SHORE, WaterRole.POND_SHORE, WaterRole.BANK, WaterRole.DAM};
WaterRole[] dry = {WaterRole.MOUTH, WaterRole.SHORE, WaterRole.POND_SHORE, WaterRole.BANK, WaterRole.DAM};
int column = 0;
for (int x = 0; x <= 39; x++) {
for (int z = 0; z < 16; z++) {
roles.put(columnKey(x, z), dry[column++ % dry.length]);
}
}
assertTrue("mouths, inlets, shores, banks and dams do not count as river water",
assertTrue("mouths, shores, banks and dams do not count as river water",
StructureWaterRules.admitsStart(plan, stageWater, VILLAGE));
roles.clear();
for (int x = 0; x <= 39; x++) {
for (int z = 0; z < 16; z++) {
roles.put(columnKey(x, z), x % 2 == 0 ? WaterRole.INLET : WaterRole.BANK);
}
}
assertFalse("a sea inlet under the pieces counts as river water", StructureWaterRules.admitsStart(plan, stageWater, VILLAGE));
}
@Test