From 2d8e8ba86d38f88220e3a1bdf9d209e356af84c5 Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Sun, 22 Dec 2013 16:32:39 +0000 Subject: [PATCH] tornado: add logic for when tornado runs out of steam This is code from the original C/C++ release, modified to fix what I perceived as a bug. After the tornado runs for 200 ticks, there is a 0.2% chance of termination each tick. git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@912 d9718cc8-9f43-0410-858b-315f434eb58c --- src/micropolisj/engine/TornadoSprite.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/micropolisj/engine/TornadoSprite.java b/src/micropolisj/engine/TornadoSprite.java index cfdca3d..b6702c8 100644 --- a/src/micropolisj/engine/TornadoSprite.java +++ b/src/micropolisj/engine/TornadoSprite.java @@ -75,7 +75,11 @@ public class TornadoSprite extends Sprite return; } - // FIXME- the original code checks here for an ending condition + if (this.count == 0 && city.PRNG.nextInt(501) == 0) { + // early termination + this.frame = 0; + return; + } destroyTile(x/16, y/16); }