That code snippet is a bit too limited to judge what's going wrong.
Could you post the whole method's code please, prior and after your modification?
![Cheers ]cheers[](https://www.sas1946.com/main/Smileys/akyhne/occasion14.gif)
Mike
Too many lines. The whole method is not included.
I'm trying to add a meter for the number of attacks.
So that in the editor it is possible to set how many times the aircraft will attack the target.
There is a sample Formation I try to add my parameter after it.
It works only if the type Fornation is indicated at the point. Without it, I get a mistake.
1)GWindowComboControl wFormations;
This creates an element for the window.
public void load(SectFile var1) {
Object var58 = null;
String var59 = var49.next((String)null);
if (var59 != null && var59.startsWith("F")) {
var59 = var59.substring(1);
}
String count = var49.next((String)null);
if (count != null && count.startsWith("C")) {
count = count.substring(1);
}
I added the same code for my line. Only to make if the line begins with S.
if (var59 != null) {
var43.formation = Integer.parseInt(var59);
}
if (count != null ) {
var43.gattackcounter = Integer.parseInt(count);
}
This transforms into a whole value from the line.
I made exactly my same line.
}
public boolean save(SectFile var1) {
for(int var15 = 0; var15 < var9; ++var15) {
PAir var16 = (PAir)var8.point(var15);
Point3d var17 = var16.pos.getAbsPoint();
switch (var16.type()) {
case 4:
String var31 = "";
if (var16.waypointType > 0) {
var31 = "_" + var16.waypointType;
}
var1.lineAdd(var20, "GATTACKDIRECTION" + var31, this.fmt(var17.x) + " " + this.fmt(var17.y) + " " + this.fmt(var16.height) + " " + this.fmt(var16.speed) + this.saveTarget(var16) + this.saveRadioSilence(var16) + this.saveFormation(var16) + this.saveGattackcounter(var16));
if (var16.waypointType > 800) {
var1.lineAdd(var20, "TRIGGERS", var16.cycles + " " + var16.delayTimer + " " + (int)var16.orient + " " + var16.baseSize + " " + var16.targetTrigger + " " + var16.altDifference);
}
break;
Saving points of the route to the file.
I created my type with index 4.
0 flight.
1 take -off.
2 posterity.
3 attack.
4 My attack.
Therefore, there are 4 case.
}
Save in file.
There is a record of the type of point, coordinates, speed, height, radio silence, the goal if any, and Formation I added my option in exactly the same essentially.
this.saveFormation(var16) + this.saveGattackcounter(var16)
private String saveFormation(PAir var1) {
return var1.formation == 0 ? "" : " F" + var1.formation;
}
private String saveGattackcounter(PAir var1) {
return var1.gattackcounter == 0 ? "" : " C" + var1.gattackcounter;
}
Here is my exactly the same as the original team for that line.
public void initEditWay2() {
this.wGattackcounterLabel = new GWindowLabel(var1, 1.0F, 5.0F, 19.0F, 1.3F, i18n("GAttackCount"), (String)null);
var1.addLabel(this.wGattackcounterLabel);
this.wGattackcounterType = new GWindowComboControl(var1, 19.0F, 5.0F, 5.0F){
public void afterCreated() {
super.afterCreated();
boolean[] var1 = new boolean[PAir.count.length];
for(int var2 = 0; var2 < PAir.count.length; ++var2) {
this.add(Plugin.i18n(PAir.count[var2]));
var1[var2] = true;
}
this.posEnable = var1;
}
public boolean notify(int var1, int var2) {
if (var1 == 2) {
PAir var3 = (PAir)Plugin.builder.selectedPoint();
int var4 = PlMisAir.this.wGattackcounterType.getSelected();
if (var4 < 0) {
var4 = 0;
}
if (var4 > PAir.count.length - 1) {
var4 = PAir.count.length - 1;
}
var3.gattackcounter = var4 == 0 ? var4 : var4 + 1;
PlMisAir.this.fillDialogWay2();
PlMission.setChanged();
}
return true;
}
};
var1.addControl(this.wGattackcounterType);
}
This creates options in the editor on 2 window settings window.
private void fillDialogWay2() {
PAir var1 = (PAir)Plugin.builder.selectedPoint();
int var2 = var1.waypointType;
int var7 = var1.gattackcounter;
int var10000;
if (var7 <= 0) {
var10000 = 0;
} else {
--var7;
var10000 = var7;
}
var7 = var10000;
this.wGattackcounterType.setSelected(var7, true, false);
}
This is how I understand the filling out data. In the editor.
