Skip to content

Commit 9dbeb0b

Browse files
author
bytekeeper
committed
If builder was null, all locations were valid. Now applying same logic as BWAPI.
1 parent bd746bc commit 9dbeb0b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/bwapi/Game.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,11 @@ public boolean canBuildHere(final TilePosition position, final UnitType type, fi
720720
if (type != Special_Start_Location) {
721721
final Position targPos = lt.toPosition().add(type.tileSize().toPosition().divide(2));
722722
final List<Unit> unitsInRect = getUnitsInRectangle(lt.toPosition(), rb.toPosition(),
723-
u -> !u.isFlying() && !u.isLoaded() && builder != null || type == Zerg_Nydus_Canal
723+
u -> !u.isFlying() && !u.isLoaded() && (builder != u || type == Zerg_Nydus_Canal)
724724
&& u.getLeft() <= targPos.x + type.dimensionRight()
725725
&& u.getTop() <= targPos.y + type.dimensionDown()
726-
&& u.getRight() <= targPos.x + type.dimensionLeft()
727-
&& u.getBottom() <= targPos.y + type.dimensionUp());
726+
&& u.getRight() >= targPos.x - type.dimensionLeft()
727+
&& u.getBottom() >= targPos.y - type.dimensionUp());
728728

729729
for (final Unit u : unitsInRect) {
730730
// Addons can be placed over units that can move, pushing them out of the way

0 commit comments

Comments
 (0)