(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:
22
npf.h
22
npf.h
@@ -117,6 +117,11 @@ const byte _signal_against_trackdir[14];
|
||||
*/
|
||||
const uint16 _trackdir_reaches_trackdirs[14];
|
||||
|
||||
/**
|
||||
* Maps a trackdir to the trackdir that you will end up on if you go straight
|
||||
* ahead. This will be the same trackdir for diagonal trackdirs, but a
|
||||
* different (alternating) one for straight trackdirs */
|
||||
const uint16 _next_trackdir[14];
|
||||
/**
|
||||
* Maps a trackdir to all trackdirs that make 90 deg turns with it.
|
||||
*/
|
||||
@@ -161,6 +166,23 @@ const byte _reverse_dir[4];
|
||||
*/
|
||||
const byte _reverse_trackdir[14];
|
||||
|
||||
/* Returns the Track that a given Trackdir represents */
|
||||
static inline byte TrackdirToTrack(byte trackdir) { return trackdir & 0x7; }
|
||||
|
||||
/* Returns a Trackdir for the given Track. Since every Track corresponds to
|
||||
* two Trackdirs, we choose the one which points between N and SE.
|
||||
* Note that the actual implementation is quite futile, but this might change
|
||||
* in the future.
|
||||
*/
|
||||
static inline byte TrackToTrackdir(byte track) { return track; }
|
||||
|
||||
/* Checks if a given Track is diagonal */
|
||||
static inline bool IsDiagonalTrack(byte track) { return track == 0x0 || track == 0x1; }
|
||||
|
||||
/* Checks if a given Trackdir is diagonal. */
|
||||
static inline bool IsDiagonalTrackdir(byte trackdir) { return IsDiagonalTrack(TrackdirToTrack(trackdir)); }
|
||||
|
||||
|
||||
#define REVERSE_TRACKDIR(trackdir) (trackdir ^ 0x8)
|
||||
|
||||
#endif // NPF_H
|
||||
|
Reference in New Issue
Block a user