Automatic vs Manual Job Sorting.

This commit is contained in:
AlgorithmX2 2014-07-31 20:06:37 -05:00
parent 95c770e198
commit 62289dcf82
3 changed files with 14 additions and 5 deletions

View file

@ -323,7 +323,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
if ( result != null && simulation == false ) if ( result != null && simulation == false )
{ {
ICraftingGrid cc = getGrid().getCache( ICraftingGrid.class ); ICraftingGrid cc = getGrid().getCache( ICraftingGrid.class );
ICraftingLink g = cc.submitJob( result, null, selectedCpu == -1 ? null : cpus.get( selectedCpu ).cpu, getActionSrc() ); ICraftingLink g = cc.submitJob( result, null, selectedCpu == -1 ? null : cpus.get( selectedCpu ).cpu, true, getActionSrc() );
autoStart = false; autoStart = false;
if ( g != null && OriginalGui != null && openContext != null ) if ( g != null && OriginalGui != null && openContext != null )
{ {

View file

@ -80,7 +80,7 @@ public class MultiCraftingTracker
if ( job != null ) if ( job != null )
{ {
setJob( x, null ); setJob( x, null );
setLink( x, cg.submitJob( job, owner, null, mySrc ) ); setLink( x, cg.submitJob( job, owner, null, false, mySrc ) );
return true; return true;
} }
} }

View file

@ -386,7 +386,8 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
} }
@Override @Override
public ICraftingLink submitJob(ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, BaseActionSource src) public ICraftingLink submitJob(ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, final boolean prioritizePower,
BaseActionSource src)
{ {
if ( job.isSimulation() ) if ( job.isSimulation() )
return null; return null;
@ -412,6 +413,8 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
@Override @Override
public int compare(CraftingCPUCluster o1, CraftingCPUCluster o2) public int compare(CraftingCPUCluster o1, CraftingCPUCluster o2)
{
if ( prioritizePower )
{ {
int a = ItemSorters.compareLong( o2.getCoProcessors(), o1.getCoProcessors() ); int a = ItemSorters.compareLong( o2.getCoProcessors(), o1.getCoProcessors() );
if ( a != 0 ) if ( a != 0 )
@ -419,6 +422,12 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
return ItemSorters.compareLong( o2.getAvailableStorage(), o1.getAvailableStorage() ); return ItemSorters.compareLong( o2.getAvailableStorage(), o1.getAvailableStorage() );
} }
int a = ItemSorters.compareLong( o1.getCoProcessors(), o2.getCoProcessors() );
if ( a != 0 )
return a;
return ItemSorters.compareLong( o1.getAvailableStorage(), o2.getAvailableStorage() );
}
} ); } );
if ( !validCpusClusters.isEmpty() ) if ( !validCpusClusters.isEmpty() )