a new UAlbertaBot bug fix
The bot bftjoe by Joseph Huang fixes a bug in UAlbertaBot that I did not catch.
bool UnitUtil::CanAttack(BWAPI::Unit attacker, BWAPI::Unit target) { return GetWeapon(attacker, target) != BWAPI::UnitTypes::None; }
Easy to type, easy to read past... and totally wrong. Unit type None
is 228, which does not match the value of any weapon type, so it will always return true
. “All ints are the same type, right?” Bjarne Stroustrup: “Uh, sure.”
bool UnitUtil::CanAttack(BWAPI::Unit attacker, BWAPI::Unit target) { return GetWeapon(attacker, target) != BWAPI::WeaponTypes::None; }
In UAlbertaBot, CanAttack()
is used only in the tank manager, so the damage, er, fallout, er... severity is limited. Steamhammer additionally uses the function in controlling lurkers, which it does not build by default because its control is so poor. So the next Steamhammer version should be a little less clumsy with tanks and lurkers. Still pretty clumsy, though; the clumsiness runs deep.
Tomorrow: The newly uploaded Krasi0 seems to be playing new builds.
Comments
Jay Scott on :
krasi0 on :
Jay Scott on :