View topic - Java unitdef crash



All times are UTC + 1 hour


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Java unitdef crash
PostPosted: 06 May 2012, 12:16 

Joined: 04 Oct 2007, 00:51
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:
Code:
   @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;
   }


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?


Top
 Offline Profile  
 
 Post subject: Re: Java unitdef crash
PostPosted: 07 May 2012, 06:41 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
yeah, tutorial is outdated. :/
the non-OO java AI Interface is not meant ot be used by devs directly, but rather (maybe) ... for example when you implement an AI Wrapper in an other JVM supported language then Java. though that will likely nto make sense, as probably all of these languages may be able to use the Java OO Wrapper directly, and thus not need their own wrapper.
it should not crash though, but .. i have no time, nad there are way more important things to fix first, with the Java AI Interface.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.