@Override
    protected void toXMLImpl(XMLStreamWriter out, Player player,
                             boolean showAll, boolean toSavedGame)
        throws XMLStreamException {
        PlayerExploredTile pet;

        out.writeStartElement(getXMLElementTagName());

        super.writeAttributes(out);
        out.writeAttribute("established", Integer.toString(established.getNumber()));
        if (showAll || toSavedGame || player.owns(this)) {
            out.writeAttribute("sonsOfLiberty", Integer.toString(sonsOfLiberty));
            out.writeAttribute("oldSonsOfLiberty", Integer.toString(oldSonsOfLiberty));
            out.writeAttribute("tories", Integer.toString(tories));
            out.writeAttribute("oldTories", Integer.toString(oldTories));
            out.writeAttribute("liberty", Integer.toString(liberty));
            out.writeAttribute("immigration", Integer.toString(immigration));
            out.writeAttribute("productionBonus", Integer.toString(productionBonus));
            out.writeAttribute("landLocked", Boolean.toString(landLocked));

        } else if ((pet = getTile().getPlayerExploredTile(player)) != null) {
            if (pet.getColonyUnitCount() > 0) {
                out.writeAttribute("unitCount",
                    Integer.toString(pet.getColonyUnitCount()));
            }
            if (pet.getColonyStockadeKey() != null) {
                out.writeAttribute("stockadeKey",
                    pet.getColonyStockadeKey());
            }
        }

        writeChildren(out, player, showAll, toSavedGame);

        out.writeEndElement();
    }