From 4f05e700007ea950b3dd3245f7ba4e99c0ac5c1e Mon Sep 17 00:00:00 2001 From: Stian Grenborgen Date: Sun, 28 Jan 2024 08:06:52 +0100 Subject: [PATCH] Hides the display of the "option only"-nation type from the start game panel. This nation type was already hidden from display in the Colopedia. --- src/net/sf/freecol/client/gui/panel/PlayersTable.java | 3 +-- .../client/gui/panel/colopedia/NationTypeDetailPanel.java | 4 +--- src/net/sf/freecol/common/model/Specification.java | 6 ++++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/net/sf/freecol/client/gui/panel/PlayersTable.java b/src/net/sf/freecol/client/gui/panel/PlayersTable.java index f349b325c..d7f073146 100644 --- a/src/net/sf/freecol/client/gui/panel/PlayersTable.java +++ b/src/net/sf/freecol/client/gui/panel/PlayersTable.java @@ -708,8 +708,7 @@ public final class PlayersTable extends JTable { TableColumn advantagesColumn = tcm.getColumn(ADVANTAGE_COLUMN); switch (nationOptions.getNationalAdvantages()) { case SELECTABLE: - advantagesColumn.setCellEditor(new AdvantageCellEditor(spec - .getEuropeanNationTypes())); + advantagesColumn.setCellEditor(new AdvantageCellEditor(spec.getVisibleEuropeanNationTypes())); break; case FIXED: break; // Do nothing diff --git a/src/net/sf/freecol/client/gui/panel/colopedia/NationTypeDetailPanel.java b/src/net/sf/freecol/client/gui/panel/colopedia/NationTypeDetailPanel.java index 95d994571..0a8f3ae23 100644 --- a/src/net/sf/freecol/client/gui/panel/colopedia/NationTypeDetailPanel.java +++ b/src/net/sf/freecol/client/gui/panel/colopedia/NationTypeDetailPanel.java @@ -84,13 +84,11 @@ public class NationTypeDetailPanel getName(), null)); List nations = new ArrayList<>(); - nations.addAll(getSpecification().getEuropeanNationTypes()); + nations.addAll(getSpecification().getVisibleEuropeanNationTypes()); nations.addAll(getSpecification().getREFNationTypes()); nations.addAll(getSpecification().getIndianNationTypes()); ImageIcon icon = new ImageIcon(ImageUtils.createCenteredImage(getImageLibrary().getLibertyImage(), getListItemIconSize())); for (NationType type : nations) { - // Suppress special case. FIXME: This is a kludge - if ("model.nationType.optionOnly".equals(type.getId())) continue; parent.add(buildItem(type, icon)); } root.add(parent); diff --git a/src/net/sf/freecol/common/model/Specification.java b/src/net/sf/freecol/common/model/Specification.java index c2267b2aa..1ba0f17a4 100644 --- a/src/net/sf/freecol/common/model/Specification.java +++ b/src/net/sf/freecol/common/model/Specification.java @@ -1556,6 +1556,12 @@ public final class Specification implements OptionContainer { public List getEuropeanNationTypes() { return europeanNationTypes; } + + public List getVisibleEuropeanNationTypes() { + return europeanNationTypes.stream() + .filter(type -> !"model.nationType.optionOnly".equals(type.getId())) + .collect(Collectors.toList()); + } public List getREFNationTypes() { return REFNationTypes;