Java unitdef crash
Posted: 06 May 2012, 13:16
Using code from the NullJavaAI, I've made a small test that is supposed to identify the commander when the game starts. The only code I've added is for this event:
The game crashes as soon as I call 'UnitDef_getName(def)'. Is there anything that needs to be called/setup before using the UnitDef_ methods? The tutorial for the Java interface seems to be outdated. I'm testing this with Spring v0.88 and BA v7.68.
Edit: just realized that the tutorial is for the OO java AI. I'll try that one and see if it works.
Edit2: The OO java AI works fine, so I guess I'll use that instead. Out of curiosity, is the Java one broken or a WIP?
Code: Select all
@Override public int unitFinished(int unit)
{
int def = clb.Unit_getDef(unit);
String name = clb.UnitDef_getName(def);
clb.Log_log("Unit " + unit + " has unitdef " + def + " which has name " + name);
return 0;
}
Edit: just realized that the tutorial is for the OO java AI. I'll try that one and see if it works.
Edit2: The OO java AI works fine, so I guess I'll use that instead. Out of curiosity, is the Java one broken or a WIP?