mirror of https://github.com/FreeCol/freecol.git
Remove static Specification from gui/panel.
This commit is contained in:
parent
a5529994ab
commit
e392475299
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
||||||
|
|
||||||
<langpack>
|
|
||||||
<!-- PACKS -->
|
|
||||||
<str id="FreeCol" txt="FreeCol" />
|
|
||||||
<str id="FreeCol.description" txt="Skedarët e lojës dhe materialeve të FreeCol-it." />
|
|
||||||
|
|
||||||
<str id="GameManual" txt="Manuali i lojës" />
|
|
||||||
<str id="GameManual.description" txt="Kjo paketë përmban manualin zyrtar të lojës(vetëm në anglisht)." />
|
|
||||||
|
|
||||||
<str id="SourceCode" txt="Kodi Burim" />
|
|
||||||
<str id="SourceCode.description" txt="Kodi Burim që përdoret për të ndërtuar këtë version të shpërndarjes së lojës. Këto skedarë janë për zhvilluesit dhe nuk i japin funksione shtesë lojës." />
|
|
||||||
|
|
||||||
<str id="Music" txt="Muzika" />
|
|
||||||
<str id="Music.description" txt="Muzika brenda lojës." />
|
|
||||||
|
|
||||||
<str id="SoundEffects" txt="Efekte zanore" />
|
|
||||||
<str id="SoundEffects.description" txt="Efekte zanore brenda lojës." />
|
|
||||||
|
|
||||||
<str id="MovieClips" txt="Filma të shkurtër" />
|
|
||||||
<str id="MovieClips.description" txt="Kjo paketë përmban filma të shkurtër që luhen në raste të veçanta gjatë lojës." />
|
|
||||||
<str id="MovieClips.description2" txt="Kjo paketë përmban filma të shkurtër që luhen në raste të veçanta gjatë lojës. Nëse e aktivizoni këtë paketë filmat e shkurtër do të instalohen në kompjuterin Tuaj. Mundësia tjetër është ti luani këto filma të shkurtër direkt nga CD/DVD-ja e lojës." />
|
|
||||||
|
|
||||||
|
|
||||||
<!-- OTHER -->
|
|
||||||
<str id="Location.Web" txt="Skedarët nuk janë të përfshirë në këtë instalues dhe do të shkarkohen automatikisht nga faqja e internetit e FreeCol-it nëse e aktivizoni këtë paketë." />
|
|
||||||
|
|
||||||
<str id="FreeColLanguage" txt="Ju lutemi, zgjidhni gjuhën që do të përdoret brenda lojës:" />
|
|
||||||
<str id="FreeColLanguage.autodetect" txt="Dalloje automatikisht kur të hapet loja" />
|
|
||||||
<str id="FreeColLanguage.description" txt="Ju mund ta ndryshoni këtë përzgjedhje më vonë duke përdorur menynë e Alternativave brenda lojës." />
|
|
||||||
|
|
||||||
<str id="UserFiles" txt="Ju lutemi, zgjidhni ku dëshironi ti vendosni përzgjedhjet Tuaja dhe lojërat e ruajtura:" />
|
|
||||||
<str id="UserFiles.home" txt="Në direktorinë Tuaj bazë" />
|
|
||||||
<str id="UserFiles.freecol" txt="Në direktorinë ku është instaluar FreeCol(vetëm për instalimin për një përdorues)" />
|
|
||||||
<str id="UserFiles.other" txt="Specifikoni një direktori tjetër" />
|
|
||||||
</langpack>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?>
|
|
||||||
|
|
||||||
<langpack>
|
|
||||||
<!-- PACKS -->
|
|
||||||
<str id="FreeCol" txt="FreeCol" />
|
|
||||||
<str id="FreeCol.description" txt="Dat FreeCol-Programm un Daten." />
|
|
||||||
|
|
||||||
<str id="GameManual" txt="Handbook to dat Speel" />
|
|
||||||
<str id="GameManual.description" txt="In dit Paket is dat Handbook to dat Speel in (blot op Engelsch)." />
|
|
||||||
|
|
||||||
<str id="SourceCode" txt="Bornkood" />
|
|
||||||
<str id="SourceCode.description" txt="De Bornkood för dat Kumpileren vun dat Programm. Disse Datein warrt blots vun Programmbastlers bruukt un bringt nix för dat Speel." />
|
|
||||||
|
|
||||||
<str id="Music" txt="Musik" />
|
|
||||||
<str id="Music.description" txt="De Achtergrundmusik för dat Speel." />
|
|
||||||
|
|
||||||
<str id="SoundEffects" txt="Kläng" />
|
|
||||||
<str id="SoundEffects.description" txt="De Kläng, de in dat Speel bruukt warrt." />
|
|
||||||
|
|
||||||
<str id="MovieClips" txt="Filmen" />
|
|
||||||
<str id="MovieClips.description" txt="In dit Paket sünd Filmen, de bi welk Begeevnissen in't Speel afspeelt warrt." />
|
|
||||||
<str id="MovieClips.description2" txt="In dit Paket sünd Filmen, de bi welk Begeevnissen in't Speel afspeelt warrt. Wenn dit Paket utwählt warrt, denn warrt de Filmen op dien Reekner spiekert. Ans warrt de Filmen direkt vun de Speel-CD/DVD afspeelt." />
|
|
||||||
|
|
||||||
|
|
||||||
<!-- OTHER -->
|
|
||||||
<str id="Location.Web" txt="De Datein sünd nich bi dit Installatschoonspaket mit bi un warrt automaatsch vun de FreeCol-Websteed haalt, wenn dit Paket utwählt warrt." />
|
|
||||||
|
|
||||||
<str id="FreeColLanguage" txt="Spraak utwählen, de in dat Speel bruukt warrn schall:" />
|
|
||||||
<str id="FreeColLanguage.autodetect" txt="Automaatsch bi'n Speelstart" />
|
|
||||||
<str id="FreeColLanguage.description" txt="Du kannst disse Instellung ok later in dat Instellungsmenü in't Speel ännern." />
|
|
||||||
|
|
||||||
<str id="UserFiles" txt="Spiekerplatz för Instellungen un Speelstänn utwählen:" />
|
|
||||||
<str id="UserFiles.home" txt="Home-Ordner vun'n Bruker" />
|
|
||||||
<str id="UserFiles.freecol" txt="Ordner för FreeCol (blot för Een-Bruker-Installatschoon)" />
|
|
||||||
<str id="UserFiles.other" txt="Annern Ordner angeven" />
|
|
||||||
</langpack>
|
|
|
@ -114,6 +114,7 @@ import net.sf.freecol.common.model.Map.Direction;
|
||||||
import net.sf.freecol.common.model.ModelMessage;
|
import net.sf.freecol.common.model.ModelMessage;
|
||||||
import net.sf.freecol.common.model.Player;
|
import net.sf.freecol.common.model.Player;
|
||||||
import net.sf.freecol.common.model.Settlement;
|
import net.sf.freecol.common.model.Settlement;
|
||||||
|
import net.sf.freecol.common.model.Specification;
|
||||||
import net.sf.freecol.common.model.StringTemplate;
|
import net.sf.freecol.common.model.StringTemplate;
|
||||||
import net.sf.freecol.common.model.Tile;
|
import net.sf.freecol.common.model.Tile;
|
||||||
import net.sf.freecol.common.model.TradeRoute;
|
import net.sf.freecol.common.model.TradeRoute;
|
||||||
|
@ -1668,6 +1669,15 @@ public final class Canvas extends JDesktopPane {
|
||||||
return freeColClient;
|
return freeColClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describe <code>getSpecification</code> method here.
|
||||||
|
*
|
||||||
|
* @return a <code>Specification</code> value
|
||||||
|
*/
|
||||||
|
public Specification getSpecification() {
|
||||||
|
return freeColClient.getGame().getSpecification();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a quit dialog and, if desired, logs out of the current game and
|
* Displays a quit dialog and, if desired, logs out of the current game and
|
||||||
* shows the new game panel.
|
* shows the new game panel.
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class NewEmptyMapAction extends MapboardAction {
|
||||||
final Canvas canvas = getFreeColClient().getCanvas();
|
final Canvas canvas = getFreeColClient().getCanvas();
|
||||||
final Game game = freeColClient.getGame();
|
final Game game = freeColClient.getGame();
|
||||||
|
|
||||||
Dimension size = canvas.showFreeColDialog(FreeColDialog.createMapSizeDialog());
|
Dimension size = canvas.showFreeColDialog(FreeColDialog.createMapSizeDialog(canvas));
|
||||||
if (size == null) {
|
if (size == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
package net.sf.freecol.client.gui.panel;
|
package net.sf.freecol.client.gui.panel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import javax.swing.DefaultCellEditor;
|
import javax.swing.DefaultCellEditor;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.client.gui.plaf.FreeColComboBoxRenderer;
|
import net.sf.freecol.client.gui.plaf.FreeColComboBoxRenderer;
|
||||||
import net.sf.freecol.common.model.EuropeanNationType;
|
import net.sf.freecol.common.model.EuropeanNationType;
|
||||||
|
@ -42,8 +42,8 @@ public final class AdvantageCellEditor extends DefaultCellEditor {
|
||||||
/**
|
/**
|
||||||
* A standard constructor.
|
* A standard constructor.
|
||||||
*/
|
*/
|
||||||
public AdvantageCellEditor() {
|
public AdvantageCellEditor(List<EuropeanNationType> nationTypes) {
|
||||||
super(new JComboBox(new Vector<EuropeanNationType>(FreeCol.getSpecification().getEuropeanNationTypes())));
|
super(new JComboBox(new Vector<EuropeanNationType>(nationTypes)));
|
||||||
((JComboBox) getComponent()).setRenderer(new AdvantageRenderer());
|
((JComboBox) getComponent()).setRenderer(new AdvantageRenderer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,6 @@ import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.plaf.FreeColComboBoxRenderer;
|
import net.sf.freecol.client.gui.plaf.FreeColComboBoxRenderer;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.common.model.Ability;
|
import net.sf.freecol.common.model.Ability;
|
||||||
import net.sf.freecol.common.model.AbstractGoods;
|
import net.sf.freecol.common.model.AbstractGoods;
|
||||||
import net.sf.freecol.common.model.BuildableType;
|
import net.sf.freecol.common.model.BuildableType;
|
||||||
|
@ -116,16 +115,7 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
|
||||||
* A list of unit types that can be build. Most unit types are
|
* A list of unit types that can be build. Most unit types are
|
||||||
* human and can never be built.
|
* human and can never be built.
|
||||||
*/
|
*/
|
||||||
private static final List<UnitType> buildableUnits = new ArrayList<UnitType>();
|
private List<UnitType> buildableUnits = new ArrayList<UnitType>();
|
||||||
|
|
||||||
static {
|
|
||||||
for (UnitType unitType : FreeCol.getSpecification().getUnitTypeList()) {
|
|
||||||
if (!unitType.getGoodsRequired().isEmpty()) {
|
|
||||||
// can be built
|
|
||||||
buildableUnits.add(unitType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BuildQueuePanel(Colony colony, Canvas parent) {
|
public BuildQueuePanel(Colony colony, Canvas parent) {
|
||||||
|
|
||||||
|
@ -133,6 +123,13 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
|
||||||
this.colony = colony;
|
this.colony = colony;
|
||||||
this.unitCount = colony.getUnitCount();
|
this.unitCount = colony.getUnitCount();
|
||||||
|
|
||||||
|
for (UnitType unitType : getSpecification().getUnitTypeList()) {
|
||||||
|
if (!unitType.getGoodsRequired().isEmpty()) {
|
||||||
|
// can be built
|
||||||
|
buildableUnits.add(unitType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DefaultListModel current = new DefaultListModel();
|
DefaultListModel current = new DefaultListModel();
|
||||||
for (BuildableType type : colony.getBuildQueue()) {
|
for (BuildableType type : colony.getBuildQueue()) {
|
||||||
current.addElement(type);
|
current.addElement(type);
|
||||||
|
@ -256,7 +253,7 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
|
||||||
.hasAbility("model.ability.build", unitType, getGame().getTurn())
|
.hasAbility("model.ability.build", unitType, getGame().getTurn())
|
||||||
|| featureContainer.hasAbility("model.ability.build", unitType))) {
|
|| featureContainer.hasAbility("model.ability.build", unitType))) {
|
||||||
boolean builderFound = false;
|
boolean builderFound = false;
|
||||||
for (Ability ability : FreeCol.getSpecification().getAbilities("model.ability.build")) {
|
for (Ability ability : getSpecification().getAbilities("model.ability.build")) {
|
||||||
if (ability.appliesTo(unitType)
|
if (ability.appliesTo(unitType)
|
||||||
&& ability.getValue()
|
&& ability.getValue()
|
||||||
&& ability.getSource() != null
|
&& ability.getSource() != null
|
||||||
|
@ -276,7 +273,7 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
|
||||||
for (Entry<String, Boolean> entry : requiredAbilities.entrySet()) {
|
for (Entry<String, Boolean> entry : requiredAbilities.entrySet()) {
|
||||||
if (colony.hasAbility(entry.getKey()) != entry.getValue()
|
if (colony.hasAbility(entry.getKey()) != entry.getValue()
|
||||||
&& featureContainer.hasAbility(entry.getKey()) != entry.getValue()) {
|
&& featureContainer.hasAbility(entry.getKey()) != entry.getValue()) {
|
||||||
List<FreeColGameObjectType> sources = FreeCol.getSpecification()
|
List<FreeColGameObjectType> sources = getSpecification()
|
||||||
.getTypesProviding(entry.getKey(), entry.getValue());
|
.getTypesProviding(entry.getKey(), entry.getValue());
|
||||||
if (sources.isEmpty()) {
|
if (sources.isEmpty()) {
|
||||||
// no type provides the required ability
|
// no type provides the required ability
|
||||||
|
@ -303,7 +300,7 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
|
||||||
DefaultListModel buildings = (DefaultListModel) buildingList.getModel();
|
DefaultListModel buildings = (DefaultListModel) buildingList.getModel();
|
||||||
DefaultListModel current = (DefaultListModel) buildQueueList.getModel();
|
DefaultListModel current = (DefaultListModel) buildQueueList.getModel();
|
||||||
buildings.clear();
|
buildings.clear();
|
||||||
loop: for (BuildingType buildingType : FreeCol.getSpecification().getBuildingTypeList()) {
|
loop: for (BuildingType buildingType : getSpecification().getBuildingTypeList()) {
|
||||||
// compare colony.getNoBuildReason()
|
// compare colony.getNoBuildReason()
|
||||||
List<String> lockReason = new ArrayList<String>();
|
List<String> lockReason = new ArrayList<String>();
|
||||||
Building colonyBuilding = colony.getBuilding(buildingType);
|
Building colonyBuilding = colony.getBuilding(buildingType);
|
||||||
|
@ -330,7 +327,7 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
|
||||||
for (Entry<String, Boolean> entry : requiredAbilities.entrySet()) {
|
for (Entry<String, Boolean> entry : requiredAbilities.entrySet()) {
|
||||||
if (colony.hasAbility(entry.getKey()) != entry.getValue()
|
if (colony.hasAbility(entry.getKey()) != entry.getValue()
|
||||||
&& featureContainer.hasAbility(entry.getKey()) != entry.getValue()) {
|
&& featureContainer.hasAbility(entry.getKey()) != entry.getValue()) {
|
||||||
List<FreeColGameObjectType> sources = FreeCol.getSpecification()
|
List<FreeColGameObjectType> sources = getSpecification()
|
||||||
.getTypesProviding(entry.getKey(), entry.getValue());
|
.getTypesProviding(entry.getKey(), entry.getValue());
|
||||||
if (sources.isEmpty()) {
|
if (sources.isEmpty()) {
|
||||||
// no type provides the required ability
|
// no type provides the required ability
|
||||||
|
|
|
@ -63,7 +63,6 @@ import javax.swing.SwingUtilities;
|
||||||
import javax.swing.border.BevelBorder;
|
import javax.swing.border.BevelBorder;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.ClientOptions;
|
import net.sf.freecol.client.ClientOptions;
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.GUI;
|
import net.sf.freecol.client.gui.GUI;
|
||||||
|
@ -507,11 +506,11 @@ public final class ColonyPanel extends FreeColPanel implements ActionListener,Pr
|
||||||
public void updateProductionPanel() {
|
public void updateProductionPanel() {
|
||||||
rightProductionPanel.removeAll();
|
rightProductionPanel.removeAll();
|
||||||
|
|
||||||
GoodsType grain = Specification.getSpecification().getGoodsType("model.goods.food");
|
GoodsType grain = getSpecification().getGoodsType("model.goods.food");
|
||||||
int food = 0;
|
int food = 0;
|
||||||
|
|
||||||
List<AbstractGoods> foodProduction = new ArrayList<AbstractGoods>();
|
List<AbstractGoods> foodProduction = new ArrayList<AbstractGoods>();
|
||||||
for (GoodsType goodsType : Specification.getSpecification().getGoodsTypeList()) {
|
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
|
||||||
int production = colony.getProductionOf(goodsType);
|
int production = colony.getProductionOf(goodsType);
|
||||||
if (production != 0) {
|
if (production != 0) {
|
||||||
if (goodsType.isFoodType()) {
|
if (goodsType.isFoodType()) {
|
||||||
|
@ -1154,7 +1153,7 @@ public final class ColonyPanel extends FreeColPanel implements ActionListener,Pr
|
||||||
|
|
||||||
private void update() {
|
private void update() {
|
||||||
removeAll();
|
removeAll();
|
||||||
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
|
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
|
||||||
if (goodsType.isStorable()) {
|
if (goodsType.isStorable()) {
|
||||||
Goods goods = colony.getGoodsContainer().getGoods(goodsType);
|
Goods goods = colony.getGoodsContainer().getGoods(goodsType);
|
||||||
if (goods.getAmount() >= getClient().getClientOptions()
|
if (goods.getAmount() >= getClient().getClientOptions()
|
||||||
|
|
|
@ -327,7 +327,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
private void buildTerrainSubtree(DefaultMutableTreeNode parent) {
|
private void buildTerrainSubtree(DefaultMutableTreeNode parent) {
|
||||||
for (TileType t : Specification.getSpecification().getTileTypeList()) {
|
for (TileType t : getSpecification().getTileTypeList()) {
|
||||||
buildTerrainItem(t, parent);
|
buildTerrainItem(t, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
private void buildResourceSubtree(DefaultMutableTreeNode parent) {
|
private void buildResourceSubtree(DefaultMutableTreeNode parent) {
|
||||||
for (ResourceType r : Specification.getSpecification().getResourceTypeList()) {
|
for (ResourceType r : getSpecification().getResourceTypeList()) {
|
||||||
buildResourceItem(r, parent);
|
buildResourceItem(r, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
private void buildUnitSubtree(DefaultMutableTreeNode parent) {
|
private void buildUnitSubtree(DefaultMutableTreeNode parent) {
|
||||||
for (UnitType u : Specification.getSpecification().getUnitTypeList()) {
|
for (UnitType u : getSpecification().getUnitTypeList()) {
|
||||||
if (u.getSkill() <= 0 ||
|
if (u.getSkill() <= 0 ||
|
||||||
u.hasAbility("model.ability.expertSoldier")) {
|
u.hasAbility("model.ability.expertSoldier")) {
|
||||||
buildUnitItem(u, 0.5f, parent);
|
buildUnitItem(u, 0.5f, parent);
|
||||||
|
@ -360,7 +360,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
private void buildGoodsSubtree(DefaultMutableTreeNode parent) {
|
private void buildGoodsSubtree(DefaultMutableTreeNode parent) {
|
||||||
for (GoodsType g : Specification.getSpecification().getGoodsTypeList()) {
|
for (GoodsType g : getSpecification().getGoodsTypeList()) {
|
||||||
buildGoodsItem(g, parent);
|
buildGoodsItem(g, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
private void buildSkillsSubtree(DefaultMutableTreeNode parent) {
|
private void buildSkillsSubtree(DefaultMutableTreeNode parent) {
|
||||||
for (UnitType u : Specification.getSpecification().getUnitTypeList()) {
|
for (UnitType u : getSpecification().getUnitTypeList()) {
|
||||||
if (u.getSkill() > 0) {
|
if (u.getSkill() > 0) {
|
||||||
buildUnitItem(u, 0.5f, parent);
|
buildUnitItem(u, 0.5f, parent);
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
List<BuildingType> buildingTypes = new ArrayList<BuildingType>();
|
List<BuildingType> buildingTypes = new ArrayList<BuildingType>();
|
||||||
Map<BuildingType, DefaultMutableTreeNode> buildingHash =
|
Map<BuildingType, DefaultMutableTreeNode> buildingHash =
|
||||||
new HashMap<BuildingType, DefaultMutableTreeNode>();
|
new HashMap<BuildingType, DefaultMutableTreeNode>();
|
||||||
for (BuildingType buildingType : Specification.getSpecification().getBuildingTypeList()) {
|
for (BuildingType buildingType : getSpecification().getBuildingTypeList()) {
|
||||||
if (buildingType.getUpgradesFrom() == null) {
|
if (buildingType.getUpgradesFrom() == null) {
|
||||||
String name = Messages.message(buildingType.getNameKey());
|
String name = Messages.message(buildingType.getNameKey());
|
||||||
DefaultMutableTreeNode item =
|
DefaultMutableTreeNode item =
|
||||||
|
@ -431,7 +431,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
for (FoundingFatherType fatherType : FoundingFatherType.values()) {
|
for (FoundingFatherType fatherType : FoundingFatherType.values()) {
|
||||||
fathersByType.put(fatherType, new ArrayList<FoundingFather>());
|
fathersByType.put(fatherType, new ArrayList<FoundingFather>());
|
||||||
}
|
}
|
||||||
for (FoundingFather foundingFather : Specification.getSpecification().getFoundingFathers()) {
|
for (FoundingFather foundingFather : getSpecification().getFoundingFathers()) {
|
||||||
fathersByType.get(foundingFather.getType()).add(foundingFather);
|
fathersByType.get(foundingFather.getType()).add(foundingFather);
|
||||||
}
|
}
|
||||||
for (FoundingFatherType fatherType : FoundingFatherType.values()) {
|
for (FoundingFatherType fatherType : FoundingFatherType.values()) {
|
||||||
|
@ -451,10 +451,10 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
private void buildNationsSubtree(DefaultMutableTreeNode parent) {
|
private void buildNationsSubtree(DefaultMutableTreeNode parent) {
|
||||||
for (Nation type : Specification.getSpecification().getEuropeanNations()) {
|
for (Nation type : getSpecification().getEuropeanNations()) {
|
||||||
buildNationItem(type, parent);
|
buildNationItem(type, parent);
|
||||||
}
|
}
|
||||||
for (Nation type : Specification.getSpecification().getIndianNations()) {
|
for (Nation type : getSpecification().getIndianNations()) {
|
||||||
buildNationItem(type, parent);
|
buildNationItem(type, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -465,9 +465,9 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
*/
|
*/
|
||||||
private void buildNationTypesSubtree(DefaultMutableTreeNode parent) {
|
private void buildNationTypesSubtree(DefaultMutableTreeNode parent) {
|
||||||
List<NationType> nations = new ArrayList<NationType>();
|
List<NationType> nations = new ArrayList<NationType>();
|
||||||
nations.addAll(Specification.getSpecification().getEuropeanNationTypes());
|
nations.addAll(getSpecification().getEuropeanNationTypes());
|
||||||
nations.addAll(Specification.getSpecification().getREFNationTypes());
|
nations.addAll(getSpecification().getREFNationTypes());
|
||||||
nations.addAll(Specification.getSpecification().getIndianNationTypes());
|
nations.addAll(getSpecification().getIndianNationTypes());
|
||||||
for (NationType type : nations) {
|
for (NationType type : nations) {
|
||||||
buildNationTypeItem(type, parent);
|
buildNationTypeItem(type, parent);
|
||||||
}
|
}
|
||||||
|
@ -723,7 +723,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
List<String> scopeStrings = new ArrayList<String>();
|
List<String> scopeStrings = new ArrayList<String>();
|
||||||
for (Scope scope : modifier.getScopes()) {
|
for (Scope scope : modifier.getScopes()) {
|
||||||
if (scope.getType() != null) {
|
if (scope.getType() != null) {
|
||||||
FreeColGameObjectType objectType = Specification.getSpecification()
|
FreeColGameObjectType objectType = getSpecification()
|
||||||
.getType(scope.getType());
|
.getType(scope.getType());
|
||||||
scopeStrings.add(Messages.message(objectType.getNameKey()));
|
scopeStrings.add(Messages.message(objectType.getNameKey()));
|
||||||
}
|
}
|
||||||
|
@ -733,7 +733,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GoodsType goodsType = Specification.getSpecification().getGoodsType(modifier.getId());
|
GoodsType goodsType = getSpecification().getGoodsType(modifier.getId());
|
||||||
JButton goodsButton = getGoodsButton(goodsType, text);
|
JButton goodsButton = getGoodsButton(goodsType, text);
|
||||||
goodsPanel.add(goodsButton);
|
goodsPanel.add(goodsButton);
|
||||||
}
|
}
|
||||||
|
@ -784,7 +784,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
detailPanel.add(new JLabel(Integer.toString(type.getSkill())));
|
detailPanel.add(new JLabel(Integer.toString(type.getSkill())));
|
||||||
|
|
||||||
List<BuildingType> schools = new ArrayList<BuildingType>();
|
List<BuildingType> schools = new ArrayList<BuildingType>();
|
||||||
for (final BuildingType buildingType : Specification.getSpecification().getBuildingTypeList()) {
|
for (final BuildingType buildingType : getSpecification().getBuildingTypeList()) {
|
||||||
if (buildingType.hasAbility("model.ability.teach") &&
|
if (buildingType.hasAbility("model.ability.teach") &&
|
||||||
buildingType.canAdd(type)) {
|
buildingType.canAdd(type)) {
|
||||||
schools.add(buildingType);
|
schools.add(buildingType);
|
||||||
|
@ -834,7 +834,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Modifier> bonusList = new ArrayList<Modifier>();
|
List<Modifier> bonusList = new ArrayList<Modifier>();
|
||||||
for (GoodsType goodsType : Specification.getSpecification().getGoodsTypeList()) {
|
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
|
||||||
bonusList.addAll(type.getModifierSet(goodsType.getId()));
|
bonusList.addAll(type.getModifierSet(goodsType.getId()));
|
||||||
}
|
}
|
||||||
int bonusNumber = bonusList.size();
|
int bonusNumber = bonusList.size();
|
||||||
|
@ -844,7 +844,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
JPanel productionPanel = new JPanel(new GridLayout(0, MODIFIERS_PER_ROW));
|
JPanel productionPanel = new JPanel(new GridLayout(0, MODIFIERS_PER_ROW));
|
||||||
productionPanel.setOpaque(false);
|
productionPanel.setOpaque(false);
|
||||||
for (Modifier productionBonus : bonusList) {
|
for (Modifier productionBonus : bonusList) {
|
||||||
GoodsType goodsType = Specification.getSpecification().getGoodsType(productionBonus.getId());
|
GoodsType goodsType = getSpecification().getGoodsType(productionBonus.getId());
|
||||||
String bonus = getModifierAsString(productionBonus);
|
String bonus = getModifierAsString(productionBonus);
|
||||||
productionPanel.add(getGoodsButton(goodsType, bonus));
|
productionPanel.add(getGoodsButton(goodsType, bonus));
|
||||||
}
|
}
|
||||||
|
@ -901,7 +901,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
List<TileImprovementType> improvements = new ArrayList<TileImprovementType>();
|
List<TileImprovementType> improvements = new ArrayList<TileImprovementType>();
|
||||||
List<Modifier> modifiers = new ArrayList<Modifier>();
|
List<Modifier> modifiers = new ArrayList<Modifier>();
|
||||||
for (TileImprovementType improvementType :
|
for (TileImprovementType improvementType :
|
||||||
Specification.getSpecification().getTileImprovementTypeList()) {
|
getSpecification().getTileImprovementTypeList()) {
|
||||||
Modifier productionModifier = improvementType.getProductionModifier(type);
|
Modifier productionModifier = improvementType.getProductionModifier(type);
|
||||||
if (productionModifier != null) {
|
if (productionModifier != null) {
|
||||||
improvements.add(improvementType);
|
improvements.add(improvementType);
|
||||||
|
@ -1029,7 +1029,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
JPanel production = new JPanel();
|
JPanel production = new JPanel();
|
||||||
production.setOpaque(false);
|
production.setOpaque(false);
|
||||||
production.setLayout(new MigLayout("wrap 3, gapx 20", "", ""));
|
production.setLayout(new MigLayout("wrap 3, gapx 20", "", ""));
|
||||||
for (UnitType unitType2 : Specification.getSpecification().getUnitTypeList()) {
|
for (UnitType unitType2 : getSpecification().getUnitTypeList()) {
|
||||||
if (buildingType.canAdd(unitType2)) {
|
if (buildingType.canAdd(unitType2)) {
|
||||||
production.add(getButton(unitType2));
|
production.add(getButton(unitType2));
|
||||||
}
|
}
|
||||||
|
@ -1060,7 +1060,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
// Specialist
|
// Specialist
|
||||||
if (workplaces > 0) {
|
if (workplaces > 0) {
|
||||||
detailPanel.add(new JLabel(Messages.message("colopedia.buildings.specialist")));
|
detailPanel.add(new JLabel(Messages.message("colopedia.buildings.specialist")));
|
||||||
final UnitType unitType = Specification.getSpecification()
|
final UnitType unitType = getSpecification()
|
||||||
.getExpertForProducing(buildingType.getProducedGoodsType());
|
.getExpertForProducing(buildingType.getProducedGoodsType());
|
||||||
if (unitType == null) {
|
if (unitType == null) {
|
||||||
detailPanel.add(new JLabel(none));
|
detailPanel.add(new JLabel(none));
|
||||||
|
@ -1078,7 +1078,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
|
|
||||||
for (Modifier productionBonus : bonusList) {
|
for (Modifier productionBonus : bonusList) {
|
||||||
try {
|
try {
|
||||||
GoodsType goodsType = Specification.getSpecification()
|
GoodsType goodsType = getSpecification()
|
||||||
.getGoodsType(productionBonus.getId());
|
.getGoodsType(productionBonus.getId());
|
||||||
String bonus = getModifierAsString(productionBonus);
|
String bonus = getModifierAsString(productionBonus);
|
||||||
productionPanel.add(getGoodsButton(goodsType, bonus));
|
productionPanel.add(getGoodsButton(goodsType, bonus));
|
||||||
|
@ -1395,7 +1395,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
Messages.message(entry.getKey() + ".name"),
|
Messages.message(entry.getKey() + ".name"),
|
||||||
doc.getStyle("regular"));
|
doc.getStyle("regular"));
|
||||||
List<JButton> requiredTypes = new ArrayList<JButton>();
|
List<JButton> requiredTypes = new ArrayList<JButton>();
|
||||||
for (FreeColGameObjectType type : Specification.getSpecification()
|
for (FreeColGameObjectType type : getSpecification()
|
||||||
.getTypesProviding(entry.getKey(), entry.getValue())) {
|
.getTypesProviding(entry.getKey(), entry.getValue())) {
|
||||||
JButton typeButton = getButton(type);
|
JButton typeButton = getButton(type);
|
||||||
typeButton.addActionListener(this);
|
typeButton.addActionListener(this);
|
||||||
|
@ -1428,7 +1428,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
|
||||||
if (OK.equals(command)) {
|
if (OK.equals(command)) {
|
||||||
getCanvas().remove(this);
|
getCanvas().remove(this);
|
||||||
} else {
|
} else {
|
||||||
FreeColGameObjectType type = Specification.getSpecification().getType(command);
|
FreeColGameObjectType type = getSpecification().getType(command);
|
||||||
initialize(type);
|
initialize(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,7 +362,7 @@ public final class DefaultTransferHandler extends TransferHandler {
|
||||||
Unit unit = unitLabel.getUnit();
|
Unit unit = unitLabel.getUnit();
|
||||||
if (unit.hasAbility("model.ability.canBeEquipped")) {
|
if (unit.hasAbility("model.ability.canBeEquipped")) {
|
||||||
Goods goods = label.getGoods();
|
Goods goods = label.getGoods();
|
||||||
for (EquipmentType equipment : Specification.getSpecification()
|
for (EquipmentType equipment : canvas.getSpecification()
|
||||||
.getEquipmentTypeList()) {
|
.getEquipmentTypeList()) {
|
||||||
if (unit.canBeEquippedWith(equipment) && equipment.getGoodsRequired().size() == 1) {
|
if (unit.canBeEquippedWith(equipment) && equipment.getGoodsRequired().size() == 1) {
|
||||||
AbstractGoods requiredGoods = equipment.getGoodsRequired().get(0);
|
AbstractGoods requiredGoods = equipment.getGoodsRequired().get(0);
|
||||||
|
@ -428,7 +428,7 @@ public final class DefaultTransferHandler extends TransferHandler {
|
||||||
UnitLabel unitLabel = (UnitLabel) comp;
|
UnitLabel unitLabel = (UnitLabel) comp;
|
||||||
Unit unit = unitLabel.getUnit();
|
Unit unit = unitLabel.getUnit();
|
||||||
if (unit.hasAbility("model.ability.canBeEquipped")) {
|
if (unit.hasAbility("model.ability.canBeEquipped")) {
|
||||||
for (EquipmentType equipment : Specification.getSpecification()
|
for (EquipmentType equipment : canvas.getSpecification()
|
||||||
.getEquipmentTypeList()) {
|
.getEquipmentTypeList()) {
|
||||||
if (unit.canBeEquippedWith(equipment) && equipment.getGoodsRequired().size() == 1) {
|
if (unit.canBeEquippedWith(equipment) && equipment.getGoodsRequired().size() == 1) {
|
||||||
AbstractGoods requiredGoods = equipment.getGoodsRequired().get(0);
|
AbstractGoods requiredGoods = equipment.getGoodsRequired().get(0);
|
||||||
|
|
|
@ -79,12 +79,12 @@ public final class DifficultyDialog extends FreeColDialog<DifficultyLevel> imple
|
||||||
level = getGame().getDifficultyLevel();
|
level = getGame().getDifficultyLevel();
|
||||||
if (level == null) {
|
if (level == null) {
|
||||||
// compatibility code
|
// compatibility code
|
||||||
level = Specification.getSpecification().getDifficultyLevel(0);
|
level = getSpecification().getDifficultyLevel(0);
|
||||||
}
|
}
|
||||||
difficultyBox.addItem(Messages.message(level.getId()));
|
difficultyBox.addItem(Messages.message(level.getId()));
|
||||||
difficultyBox.setEnabled(false);
|
difficultyBox.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
for (DifficultyLevel dLevel : Specification.getSpecification().getDifficultyLevels()) {
|
for (DifficultyLevel dLevel : getSpecification().getDifficultyLevels()) {
|
||||||
String id = dLevel.getId();
|
String id = dLevel.getId();
|
||||||
if ("model.difficulty.medium".equals(id)) {
|
if ("model.difficulty.medium".equals(id)) {
|
||||||
DEFAULT_INDEX = difficultyBox.getItemCount();
|
DEFAULT_INDEX = difficultyBox.getItemCount();
|
||||||
|
@ -160,7 +160,7 @@ public final class DifficultyDialog extends FreeColDialog<DifficultyLevel> imple
|
||||||
ui.rollback();
|
ui.rollback();
|
||||||
ui.unregister();
|
ui.unregister();
|
||||||
getCanvas().remove(this);
|
getCanvas().remove(this);
|
||||||
setResponse(Specification.getSpecification().getDifficultyLevel(DEFAULT_INDEX));
|
setResponse(getSpecification().getDifficultyLevel(DEFAULT_INDEX));
|
||||||
} else if (RESET.equals(command)) {
|
} else if (RESET.equals(command)) {
|
||||||
ui.reset();
|
ui.reset();
|
||||||
} else {
|
} else {
|
||||||
|
@ -170,7 +170,7 @@ public final class DifficultyDialog extends FreeColDialog<DifficultyLevel> imple
|
||||||
|
|
||||||
public void itemStateChanged(ItemEvent event) {
|
public void itemStateChanged(ItemEvent event) {
|
||||||
int index = difficultyBox.getSelectedIndex();
|
int index = difficultyBox.getSelectedIndex();
|
||||||
level = Specification.getSpecification().getDifficultyLevel(index);
|
level = getSpecification().getDifficultyLevel(index);
|
||||||
ui = new OptionMapUI(new DifficultyOptionMap(level), (index == CUSTOM_INDEX));
|
ui = new OptionMapUI(new DifficultyOptionMap(level), (index == CUSTOM_INDEX));
|
||||||
optionPanel.removeAll();
|
optionPanel.removeAll();
|
||||||
optionPanel.add(ui);
|
optionPanel.add(ui);
|
||||||
|
|
|
@ -249,7 +249,7 @@ public final class DragListener extends MouseAdapter {
|
||||||
Colony colony = tempUnit.getLocation().getColony();
|
Colony colony = tempUnit.getLocation().getColony();
|
||||||
boolean separatorNeeded = false;
|
boolean separatorNeeded = false;
|
||||||
|
|
||||||
List<GoodsType> farmedGoods = Specification.getSpecification().getFarmedGoodsTypeList();
|
List<GoodsType> farmedGoods = canvas.getSpecification().getFarmedGoodsTypeList();
|
||||||
// Work in Field - automatically find the best location
|
// Work in Field - automatically find the best location
|
||||||
for (GoodsType goodsType : farmedGoods) {
|
for (GoodsType goodsType : farmedGoods) {
|
||||||
ColonyTile bestTile = colony.getVacantColonyTileFor(tempUnit, false, goodsType);
|
ColonyTile bestTile = colony.getVacantColonyTileFor(tempUnit, false, goodsType);
|
||||||
|
@ -349,7 +349,7 @@ public final class DragListener extends MouseAdapter {
|
||||||
}
|
}
|
||||||
int experience = Math.min(tempUnit.getExperience(), 200);
|
int experience = Math.min(tempUnit.getExperience(), 200);
|
||||||
if (experience > 0 && tempUnit.getWorkType() != null) {
|
if (experience > 0 && tempUnit.getWorkType() != null) {
|
||||||
UnitType workType = Specification.getSpecification()
|
UnitType workType = canvas.getSpecification()
|
||||||
.getExpertForProducing(tempUnit.getWorkType());
|
.getExpertForProducing(tempUnit.getWorkType());
|
||||||
if (tempUnit.getType().canBeUpgraded(workType, ChangeType.EXPERIENCE)) {
|
if (tempUnit.getType().canBeUpgraded(workType, ChangeType.EXPERIENCE)) {
|
||||||
JMenuItem experienceItem = new JMenuItem(Messages.message("menuBar.experience") +
|
JMenuItem experienceItem = new JMenuItem(Messages.message("menuBar.experience") +
|
||||||
|
@ -437,7 +437,7 @@ public final class DragListener extends MouseAdapter {
|
||||||
|
|
||||||
EquipmentType horses = null;
|
EquipmentType horses = null;
|
||||||
EquipmentType muskets = null;
|
EquipmentType muskets = null;
|
||||||
for (EquipmentType equipmentType : Specification.getSpecification().getEquipmentTypeList()) {
|
for (EquipmentType equipmentType : canvas.getSpecification().getEquipmentTypeList()) {
|
||||||
int count = tempUnit.getEquipment().getCount(equipmentType);
|
int count = tempUnit.getEquipment().getCount(equipmentType);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
// "remove current equipment" action
|
// "remove current equipment" action
|
||||||
|
|
|
@ -62,8 +62,6 @@ public final class EditSettlementDialog extends FreeColDialog<IndianSettlement>
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private static final Logger logger = Logger.getLogger(EditSettlementDialog.class.getName());
|
private static final Logger logger = Logger.getLogger(EditSettlementDialog.class.getName());
|
||||||
|
|
||||||
private static final UnitType BRAVE = Specification.getSpecification().getUnitType("model.unit.brave");
|
|
||||||
|
|
||||||
private static final String REMOVE = "REMOVE";
|
private static final String REMOVE = "REMOVE";
|
||||||
|
|
||||||
private final IndianSettlement settlement;
|
private final IndianSettlement settlement;
|
||||||
|
@ -184,6 +182,7 @@ public final class EditSettlementDialog extends FreeColDialog<IndianSettlement>
|
||||||
settlement.setLearnableSkill((UnitType) skill.getSelectedItem());
|
settlement.setLearnableSkill((UnitType) skill.getSelectedItem());
|
||||||
int numberOfUnits = (Integer) units.getValue() - settlement.getUnitCount();
|
int numberOfUnits = (Integer) units.getValue() - settlement.getUnitCount();
|
||||||
if (numberOfUnits > 0) {
|
if (numberOfUnits > 0) {
|
||||||
|
UnitType BRAVE = getSpecification().getUnitType("model.unit.brave");
|
||||||
for (int index = 0; index < numberOfUnits; index++) {
|
for (int index = 0; index < numberOfUnits; index++) {
|
||||||
settlement.add(new Unit(settlement.getGame(), settlement, settlement.getOwner(),
|
settlement.add(new Unit(settlement.getGame(), settlement, settlement.getOwner(),
|
||||||
BRAVE, UnitState.ACTIVE));
|
BRAVE, UnitState.ACTIVE));
|
||||||
|
|
|
@ -51,7 +51,6 @@ import javax.swing.text.SimpleAttributeSet;
|
||||||
import javax.swing.text.StyleConstants;
|
import javax.swing.text.StyleConstants;
|
||||||
import javax.swing.text.StyledDocument;
|
import javax.swing.text.StyledDocument;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.ClientOptions;
|
import net.sf.freecol.client.ClientOptions;
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
|
@ -341,7 +340,7 @@ public final class EuropePanel extends FreeColPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GoodsType> goodsTypes = FreeCol.getSpecification().getGoodsTypeList();
|
List<GoodsType> goodsTypes = getSpecification().getGoodsTypeList();
|
||||||
for (GoodsType goodsType : goodsTypes) {
|
for (GoodsType goodsType : goodsTypes) {
|
||||||
if (goodsType.isStorable()) {
|
if (goodsType.isStorable()) {
|
||||||
MarketLabel marketLabel = new MarketLabel(goodsType, getMyPlayer().getMarket(), getCanvas());
|
MarketLabel marketLabel = new MarketLabel(goodsType, getMyPlayer().getMarket(), getCanvas());
|
||||||
|
|
|
@ -357,9 +357,9 @@ public class FreeColDialog<T> extends FreeColPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static FreeColDialog<Dimension> createMapSizeDialog() {
|
public static FreeColDialog<Dimension> createMapSizeDialog(final Canvas canvas) {
|
||||||
|
|
||||||
final int defaultSize = FreeCol.getSpecification().getRangeOption("model.option.mapSize")
|
final int defaultSize = canvas.getSpecification().getRangeOption("model.option.mapSize")
|
||||||
.getValue();
|
.getValue();
|
||||||
final int defaultHeight = MapGeneratorOptions.getHeight(defaultSize);
|
final int defaultHeight = MapGeneratorOptions.getHeight(defaultSize);
|
||||||
final int defaultWidth = MapGeneratorOptions.getWidth(defaultSize);
|
final int defaultWidth = MapGeneratorOptions.getWidth(defaultSize);
|
||||||
|
@ -371,10 +371,9 @@ public class FreeColDialog<T> extends FreeColPanel {
|
||||||
final JTextField inputWidth = new JTextField(Integer.toString(defaultWidth), COLUMNS);
|
final JTextField inputWidth = new JTextField(Integer.toString(defaultWidth), COLUMNS);
|
||||||
final JTextField inputHeight = new JTextField(Integer.toString(defaultHeight), COLUMNS);
|
final JTextField inputHeight = new JTextField(Integer.toString(defaultHeight), COLUMNS);
|
||||||
|
|
||||||
final FreeColDialog<Dimension> mapSizeDialog =
|
final FreeColDialog<Dimension> mapSizeDialog = new FreeColDialog<Dimension>(canvas);
|
||||||
new FreeColDialog<Dimension>(FreeCol.getFreeColClient().getCanvas());
|
|
||||||
|
|
||||||
mapSizeDialog.setLayout(new MigLayout("wrap 2", "", ""));
|
mapSizeDialog.setLayout(new MigLayout("wrap 2"));
|
||||||
|
|
||||||
mapSizeDialog.okButton.setText(Messages.message("ok"));
|
mapSizeDialog.okButton.setText(Messages.message("ok"));
|
||||||
mapSizeDialog.okButton.addActionListener(new ActionListener() {
|
mapSizeDialog.okButton.addActionListener(new ActionListener() {
|
||||||
|
@ -387,7 +386,7 @@ public class FreeColDialog<T> extends FreeColPanel {
|
||||||
}
|
}
|
||||||
mapSizeDialog.setResponse(new Dimension(width, height));
|
mapSizeDialog.setResponse(new Dimension(width, height));
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
FreeCol.getFreeColClient().getCanvas().errorMessage("integerAboveZero");
|
canvas.errorMessage("integerAboveZero");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -240,7 +240,7 @@ public class FreeColPanel extends JPanel implements ActionListener {
|
||||||
* @return a <code>Specification</code> value
|
* @return a <code>Specification</code> value
|
||||||
*/
|
*/
|
||||||
public Specification getSpecification() {
|
public Specification getSpecification() {
|
||||||
return getGame().getSpecification();
|
return canvas.getSpecification();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package net.sf.freecol.client.gui.panel;
|
package net.sf.freecol.client.gui.panel;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.FreeColClient;
|
import net.sf.freecol.client.FreeColClient;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.common.model.Specification;
|
import net.sf.freecol.common.model.Specification;
|
||||||
|
@ -376,7 +375,7 @@ public class LabourData {
|
||||||
private UnitData scout;
|
private UnitData scout;
|
||||||
|
|
||||||
public LabourData(FreeColClient client) {
|
public LabourData(FreeColClient client) {
|
||||||
Specification spec = FreeCol.getSpecification();
|
Specification spec = client.getGame().getSpecification();
|
||||||
for (UnitType unitType : spec.getUnitTypeList()) {
|
for (UnitType unitType : spec.getUnitTypeList()) {
|
||||||
if (!unitType.isAvailableTo(client.getMyPlayer())) {
|
if (!unitType.isAvailableTo(client.getMyPlayer())) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -447,7 +446,7 @@ public class LabourData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<UnitType> getLabourTypes(Player player) {
|
public static List<UnitType> getLabourTypes(Player player) {
|
||||||
List<UnitType> unitTypes = FreeCol.getSpecification().getUnitTypeList();
|
List<UnitType> unitTypes = player.getSpecification().getUnitTypeList();
|
||||||
ArrayList<UnitType> labourTypes = new ArrayList<UnitType>();
|
ArrayList<UnitType> labourTypes = new ArrayList<UnitType>();
|
||||||
for (UnitType unitType : unitTypes) {
|
for (UnitType unitType : unitTypes) {
|
||||||
if (unitType.hasSkill() && unitType.isAvailableTo(player)) {
|
if (unitType.hasSkill() && unitType.isAvailableTo(player)) {
|
||||||
|
|
|
@ -30,7 +30,6 @@ import javax.swing.Action;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JLayeredPane;
|
import javax.swing.JLayeredPane;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.ClientOptions;
|
import net.sf.freecol.client.ClientOptions;
|
||||||
import net.sf.freecol.client.FreeColClient;
|
import net.sf.freecol.client.FreeColClient;
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
|
@ -92,7 +91,8 @@ public final class MapControls {
|
||||||
ubList.add(new UnitButton(am.getFreeColAction(SkipUnitAction.id)));
|
ubList.add(new UnitButton(am.getFreeColAction(SkipUnitAction.id)));
|
||||||
ubList.add(new UnitButton(am.getFreeColAction(SentryAction.id)));
|
ubList.add(new UnitButton(am.getFreeColAction(SentryAction.id)));
|
||||||
ubList.add(new UnitButton(am.getFreeColAction(FortifyAction.id)));
|
ubList.add(new UnitButton(am.getFreeColAction(FortifyAction.id)));
|
||||||
for (ImprovementActionType iaType : FreeCol.getSpecification().getImprovementActionTypeList()) {
|
for (ImprovementActionType iaType : freeColClient.getGame().getSpecification()
|
||||||
|
.getImprovementActionTypeList()) {
|
||||||
ubList.add(new UnitButton(am.getFreeColAction(iaType.getId())));
|
ubList.add(new UnitButton(am.getFreeColAction(iaType.getId())));
|
||||||
}
|
}
|
||||||
ubList.add(new UnitButton(am.getFreeColAction(BuildColonyAction.id)));
|
ubList.add(new UnitButton(am.getFreeColAction(BuildColonyAction.id)));
|
||||||
|
|
|
@ -81,16 +81,11 @@ public final class MapEditorTransformPanel extends FreeColPanel {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private static final Logger logger = Logger.getLogger(MapEditorTransformPanel.class.getName());
|
private static final Logger logger = Logger.getLogger(MapEditorTransformPanel.class.getName());
|
||||||
|
|
||||||
private static final UnitType BRAVE = Specification.getSpecification().getUnitType("model.unit.brave");
|
|
||||||
|
|
||||||
private final JPanel listPanel;
|
private final JPanel listPanel;
|
||||||
private JToggleButton settlementButton;
|
private JToggleButton settlementButton;
|
||||||
|
|
||||||
private ButtonGroup group;
|
private ButtonGroup group;
|
||||||
|
|
||||||
private static final TileImprovementType riverType =
|
|
||||||
Specification.getSpecification().getTileImprovementType("model.improvement.river");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describe nativePlayer here.
|
* Describe nativePlayer here.
|
||||||
*/
|
*/
|
||||||
|
@ -109,7 +104,7 @@ public final class MapEditorTransformPanel extends FreeColPanel {
|
||||||
if (server.getAIMain() == null) {
|
if (server.getAIMain() == null) {
|
||||||
server.setAIMain(new AIMain(server));
|
server.setAIMain(new AIMain(server));
|
||||||
}
|
}
|
||||||
for (Nation nation : Specification.getSpecification().getIndianNations()) {
|
for (Nation nation : getSpecification().getIndianNations()) {
|
||||||
server.addAIPlayer(nation);
|
server.addAIPlayer(nation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +129,7 @@ public final class MapEditorTransformPanel extends FreeColPanel {
|
||||||
* Builds the buttons for all the terrains.
|
* Builds the buttons for all the terrains.
|
||||||
*/
|
*/
|
||||||
private void buildList() {
|
private void buildList() {
|
||||||
List<TileType> tileList = Specification.getSpecification().getTileTypeList();
|
List<TileType> tileList = getSpecification().getTileTypeList();
|
||||||
for (TileType type : tileList) {
|
for (TileType type : tileList) {
|
||||||
listPanel.add(buildButton(getLibrary().getCompoundTerrainImage(type, 0.5),
|
listPanel.add(buildButton(getLibrary().getCompoundTerrainImage(type, 0.5),
|
||||||
Messages.message(type.getNameKey()),
|
Messages.message(type.getNameKey()),
|
||||||
|
@ -146,7 +141,7 @@ public final class MapEditorTransformPanel extends FreeColPanel {
|
||||||
listPanel.add(buildButton(getLibrary().getRiverImage(20, 0.5),
|
listPanel.add(buildButton(getLibrary().getRiverImage(20, 0.5),
|
||||||
Messages.message("majorRiver"),
|
Messages.message("majorRiver"),
|
||||||
new RiverTransform(TileImprovement.LARGE_RIVER)));
|
new RiverTransform(TileImprovement.LARGE_RIVER)));
|
||||||
listPanel.add(buildButton(getLibrary().getBonusImage(Specification.getSpecification()
|
listPanel.add(buildButton(getLibrary().getBonusImage(getSpecification()
|
||||||
.getResourceTypeList().get(0), 0.8),
|
.getResourceTypeList().get(0), 0.8),
|
||||||
Messages.message("editor.resource"), new ResourceTransform()));
|
Messages.message("editor.resource"), new ResourceTransform()));
|
||||||
listPanel.add(buildButton(getLibrary().getMiscImage(ImageLibrary.LOST_CITY_RUMOUR, 0.66),
|
listPanel.add(buildButton(getLibrary().getMiscImage(ImageLibrary.LOST_CITY_RUMOUR, 0.66),
|
||||||
|
@ -283,6 +278,9 @@ public final class MapEditorTransformPanel extends FreeColPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void transform(Tile tile) {
|
public void transform(Tile tile) {
|
||||||
|
TileImprovementType riverType =
|
||||||
|
tile.getSpecification().getTileImprovementType("model.improvement.river");
|
||||||
|
|
||||||
if (tile.getType().canHaveImprovement(riverType)) {
|
if (tile.getType().canHaveImprovement(riverType)) {
|
||||||
TileItemContainer tic = tile.getTileItemContainer();
|
TileItemContainer tic = tile.getTileItemContainer();
|
||||||
if (tic == null) {
|
if (tic == null) {
|
||||||
|
@ -400,9 +398,10 @@ public final class MapEditorTransformPanel extends FreeColPanel {
|
||||||
settlement = new IndianSettlement(t.getGame(), nativePlayer, t, name, false,
|
settlement = new IndianSettlement(t.getGame(), nativePlayer, t, name, false,
|
||||||
skill, new HashSet<Player>(), null);
|
skill, new HashSet<Player>(), null);
|
||||||
t.setSettlement(settlement);
|
t.setSettlement(settlement);
|
||||||
|
UnitType brave = getSpecification().getUnitType("model.unit.brave");
|
||||||
for (int index = 0; index < 5; index++) {
|
for (int index = 0; index < 5; index++) {
|
||||||
settlement.add(new Unit(settlement.getGame(), settlement, settlement.getOwner(),
|
settlement.add(new Unit(settlement.getGame(), settlement, settlement.getOwner(),
|
||||||
BRAVE, UnitState.ACTIVE));
|
brave, UnitState.ACTIVE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ import javax.swing.JPanel;
|
||||||
import javax.swing.border.BevelBorder;
|
import javax.swing.border.BevelBorder;
|
||||||
import javax.swing.event.MouseInputListener;
|
import javax.swing.event.MouseInputListener;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.ClientOptions;
|
import net.sf.freecol.client.ClientOptions;
|
||||||
import net.sf.freecol.client.FreeColClient;
|
import net.sf.freecol.client.FreeColClient;
|
||||||
import net.sf.freecol.client.gui.ImageLibrary;
|
import net.sf.freecol.client.gui.ImageLibrary;
|
||||||
|
@ -343,7 +342,7 @@ public final class MiniMap extends JPanel implements MouseInputListener {
|
||||||
* miniRectX/Y are the center of the rectangle.
|
* miniRectX/Y are the center of the rectangle.
|
||||||
* Use miniRectWidth/Height / 2 to get the upper left corner.
|
* Use miniRectWidth/Height / 2 to get the upper left corner.
|
||||||
* x/yTiles are the number of tiles that fit on the large map */
|
* x/yTiles are the number of tiles that fit on the large map */
|
||||||
TileType tileType = FreeCol.getSpecification().getTileTypeList().get(0);
|
TileType tileType = freeColClient.getGame().getSpecification().getTileTypeList().get(0);
|
||||||
int miniRectX = (freeColClient.getGUI().getFocus().getX() - firstColumn) * tileSize;
|
int miniRectX = (freeColClient.getGUI().getFocus().getX() - firstColumn) * tileSize;
|
||||||
int miniRectY = (freeColClient.getGUI().getFocus().getY() - firstRow) * tileSize / 4;
|
int miniRectY = (freeColClient.getGUI().getFocus().getY() - firstRow) * tileSize / 4;
|
||||||
int miniRectWidth = (getParent().getWidth() / library.getTerrainImageWidth(tileType) + 1) * tileSize;
|
int miniRectWidth = (getParent().getWidth() / library.getTerrainImageWidth(tileType) + 1) * tileSize;
|
||||||
|
|
|
@ -143,7 +143,7 @@ public final class PlayersTable extends JTable {
|
||||||
|
|
||||||
TableColumn advantagesColumn = getColumnModel().getColumn(ADVANTAGE_COLUMN);
|
TableColumn advantagesColumn = getColumnModel().getColumn(ADVANTAGE_COLUMN);
|
||||||
if (nationOptions.getNationalAdvantages() == NationOptions.Advantages.SELECTABLE) {
|
if (nationOptions.getNationalAdvantages() == NationOptions.Advantages.SELECTABLE) {
|
||||||
advantagesColumn.setCellEditor(new AdvantageCellEditor());
|
advantagesColumn.setCellEditor(new AdvantageCellEditor(canvas.getSpecification().getEuropeanNationTypes()));
|
||||||
}
|
}
|
||||||
advantagesColumn.setCellRenderer(new AdvantageCellRenderer(nationOptions.getNationalAdvantages()));
|
advantagesColumn.setCellRenderer(new AdvantageCellRenderer(nationOptions.getNationalAdvantages()));
|
||||||
advantagesColumn.setHeaderRenderer(renderer);
|
advantagesColumn.setHeaderRenderer(renderer);
|
||||||
|
@ -394,7 +394,7 @@ public final class PlayersTable extends JTable {
|
||||||
public PlayersTableModel(PreGameController pgc, NationOptions nationOptions, Player owningPlayer) {
|
public PlayersTableModel(PreGameController pgc, NationOptions nationOptions, Player owningPlayer) {
|
||||||
nations = new ArrayList<Nation>();
|
nations = new ArrayList<Nation>();
|
||||||
players = new HashMap<Nation, Player>();
|
players = new HashMap<Nation, Player>();
|
||||||
for (Nation nation : Specification.getSpecification().getNations()) {
|
for (Nation nation : owningPlayer.getSpecification().getNations()) {
|
||||||
NationState state = nationOptions.getNations().get(nation);
|
NationState state = nationOptions.getNations().get(nation);
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
nations.add(nation);
|
nations.add(nation);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class RebelToolTip extends JToolTip {
|
||||||
add(new JLabel(Integer.toString(colony.getTory()) + "%"));
|
add(new JLabel(Integer.toString(colony.getTory()) + "%"));
|
||||||
|
|
||||||
int libertyProduction = 0;
|
int libertyProduction = 0;
|
||||||
for (GoodsType goodsType : Specification.getSpecification().getLibertyGoodsTypeList()) {
|
for (GoodsType goodsType : colony.getSpecification().getLibertyGoodsTypeList()) {
|
||||||
add(new JLabel(Messages.message(goodsType.getNameKey())));
|
add(new JLabel(Messages.message(goodsType.getNameKey())));
|
||||||
int netProduction = colony.getProductionNetOf(goodsType);
|
int netProduction = colony.getProductionNetOf(goodsType);
|
||||||
libertyProduction += netProduction;
|
libertyProduction += netProduction;
|
||||||
|
|
|
@ -101,7 +101,7 @@ public final class RecruitDialog extends FreeColDialog<Integer> implements Actio
|
||||||
|
|
||||||
int production = 0;
|
int production = 0;
|
||||||
for (Colony colony : player.getColonies()) {
|
for (Colony colony : player.getColonies()) {
|
||||||
production += colony.getProductionOf(Specification.getSpecification()
|
production += colony.getProductionOf(getSpecification()
|
||||||
.getGoodsType("model.goods.crosses"));
|
.getGoodsType("model.goods.crosses"));
|
||||||
}
|
}
|
||||||
int turns = 100;
|
int turns = 100;
|
||||||
|
|
|
@ -89,7 +89,7 @@ public final class ReportCargoPanel extends ReportPanel {
|
||||||
reportPanel.add(new JSeparator(JSeparator.HORIZONTAL), "growx");
|
reportPanel.add(new JSeparator(JSeparator.HORIZONTAL), "growx");
|
||||||
|
|
||||||
List<AbstractUnit> cargoTypes = new ArrayList<AbstractUnit>();
|
List<AbstractUnit> cargoTypes = new ArrayList<AbstractUnit>();
|
||||||
for (UnitType unitType : Specification.getSpecification().getUnitTypeList()) {
|
for (UnitType unitType : getSpecification().getUnitTypeList()) {
|
||||||
if (unitType.isAvailableTo(player)
|
if (unitType.isAvailableTo(player)
|
||||||
&& (unitType.canCarryUnits() || unitType.canCarryGoods())) {
|
&& (unitType.canCarryUnits() || unitType.canCarryGoods())) {
|
||||||
cargoTypes.add(new AbstractUnit(unitType, Role.DEFAULT, carriers.getCount(unitType)));
|
cargoTypes.add(new AbstractUnit(unitType, Role.DEFAULT, carriers.getCount(unitType)));
|
||||||
|
|
|
@ -27,7 +27,6 @@ import javax.swing.JButton;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JSeparator;
|
import javax.swing.JSeparator;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.common.model.Specification;
|
import net.sf.freecol.common.model.Specification;
|
||||||
|
@ -95,8 +94,8 @@ public final class ReportColonyPanel extends ReportPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Production
|
// Production
|
||||||
GoodsType food = Specification.getSpecification().getGoodsType("model.goods.food");
|
GoodsType food = getSpecification().getGoodsType("model.goods.food");
|
||||||
GoodsType horses = Specification.getSpecification().getGoodsType("model.goods.horses");
|
GoodsType horses = getSpecification().getGoodsType("model.goods.horses");
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int netFood = colony.getFoodProduction() - colony.getFoodConsumption();
|
int netFood = colony.getFoodProduction() - colony.getFoodConsumption();
|
||||||
if (netFood != 0) {
|
if (netFood != 0) {
|
||||||
|
@ -105,7 +104,7 @@ public final class ReportColonyPanel extends ReportPanel {
|
||||||
reportPanel.add(productionLabel, "span 2, top");
|
reportPanel.add(productionLabel, "span 2, top");
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
|
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
|
||||||
if (goodsType.isFoodType()) {
|
if (goodsType.isFoodType()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ package net.sf.freecol.client.gui.panel;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.common.model.Colony;
|
import net.sf.freecol.common.model.Colony;
|
||||||
|
@ -69,7 +68,7 @@ public final class ReportContinentalCongressPanel extends ReportPanel {
|
||||||
currentFatherLabel.setVerticalTextPosition(JLabel.TOP);
|
currentFatherLabel.setVerticalTextPosition(JLabel.TOP);
|
||||||
currentFatherLabel.setHorizontalTextPosition(JLabel.CENTER);
|
currentFatherLabel.setHorizontalTextPosition(JLabel.CENTER);
|
||||||
reportPanel.add(currentFatherLabel);
|
reportPanel.add(currentFatherLabel);
|
||||||
GoodsType bellsType = FreeCol.getSpecification().getGoodsType("model.goods.bells");
|
GoodsType bellsType = getSpecification().getGoodsType("model.goods.bells");
|
||||||
FreeColProgressBar progressBar = new FreeColProgressBar(getCanvas(), bellsType);
|
FreeColProgressBar progressBar = new FreeColProgressBar(getCanvas(), bellsType);
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for (Colony colony : player.getColonies()) {
|
for (Colony colony : player.getColonies()) {
|
||||||
|
|
|
@ -33,7 +33,6 @@ import javax.swing.JButton;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.common.model.Specification;
|
import net.sf.freecol.common.model.Specification;
|
||||||
|
@ -77,7 +76,7 @@ public final class ReportLabourPanel extends ReportPanel implements ActionListen
|
||||||
unitOnLand = new TypeCountMap<UnitType>();
|
unitOnLand = new TypeCountMap<UnitType>();
|
||||||
unitInEurope = new TypeCountMap<UnitType>();
|
unitInEurope = new TypeCountMap<UnitType>();
|
||||||
unitLocations = new HashMap<UnitType, Map<Colony, Integer>>();
|
unitLocations = new HashMap<UnitType, Map<Colony, Integer>>();
|
||||||
for (UnitType type : Specification.getSpecification().getUnitTypeList()) {
|
for (UnitType type : getSpecification().getUnitTypeList()) {
|
||||||
unitLocations.put(type, new HashMap<Colony, Integer>());
|
unitLocations.put(type, new HashMap<Colony, Integer>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +116,7 @@ public final class ReportLabourPanel extends ReportPanel implements ActionListen
|
||||||
|
|
||||||
public void displayData() {
|
public void displayData() {
|
||||||
|
|
||||||
List<UnitType> unitTypes = FreeCol.getSpecification().getUnitTypeList();
|
List<UnitType> unitTypes = getSpecification().getUnitTypeList();
|
||||||
ArrayList<UnitType> colonists = new ArrayList<UnitType>();
|
ArrayList<UnitType> colonists = new ArrayList<UnitType>();
|
||||||
for (UnitType unitType : unitTypes) {
|
for (UnitType unitType : unitTypes) {
|
||||||
if (unitType.hasSkill()) {
|
if (unitType.hasSkill()) {
|
||||||
|
@ -223,7 +222,7 @@ public final class ReportLabourPanel extends ReportPanel implements ActionListen
|
||||||
if (OK.equals(command)) {
|
if (OK.equals(command)) {
|
||||||
super.actionPerformed(event);
|
super.actionPerformed(event);
|
||||||
} else {
|
} else {
|
||||||
UnitType unitType = FreeCol.getSpecification().getUnitType(command);
|
UnitType unitType = getSpecification().getUnitType(command);
|
||||||
ReportLabourDetailPanel details = new ReportLabourDetailPanel(getCanvas());
|
ReportLabourDetailPanel details = new ReportLabourDetailPanel(getCanvas());
|
||||||
details.setDetailPanel(createUnitDetails(unitType, details));
|
details.setDetailPanel(createUnitDetails(unitType, details));
|
||||||
getCanvas().addAsFrame(details);
|
getCanvas().addAsFrame(details);
|
||||||
|
|
|
@ -78,9 +78,6 @@ public final class ReportMilitaryPanel extends ReportPanel {
|
||||||
private Map<EquippedUnitType, Integer> unitMap;
|
private Map<EquippedUnitType, Integer> unitMap;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static final UnitType defaultType =
|
|
||||||
Specification.getSpecification().getUnitType("model.unit.freeColonist");
|
|
||||||
|
|
||||||
private List<String> colonyNames;
|
private List<String> colonyNames;
|
||||||
private List<String> otherNames;
|
private List<String> otherNames;
|
||||||
|
|
||||||
|
@ -130,7 +127,7 @@ public final class ReportMilitaryPanel extends ReportPanel {
|
||||||
List<AbstractUnit> scoutUnits = new ArrayList<AbstractUnit>();
|
List<AbstractUnit> scoutUnits = new ArrayList<AbstractUnit>();
|
||||||
List<AbstractUnit> dragoonUnits = new ArrayList<AbstractUnit>();
|
List<AbstractUnit> dragoonUnits = new ArrayList<AbstractUnit>();
|
||||||
List<AbstractUnit> soldierUnits = new ArrayList<AbstractUnit>();
|
List<AbstractUnit> soldierUnits = new ArrayList<AbstractUnit>();
|
||||||
for (UnitType unitType : Specification.getSpecification().getUnitTypeList()) {
|
for (UnitType unitType : getSpecification().getUnitTypeList()) {
|
||||||
if (unitType.isAvailableTo(player) &&
|
if (unitType.isAvailableTo(player) &&
|
||||||
!unitType.hasAbility("model.ability.navalUnit") &&
|
!unitType.hasAbility("model.ability.navalUnit") &&
|
||||||
(unitType.hasAbility("model.ability.expertSoldier") ||
|
(unitType.hasAbility("model.ability.expertSoldier") ||
|
||||||
|
@ -144,6 +141,7 @@ public final class ReportMilitaryPanel extends ReportPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
UnitType defaultType = getSpecification().getUnitType("model.unit.freeColonist");
|
||||||
dragoonUnits.add(new AbstractUnit(defaultType, Role.DRAGOON, dragoons.getCount(defaultType)));
|
dragoonUnits.add(new AbstractUnit(defaultType, Role.DRAGOON, dragoons.getCount(defaultType)));
|
||||||
soldierUnits.add(new AbstractUnit(defaultType, Role.SOLDIER, soldiers.getCount(defaultType)));
|
soldierUnits.add(new AbstractUnit(defaultType, Role.SOLDIER, soldiers.getCount(defaultType)));
|
||||||
scoutUnits.add(new AbstractUnit(defaultType, Role.SCOUT, scouts.getCount(defaultType)));
|
scoutUnits.add(new AbstractUnit(defaultType, Role.SCOUT, scouts.getCount(defaultType)));
|
||||||
|
@ -203,6 +201,7 @@ public final class ReportMilitaryPanel extends ReportPanel {
|
||||||
otherNames.add(Messages.message(player.getEurope().getNameKey()));
|
otherNames.add(Messages.message(player.getEurope().getNameKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UnitType defaultType = getSpecification().getUnitType("model.unit.freeColonist");
|
||||||
for (Unit unit : player.getUnits()) {
|
for (Unit unit : player.getUnits()) {
|
||||||
if (unit.isOffensiveUnit() && !unit.isNaval()) {
|
if (unit.isOffensiveUnit() && !unit.isNaval()) {
|
||||||
UnitType unitType = defaultType;
|
UnitType unitType = defaultType;
|
||||||
|
|
|
@ -95,7 +95,7 @@ public final class ReportNavalPanel extends ReportPanel {
|
||||||
reportPanel.add(new JSeparator(JSeparator.HORIZONTAL), "growx");
|
reportPanel.add(new JSeparator(JSeparator.HORIZONTAL), "growx");
|
||||||
|
|
||||||
List<AbstractUnit> ships = new ArrayList<AbstractUnit>();
|
List<AbstractUnit> ships = new ArrayList<AbstractUnit>();
|
||||||
for (UnitType unitType : Specification.getSpecification().getUnitTypeList()) {
|
for (UnitType unitType : getSpecification().getUnitTypeList()) {
|
||||||
if (unitType.isAvailableTo(player) && unitType.hasAbility("model.ability.navalUnit")) {
|
if (unitType.isAvailableTo(player) && unitType.hasAbility("model.ability.navalUnit")) {
|
||||||
ships.add(new AbstractUnit(unitType, Role.DEFAULT, navalUnits.getCount(unitType)));
|
ships.add(new AbstractUnit(unitType, Role.DEFAULT, navalUnits.getCount(unitType)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import javax.swing.JButton;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.common.model.Specification;
|
import net.sf.freecol.common.model.Specification;
|
||||||
|
@ -67,7 +66,7 @@ public final class ReportProductionPanel extends ReportPanel {
|
||||||
goodsTypes = new ArrayList<GoodsType>();
|
goodsTypes = new ArrayList<GoodsType>();
|
||||||
List<String> goodsNames = new ArrayList<String>();
|
List<String> goodsNames = new ArrayList<String>();
|
||||||
goodsNames.add(Messages.message("nothing"));
|
goodsNames.add(Messages.message("nothing"));
|
||||||
for (GoodsType goodsType : Specification.getSpecification().getGoodsTypeList()) {
|
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
|
||||||
if (!goodsType.isFarmed()) {
|
if (!goodsType.isFarmed()) {
|
||||||
goodsTypes.add(goodsType);
|
goodsTypes.add(goodsType);
|
||||||
goodsNames.add(Messages.message(goodsType.getNameKey()));
|
goodsNames.add(Messages.message(goodsType.getNameKey()));
|
||||||
|
@ -117,7 +116,7 @@ public final class ReportProductionPanel extends ReportPanel {
|
||||||
List<List<BuildingType>> basicBuildingTypes = new ArrayList<List<BuildingType>>();
|
List<List<BuildingType>> basicBuildingTypes = new ArrayList<List<BuildingType>>();
|
||||||
for (GoodsType goodsType : selectedTypes) {
|
for (GoodsType goodsType : selectedTypes) {
|
||||||
List<BuildingType> buildingTypes = new ArrayList<BuildingType>();
|
List<BuildingType> buildingTypes = new ArrayList<BuildingType>();
|
||||||
for (BuildingType buildingType : FreeCol.getSpecification().getBuildingTypeList()) {
|
for (BuildingType buildingType : getSpecification().getBuildingTypeList()) {
|
||||||
if (goodsType.equals(buildingType.getProducedGoodsType())
|
if (goodsType.equals(buildingType.getProducedGoodsType())
|
||||||
|| !buildingType.getModifierSet(goodsType.getId()).isEmpty()) {
|
|| !buildingType.getModifierSet(goodsType.getId()).isEmpty()) {
|
||||||
BuildingType firstLevel = buildingType.getFirstLevel();
|
BuildingType firstLevel = buildingType.getFirstLevel();
|
||||||
|
|
|
@ -53,7 +53,7 @@ public final class ReportReligiousPanel extends ReportPanel implements ActionLis
|
||||||
Player player = getMyPlayer();
|
Player player = getMyPlayer();
|
||||||
|
|
||||||
reportPanel.add(new JLabel(Messages.message("crosses")));
|
reportPanel.add(new JLabel(Messages.message("crosses")));
|
||||||
GoodsType crosses = Specification.getSpecification().getGoodsType("model.goods.crosses");
|
GoodsType crosses = getSpecification().getGoodsType("model.goods.crosses");
|
||||||
FreeColProgressBar progressBar = new FreeColProgressBar(getCanvas(), crosses);
|
FreeColProgressBar progressBar = new FreeColProgressBar(getCanvas(), crosses);
|
||||||
reportPanel.add(progressBar, "span");
|
reportPanel.add(progressBar, "span");
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ import javax.swing.JViewport;
|
||||||
import javax.swing.text.StyleConstants;
|
import javax.swing.text.StyleConstants;
|
||||||
import javax.swing.text.StyledDocument;
|
import javax.swing.text.StyledDocument;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.common.model.Building;
|
import net.sf.freecol.common.model.Building;
|
||||||
|
@ -86,13 +85,13 @@ public final class ReportRequirementsPanel extends ReportPanel {
|
||||||
JTextPane textPane = getDefaultTextPane();
|
JTextPane textPane = getDefaultTextPane();
|
||||||
StyledDocument doc = textPane.getStyledDocument();
|
StyledDocument doc = textPane.getStyledDocument();
|
||||||
|
|
||||||
int numberUnitTypes = FreeCol.getSpecification().numberOfUnitTypes();
|
int numberUnitTypes = getSpecification().numberOfUnitTypes();
|
||||||
int numberGoodsTypes = FreeCol.getSpecification().numberOfGoodsTypes();
|
int numberGoodsTypes = getSpecification().numberOfGoodsTypes();
|
||||||
unitCount = new int[colonies.size()][numberUnitTypes];
|
unitCount = new int[colonies.size()][numberUnitTypes];
|
||||||
canTrain = new boolean[colonies.size()][numberUnitTypes];
|
canTrain = new boolean[colonies.size()][numberUnitTypes];
|
||||||
surplus = new int[colonies.size()][numberGoodsTypes];
|
surplus = new int[colonies.size()][numberGoodsTypes];
|
||||||
|
|
||||||
List<GoodsType> goodsTypes = FreeCol.getSpecification().getGoodsTypeList();
|
List<GoodsType> goodsTypes = getSpecification().getGoodsTypeList();
|
||||||
// check which colonies can train which units
|
// check which colonies can train which units
|
||||||
for (int index = 0; index < colonies.size(); index++) {
|
for (int index = 0; index < colonies.size(); index++) {
|
||||||
Colony colony = colonies.get(index);
|
Colony colony = colonies.get(index);
|
||||||
|
@ -127,7 +126,7 @@ public final class ReportRequirementsPanel extends ReportPanel {
|
||||||
Unit unit = colonyTile.getUnit();
|
Unit unit = colonyTile.getUnit();
|
||||||
if (unit != null) {
|
if (unit != null) {
|
||||||
GoodsType workType = unit.getWorkType();
|
GoodsType workType = unit.getWorkType();
|
||||||
UnitType expert = FreeCol.getSpecification().getExpertForProducing(workType);
|
UnitType expert = getSpecification().getExpertForProducing(workType);
|
||||||
int expertIndex = expert.getIndex();
|
int expertIndex = expert.getIndex();
|
||||||
if (unitCount[index][expertIndex] == 0 && !expertWarning[expertIndex]) {
|
if (unitCount[index][expertIndex] == 0 && !expertWarning[expertIndex]) {
|
||||||
addExpertWarning(doc, index, workType, expert);
|
addExpertWarning(doc, index, workType, expert);
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package net.sf.freecol.client.gui.panel;
|
package net.sf.freecol.client.gui.panel;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.common.model.Colony;
|
import net.sf.freecol.common.model.Colony;
|
||||||
|
@ -84,7 +83,7 @@ public final class ReportTradePanel extends ReportPanel {
|
||||||
goodsHeader.setBorder(new EmptyBorder(20, 20, 0, 20));
|
goodsHeader.setBorder(new EmptyBorder(20, 20, 0, 20));
|
||||||
scrollPane.setColumnHeaderView(goodsHeader);
|
scrollPane.setColumnHeaderView(goodsHeader);
|
||||||
|
|
||||||
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
|
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
|
||||||
if (goodsType.isStorable()) {
|
if (goodsType.isStorable()) {
|
||||||
storableGoods.add(goodsType);
|
storableGoods.add(goodsType);
|
||||||
}
|
}
|
||||||
|
@ -200,7 +199,7 @@ public final class ReportTradePanel extends ReportPanel {
|
||||||
JButton colonyButton = createColonyButton(colony, colonyIndex);
|
JButton colonyButton = createColonyButton(colony, colonyIndex);
|
||||||
reportPanel.add(colonyButton, "cell 0 " + row + " 1 2");
|
reportPanel.add(colonyButton, "cell 0 " + row + " 1 2");
|
||||||
column = 0;
|
column = 0;
|
||||||
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
|
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
|
||||||
if (!goodsType.isStorable()) {
|
if (!goodsType.isStorable()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ import javax.swing.JLabel;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.common.model.GoodsType;
|
import net.sf.freecol.common.model.GoodsType;
|
||||||
|
@ -108,13 +107,13 @@ public final class TilePanel extends FreeColPanel {
|
||||||
|
|
||||||
if (tileType != null) {
|
if (tileType != null) {
|
||||||
// TODO: make this more generic
|
// TODO: make this more generic
|
||||||
UnitType colonist = FreeCol.getSpecification().getUnitType("model.unit.freeColonist");
|
UnitType colonist = getSpecification().getUnitType("model.unit.freeColonist");
|
||||||
|
|
||||||
JLabel label = null;
|
JLabel label = null;
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (GoodsType goodsType : FreeCol.getSpecification().getFarmedGoodsTypeList()) {
|
for (GoodsType goodsType : getSpecification().getFarmedGoodsTypeList()) {
|
||||||
int potential = tile.potential(goodsType, colonist);
|
int potential = tile.potential(goodsType, colonist);
|
||||||
UnitType expert = FreeCol.getSpecification().getExpertForProducing(goodsType);
|
UnitType expert = getSpecification().getExpertForProducing(goodsType);
|
||||||
int expertPotential = tile.potential(goodsType, expert);
|
int expertPotential = tile.potential(goodsType, expert);
|
||||||
if (potential > 0) {
|
if (potential > 0) {
|
||||||
label = new JLabel(String.valueOf(potential),
|
label = new JLabel(String.valueOf(potential),
|
||||||
|
|
|
@ -49,7 +49,6 @@ import javax.swing.TransferHandler;
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.common.model.Colony;
|
import net.sf.freecol.common.model.Colony;
|
||||||
|
@ -342,7 +341,7 @@ public final class TradeRouteInputDialog extends FreeColDialog<Boolean> implemen
|
||||||
|
|
||||||
public GoodsPanel() {
|
public GoodsPanel() {
|
||||||
super(new GridLayout(0, 5, margin, margin));
|
super(new GridLayout(0, 5, margin, margin));
|
||||||
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
|
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
|
||||||
if (goodsType.isStorable()) {
|
if (goodsType.isStorable()) {
|
||||||
CargoLabel label = new CargoLabel(goodsType);
|
CargoLabel label = new CargoLabel(goodsType);
|
||||||
add(label);
|
add(label);
|
||||||
|
|
|
@ -31,7 +31,6 @@ import javax.swing.ImageIcon;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
|
|
||||||
|
@ -79,13 +78,13 @@ public final class TrainDialog extends FreeColDialog<Integer> implements ActionL
|
||||||
|
|
||||||
switch(europeAction) {
|
switch(europeAction) {
|
||||||
case TRAIN:
|
case TRAIN:
|
||||||
trainableUnits.addAll(FreeCol.getSpecification().getUnitTypesTrainedInEurope());
|
trainableUnits.addAll(getSpecification().getUnitTypesTrainedInEurope());
|
||||||
question = new JLabel(Messages.message("trainDialog.clickOn"));
|
question = new JLabel(Messages.message("trainDialog.clickOn"));
|
||||||
setLayout(new MigLayout("wrap 3", "[sg]", ""));
|
setLayout(new MigLayout("wrap 3", "[sg]", ""));
|
||||||
break;
|
break;
|
||||||
case PURCHASE:
|
case PURCHASE:
|
||||||
default:
|
default:
|
||||||
trainableUnits.addAll(FreeCol.getSpecification().getUnitTypesPurchasedInEurope());
|
trainableUnits.addAll(getSpecification().getUnitTypesPurchasedInEurope());
|
||||||
question = new JLabel(Messages.message("purchaseDialog.clickOn"));
|
question = new JLabel(Messages.message("purchaseDialog.clickOn"));
|
||||||
setLayout(new MigLayout("wrap 2", "[sg]", ""));
|
setLayout(new MigLayout("wrap 2", "[sg]", ""));
|
||||||
}
|
}
|
||||||
|
@ -154,7 +153,7 @@ public final class TrainDialog extends FreeColDialog<Integer> implements ActionL
|
||||||
if (TRAIN_DONE.equals(command)) {
|
if (TRAIN_DONE.equals(command)) {
|
||||||
setResponse(new Integer(-1));
|
setResponse(new Integer(-1));
|
||||||
} else {
|
} else {
|
||||||
UnitType unitType = FreeCol.getSpecification().getUnitType(command);
|
UnitType unitType = getSpecification().getUnitType(command);
|
||||||
getController().trainUnitInEurope(unitType);
|
getController().trainUnitInEurope(unitType);
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ import javax.swing.ImageIcon;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.control.InGameController;
|
import net.sf.freecol.client.control.InGameController;
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.ImageLibrary;
|
import net.sf.freecol.client.gui.ImageLibrary;
|
||||||
|
@ -326,7 +325,7 @@ public final class UnitLabel extends JLabel implements ActionListener, PropertyC
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WORK_TILE:
|
case WORK_TILE:
|
||||||
GoodsType goodsType = FreeCol.getSpecification().getGoodsType(arg);
|
GoodsType goodsType = parent.getSpecification().getGoodsType(arg);
|
||||||
// Change workType first for the benefit of change listeners
|
// Change workType first for the benefit of change listeners
|
||||||
inGameController.changeWorkType(unit, goodsType);
|
inGameController.changeWorkType(unit, goodsType);
|
||||||
// Move unit to best producing ColonyTile
|
// Move unit to best producing ColonyTile
|
||||||
|
@ -336,7 +335,7 @@ public final class UnitLabel extends JLabel implements ActionListener, PropertyC
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WORK_BUILDING:
|
case WORK_BUILDING:
|
||||||
BuildingType buildingType = FreeCol.getSpecification().getBuildingType(arg);
|
BuildingType buildingType = parent.getSpecification().getBuildingType(arg);
|
||||||
Building building = unit.getColony().getBuilding(buildingType);
|
Building building = unit.getColony().getBuilding(buildingType);
|
||||||
inGameController.work(unit, building);
|
inGameController.work(unit, building);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -34,7 +34,6 @@ import javax.swing.JScrollPane;
|
||||||
import javax.swing.JSpinner;
|
import javax.swing.JSpinner;
|
||||||
import javax.swing.SpinnerNumberModel;
|
import javax.swing.SpinnerNumberModel;
|
||||||
|
|
||||||
import net.sf.freecol.FreeCol;
|
|
||||||
import net.sf.freecol.client.gui.Canvas;
|
import net.sf.freecol.client.gui.Canvas;
|
||||||
import net.sf.freecol.client.gui.i18n.Messages;
|
import net.sf.freecol.client.gui.i18n.Messages;
|
||||||
import net.sf.freecol.common.model.Colony;
|
import net.sf.freecol.common.model.Colony;
|
||||||
|
@ -94,7 +93,7 @@ public final class WarehouseDialog extends FreeColDialog<Boolean> implements Act
|
||||||
add(ok, "newline 20, split 2, tag ok");
|
add(ok, "newline 20, split 2, tag ok");
|
||||||
add(cancel, "tag cancel");
|
add(cancel, "tag cancel");
|
||||||
|
|
||||||
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
|
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
|
||||||
if (goodsType.isStorable()) {
|
if (goodsType.isStorable()) {
|
||||||
warehouseDialog.add(new WarehouseGoodsPanel(colony, goodsType));
|
warehouseDialog.add(new WarehouseGoodsPanel(colony, goodsType));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue