Reduce scope of variables

This commit is contained in:
thatsIch
2015-09-30 14:22:21 +02:00
parent dca09fe0a6
commit 059523f543
70 changed files with 151 additions and 199 deletions
+1 -1
View File
@@ -307,9 +307,9 @@ public class PathGridCache implements IPathingGrid
private int calculateRequiredChannels()
{
int depth = 0;
this.semiOpen.clear();
int depth = 0;
for( IGridNode nodes : this.requireChannels )
{
if( !this.semiOpen.contains( nodes ) )
+6 -11
View File
@@ -64,13 +64,6 @@ public class SpatialPylonCache implements ISpatialCache
public void reset( IGrid grid )
{
int reqX = 0;
int reqY = 0;
int reqZ = 0;
int requirePylonBlocks = 1;
double minPower = 0;
double maxPower = 0;
this.clusters = new HashMap<SpatialPylonCluster, SpatialPylonCluster>();
this.ioPorts = new LinkedList<TileSpatialIOPort>();
@@ -120,6 +113,8 @@ public class SpatialPylonCache implements ISpatialCache
this.captureMax.z = Math.max( this.captureMax.z, cl.max.z );
}
double maxPower = 0;
double minPower = 0;
if( this.hasRegion() )
{
this.isValid = this.captureMax.x - this.captureMin.x > 1 && this.captureMax.y - this.captureMin.y > 1 && this.captureMax.z - this.captureMin.z > 1;
@@ -149,10 +144,10 @@ public class SpatialPylonCache implements ISpatialCache
}
}
reqX = this.captureMax.x - this.captureMin.x;
reqY = this.captureMax.y - this.captureMin.y;
reqZ = this.captureMax.z - this.captureMin.z;
requirePylonBlocks = Math.max( 6, ( ( reqX * reqZ + reqX * reqY + reqY * reqZ ) * 3 ) / 8 );
int reqX = this.captureMax.x - this.captureMin.x;
int reqY = this.captureMax.y - this.captureMin.y;
int reqZ = this.captureMax.z - this.captureMin.z;
int requirePylonBlocks = Math.max( 6, ( ( reqX * reqZ + reqX * reqY + reqY * reqZ ) * 3 ) / 8 );
this.efficiency = (double) pylonBlocks / (double) requirePylonBlocks;