public void fortify() {
		Countries c = map.getCountries();

		// there are no troops to fortify
		if (c.getTroops(c.getAttacker()) == 1) {
			return;
		}

		// get amount of fortifiers
		boolean stop = false;
		int fortification;
		do {
			String fortification_String;
			do {
				fortification_String = JOptionPane.showInputDialog(
						map.getFrame(),
						"How many units do you want to send as fortification?",
						c.getTroops(c.getAttacker()) - 1);

				// cancel was clicked
				if (fortification_String == null) {
					stop = true;
					fortification_String = "0";
				}

				// while not cancelled and not numeric
			} while (!stop && !Functions.isNumeric(fortification_String));

			fortification = Integer.parseInt(fortification_String);

			// while not cancelled and fortification amount too high or too low
		} while (!stop
				&& (fortification < 0
						|| fortification >= c.getTroops(c.getAttacker()) || fortification < 0));

		// move the fortifiers
		if (fortification != 0) {
			sendreceive("fortification:" + c.getAttacker() + ":"
					+ c.getDefender() + ":" + fortification);
			c.removeAttacker();
			endTurn();
		}
	}