Skip to content

Commit d2ead09

Browse files
committed
bug fix: minor adjustment to pureint (got missed)
1 parent ce1f75f commit d2ead09

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src-ai/hughai/CSAI.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
public class CSAI extends AbstractOOAI implements IHughAI
4343
{
4444
// make these available for public access to other classes, though we can get them directly through GetInstance too
45+
public int skirmishAIId;
4546
public OOAICallback aicallback;
4647
//public LogFile logfile;
4748

@@ -77,11 +78,11 @@ public String getCacheDirectoryPath()
7778
private static final int DEFAULT_ZONE = 0;
7879

7980
public void sendTextMessage(String msg) {
80-
81-
try {
82-
aicallback.getGame().sendTextMessage(msg, 0);
83-
} catch (Exception ex) {
84-
ex.printStackTrace();
81+
82+
try {
83+
aicallback.getGame().sendTextMessage(msg, 0);
84+
} catch (Exception ex) {
85+
ex.printStackTrace();
8586
}
8687
}
8788

@@ -126,28 +127,29 @@ public void unregisterGameListener( GameAdapter gameListener ) {
126127
}
127128

128129
@Override
129-
public int init( int team, OOAICallback aicallback )
130+
public int init( int skirmishAIId, OOAICallback aicallback )
130131
{
132+
this.skirmishAIId = skirmishAIId;
131133
this.aicallback = aicallback;
132134

133135
try{
134-
sendTextMessage("ai " + team + " initing..");
135-
this.Team = team;
136+
sendTextMessage("ai " + skirmishAIId + " initing..");
137+
this.Team = aicallback.getSkirmishAI().getTeamId();
136138
//logfile = new LogFile();
137139

138140
playerObjects = new PlayerObjects( this );
139141

140142
logfile = playerObjects.getLogFile();
141-
logfile.Init( getAIDirectoryPath() + "team" + team + ".log" );
143+
logfile.Init( getAIDirectoryPath() + "team" + this.Team + ".log" );
142144
logfile.writeLine( "Opening log" );
143-
logfile.WriteLine( "Hugh AI started v" + AIVersion + ", team " + team +
145+
logfile.WriteLine( "Hugh AI started v" + AIVersion + ", team " + this.Team +
144146
" map " + aicallback.getMap().getName() + " mod " + aicallback.getMod().getHumanName() );
145147

146148
// if( new File( getAIDirectoryPath() + File.separator + "debug.flg" ).exists() ) // if this file exists, activate debug mode; saves manually changing this for releases
147149
config = playerObjects.getConfig();
148-
150+
149151
playerObjects.getOptionsFromStartScript();
150-
152+
151153
if( config.isDebug() ) {
152154
logfile.WriteLine( "Toggling debug on" );
153155
DebugOn = true;
@@ -161,25 +163,25 @@ public int init( int team, OOAICallback aicallback )
161163
InitCache();
162164

163165
logfile.WriteLine("Is game paused? : " + aicallback.getGame().isPaused());
164-
166+
165167
playerObjects.getFrameController().Init();
166168

167169
drawingUtils = playerObjects.getDrawingUtils();
168170
drawingUtils.CleanDrawing();
169171
timeHelper = playerObjects.getTimeHelper();
170-
172+
171173
playerObjects.getMainUI();
172174
playerObjects.getConfigDialog();
173175
// playerObjects.getWorkflowUI();
174176
playerObjects.getConsoleJava();
175177
playerObjects.getConsoleEcma();
176-
178+
177179
playerObjects.getWelcomeMessages();
178180

179181
playerObjects.getUnitController();
180182
playerObjects.getEnemyTracker();
181183
playerObjects.getMaps();
182-
184+
183185
playerObjects.getBuildEconomy();
184186

185187
if( DebugOn ) {
@@ -190,7 +192,7 @@ public int init( int team, OOAICallback aicallback )
190192
RegisterVoiceCommand( "unpauseai", new VoiceUnpauseAI() );
191193
playerObjects.getMainUI().registerButton( "Reload AI", new ReloadAIButton() );
192194

193-
SendTextMsg("Hugh AI initialized v" + AIVersion + ", team " + team);
195+
SendTextMsg("Hugh AI initialized v" + AIVersion + ", team " + this.Team);
194196
}
195197
catch( Exception e )
196198
{

0 commit comments

Comments
 (0)