summaryrefslogtreecommitdiff
path: root/station.h
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-05-02 22:13:20 +0000
committermatthijs <matthijs@openttd.org>2005-05-02 22:13:20 +0000
commit2ab5eee78b495ec73049c8446a0ed37ab4ff0920 (patch)
treed0b9834259f5e0b0d954f2722cf9ab0ce5de1d99 /station.h
parentd26052c7df0e3ae640f45d72068e3112c2c21477 (diff)
downloadopenttd-2ab5eee78b495ec73049c8446a0ed37ab4ff0920.tar.xz
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
Buoys will now try to get within 3 tiles of a buoy instead of a the actual buoy tile. This gets ships to got past buoys in a realistic (IMO) way instead of barging right through them. - Fix: [NPF] Trains get curves penalties sometimes even when the track is straight. - Add: [NPF] Ships get a penalty for going over buoys now, so they will try to go around. - Add: [NPF] Ships get a penalty for curves too, yay for straight lines. - Add: TrackdirToTrack(), TrackToTrackdir(), IsDiagonalTrack() and IsDiagonalTrackdir() helper functions. - Add: IsBuoy() and IsBuoyTile() helper functions. - Codechange: Rearranged part of the control flow of ShipController(), removing a goto.
Diffstat (limited to 'station.h')
-rw-r--r--station.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/station.h b/station.h
index 6252c4328..413613b46 100644
--- a/station.h
+++ b/station.h
@@ -103,6 +103,8 @@ enum {
HVOT_TRUCK = 1 << 3,
HVOT_AIRCRAFT = 1 << 4,
HVOT_SHIP = 1 << 5,
+ /* This bit is used to mark stations. No, it does not belong here, but what
+ * can we do? ;-) */
HVOT_BUOY = 1 << 6
};
@@ -290,7 +292,7 @@ static inline bool IsCompatibleTrainStationTile(TileIndex tile, TileIndex ref)
(_map5[tile] & 0x01) == (_map5[ref] & 0x01); // same direction?
}
-static inline bool IsRoadStationTile(uint tile) {
+static inline bool IsRoadStationTile(TileIndex tile) {
return IsTileType(tile, MP_STATION) && IS_BYTE_INSIDE(_map5[tile], 0x43, 0x4B);
}
@@ -302,6 +304,15 @@ static inline bool IsValidStation(const Station *st)
return st->xy != 0; /* XXX: Replace by INVALID_TILE someday */
}
+static inline bool IsBuoy(const Station* st)
+{
+ return st->had_vehicle_of_type & HVOT_BUOY; /* XXX: We should really ditch this ugly coding and switch to something sane... */
+}
+
+static inline bool IsBuoyTile(TileIndex tile) {
+ return IsTileType(tile, MP_STATION) && _map5[tile] == 0x52;
+}
+
/* Get's the direction the station exit points towards. Ie, returns 0 for a
* station with the exit NE. */
static inline byte GetRoadStationDir(uint tile) {