summaryrefslogtreecommitdiff
path: root/src/station.h
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2007-01-14 23:02:12 +0000
committerKUDr <kudr@openttd.org>2007-01-14 23:02:12 +0000
commitcd74706c5409ab6c912618be25dfa6dcea7bbaf5 (patch)
tree2febfb4531c8e73b22c79f285dce790980a7a8e1 /src/station.h
parentde10e911cbcc09b56eff3bc9ab4fe7045c3e6efc (diff)
downloadopenttd-cd74706c5409ab6c912618be25dfa6dcea7bbaf5.tar.xz
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
Diffstat (limited to 'src/station.h')
-rw-r--r--src/station.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/station.h b/src/station.h
index 73486bffe..e2ec2e8a7 100644
--- a/src/station.h
+++ b/src/station.h
@@ -59,6 +59,29 @@ typedef struct StationSpecList {
uint8 localidx; /// Station ID within GRF of station
} StationSpecList;
+/** StationRect - used to track station spread out rectangle - cheaper than scanning whole map */
+struct StationRect : public Rect {
+ enum StationRectMode
+ {
+ ADD_TEST = 0,
+ ADD_TRY,
+ ADD_FORCE
+ };
+
+ StationRect();
+ void MakeEmpty();
+ bool PtInRectXY(int x, int y) const;
+ bool IsEmpty() const;
+ bool BeforeAddTile(TileIndex tile, StationRectMode mode);
+ bool BeforeAddRect(TileIndex tile, int w, int h, StationRectMode mode);
+ bool AfterRemoveTile(Station *st, TileIndex tile);
+ bool AfterRemoveRect(Station *st, TileIndex tile, int w, int h);
+
+ static bool ScanForStationTiles(StationID st_id, int left_a, int top_a, int right_a, int bottom_a);
+
+ StationRect& operator = (Rect src);
+};
+
struct Station {
TileIndex xy;
RoadStop *bus_stops;
@@ -107,9 +130,9 @@ struct Station {
byte bus_stop_status_obsolete;
byte blocked_months_obsolete;
- Rect rect; ///< Station spread out rectangle (not saved) maintained by StationRect_xxx() functions
+ StationRect rect; ///< Station spread out rectangle (not saved) maintained by StationRect_xxx() functions
- static const int cDebugCtorLevel = 1;
+ static const int cDebugCtorLevel = 3;
Station(TileIndex tile = 0);
~Station();