@@ 261,4 261,8 @@ public class CityDB {
public String getPicture() {
return picture;
}
+
+ public int sortByXMLID(CityDB other) {
+ return this.xmlID - other.xmlID;
+ }
}
@@ 51,9 51,9 @@ public class Main {
//This will eventually go obsolete once we load everything from our DB
//Prior to that, it might decrease when we load EE1 cities from the DB
- static int nextXMLID = 125;
+ static int nextXMLID = 0;
- final static int[] years = { 1900, 1910, 1920, 1930, 1940 };
+ final static int[] years = { 1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010 };
private static DecimalFormat percentFormat = new DecimalFormat("0.00");
@@ 67,6 67,7 @@ public class Main {
CreateCityDB cityDB = null;
cityDB = ImportCitiesFromXMLFile(cityDB, citiesAlreadyExisting);
+ Main.nextXMLID = cityDB.getCityList().size() + 1;
DBReader dbReader = new DBReader("D:/Gear City Mods/CityInfo.sqlite");
List<CountryDB> countries = dbReader.readCountryInfo();
@@ 108,6 109,7 @@ public class Main {
//Re-import so we don't add cities to the XML more than once
cityDB = ImportCitiesFromXMLFile(cityDB, citiesAlreadyExisting);
updateExistingXMLCities(citiesAlreadyExisting, cityDB);
+ cities.sort(CityDB::sortByXMLID);
cityDBLoop: for (CityDB city : cities) {
//See if it's already in the XML, if so skip
@@ 254,6 256,9 @@ cityDBLoop: for (CityDB city : cities) {
city.setPopPercentByYear(year, percent);
//TODO: Less hacky. This shouldn't really be in a loop
if (city.getXmlID() == 0) {
+ if (Main.nextXMLID == 228) {
+ System.out.println("debug");
+ }
city.setXMLID(Main.nextXMLID); //todo: less hacky
Main.nextXMLID++;
}