(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.
This commit is contained in:
matthijs
2005-05-02 22:13:20 +00:00
parent a7b661d47b
commit ba733c005d
9 changed files with 119 additions and 50 deletions

View File

@@ -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) {