From aabc55f15b0dab3de251bab46d59097b730f9193 Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Thu, 27 Aug 2015 01:40:38 +0200 Subject: [PATCH] Reduced space usage in SpawnerService --- src/services/spawn/SpawnerService.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/services/spawn/SpawnerService.java b/src/services/spawn/SpawnerService.java index 0d64eebb7..1fbdc491d 100644 --- a/src/services/spawn/SpawnerService.java +++ b/src/services/spawn/SpawnerService.java @@ -92,18 +92,12 @@ public final class SpawnerService extends Service { DatatableData eggs = ServerFactory.getDatatable("spawn/static.iff"); eggs.handleRows(rowIndex -> { - final Location loc; - final int buildingId; - final SWGObject egg; - final SpawnType spawnType; - final boolean spawnInCell; - if((Integer) eggs.getCell(rowIndex, 12) == 1) { // We only spawn active eggs - buildingId = (int) eggs.getCell(rowIndex, 3); - loc = new Location((float) eggs.getCell(rowIndex, 5), (float) eggs.getCell(rowIndex, 6), (float) eggs.getCell(rowIndex, 7), Terrain.valueOf((String) eggs.getCell(rowIndex, 1))); - spawnType = SpawnType.valueOf((String) eggs.getCell(rowIndex, 2)); - spawnInCell = buildingId != -1; - egg = objectManager.createObject(spawnType.getObjectTemplate(), loc, !spawnInCell, false); + final int buildingId = (int) eggs.getCell(rowIndex, 3); + final Location loc = new Location((float) eggs.getCell(rowIndex, 5), (float) eggs.getCell(rowIndex, 6), (float) eggs.getCell(rowIndex, 7), Terrain.valueOf((String) eggs.getCell(rowIndex, 1))); + final SpawnType spawnType = SpawnType.valueOf((String) eggs.getCell(rowIndex, 2)); + final boolean spawnInCell = buildingId != -1; + final SWGObject egg = objectManager.createObject(spawnType.getObjectTemplate(), loc, !spawnInCell, false); if(spawnInCell) // If it wants to be inside a building, make it so! ((BuildingObject) objectManager.getObjectById(buildingId)).getCellByName((String) eggs.getCell(rowIndex, 4)).addObject(egg);