public WindowCastle(core.Player p, core.Castle c, core.Hero h)
	{
		super();
		
		//setStyleSheet("background-color: #333; color: white;");
		
		player = p;
		castle = c;
		hero = h;
		Hero g = c.getGarission();
		
		setLayout(layout);
		buyWidget.setLayout(buyLayout);
		
		buys[0] = new WidgetBuy(p, c, core.CastleBuilding.CITY_COUNCIL);
		buyLayout.addWidget(buys[0], 1, 1, AlignmentFlag.AlignTop);
		buys[1] = new WidgetBuy(p, c, core.CastleBuilding.TOWN_HALL);
		buyLayout.addWidget(buys[1], 1, 2, AlignmentFlag.AlignTop);
		buys[2] = new WidgetBuy(p, c, core.CastleBuilding.CAPITOL);
		buyLayout.addWidget(buys[2], 1, 3, AlignmentFlag.AlignTop);
		
		buys[3] = new WidgetBuy(p, c, core.CastleBuilding.FORT);
		buyLayout.addWidget(buys[3], 2, 1, AlignmentFlag.AlignTop);
		buys[4] = new WidgetBuy(p, c, core.CastleBuilding.CITADEL);
		buyLayout.addWidget(buys[4], 2, 2, AlignmentFlag.AlignTop);
		buys[5] = new WidgetBuy(p, c, core.CastleBuilding.CASTLE);
		buyLayout.addWidget(buys[5], 2, 3, AlignmentFlag.AlignTop);
		
		buys[6] = new WidgetBuy(p, c, core.CastleBuilding.getTier(1, c.getType()));
		buyLayout.addWidget(buys[6], 3, 1, AlignmentFlag.AlignTop);
		
		recruits[0] = new WidgetRecruit(p, c, g, core.UnitType.getTier(1, c.getType()));
		buyLayout.addWidget(recruits[0], 3, 2, 3, 3, AlignmentFlag.AlignTop);
		
		buys[7] = new WidgetBuy(p, c, core.CastleBuilding.getTier(2, c.getType()));
		buyLayout.addWidget(buys[7], 4, 1, AlignmentFlag.AlignTop);
		
		recruits[1] = new WidgetRecruit(p, c, g, core.UnitType.getTier(2, c.getType()));
		buyLayout.addWidget(recruits[1], 4, 2, 4, 3, AlignmentFlag.AlignTop);
		
		buys[8] = new WidgetBuy(p, c, core.CastleBuilding.getTier(3, c.getType()));
		buyLayout.addWidget(buys[8], 5, 1, AlignmentFlag.AlignTop);
		
		recruits[2] = new WidgetRecruit(p, c, g, core.UnitType.getTier(3, c.getType()));
		buyLayout.addWidget(recruits[2], 5, 2, 5, 3, AlignmentFlag.AlignTop);
		
		buys[9] = new WidgetBuy(p, c, core.CastleBuilding.getTier(4, c.getType()));
		buyLayout.addWidget(buys[9], 6, 1, AlignmentFlag.AlignTop);
		
		recruits[3] = new WidgetRecruit(p, c, g, core.UnitType.getTier(4, c.getType()));
		buyLayout.addWidget(recruits[3], 6, 2, 6, 3, AlignmentFlag.AlignTop);
		
		QScrollArea scroll = new QScrollArea();
		scroll.setWidget(buyWidget);
		scroll.setWidgetResizable(true);
		scroll.setSizePolicy(Policy.MinimumExpanding, Policy.MinimumExpanding);
		
		layout.addWidget(scroll);
		layout.addLayout(bottomLayout);
		units = new WidgetUnits(g.getUnits(), h==null ? null : h.getUnits(), g, h);
		bottomLayout.addWidget(units);
		
		QFormLayout statusLayout = new QFormLayout();
		//statusLayout.addRow("Dzień:", statusDay);
		statusLayout.setMargin(10);
		//statusLayout.addRow("", new QLabel());
		statusLayout.addRow("Gracz:", new QLabel(player.getName()));
		statusLayout.addRow("Złoto:", statusGold);
		statusLayout.addRow("Kamień:", statusOre);
		statusLayout.addRow("Drewno:", statusWood);
		
		
		
		for (int i=0; i<buys.length; ++i) {
			buys[i].buyed.connect(this,"buyed()");
		}
		
		for (int i=0; i<recruits.length; ++i) {
			recruits[i].recruited.connect(this,"recruited()");
		}
		
		QVBoxLayout buttonsLayout = new QVBoxLayout();
		buttonsLayout.setMargin(10);
		
		buttonsLayout.setWidgetSpacing(0);
		buttonsLayout.addWidget(exit);
		buttonsLayout.addWidget(newHero);
		buttonsLayout.addWidget(oldHero);
		buttonsLayout.addWidget(market);
		//buttonsLayout.addWidget(new QLabel());
		//buttonsLayout.addStretch();
		
		
		//statusLayout.addRow(exit);
		
		
		bottomLayout.addLayout(buttonsLayout);
		bottomLayout.addLayout(statusLayout);
		bottomLayout.addStretch();
		
		exit.clicked.connect(this, "exit()");
		market.clicked.connect(this, "market()");
		newHero.clicked.connect(this, "recruitHero()");
		oldHero.clicked.connect(this, "resurectHero()");
		
		oldHero.setMinimumSize(150, 20);
		newHero.setMinimumSize(150, 20);
		exit.setMinimumSize(150, 20);
		market.setMinimumSize(150, 20);
		updateResources();
	}