Remove static Specification from gui/panel.

This commit is contained in:
Michael Vehrs 2010-06-19 08:21:10 +00:00
parent a5529994ab
commit e392475299
37 changed files with 117 additions and 201 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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.Player;
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.Tile;
import net.sf.freecol.common.model.TradeRoute;
@ -1668,6 +1669,15 @@ public final class Canvas extends JDesktopPane {
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
* shows the new game panel.

View File

@ -65,7 +65,7 @@ public class NewEmptyMapAction extends MapboardAction {
final Canvas canvas = getFreeColClient().getCanvas();
final Game game = freeColClient.getGame();
Dimension size = canvas.showFreeColDialog(FreeColDialog.createMapSizeDialog());
Dimension size = canvas.showFreeColDialog(FreeColDialog.createMapSizeDialog(canvas));
if (size == null) {
return;
}

View File

@ -20,13 +20,13 @@
package net.sf.freecol.client.gui.panel;
import java.util.List;
import java.util.Vector;
import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.gui.i18n.Messages;
import net.sf.freecol.client.gui.plaf.FreeColComboBoxRenderer;
import net.sf.freecol.common.model.EuropeanNationType;
@ -42,8 +42,8 @@ public final class AdvantageCellEditor extends DefaultCellEditor {
/**
* A standard constructor.
*/
public AdvantageCellEditor() {
super(new JComboBox(new Vector<EuropeanNationType>(FreeCol.getSpecification().getEuropeanNationTypes())));
public AdvantageCellEditor(List<EuropeanNationType> nationTypes) {
super(new JComboBox(new Vector<EuropeanNationType>(nationTypes)));
((JComboBox) getComponent()).setRenderer(new AdvantageRenderer());
}

View File

@ -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.plaf.FreeColComboBoxRenderer;
import net.sf.freecol.FreeCol;
import net.sf.freecol.common.model.Ability;
import net.sf.freecol.common.model.AbstractGoods;
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
* human and can never be built.
*/
private static final List<UnitType> buildableUnits = new ArrayList<UnitType>();
static {
for (UnitType unitType : FreeCol.getSpecification().getUnitTypeList()) {
if (!unitType.getGoodsRequired().isEmpty()) {
// can be built
buildableUnits.add(unitType);
}
}
}
private List<UnitType> buildableUnits = new ArrayList<UnitType>();
public BuildQueuePanel(Colony colony, Canvas parent) {
@ -133,6 +123,13 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
this.colony = colony;
this.unitCount = colony.getUnitCount();
for (UnitType unitType : getSpecification().getUnitTypeList()) {
if (!unitType.getGoodsRequired().isEmpty()) {
// can be built
buildableUnits.add(unitType);
}
}
DefaultListModel current = new DefaultListModel();
for (BuildableType type : colony.getBuildQueue()) {
current.addElement(type);
@ -256,7 +253,7 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
.hasAbility("model.ability.build", unitType, getGame().getTurn())
|| featureContainer.hasAbility("model.ability.build", unitType))) {
boolean builderFound = false;
for (Ability ability : FreeCol.getSpecification().getAbilities("model.ability.build")) {
for (Ability ability : getSpecification().getAbilities("model.ability.build")) {
if (ability.appliesTo(unitType)
&& ability.getValue()
&& ability.getSource() != null
@ -276,7 +273,7 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
for (Entry<String, Boolean> entry : requiredAbilities.entrySet()) {
if (colony.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());
if (sources.isEmpty()) {
// no type provides the required ability
@ -303,7 +300,7 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
DefaultListModel buildings = (DefaultListModel) buildingList.getModel();
DefaultListModel current = (DefaultListModel) buildQueueList.getModel();
buildings.clear();
loop: for (BuildingType buildingType : FreeCol.getSpecification().getBuildingTypeList()) {
loop: for (BuildingType buildingType : getSpecification().getBuildingTypeList()) {
// compare colony.getNoBuildReason()
List<String> lockReason = new ArrayList<String>();
Building colonyBuilding = colony.getBuilding(buildingType);
@ -330,7 +327,7 @@ public class BuildQueuePanel extends FreeColPanel implements ActionListener, Ite
for (Entry<String, Boolean> entry : requiredAbilities.entrySet()) {
if (colony.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());
if (sources.isEmpty()) {
// no type provides the required ability

View File

@ -63,7 +63,6 @@ import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;
import net.miginfocom.swing.MigLayout;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.ClientOptions;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.GUI;
@ -507,11 +506,11 @@ public final class ColonyPanel extends FreeColPanel implements ActionListener,Pr
public void updateProductionPanel() {
rightProductionPanel.removeAll();
GoodsType grain = Specification.getSpecification().getGoodsType("model.goods.food");
GoodsType grain = getSpecification().getGoodsType("model.goods.food");
int food = 0;
List<AbstractGoods> foodProduction = new ArrayList<AbstractGoods>();
for (GoodsType goodsType : Specification.getSpecification().getGoodsTypeList()) {
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
int production = colony.getProductionOf(goodsType);
if (production != 0) {
if (goodsType.isFoodType()) {
@ -1154,7 +1153,7 @@ public final class ColonyPanel extends FreeColPanel implements ActionListener,Pr
private void update() {
removeAll();
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
if (goodsType.isStorable()) {
Goods goods = colony.getGoodsContainer().getGoods(goodsType);
if (goods.getAmount() >= getClient().getClientOptions()

View File

@ -327,7 +327,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
* @param parent
*/
private void buildTerrainSubtree(DefaultMutableTreeNode parent) {
for (TileType t : Specification.getSpecification().getTileTypeList()) {
for (TileType t : getSpecification().getTileTypeList()) {
buildTerrainItem(t, parent);
}
}
@ -337,7 +337,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
* @param parent
*/
private void buildResourceSubtree(DefaultMutableTreeNode parent) {
for (ResourceType r : Specification.getSpecification().getResourceTypeList()) {
for (ResourceType r : getSpecification().getResourceTypeList()) {
buildResourceItem(r, parent);
}
}
@ -347,7 +347,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
* @param parent
*/
private void buildUnitSubtree(DefaultMutableTreeNode parent) {
for (UnitType u : Specification.getSpecification().getUnitTypeList()) {
for (UnitType u : getSpecification().getUnitTypeList()) {
if (u.getSkill() <= 0 ||
u.hasAbility("model.ability.expertSoldier")) {
buildUnitItem(u, 0.5f, parent);
@ -360,7 +360,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
* @param parent
*/
private void buildGoodsSubtree(DefaultMutableTreeNode parent) {
for (GoodsType g : Specification.getSpecification().getGoodsTypeList()) {
for (GoodsType g : getSpecification().getGoodsTypeList()) {
buildGoodsItem(g, parent);
}
}
@ -370,7 +370,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
* @param parent
*/
private void buildSkillsSubtree(DefaultMutableTreeNode parent) {
for (UnitType u : Specification.getSpecification().getUnitTypeList()) {
for (UnitType u : getSpecification().getUnitTypeList()) {
if (u.getSkill() > 0) {
buildUnitItem(u, 0.5f, parent);
}
@ -388,7 +388,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
List<BuildingType> buildingTypes = new ArrayList<BuildingType>();
Map<BuildingType, DefaultMutableTreeNode> buildingHash =
new HashMap<BuildingType, DefaultMutableTreeNode>();
for (BuildingType buildingType : Specification.getSpecification().getBuildingTypeList()) {
for (BuildingType buildingType : getSpecification().getBuildingTypeList()) {
if (buildingType.getUpgradesFrom() == null) {
String name = Messages.message(buildingType.getNameKey());
DefaultMutableTreeNode item =
@ -431,7 +431,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
for (FoundingFatherType fatherType : FoundingFatherType.values()) {
fathersByType.put(fatherType, new ArrayList<FoundingFather>());
}
for (FoundingFather foundingFather : Specification.getSpecification().getFoundingFathers()) {
for (FoundingFather foundingFather : getSpecification().getFoundingFathers()) {
fathersByType.get(foundingFather.getType()).add(foundingFather);
}
for (FoundingFatherType fatherType : FoundingFatherType.values()) {
@ -451,10 +451,10 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
* @param parent
*/
private void buildNationsSubtree(DefaultMutableTreeNode parent) {
for (Nation type : Specification.getSpecification().getEuropeanNations()) {
for (Nation type : getSpecification().getEuropeanNations()) {
buildNationItem(type, parent);
}
for (Nation type : Specification.getSpecification().getIndianNations()) {
for (Nation type : getSpecification().getIndianNations()) {
buildNationItem(type, parent);
}
}
@ -465,9 +465,9 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
*/
private void buildNationTypesSubtree(DefaultMutableTreeNode parent) {
List<NationType> nations = new ArrayList<NationType>();
nations.addAll(Specification.getSpecification().getEuropeanNationTypes());
nations.addAll(Specification.getSpecification().getREFNationTypes());
nations.addAll(Specification.getSpecification().getIndianNationTypes());
nations.addAll(getSpecification().getEuropeanNationTypes());
nations.addAll(getSpecification().getREFNationTypes());
nations.addAll(getSpecification().getIndianNationTypes());
for (NationType type : nations) {
buildNationTypeItem(type, parent);
}
@ -723,7 +723,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
List<String> scopeStrings = new ArrayList<String>();
for (Scope scope : modifier.getScopes()) {
if (scope.getType() != null) {
FreeColGameObjectType objectType = Specification.getSpecification()
FreeColGameObjectType objectType = getSpecification()
.getType(scope.getType());
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);
goodsPanel.add(goodsButton);
}
@ -784,7 +784,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
detailPanel.add(new JLabel(Integer.toString(type.getSkill())));
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") &&
buildingType.canAdd(type)) {
schools.add(buildingType);
@ -834,7 +834,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
}
List<Modifier> bonusList = new ArrayList<Modifier>();
for (GoodsType goodsType : Specification.getSpecification().getGoodsTypeList()) {
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
bonusList.addAll(type.getModifierSet(goodsType.getId()));
}
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));
productionPanel.setOpaque(false);
for (Modifier productionBonus : bonusList) {
GoodsType goodsType = Specification.getSpecification().getGoodsType(productionBonus.getId());
GoodsType goodsType = getSpecification().getGoodsType(productionBonus.getId());
String bonus = getModifierAsString(productionBonus);
productionPanel.add(getGoodsButton(goodsType, bonus));
}
@ -901,7 +901,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
List<TileImprovementType> improvements = new ArrayList<TileImprovementType>();
List<Modifier> modifiers = new ArrayList<Modifier>();
for (TileImprovementType improvementType :
Specification.getSpecification().getTileImprovementTypeList()) {
getSpecification().getTileImprovementTypeList()) {
Modifier productionModifier = improvementType.getProductionModifier(type);
if (productionModifier != null) {
improvements.add(improvementType);
@ -1029,7 +1029,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
JPanel production = new JPanel();
production.setOpaque(false);
production.setLayout(new MigLayout("wrap 3, gapx 20", "", ""));
for (UnitType unitType2 : Specification.getSpecification().getUnitTypeList()) {
for (UnitType unitType2 : getSpecification().getUnitTypeList()) {
if (buildingType.canAdd(unitType2)) {
production.add(getButton(unitType2));
}
@ -1060,7 +1060,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
// Specialist
if (workplaces > 0) {
detailPanel.add(new JLabel(Messages.message("colopedia.buildings.specialist")));
final UnitType unitType = Specification.getSpecification()
final UnitType unitType = getSpecification()
.getExpertForProducing(buildingType.getProducedGoodsType());
if (unitType == null) {
detailPanel.add(new JLabel(none));
@ -1078,7 +1078,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
for (Modifier productionBonus : bonusList) {
try {
GoodsType goodsType = Specification.getSpecification()
GoodsType goodsType = getSpecification()
.getGoodsType(productionBonus.getId());
String bonus = getModifierAsString(productionBonus);
productionPanel.add(getGoodsButton(goodsType, bonus));
@ -1395,7 +1395,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
Messages.message(entry.getKey() + ".name"),
doc.getStyle("regular"));
List<JButton> requiredTypes = new ArrayList<JButton>();
for (FreeColGameObjectType type : Specification.getSpecification()
for (FreeColGameObjectType type : getSpecification()
.getTypesProviding(entry.getKey(), entry.getValue())) {
JButton typeButton = getButton(type);
typeButton.addActionListener(this);
@ -1428,7 +1428,7 @@ public final class ColopediaPanel extends FreeColPanel implements TreeSelectionL
if (OK.equals(command)) {
getCanvas().remove(this);
} else {
FreeColGameObjectType type = Specification.getSpecification().getType(command);
FreeColGameObjectType type = getSpecification().getType(command);
initialize(type);
}
}

View File

@ -362,7 +362,7 @@ public final class DefaultTransferHandler extends TransferHandler {
Unit unit = unitLabel.getUnit();
if (unit.hasAbility("model.ability.canBeEquipped")) {
Goods goods = label.getGoods();
for (EquipmentType equipment : Specification.getSpecification()
for (EquipmentType equipment : canvas.getSpecification()
.getEquipmentTypeList()) {
if (unit.canBeEquippedWith(equipment) && equipment.getGoodsRequired().size() == 1) {
AbstractGoods requiredGoods = equipment.getGoodsRequired().get(0);
@ -428,7 +428,7 @@ public final class DefaultTransferHandler extends TransferHandler {
UnitLabel unitLabel = (UnitLabel) comp;
Unit unit = unitLabel.getUnit();
if (unit.hasAbility("model.ability.canBeEquipped")) {
for (EquipmentType equipment : Specification.getSpecification()
for (EquipmentType equipment : canvas.getSpecification()
.getEquipmentTypeList()) {
if (unit.canBeEquippedWith(equipment) && equipment.getGoodsRequired().size() == 1) {
AbstractGoods requiredGoods = equipment.getGoodsRequired().get(0);

View File

@ -79,12 +79,12 @@ public final class DifficultyDialog extends FreeColDialog<DifficultyLevel> imple
level = getGame().getDifficultyLevel();
if (level == null) {
// compatibility code
level = Specification.getSpecification().getDifficultyLevel(0);
level = getSpecification().getDifficultyLevel(0);
}
difficultyBox.addItem(Messages.message(level.getId()));
difficultyBox.setEnabled(false);
} else {
for (DifficultyLevel dLevel : Specification.getSpecification().getDifficultyLevels()) {
for (DifficultyLevel dLevel : getSpecification().getDifficultyLevels()) {
String id = dLevel.getId();
if ("model.difficulty.medium".equals(id)) {
DEFAULT_INDEX = difficultyBox.getItemCount();
@ -160,7 +160,7 @@ public final class DifficultyDialog extends FreeColDialog<DifficultyLevel> imple
ui.rollback();
ui.unregister();
getCanvas().remove(this);
setResponse(Specification.getSpecification().getDifficultyLevel(DEFAULT_INDEX));
setResponse(getSpecification().getDifficultyLevel(DEFAULT_INDEX));
} else if (RESET.equals(command)) {
ui.reset();
} else {
@ -170,7 +170,7 @@ public final class DifficultyDialog extends FreeColDialog<DifficultyLevel> imple
public void itemStateChanged(ItemEvent event) {
int index = difficultyBox.getSelectedIndex();
level = Specification.getSpecification().getDifficultyLevel(index);
level = getSpecification().getDifficultyLevel(index);
ui = new OptionMapUI(new DifficultyOptionMap(level), (index == CUSTOM_INDEX));
optionPanel.removeAll();
optionPanel.add(ui);

View File

@ -249,7 +249,7 @@ public final class DragListener extends MouseAdapter {
Colony colony = tempUnit.getLocation().getColony();
boolean separatorNeeded = false;
List<GoodsType> farmedGoods = Specification.getSpecification().getFarmedGoodsTypeList();
List<GoodsType> farmedGoods = canvas.getSpecification().getFarmedGoodsTypeList();
// Work in Field - automatically find the best location
for (GoodsType goodsType : farmedGoods) {
ColonyTile bestTile = colony.getVacantColonyTileFor(tempUnit, false, goodsType);
@ -349,7 +349,7 @@ public final class DragListener extends MouseAdapter {
}
int experience = Math.min(tempUnit.getExperience(), 200);
if (experience > 0 && tempUnit.getWorkType() != null) {
UnitType workType = Specification.getSpecification()
UnitType workType = canvas.getSpecification()
.getExpertForProducing(tempUnit.getWorkType());
if (tempUnit.getType().canBeUpgraded(workType, ChangeType.EXPERIENCE)) {
JMenuItem experienceItem = new JMenuItem(Messages.message("menuBar.experience") +
@ -437,7 +437,7 @@ public final class DragListener extends MouseAdapter {
EquipmentType horses = null;
EquipmentType muskets = null;
for (EquipmentType equipmentType : Specification.getSpecification().getEquipmentTypeList()) {
for (EquipmentType equipmentType : canvas.getSpecification().getEquipmentTypeList()) {
int count = tempUnit.getEquipment().getCount(equipmentType);
if (count > 0) {
// "remove current equipment" action

View File

@ -62,8 +62,6 @@ public final class EditSettlementDialog extends FreeColDialog<IndianSettlement>
@SuppressWarnings("unused")
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 final IndianSettlement settlement;
@ -184,6 +182,7 @@ public final class EditSettlementDialog extends FreeColDialog<IndianSettlement>
settlement.setLearnableSkill((UnitType) skill.getSelectedItem());
int numberOfUnits = (Integer) units.getValue() - settlement.getUnitCount();
if (numberOfUnits > 0) {
UnitType BRAVE = getSpecification().getUnitType("model.unit.brave");
for (int index = 0; index < numberOfUnits; index++) {
settlement.add(new Unit(settlement.getGame(), settlement, settlement.getOwner(),
BRAVE, UnitState.ACTIVE));

View File

@ -51,7 +51,6 @@ import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.ClientOptions;
import net.sf.freecol.client.gui.Canvas;
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) {
if (goodsType.isStorable()) {
MarketLabel marketLabel = new MarketLabel(goodsType, getMyPlayer().getMarket(), getCanvas());

View File

@ -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();
final int defaultHeight = MapGeneratorOptions.getHeight(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 inputHeight = new JTextField(Integer.toString(defaultHeight), COLUMNS);
final FreeColDialog<Dimension> mapSizeDialog =
new FreeColDialog<Dimension>(FreeCol.getFreeColClient().getCanvas());
final FreeColDialog<Dimension> mapSizeDialog = new FreeColDialog<Dimension>(canvas);
mapSizeDialog.setLayout(new MigLayout("wrap 2", "", ""));
mapSizeDialog.setLayout(new MigLayout("wrap 2"));
mapSizeDialog.okButton.setText(Messages.message("ok"));
mapSizeDialog.okButton.addActionListener(new ActionListener() {
@ -387,7 +386,7 @@ public class FreeColDialog<T> extends FreeColPanel {
}
mapSizeDialog.setResponse(new Dimension(width, height));
} catch (NumberFormatException nfe) {
FreeCol.getFreeColClient().getCanvas().errorMessage("integerAboveZero");
canvas.errorMessage("integerAboveZero");
}
}
});

View File

@ -240,7 +240,7 @@ public class FreeColPanel extends JPanel implements ActionListener {
* @return a <code>Specification</code> value
*/
public Specification getSpecification() {
return getGame().getSpecification();
return canvas.getSpecification();
}
/**

View File

@ -19,7 +19,6 @@
package net.sf.freecol.client.gui.panel;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.FreeColClient;
import net.sf.freecol.client.gui.i18n.Messages;
import net.sf.freecol.common.model.Specification;
@ -376,7 +375,7 @@ public class LabourData {
private UnitData scout;
public LabourData(FreeColClient client) {
Specification spec = FreeCol.getSpecification();
Specification spec = client.getGame().getSpecification();
for (UnitType unitType : spec.getUnitTypeList()) {
if (!unitType.isAvailableTo(client.getMyPlayer())) {
continue;
@ -447,7 +446,7 @@ public class LabourData {
}
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>();
for (UnitType unitType : unitTypes) {
if (unitType.hasSkill() && unitType.isAvailableTo(player)) {

View File

@ -30,7 +30,6 @@ import javax.swing.Action;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.ClientOptions;
import net.sf.freecol.client.FreeColClient;
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(SentryAction.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(BuildColonyAction.id)));

View File

@ -81,16 +81,11 @@ public final class MapEditorTransformPanel extends FreeColPanel {
@SuppressWarnings("unused")
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 JToggleButton settlementButton;
private ButtonGroup group;
private static final TileImprovementType riverType =
Specification.getSpecification().getTileImprovementType("model.improvement.river");
/**
* Describe nativePlayer here.
*/
@ -109,7 +104,7 @@ public final class MapEditorTransformPanel extends FreeColPanel {
if (server.getAIMain() == null) {
server.setAIMain(new AIMain(server));
}
for (Nation nation : Specification.getSpecification().getIndianNations()) {
for (Nation nation : getSpecification().getIndianNations()) {
server.addAIPlayer(nation);
}
}
@ -134,7 +129,7 @@ public final class MapEditorTransformPanel extends FreeColPanel {
* Builds the buttons for all the terrains.
*/
private void buildList() {
List<TileType> tileList = Specification.getSpecification().getTileTypeList();
List<TileType> tileList = getSpecification().getTileTypeList();
for (TileType type : tileList) {
listPanel.add(buildButton(getLibrary().getCompoundTerrainImage(type, 0.5),
Messages.message(type.getNameKey()),
@ -146,7 +141,7 @@ public final class MapEditorTransformPanel extends FreeColPanel {
listPanel.add(buildButton(getLibrary().getRiverImage(20, 0.5),
Messages.message("majorRiver"),
new RiverTransform(TileImprovement.LARGE_RIVER)));
listPanel.add(buildButton(getLibrary().getBonusImage(Specification.getSpecification()
listPanel.add(buildButton(getLibrary().getBonusImage(getSpecification()
.getResourceTypeList().get(0), 0.8),
Messages.message("editor.resource"), new ResourceTransform()));
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) {
TileImprovementType riverType =
tile.getSpecification().getTileImprovementType("model.improvement.river");
if (tile.getType().canHaveImprovement(riverType)) {
TileItemContainer tic = tile.getTileItemContainer();
if (tic == null) {
@ -400,9 +398,10 @@ public final class MapEditorTransformPanel extends FreeColPanel {
settlement = new IndianSettlement(t.getGame(), nativePlayer, t, name, false,
skill, new HashSet<Player>(), null);
t.setSettlement(settlement);
UnitType brave = getSpecification().getUnitType("model.unit.brave");
for (int index = 0; index < 5; index++) {
settlement.add(new Unit(settlement.getGame(), settlement, settlement.getOwner(),
BRAVE, UnitState.ACTIVE));
brave, UnitState.ACTIVE));
}
}
}

View File

@ -37,7 +37,6 @@ import javax.swing.JPanel;
import javax.swing.border.BevelBorder;
import javax.swing.event.MouseInputListener;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.ClientOptions;
import net.sf.freecol.client.FreeColClient;
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.
* Use miniRectWidth/Height / 2 to get the upper left corner.
* 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 miniRectY = (freeColClient.getGUI().getFocus().getY() - firstRow) * tileSize / 4;
int miniRectWidth = (getParent().getWidth() / library.getTerrainImageWidth(tileType) + 1) * tileSize;

View File

@ -143,7 +143,7 @@ public final class PlayersTable extends JTable {
TableColumn advantagesColumn = getColumnModel().getColumn(ADVANTAGE_COLUMN);
if (nationOptions.getNationalAdvantages() == NationOptions.Advantages.SELECTABLE) {
advantagesColumn.setCellEditor(new AdvantageCellEditor());
advantagesColumn.setCellEditor(new AdvantageCellEditor(canvas.getSpecification().getEuropeanNationTypes()));
}
advantagesColumn.setCellRenderer(new AdvantageCellRenderer(nationOptions.getNationalAdvantages()));
advantagesColumn.setHeaderRenderer(renderer);
@ -394,7 +394,7 @@ public final class PlayersTable extends JTable {
public PlayersTableModel(PreGameController pgc, NationOptions nationOptions, Player owningPlayer) {
nations = new ArrayList<Nation>();
players = new HashMap<Nation, Player>();
for (Nation nation : Specification.getSpecification().getNations()) {
for (Nation nation : owningPlayer.getSpecification().getNations()) {
NationState state = nationOptions.getNations().get(nation);
if (state != null) {
nations.add(nation);

View File

@ -58,7 +58,7 @@ public class RebelToolTip extends JToolTip {
add(new JLabel(Integer.toString(colony.getTory()) + "%"));
int libertyProduction = 0;
for (GoodsType goodsType : Specification.getSpecification().getLibertyGoodsTypeList()) {
for (GoodsType goodsType : colony.getSpecification().getLibertyGoodsTypeList()) {
add(new JLabel(Messages.message(goodsType.getNameKey())));
int netProduction = colony.getProductionNetOf(goodsType);
libertyProduction += netProduction;

View File

@ -101,7 +101,7 @@ public final class RecruitDialog extends FreeColDialog<Integer> implements Actio
int production = 0;
for (Colony colony : player.getColonies()) {
production += colony.getProductionOf(Specification.getSpecification()
production += colony.getProductionOf(getSpecification()
.getGoodsType("model.goods.crosses"));
}
int turns = 100;

View File

@ -89,7 +89,7 @@ public final class ReportCargoPanel extends ReportPanel {
reportPanel.add(new JSeparator(JSeparator.HORIZONTAL), "growx");
List<AbstractUnit> cargoTypes = new ArrayList<AbstractUnit>();
for (UnitType unitType : Specification.getSpecification().getUnitTypeList()) {
for (UnitType unitType : getSpecification().getUnitTypeList()) {
if (unitType.isAvailableTo(player)
&& (unitType.canCarryUnits() || unitType.canCarryGoods())) {
cargoTypes.add(new AbstractUnit(unitType, Role.DEFAULT, carriers.getCount(unitType)));

View File

@ -27,7 +27,6 @@ import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JSeparator;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.i18n.Messages;
import net.sf.freecol.common.model.Specification;
@ -95,8 +94,8 @@ public final class ReportColonyPanel extends ReportPanel {
}
// Production
GoodsType food = Specification.getSpecification().getGoodsType("model.goods.food");
GoodsType horses = Specification.getSpecification().getGoodsType("model.goods.horses");
GoodsType food = getSpecification().getGoodsType("model.goods.food");
GoodsType horses = getSpecification().getGoodsType("model.goods.horses");
int count = 0;
int netFood = colony.getFoodProduction() - colony.getFoodConsumption();
if (netFood != 0) {
@ -105,7 +104,7 @@ public final class ReportColonyPanel extends ReportPanel {
reportPanel.add(productionLabel, "span 2, top");
count++;
}
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
if (goodsType.isFoodType()) {
continue;
}

View File

@ -23,7 +23,6 @@ package net.sf.freecol.client.gui.panel;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.i18n.Messages;
import net.sf.freecol.common.model.Colony;
@ -69,7 +68,7 @@ public final class ReportContinentalCongressPanel extends ReportPanel {
currentFatherLabel.setVerticalTextPosition(JLabel.TOP);
currentFatherLabel.setHorizontalTextPosition(JLabel.CENTER);
reportPanel.add(currentFatherLabel);
GoodsType bellsType = FreeCol.getSpecification().getGoodsType("model.goods.bells");
GoodsType bellsType = getSpecification().getGoodsType("model.goods.bells");
FreeColProgressBar progressBar = new FreeColProgressBar(getCanvas(), bellsType);
int total = 0;
for (Colony colony : player.getColonies()) {

View File

@ -33,7 +33,6 @@ import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.i18n.Messages;
import net.sf.freecol.common.model.Specification;
@ -77,7 +76,7 @@ public final class ReportLabourPanel extends ReportPanel implements ActionListen
unitOnLand = new TypeCountMap<UnitType>();
unitInEurope = new TypeCountMap<UnitType>();
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>());
}
@ -117,7 +116,7 @@ public final class ReportLabourPanel extends ReportPanel implements ActionListen
public void displayData() {
List<UnitType> unitTypes = FreeCol.getSpecification().getUnitTypeList();
List<UnitType> unitTypes = getSpecification().getUnitTypeList();
ArrayList<UnitType> colonists = new ArrayList<UnitType>();
for (UnitType unitType : unitTypes) {
if (unitType.hasSkill()) {
@ -223,7 +222,7 @@ public final class ReportLabourPanel extends ReportPanel implements ActionListen
if (OK.equals(command)) {
super.actionPerformed(event);
} else {
UnitType unitType = FreeCol.getSpecification().getUnitType(command);
UnitType unitType = getSpecification().getUnitType(command);
ReportLabourDetailPanel details = new ReportLabourDetailPanel(getCanvas());
details.setDetailPanel(createUnitDetails(unitType, details));
getCanvas().addAsFrame(details);

View File

@ -78,9 +78,6 @@ public final class ReportMilitaryPanel extends ReportPanel {
private Map<EquippedUnitType, Integer> unitMap;
*/
private static final UnitType defaultType =
Specification.getSpecification().getUnitType("model.unit.freeColonist");
private List<String> colonyNames;
private List<String> otherNames;
@ -130,7 +127,7 @@ public final class ReportMilitaryPanel extends ReportPanel {
List<AbstractUnit> scoutUnits = new ArrayList<AbstractUnit>();
List<AbstractUnit> dragoonUnits = new ArrayList<AbstractUnit>();
List<AbstractUnit> soldierUnits = new ArrayList<AbstractUnit>();
for (UnitType unitType : Specification.getSpecification().getUnitTypeList()) {
for (UnitType unitType : getSpecification().getUnitTypeList()) {
if (unitType.isAvailableTo(player) &&
!unitType.hasAbility("model.ability.navalUnit") &&
(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)));
soldierUnits.add(new AbstractUnit(defaultType, Role.SOLDIER, soldiers.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()));
}
UnitType defaultType = getSpecification().getUnitType("model.unit.freeColonist");
for (Unit unit : player.getUnits()) {
if (unit.isOffensiveUnit() && !unit.isNaval()) {
UnitType unitType = defaultType;

View File

@ -95,7 +95,7 @@ public final class ReportNavalPanel extends ReportPanel {
reportPanel.add(new JSeparator(JSeparator.HORIZONTAL), "growx");
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")) {
ships.add(new AbstractUnit(unitType, Role.DEFAULT, navalUnits.getCount(unitType)));
}

View File

@ -29,7 +29,6 @@ import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.i18n.Messages;
import net.sf.freecol.common.model.Specification;
@ -67,7 +66,7 @@ public final class ReportProductionPanel extends ReportPanel {
goodsTypes = new ArrayList<GoodsType>();
List<String> goodsNames = new ArrayList<String>();
goodsNames.add(Messages.message("nothing"));
for (GoodsType goodsType : Specification.getSpecification().getGoodsTypeList()) {
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
if (!goodsType.isFarmed()) {
goodsTypes.add(goodsType);
goodsNames.add(Messages.message(goodsType.getNameKey()));
@ -117,7 +116,7 @@ public final class ReportProductionPanel extends ReportPanel {
List<List<BuildingType>> basicBuildingTypes = new ArrayList<List<BuildingType>>();
for (GoodsType goodsType : selectedTypes) {
List<BuildingType> buildingTypes = new ArrayList<BuildingType>();
for (BuildingType buildingType : FreeCol.getSpecification().getBuildingTypeList()) {
for (BuildingType buildingType : getSpecification().getBuildingTypeList()) {
if (goodsType.equals(buildingType.getProducedGoodsType())
|| !buildingType.getModifierSet(goodsType.getId()).isEmpty()) {
BuildingType firstLevel = buildingType.getFirstLevel();

View File

@ -53,7 +53,7 @@ public final class ReportReligiousPanel extends ReportPanel implements ActionLis
Player player = getMyPlayer();
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);
reportPanel.add(progressBar, "span");

View File

@ -29,7 +29,6 @@ import javax.swing.JViewport;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.i18n.Messages;
import net.sf.freecol.common.model.Building;
@ -86,13 +85,13 @@ public final class ReportRequirementsPanel extends ReportPanel {
JTextPane textPane = getDefaultTextPane();
StyledDocument doc = textPane.getStyledDocument();
int numberUnitTypes = FreeCol.getSpecification().numberOfUnitTypes();
int numberGoodsTypes = FreeCol.getSpecification().numberOfGoodsTypes();
int numberUnitTypes = getSpecification().numberOfUnitTypes();
int numberGoodsTypes = getSpecification().numberOfGoodsTypes();
unitCount = new int[colonies.size()][numberUnitTypes];
canTrain = new boolean[colonies.size()][numberUnitTypes];
surplus = new int[colonies.size()][numberGoodsTypes];
List<GoodsType> goodsTypes = FreeCol.getSpecification().getGoodsTypeList();
List<GoodsType> goodsTypes = getSpecification().getGoodsTypeList();
// check which colonies can train which units
for (int index = 0; index < colonies.size(); index++) {
Colony colony = colonies.get(index);
@ -127,7 +126,7 @@ public final class ReportRequirementsPanel extends ReportPanel {
Unit unit = colonyTile.getUnit();
if (unit != null) {
GoodsType workType = unit.getWorkType();
UnitType expert = FreeCol.getSpecification().getExpertForProducing(workType);
UnitType expert = getSpecification().getExpertForProducing(workType);
int expertIndex = expert.getIndex();
if (unitCount[index][expertIndex] == 0 && !expertWarning[expertIndex]) {
addExpertWarning(doc, index, workType, expert);

View File

@ -19,7 +19,6 @@
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.i18n.Messages;
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));
scrollPane.setColumnHeaderView(goodsHeader);
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
if (goodsType.isStorable()) {
storableGoods.add(goodsType);
}
@ -200,7 +199,7 @@ public final class ReportTradePanel extends ReportPanel {
JButton colonyButton = createColonyButton(colony, colonyIndex);
reportPanel.add(colonyButton, "cell 0 " + row + " 1 2");
column = 0;
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
if (!goodsType.isStorable()) {
continue;
}

View File

@ -36,7 +36,6 @@ import javax.swing.JLabel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.i18n.Messages;
import net.sf.freecol.common.model.GoodsType;
@ -108,13 +107,13 @@ public final class TilePanel extends FreeColPanel {
if (tileType != null) {
// TODO: make this more generic
UnitType colonist = FreeCol.getSpecification().getUnitType("model.unit.freeColonist");
UnitType colonist = getSpecification().getUnitType("model.unit.freeColonist");
JLabel label = null;
boolean first = true;
for (GoodsType goodsType : FreeCol.getSpecification().getFarmedGoodsTypeList()) {
for (GoodsType goodsType : getSpecification().getFarmedGoodsTypeList()) {
int potential = tile.potential(goodsType, colonist);
UnitType expert = FreeCol.getSpecification().getExpertForProducing(goodsType);
UnitType expert = getSpecification().getExpertForProducing(goodsType);
int expertPotential = tile.potential(goodsType, expert);
if (potential > 0) {
label = new JLabel(String.valueOf(potential),

View File

@ -49,7 +49,6 @@ import javax.swing.TransferHandler;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.i18n.Messages;
import net.sf.freecol.common.model.Colony;
@ -342,7 +341,7 @@ public final class TradeRouteInputDialog extends FreeColDialog<Boolean> implemen
public GoodsPanel() {
super(new GridLayout(0, 5, margin, margin));
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
if (goodsType.isStorable()) {
CargoLabel label = new CargoLabel(goodsType);
add(label);

View File

@ -31,7 +31,6 @@ import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.i18n.Messages;
@ -79,13 +78,13 @@ public final class TrainDialog extends FreeColDialog<Integer> implements ActionL
switch(europeAction) {
case TRAIN:
trainableUnits.addAll(FreeCol.getSpecification().getUnitTypesTrainedInEurope());
trainableUnits.addAll(getSpecification().getUnitTypesTrainedInEurope());
question = new JLabel(Messages.message("trainDialog.clickOn"));
setLayout(new MigLayout("wrap 3", "[sg]", ""));
break;
case PURCHASE:
default:
trainableUnits.addAll(FreeCol.getSpecification().getUnitTypesPurchasedInEurope());
trainableUnits.addAll(getSpecification().getUnitTypesPurchasedInEurope());
question = new JLabel(Messages.message("purchaseDialog.clickOn"));
setLayout(new MigLayout("wrap 2", "[sg]", ""));
}
@ -154,7 +153,7 @@ public final class TrainDialog extends FreeColDialog<Integer> implements ActionL
if (TRAIN_DONE.equals(command)) {
setResponse(new Integer(-1));
} else {
UnitType unitType = FreeCol.getSpecification().getUnitType(command);
UnitType unitType = getSpecification().getUnitType(command);
getController().trainUnitInEurope(unitType);
initialize();
}

View File

@ -38,7 +38,6 @@ import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.UIManager;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.control.InGameController;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.ImageLibrary;
@ -326,7 +325,7 @@ public final class UnitLabel extends JLabel implements ActionListener, PropertyC
}
break;
case WORK_TILE:
GoodsType goodsType = FreeCol.getSpecification().getGoodsType(arg);
GoodsType goodsType = parent.getSpecification().getGoodsType(arg);
// Change workType first for the benefit of change listeners
inGameController.changeWorkType(unit, goodsType);
// Move unit to best producing ColonyTile
@ -336,7 +335,7 @@ public final class UnitLabel extends JLabel implements ActionListener, PropertyC
}
break;
case WORK_BUILDING:
BuildingType buildingType = FreeCol.getSpecification().getBuildingType(arg);
BuildingType buildingType = parent.getSpecification().getBuildingType(arg);
Building building = unit.getColony().getBuilding(buildingType);
inGameController.work(unit, building);
break;

View File

@ -34,7 +34,6 @@ import javax.swing.JScrollPane;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.i18n.Messages;
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(cancel, "tag cancel");
for (GoodsType goodsType : FreeCol.getSpecification().getGoodsTypeList()) {
for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
if (goodsType.isStorable()) {
warehouseDialog.add(new WarehouseGoodsPanel(colony, goodsType));
}