private void createUnits() {

		ArrayList<Building> buildings = g.map.getPlayersBuildings(this);
		boolean hasMoney = true;
		while (hasMoney) {

			for (Building building : buildings) {
				if (building instanceof Factory) {
					((Factory) building).recruitTank(g.map, building.getCell(),
							true);
				}
				if (building instanceof Barracks) {
					((Barracks) building).recruitMarine(g.map,
							building.getCell(), true);
				}
			}

			if (buildings.contains(Barracks.class)) {
				hasMoney = this.getMoney() >= Marine.cost;
			} else if (buildings.contains(Factory.class)) {
				hasMoney = this.getMoney() >= Tank.cost;
			} else {
				hasMoney = false;
			}
		}

	}