From a8e1404790cf374525a7b2662522eb92678b3c7a Mon Sep 17 00:00:00 2001 From: hATrayflood Date: Thu, 5 Nov 2015 02:04:37 +0900 Subject: [PATCH] fix #55: date and population are blank when load a city --- micropolis-java/src/micropolisj/engine/Micropolis.java | 9 ++++++++- micropolis-java/src/micropolisj/gui/MainWindow.java | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/micropolis-java/src/micropolisj/engine/Micropolis.java b/micropolis-java/src/micropolisj/engine/Micropolis.java index 1a1454c4..95a6b9ad 100644 --- a/micropolis-java/src/micropolisj/engine/Micropolis.java +++ b/micropolis-java/src/micropolisj/engine/Micropolis.java @@ -1983,6 +1983,8 @@ void loadMisc(DataInputStream dis) resCap = false; comCap = false; indCap = false; + + lastCityPop = calcPopulation(); } void writeMisc(DataOutputStream out) @@ -2491,7 +2493,7 @@ void makeExplosionAt(int x, int y) void checkGrowth() { if (cityTime % 4 == 0) { - int newPop = (resPop + comPop * 8 + indPop * 8) * 20; + int newPop = calcPopulation(); if (lastCityPop != 0) { MicropolisMessage z = null; if (lastCityPop < 500000 && newPop >= 500000) { @@ -2513,6 +2515,11 @@ void checkGrowth() } } + int calcPopulation() + { + return (resPop + comPop * 8 + indPop * 8) * 20; + } + void doMessages() { //MORE (scenario stuff) diff --git a/micropolis-java/src/micropolisj/gui/MainWindow.java b/micropolis-java/src/micropolisj/gui/MainWindow.java index 47fc7146..e64f1235 100644 --- a/micropolis-java/src/micropolisj/gui/MainWindow.java +++ b/micropolis-java/src/micropolisj/gui/MainWindow.java @@ -281,6 +281,7 @@ public void windowClosed(WindowEvent ev) engine.addListener(this); engine.addEarthquakeListener(this); reloadFunds(); + updateDateLabel(); reloadOptions(); startTimer(); makeClean(); @@ -312,6 +313,7 @@ public void setEngine(Micropolis newEngine) demandInd.setEngine(engine); graphsPane.setEngine(engine); reloadFunds(); + updateDateLabel(); reloadOptions(); notificationPane.setVisible(false);