Package org.freerealm.diplomacy

Examples of org.freerealm.diplomacy.Diplomacy


        realm.setTileImprovementTypeManager(new TileImprovementTypeManager());
        realm.setSettlementImprovementManager(new SettlementImprovementManager());
        realm.setUnitTypeManager(new UnitTypeManager());
        realm.setNationManager(new NationManager());
        realm.setPlayerManager(new PlayerManager());
        realm.setDiplomacy(new Diplomacy());
        realm.setHistory(new FreeRealmHistory());
        realm.setWorldMap(new WorldMap());
        realm.setPathFinder(null);
        realm.setNumberOfTurns(0);
        realm.setManagedObjectCount(0);
View Full Code Here


        xml.append("</relations>\n");
        return xml.toString();
    }

    public Diplomacy initializeFromNode(Realm realm, Node node) {
        Diplomacy diplomacy = new Diplomacy();
        Node tileTypesNode = XMLConverterUtility.findNode(node, "relations");
        for (Node subNode = tileTypesNode.getFirstChild(); subNode != null; subNode = subNode.getNextSibling()) {
            if (subNode.getNodeType() == Node.ELEMENT_NODE) {
                int player1Id = Integer.parseInt(XMLConverterUtility.findNode(subNode, "player1").getFirstChild().getNodeValue());
                int player2Id = Integer.parseInt(XMLConverterUtility.findNode(subNode, "player2").getFirstChild().getNodeValue());
                int status = Integer.parseInt(XMLConverterUtility.findNode(subNode, "status").getFirstChild().getNodeValue());
                Player player1 = realm.getPlayerManager().getPlayer(player1Id);
                Player player2 = realm.getPlayerManager().getPlayer(player2Id);
                diplomacy.addPlayerRelation(player1, player2, status);
            }
        }
        return diplomacy;
    }
View Full Code Here

        PlayerManager playerManager = new PlayerManager();
        (new PlayerManagerXMLWrapper(playerManager)).initializeFromNode(realm, playersNode);
        realm.setPlayerManager(playerManager);

        Node diplomacyNode = XMLConverterUtility.findNode(node, "diplomacy");
        Diplomacy diplomacy = (new DiplomacyXMLConverter()).initializeFromNode(realm, diplomacyNode);
        realm.setDiplomacy(diplomacy);

        Node historyNode = XMLConverterUtility.findNode(node, "history");
        History history = (new FreeRealmHistoryXMLConverter()).initializeFromNode(realm, historyNode);
        realm.setHistory(history);
View Full Code Here

        NationManager nationManager = new NationManager();
        (new NationManagerXMLWrapper(nationManager)).initializeFromNode(realm, getRootNodeFromFile(configProperties.getProperty("nations_filename")));
        realm.setNationManager(nationManager);
        realm.setPlayerManager(new PlayerManager());
        realm.setDiplomacy(new Diplomacy());
        realm.setNumberOfTurns(0);
        realm.setHistory(new FreeRealmHistory());
    }
View Full Code Here

TOP

Related Classes of org.freerealm.diplomacy.Diplomacy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.