summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-01-03 16:27:52 +0000
committersmatz <smatz@openttd.org>2009-01-03 16:27:52 +0000
commit5ba7c672da004302fb9ffbb2cc4d47d5fd8dfa6a (patch)
tree2361c787823275e7f4d3be5d74d93da658d5e333
parentb00e510140b4983d58f580fdca87368b1edb436a (diff)
downloadopenttd-5ba7c672da004302fb9ffbb2cc4d47d5fd8dfa6a.tar.xz
(svn r14808) -Fix (r1): coal mine subsidence could wrap around map edges
-rw-r--r--src/disaster_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 37a2a3bb0..ccdd230ca 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -983,11 +983,11 @@ static void Disaster_CoalMine_Init()
{
TileIndex tile = i->xy;
TileIndexDiff step = TileOffsByDiagDir((DiagDirection)GB(Random(), 0, 2));
- uint n;
- for (n = 0; n < 30; n++) {
+ for (uint n = 0; n < 30; n++) {
DisasterClearSquare(tile);
- tile = TILE_MASK(tile + step);
+ tile += step;
+ if (!IsValidTile(tile)) break;
}
}
return;