diff --git a/src/micropolisj/engine/Micropolis.java b/src/micropolisj/engine/Micropolis.java index 35ecd18..2400308 100644 --- a/src/micropolisj/engine/Micropolis.java +++ b/src/micropolisj/engine/Micropolis.java @@ -257,10 +257,10 @@ public class Micropolis } } - void fireCityMessage(MicropolisMessage message, CityLocation loc, boolean isPic) + void fireCityMessage(MicropolisMessage message, CityLocation loc) { for (Listener l : listeners) { - l.cityMessage(message, loc, isPic); + l.cityMessage(message, loc); } } @@ -380,7 +380,7 @@ public class Micropolis */ public interface Listener { - void cityMessage(MicropolisMessage message, CityLocation loc, boolean isPic); + void cityMessage(MicropolisMessage message, CityLocation loc); void citySound(Sound sound, CityLocation loc); /** @@ -1783,7 +1783,7 @@ public class Micropolis } clearMes(); - sendMessageAtPic(MicropolisMessage.MELTDOWN_REPORT, xpos, ypos); + sendMessageAt(MicropolisMessage.MELTDOWN_REPORT, xpos, ypos); } static final int [] MltdwnTab = { 30000, 20000, 10000 }; @@ -2124,7 +2124,7 @@ public class Micropolis makeSound(centerMassX, centerMassY, Sound.EXPLOSION_LOW); fireEarthquakeStarted(); - sendMessageAtPic(MicropolisMessage.EARTHQUAKE_REPORT, centerMassX, centerMassY); + sendMessageAt(MicropolisMessage.EARTHQUAKE_REPORT, centerMassX, centerMassY); int time = PRNG.nextInt(701) + 300; for (int z = 0; z < time; z++) { int x = PRNG.nextInt(getWidth()); @@ -2150,7 +2150,7 @@ public class Micropolis if (TileConstants.isArsonable(t)) { setTile(x, y, (char)(FIRE + PRNG.nextInt(8))); crashLocation = new CityLocation(x, y); - sendMessageAtPic(MicropolisMessage.FIRE_REPORT, x, y); + sendMessageAt(MicropolisMessage.FIRE_REPORT, x, y); } } @@ -2249,7 +2249,7 @@ public class Micropolis int xpos = PRNG.nextInt(getWidth() - 19) + 10; int ypos = PRNG.nextInt(getHeight() - 19) + 10; sprites.add(new TornadoSprite(this, xpos, ypos)); - sendMessageAtPic(MicropolisMessage.TORNADO_REPORT, xpos, ypos); + sendMessageAt(MicropolisMessage.TORNADO_REPORT, xpos, ypos); } public void makeFlood() @@ -2271,7 +2271,7 @@ public class Micropolis if (isFloodable(c)) { setTile(xx, yy, FLOOD); floodCnt = 30; - sendMessageAtPic(MicropolisMessage.FLOOD_REPORT, xx, yy); + sendMessageAt(MicropolisMessage.FLOOD_REPORT, xx, yy); floodX = xx; floodY = yy; return; @@ -2403,7 +2403,7 @@ public class Micropolis z = MicropolisMessage.POP_2K_REACHED; } if (z != null) { - sendMessage(z, true); + sendMessage(z); } } lastCityPop = newPop; @@ -2479,12 +2479,12 @@ public class Micropolis break; case 35: if (pollutionAverage > 60) { // FIXME, consider changing threshold to 80 - sendMessage(MicropolisMessage.HIGH_POLLUTION, true); + sendMessage(MicropolisMessage.HIGH_POLLUTION); } break; case 42: if (crimeAverage > 100) { - sendMessage(MicropolisMessage.HIGH_CRIME, true); + sendMessage(MicropolisMessage.HIGH_CRIME); } break; case 45: @@ -2537,22 +2537,12 @@ public class Micropolis void sendMessage(MicropolisMessage message) { - fireCityMessage(message, null, false); - } - - void sendMessage(MicropolisMessage message, boolean isPic) - { - fireCityMessage(message, null, true); + fireCityMessage(message, null); } void sendMessageAt(MicropolisMessage message, int x, int y) { - fireCityMessage(message, new CityLocation(x,y), false); - } - - void sendMessageAtPic(MicropolisMessage message, int x, int y) - { - fireCityMessage(message, new CityLocation(x,y), true); + fireCityMessage(message, new CityLocation(x,y)); } public ZoneStatus queryZoneStatus(int xpos, int ypos) diff --git a/src/micropolisj/engine/MicropolisMessage.java b/src/micropolisj/engine/MicropolisMessage.java index ae1669c..ec365b2 100644 --- a/src/micropolisj/engine/MicropolisMessage.java +++ b/src/micropolisj/engine/MicropolisMessage.java @@ -61,4 +61,30 @@ public enum MicropolisMessage // added by Jason NO_NUCLEAR_PLANTS; + + /** Whether the message should be displayed in the notification pane. */ + public boolean useNotificationPane = false; + + static + { + // not location-specific + POP_2K_REACHED.useNotificationPane = true; + POP_10K_REACHED.useNotificationPane = true; + POP_50K_REACHED.useNotificationPane = true; + POP_100K_REACHED.useNotificationPane = true; + POP_500K_REACHED.useNotificationPane = true; + HIGH_CRIME.useNotificationPane = true; + HIGH_POLLUTION.useNotificationPane = true; + + // location-specific + FLOOD_REPORT.useNotificationPane = true; + FIRE_REPORT.useNotificationPane = true; + TORNADO_REPORT.useNotificationPane = true; + MELTDOWN_REPORT.useNotificationPane = true; + EARTHQUAKE_REPORT.useNotificationPane = true; + TRAIN_CRASH_REPORT.useNotificationPane = true; + SHIPWRECK_REPORT.useNotificationPane = true; + COPTER_CRASH_REPORT.useNotificationPane = true; + PLANECRASH_REPORT.useNotificationPane = true; + } } diff --git a/src/micropolisj/engine/Sprite.java b/src/micropolisj/engine/Sprite.java index e285bd6..c914bbf 100644 --- a/src/micropolisj/engine/Sprite.java +++ b/src/micropolisj/engine/Sprite.java @@ -130,20 +130,20 @@ public abstract class Sprite switch (kind) { case AIR: city.crashLocation = new CityLocation(xpos, ypos); - city.sendMessageAtPic(MicropolisMessage.PLANECRASH_REPORT, xpos, ypos); + city.sendMessageAt(MicropolisMessage.PLANECRASH_REPORT, xpos, ypos); break; case SHI: city.crashLocation = new CityLocation(xpos, ypos); - city.sendMessageAtPic(MicropolisMessage.SHIPWRECK_REPORT, xpos, ypos); + city.sendMessageAt(MicropolisMessage.SHIPWRECK_REPORT, xpos, ypos); break; case TRA: case BUS: city.crashLocation = new CityLocation(xpos, ypos); - city.sendMessageAtPic(MicropolisMessage.TRAIN_CRASH_REPORT, xpos, ypos); + city.sendMessageAt(MicropolisMessage.TRAIN_CRASH_REPORT, xpos, ypos); break; case COP: city.crashLocation = new CityLocation(xpos, ypos); - city.sendMessageAtPic(MicropolisMessage.COPTER_CRASH_REPORT, xpos, ypos); + city.sendMessageAt(MicropolisMessage.COPTER_CRASH_REPORT, xpos, ypos); break; } diff --git a/src/micropolisj/gui/DemandIndicator.java b/src/micropolisj/gui/DemandIndicator.java index 4b3bdc3..785db96 100644 --- a/src/micropolisj/gui/DemandIndicator.java +++ b/src/micropolisj/gui/DemandIndicator.java @@ -141,7 +141,7 @@ public class DemandIndicator extends JComponent } //implements Micropolis.Listener - public void cityMessage(MicropolisMessage m, CityLocation p, boolean x) { } + public void cityMessage(MicropolisMessage m, CityLocation p) { } public void citySound(Sound sound, CityLocation p) { } public void censusChanged() { } public void evaluationChanged() { } diff --git a/src/micropolisj/gui/EvaluationPane.java b/src/micropolisj/gui/EvaluationPane.java index 7ad9d84..497eef3 100644 --- a/src/micropolisj/gui/EvaluationPane.java +++ b/src/micropolisj/gui/EvaluationPane.java @@ -242,7 +242,7 @@ public class EvaluationPane extends JPanel } //implements Micropolis.Listener - public void cityMessage(MicropolisMessage message, CityLocation loc, boolean isPic) {} + public void cityMessage(MicropolisMessage message, CityLocation loc) {} public void citySound(Sound sound, CityLocation loc) {} public void censusChanged() {} public void demandChanged() {} diff --git a/src/micropolisj/gui/GraphsPane.java b/src/micropolisj/gui/GraphsPane.java index 5f41bb9..dc8d2ce 100644 --- a/src/micropolisj/gui/GraphsPane.java +++ b/src/micropolisj/gui/GraphsPane.java @@ -143,7 +143,7 @@ public class GraphsPane extends JPanel } //implements Micropolis.Listener - public void cityMessage(MicropolisMessage message, CityLocation loc, boolean isPic) {} + public void cityMessage(MicropolisMessage message, CityLocation loc) {} public void citySound(Sound sound, CityLocation loc) {} public void demandChanged() {} public void evaluationChanged() {} diff --git a/src/micropolisj/gui/MainWindow.java b/src/micropolisj/gui/MainWindow.java index c77dcc3..64baf6a 100644 --- a/src/micropolisj/gui/MainWindow.java +++ b/src/micropolisj/gui/MainWindow.java @@ -1540,11 +1540,11 @@ public class MainWindow extends JFrame } //implements Micropolis.Listener - public void cityMessage(MicropolisMessage m, CityLocation p, boolean pictureMessage) + public void cityMessage(MicropolisMessage m, CityLocation p) { messagesPane.appendCityMessage(m); - if (pictureMessage && p != null) + if (m.useNotificationPane && p != null) { notificationPane.showMessage(engine, m, p.x, p.y); }