Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #55: date and population are blank when load a city #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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) {
Expand All @@ -2513,6 +2515,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