Try to autoformat this code under Processing 124 Mac OS X Macbook Intel Core Duo 1, with 1gb ram. you'd get a arrayindexoutofbounds exception. but if you comment it out, it formats fine. I went to the bug database. Apparently it is reported has fixed, but it doesn't appear so.
Code:
class SFunit
{
int tx,ty,hp,ap,sp,te,exists,ut,side,ai,player,tp;
int lastfired=0;
int lparticle=0;
int cweapon=0;
int pcharn=0;
int firing=0;
float vx,vy,accelerating,deg,x,y;
String name,description,utype;
SFunit(float a,float b, int c, int d, int e, int f, int g, int h,int i, String A, String B, String C)
{
x=a;
y=b;
hp=c;
ap=d;
sp=e;
exists=f;
side=g;
ai=h;
player=i;
name=A;
description=B;
utype=C;
deg=0;
te=-1;//t unit
tp=-1;//t planet
//match ut.
for (int gg=0; gg<20;gg++)
{
if (utype.equals(unittype[gg].name))
{
ut=gg;
break;
}
}
}
void update(int sx,int sy)
{
if (this.deg>=360)
{
this.deg=this.deg%360;
}
if (this.deg<0)
{
this.deg=360+this.deg;
}
this.vx=this.vx+accelerating*sin(PI*deg/180)*unittype[ut].acc;
this.vy=this.vy+accelerating*cos(PI*deg/180)*unittype[ut].acc;
this.x+=this.vx;
this.y+=this.vy;
if (this.firing==1)
{
for (int gg=0; gg<52; gg++)
{
//get the currently selected weapon and match its char to the one defined in the ship's type.
if (unittype[this.ut].wstring.charAt(this.cweapon)==weapon[gg].weaponchar)
{
if ((millis()>this.lastfired+weapon[gg].delaybetweenstring || this.pcharn!=0))
{//check delays
if ((millis()>this.lparticle+weapon[gg].delaybetweenparticle && this.pcharn!=0) || (millis()>this.lastfired+weapon[gg].delaybetweenstring) )
{
if (millis()>this.lastfired+weapon[gg].delaybetweenstring) this.lastfired=millis();
this.pcharn=this.pcharn+1;
if (this.pcharn>4)
{
this.pcharn=0; //nth bullet in series
}
this.lparticle=millis();
for (int kk=0;kk<52;kk++)
{
//find the particle type defined in the weapon string, which is the current 'bullet' to be shot in the weapon string.
// a weapon string is a series of bullets of any type.
if (particletype[kk].Pchar==weapon[gg].particlestring.charAt(this.pcharn))
{
for (int ii=0;ii<1000;ii++)
{
//find an empty particle space
if (particle[ii].exists==0 && particletype[kk].Pchar!='_')
{
//place particle
particle[ii]=new SFparticle(0,millis(),0,1,1,this.x,this.y,this.vx+sin(PI*this.deg/180)*particletype[particle[ii].pt].initv,this.vy+cos(PI*this.deg/180)*particletype[particle[ii].pt].initv,0,deg,"bullet",str(random(0,1000000)));
break;
}
}
break;
}
}
}
}
break;
}
}
}
}
void ai()
{
}
}