Search in sources :

Example 11 with MapZone

use of eidolons.game.battlecraft.logic.dungeon.location.building.MapZone in project Eidolons by IDemiurge.

the class LocationBuilder method initZones.

private void initZones(Node zonesNode, DungeonPlan plan) {
    int id = 0;
    int zoneId = 0;
    List<MapZone> zones = new ArrayList<>();
    for (Node zoneNode : XML_Converter.getNodeList(zonesNode)) {
        MapZone zone;
        try {
            zone = createZone(plan, zoneId, zoneNode);
        } catch (Exception e) {
            // main.system.ExceptionMaster.printStackTrace(e);
            zone = new MapZone(plan.getDungeon(), zoneId, 0, plan.getDungeon().getWidth(), 0, plan.getDungeon().getHeight());
        }
        // ++ add coord exceptions
        zoneId++;
        zones.add(zone);
        for (Node node : XML_Converter.getNodeList(XML_Converter.getNodeList(zoneNode).get(0))) {
            // if (node.getNodeName().equalsIgnoreCase(BLOCKS_NODE))
            // blocks = initBlocks(XML_Converter.getStringFromXML(node));
            MapBlock block = constructBlock(node, id, zone, plan, getDungeon().getDungeon());
            id++;
            zone.addBlock(block);
            plan.getBlocks().add(block);
        }
    }
    if (plan.getBlocks().size() == 1) {
        int w = plan.getBlocks().get(0).getWidth();
        int h = plan.getBlocks().get(0).getHeight();
        dungeon.setParam(PARAMS.BF_WIDTH, w, true);
        dungeon.setParam(PARAMS.BF_HEIGHT, h, true);
    }
    plan.setZones(zones);
}
Also used : MapZone(eidolons.game.battlecraft.logic.dungeon.location.building.MapZone) Node(org.w3c.dom.Node) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)

Aggregations

MapZone (eidolons.game.battlecraft.logic.dungeon.location.building.MapZone)11 MapBlock (eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)9 Coordinates (main.game.bf.Coordinates)4 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 Obj (main.entity.obj.Obj)3 ObjType (main.entity.type.ObjType)2 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 ROOM_TYPE (eidolons.game.battlecraft.logic.dungeon.location.LocationBuilder.ROOM_TYPE)1 BuildHelper (eidolons.game.battlecraft.logic.dungeon.location.building.BuildHelper)1 DungeonPlan (eidolons.game.battlecraft.logic.dungeon.location.building.DungeonPlan)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Ref (main.entity.Ref)1 Node (org.w3c.dom.Node)1