Added unit tests

This commit is contained in:
Anuken
2018-10-03 20:58:35 -04:00
parent 34715b1e06
commit c82fd9ead5
11 changed files with 233 additions and 88 deletions

View File

@@ -11,6 +11,7 @@ import io.anuke.mindustry.type.ItemStack;
import io.anuke.ucore.util.Bits;
import static io.anuke.mindustry.Vars.control;
import static io.anuke.mindustry.Vars.headless;
@Serialize
public class Sector{
@@ -46,11 +47,11 @@ public class Sector{
}
public SaveSlot getSave(){
return control.getSaves().getByID(saveID);
return !hasSave() ? null : control.getSaves().getByID(saveID);
}
public boolean hasSave(){
return control.getSaves().getByID(saveID) != null;
return !headless && control.getSaves().getByID(saveID) != null;
}
public int packedPosition(){

View File

@@ -47,7 +47,9 @@ public class Sectors{
}
world.loadSector(sector);
logic.play();
sector.saveID = control.getSaves().addSave("sector-" + sector.packedPosition()).index;
if(!headless){
sector.saveID = control.getSaves().addSave("sector-" + sector.packedPosition()).index;
}
world.sectors().save();
world.setSector(sector);
sector.currentMission().onBegin();