# HG changeset patch # User Andrew # Date 1662072083 14400 # Thu Sep 01 18:41:23 2022 -0400 # Node ID 75c5946377202fbc153b5fdf411ef46cfc7ccbc1 # Parent 148e284fb684678c1dc27b268d1e437c33446243 Set flag based on year for Germany, which AFAIK is the only country we have whose flag changes without changing names. Still imperfect, e.g. Russian cities won't change name or flag under the USSR yet. diff --git a/src/main/java/com/ajtjp/gearCity/CityInfoFile/City.java b/src/main/java/com/ajtjp/gearCity/CityInfoFile/City.java --- a/src/main/java/com/ajtjp/gearCity/CityInfoFile/City.java +++ b/src/main/java/com/ajtjp/gearCity/CityInfoFile/City.java @@ -60,7 +60,7 @@ //alignment is always the empty string this.gOVERN = new GOVERN(1); this.tAX = new TAX(1.3); - setFlag(city.getCountry().getName()); + setFlag(city.getCountry().getName(), xmlYear); this.pIC = new PIC("Generic.dds"); if (city.getPicture() != null) { this.pIC = new PIC(city.getPicture() + ".dds"); @@ -103,18 +103,31 @@ this.bUYRATE = "1"; } - public void setFlag(String countryName) { - if (countryName.equals("United Kingdom")) { - this.fLAG = new FLAG("UK.dds"); - } - else if (countryName.equals("Ottoman Empire")) { - this.fLAG = new FLAG("Ottoman.dds"); - } - else if (countryName.equals("Austria-Hungary")) { - this.fLAG = new FLAG("Austria_Hungry.dds"); //misspelled in the base game - } - else { - this.fLAG = new FLAG(countryName + ".dds"); + public void setFlag(String countryName, int year) { + switch (countryName) { + case "United Kingdom": + this.fLAG = new FLAG("UK.dds"); + break; + case "Ottoman Empire": + this.fLAG = new FLAG("Ottoman.dds"); + break; + case "Austria-Hungary": + this.fLAG = new FLAG("Austria_Hungry.dds"); //misspelled in the base game + break; + case "Germany": + if (year <= 1918) { + this.fLAG = new FLAG("GermanEmpire.dds"); + } + else if (year >= 1933 && year <= 1945) { + this.fLAG = new FLAG("3rdGerman.dds"); + } + else { + //Same flag for both Wiemar and modern periods + this.fLAG = new FLAG("Germany.dds"); + } break; + default: + this.fLAG = new FLAG(countryName + ".dds"); + break; } } diff --git a/src/main/java/com/ajtjp/gearCity/Main.java b/src/main/java/com/ajtjp/gearCity/Main.java --- a/src/main/java/com/ajtjp/gearCity/Main.java +++ b/src/main/java/com/ajtjp/gearCity/Main.java @@ -129,7 +129,7 @@ } else if (!city.getCountry().getName().equals(xml.getCOUNTRY().getNation())) { xml.setCOUNTRY(new COUNTRY(city.getCountry().getName())); - xml.setFlag(city.getCountry().getName()); + xml.setFlag(city.getCountry().getName(), year); } continue cityDBLoop; }