Skip to content

Commit

Permalink
Merge pull request #5 from hATrayflood/feature/load-improve
Browse files Browse the repository at this point in the history
fix SimHacker#55: date and population are blank when load a city
  • Loading branch information
hATrayflood committed Nov 4, 2015
2 parents 6e3350e + 732dd0e commit b37e538
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion micropolis-java/src/micropolisj/engine/Micropolis.java
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,8 @@ void loadMisc(DataInputStream dis)
resCap = false;
comCap = false;
indCap = false;

lastCityPop = calcPopulation();
}

void writeMisc(DataOutputStream out)
Expand Down Expand Up @@ -2497,7 +2499,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) {
Expand All @@ -2519,6 +2521,11 @@ void checkGrowth()
}
}

int calcPopulation()
{
return (resPop + comPop * 8 + indPop * 8) * 20;
}

void doMessages()
{
//MORE (scenario stuff)
Expand Down
2 changes: 2 additions & 0 deletions micropolis-java/src/micropolisj/gui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ public void windowClosed(WindowEvent ev)
engine.addListener(this);
engine.addEarthquakeListener(this);
reloadFunds();
updateDateLabel();
reloadOptions();
startTimer();
makeClean();
Expand Down Expand Up @@ -312,6 +313,7 @@ public void setEngine(Micropolis newEngine)
demandInd.setEngine(engine);
graphsPane.setEngine(engine);
reloadFunds();
updateDateLabel();
reloadOptions();
notificationPane.setVisible(false);

Expand Down

0 comments on commit b37e538

Please sign in to comment.