String gameId = "x3tc";
if (version == 4) gameId = root.attributeValue("game");
final Game game = GameFactory.getInstance().getGame(gameId);
final Complex complex = new Complex(game);
final FactoryFactory factoryFactory = game.getFactoryFactory();
final SectorFactory sectorFactory = game.getSectorFactory();
final WareFactory wareFactory = game.getWareFactory();
final SunFactory sunsFactory = game.getSunFactory();
complex.setSuns(sunsFactory.getSun(Integer.parseInt(root
.attributeValue("suns"))));
complex.setSector(sectorFactory
.getSector(root.attributeValue("sector")));
complex.setAddBaseComplex(Boolean.parseBoolean(root.attributeValue(
"addBaseComplex", "false")));
complex.showingProductionStats = Boolean.parseBoolean(root
.attributeValue("showingProductionStats", "false"));
complex.showingShoppingList = Boolean.parseBoolean(root.attributeValue(
"showingShoppingList", "false"));
complex.showingStorageCapacities = Boolean.parseBoolean(root
.attributeValue("showingStorageCapacities", "false"));
complex.showingComplexSetup = Boolean.parseBoolean(root.attributeValue(
"showingComplexSetup", "true"));
// Get the factories parent element (In older version this was the root
// node)
Element factoriesE = root.element("complexFactories");
if (factoriesE == null) factoriesE = root;
// Read the complex factories
for (final Object item: factoriesE.elements("complexFactory"))
{
final Element element = (Element) item;
final Factory factory = factoryFactory.getFactory(element
.attributeValue("factory"));
final ComplexFactory complexFactory;
final Element yieldsE = element.element("yields");
if (yieldsE == null)
{