Closed GoogleCodeExporter closed 9 years ago
Hi, jnibwapi is very much a work in progress and has not been particularly
active lately. I've been working with it and maintaining recently but I've only
been working with zerg, so it's entirely possible that this is a bug in the
current release (as with zerg only morph/build is necessary so I have not
tested the train function).
I will attempt to replicate your problem and get back in touch with you.
u
Cheers,
Fobbah
Original comment by Fobbah
on 25 Oct 2011 at 2:16
Working on this issue now.
Original comment by Fobbah
on 25 Oct 2011 at 4:37
I've identified the source of the issue, a cheeky little bug:
JNIEXPORT void JNICALL Java_eisbot_proxy_JNIBWAPI_train(JNIEnv *env, jobject
jObj, jint unitID, jint typeID){
Unit* unit = Broodwar->getUnit(unitID);
if (unit != NULL) {
if (unitTypeMap[typeID] != NULL)
{
unit->train(unitTypeMap[typeID]);
}
}
}
As it happens, the type ID for a terran marine is zero, and the BWAPI::UnitType
found in the unit type map was being implicitly cast to an integer to compare
with NULL, causing the check for a valid unit type to incorrectly return false.
This code for type maps of various kinds is littered through the JNIBWAPI cpp
code, so this issue is not limited to just the unit type for a marine, and
would have caused all other BWAPI types used in the jni code to fail in the
same way!
Great catch - I am marking this issue as duplicated and raising a new issue
describing the greater extend of the problem. I expect to have a complete fix
for the larger issue on the SVN tonight.
Cheers,
Fobbah
Original comment by Fobbah
on 25 Oct 2011 at 5:15
Original issue reported on code.google.com by
gio.1...@hotmail.com
on 24 Oct 2011 at 9:29