summaryrefslogtreecommitdiff
path: root/src/tilearea_type.h
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-12-09 19:30:30 +0000
committeryexo <yexo@openttd.org>2011-12-09 19:30:30 +0000
commitc9be5d50dac64fe9fefe1a1e85d4eeaf8cc2470c (patch)
treeb9ca1f44038117b6c621e448b6e87e2a2897685b /src/tilearea_type.h
parent42c4fdf9ab6c9123609afdf5a0dde3f3164795fd (diff)
downloadopenttd-c9be5d50dac64fe9fefe1a1e85d4eeaf8cc2470c.tar.xz
(svn r23461) -Fix: handle a missing airport newgrf as graceful as possible by not crashing when loading such savegame or when an airport is removed
Diffstat (limited to 'src/tilearea_type.h')
-rw-r--r--src/tilearea_type.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tilearea_type.h b/src/tilearea_type.h
index 5826ce116..1b3832a84 100644
--- a/src/tilearea_type.h
+++ b/src/tilearea_type.h
@@ -94,6 +94,11 @@ public:
* Move ourselves to the next tile in the rectange on the map.
*/
virtual TileIterator& operator ++() = 0;
+
+ /**
+ * Allocate a new iterator that is a copy of this one.
+ */
+ virtual TileIterator *Clone() const = 0;
};
/** Iterator to iterate over a tile area (rectangle) of the map. */
@@ -129,6 +134,11 @@ public:
}
return *this;
}
+
+ virtual TileIterator *Clone() const
+ {
+ return new OrthogonalTileIterator(*this);
+ }
};
/** Iterator to iterate over a diagonal area of the map. */
@@ -145,6 +155,11 @@ public:
DiagonalTileIterator(TileIndex begin, TileIndex end);
TileIterator& operator ++();
+
+ virtual TileIterator *Clone() const
+ {
+ return new DiagonalTileIterator(*this);
+ }
};
/**