Skip to content

Commit 5f999c8

Browse files
committed
implement weapontype
1 parent f25668c commit 5f999c8

File tree

2 files changed

+330
-37
lines changed

2 files changed

+330
-37
lines changed

src/main/java/bwapi/types/TechType.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ public WeaponType getWeapon() {
8787
}
8888

8989
public boolean targetsUnit() {
90-
return techTypeFlags[id] == 1 || techTypeFlags[id] == 3;
90+
return (techTypeFlags[id] & TARG_UNIT) != 0;
9191
}
9292

9393
public boolean targetsPosition() {
94-
return techTypeFlags[id] == 2 || techTypeFlags[id] == 3;
94+
return (techTypeFlags[id] & TARG_POS) != 0;
9595
}
9696

9797
public Set<UnitType> whatsUses() {
@@ -142,11 +142,15 @@ public UnitType requiredUnit() {
142142
WeaponType.None, WeaponType.None, WeaponType.None, WeaponType.None, WeaponType.Nuclear_Strike, WeaponType.Unknown
143143
};
144144

145+
private static int TARG_UNIT = 1;
146+
private static int TARG_POS = 2;
147+
private static int TARG_BOTH = 3;
148+
145149
private static int techTypeFlags[] = {
146-
0, 1, 3, 2, 3, 0, 1, 1, 1, 0, 0, 0,
147-
1, 1, 3, 3, 1, 3, 1, 3, 1,
148-
3, 3, 1, 1, 3, 0, 1, 1, 1, 1,
149-
3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3
150+
0, TARG_UNIT, TARG_BOTH, TARG_POS, TARG_BOTH, 0, TARG_UNIT, TARG_UNIT, TARG_UNIT, 0, 0, 0,
151+
TARG_UNIT, TARG_UNIT, TARG_BOTH, TARG_BOTH, TARG_UNIT, TARG_BOTH, TARG_UNIT, TARG_BOTH, TARG_UNIT,
152+
TARG_BOTH, TARG_BOTH, TARG_UNIT, TARG_UNIT, TARG_BOTH, 0, TARG_UNIT, TARG_UNIT, TARG_UNIT, TARG_UNIT,
153+
TARG_BOTH, 0, 0, TARG_BOTH, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, TARG_BOTH
150154
};
151155

152156
private static Order techOrders[] = {

0 commit comments

Comments
 (0)