diff --git a/src/engine/db/handlers/dbLootTableHandler.java b/src/engine/db/handlers/dbLootTableHandler.java index 70ea8c73..6632c0d4 100644 --- a/src/engine/db/handlers/dbLootTableHandler.java +++ b/src/engine/db/handlers/dbLootTableHandler.java @@ -133,12 +133,8 @@ public class dbLootTableHandler extends dbHandlerBase { ResultSet rs = executeQuery(); while (rs.next()) { - try { - LootManager.GenTable gt = new LootManager.GenTable(); - LootManager.AddGenTableRow(rs.getInt("groupID"), gt, new LootManager.GenTableRow(rs)); - } catch(Exception ex){ - Logger.info("LOOT TABLE ERROR FOR TABLE: " + rs.getInt("groupID")); - } + LootManager.GenTableRow row = new LootManager.GenTableRow(rs); + LootManager.AddGenTableRow(rs.getInt("groupID"), row); } Logger.info( "read: " + recordsRead); @@ -162,12 +158,8 @@ public class dbLootTableHandler extends dbHandlerBase { while (rs.next()) { recordsRead++; - try{ - LootManager.ItemTable it = new LootManager.ItemTable(); - LootManager.AddItemTableRow(rs.getInt("lootTable"),it,new LootManager.ItemTableRow(rs)); - } catch(Exception ex){ - Logger.info("LOOT TABLE ERROR FOR TABLE: " + rs.getInt("lootTable")); - } + LootManager.ItemTableRow row = new LootManager.ItemTableRow(rs); + LootManager.AddItemTableRow(rs.getInt("lootTable"),row); } Logger.info("read: " + recordsRead); @@ -190,12 +182,8 @@ public class dbLootTableHandler extends dbHandlerBase { while (rs.next()) { recordsRead++; - try{ - LootManager.ModTypeTable mtt = new LootManager.ModTypeTable(); - LootManager.AddModTypeTableRow(rs.getInt("modGroup"),mtt,new LootManager.ModTypeTableRow(rs)); - } catch(Exception ex){ - Logger.info("LOOT TABLE ERROR FOR TABLE: " + rs.getInt("modGroup")); - } + LootManager.ModTypeTableRow mttr = new LootManager.ModTypeTableRow(rs); + LootManager.AddModTypeTableRow(rs.getInt("modGroup"),mttr); } Logger.info( "read: " + recordsRead); @@ -218,12 +206,8 @@ public class dbLootTableHandler extends dbHandlerBase { while (rs.next()) { recordsRead++; - try{ - LootManager.ModTable mt = new LootManager.ModTable(); - LootManager.AddModTableRow(rs.getInt("modTable"),mt,new LootManager.ModTableRow(rs)); - } catch(Exception ex){ - Logger.info("LOOT TABLE ERROR FOR TABLE: " + rs.getInt("modTable")); - } + LootManager.ModTableRow mtr = new LootManager.ModTableRow(rs); + LootManager.AddModTableRow(rs.getInt("modTable"),mtr); } Logger.info( "read: " + recordsRead); diff --git a/src/engine/loot/LootManager.java b/src/engine/loot/LootManager.java index 6680f449..e45bed6f 100644 --- a/src/engine/loot/LootManager.java +++ b/src/engine/loot/LootManager.java @@ -112,48 +112,48 @@ public class LootManager { } return outItem; } - public static void AddGenTableRow(int tableID, GenTable genTable, GenTableRow row){ + public static void AddGenTableRow(int tableID,GenTableRow row){ if(!generalItemTables.containsKey(tableID)){ //create the new table - generalItemTables.put(tableID,genTable); - //add row to new table - generalItemTables.get(tableID).rows.add(row); + GenTable gt = new GenTable(); + gt.rows.add(row); + generalItemTables.put(tableID,gt); } else{ //add row to existing table GenTable toAdd = generalItemTables.get(tableID); toAdd.rows.add(row); } } - public static void AddItemTableRow(int tableID,ItemTable itemTable, ItemTableRow row){ + public static void AddItemTableRow(int tableID, ItemTableRow row){ if(!itemTables.containsKey(tableID)){ //create the new table - itemTables.put(tableID,itemTable); - //add new row to table - itemTables.get(tableID).rows.add(row); + ItemTable it = new ItemTable(); + it.rows.add(row); + itemTables.put(tableID,it); } else{ //add row to existing table ItemTable toAdd = itemTables.get(tableID); toAdd.rows.add(row); } } - public static void AddModTypeTableRow(int tableID,ModTypeTable modtypeTable, ModTypeTableRow row){ + public static void AddModTypeTableRow(int tableID, ModTypeTableRow row){ if(!modTypeTables.containsKey(tableID)){ //create the new table - modTypeTables.put(tableID,modtypeTable); - //add row to new table - modTypeTables.get(tableID).rows.add(row); + ModTypeTable mtt = new ModTypeTable(); + mtt.rows.add(row); + modTypeTables.put(tableID,mtt); } else{ //add row to existing table ModTypeTable toAdd = modTypeTables.get(tableID); toAdd.rows.add(row); } } - public static void AddModTableRow(int tableID, ModTable modTable, ModTableRow row){ + public static void AddModTableRow(int tableID,ModTableRow row){ if(!itemTables.containsKey(tableID)){ //create the new table - modTables.put(tableID,modTable); - //add row to new table - modTables.get(tableID).rows.add(row); + ModTable mt = new ModTable(); + mt.rows.add(row); + modTables.put(tableID,mt); } else{ //add row to existing table ModTable toAdd = modTables.get(tableID);