summaryrefslogtreecommitdiff
path: root/station_cmd.c
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
commitba733c005dbe8edf23a3f1cb05dd892df5be11a9 (patch)
treed0b9834259f5e0b0d954f2722cf9ab0ce5de1d99 /station_cmd.c
parenta7b661d47b126547815fde47b497ab7bf93d3246 (diff)
downloadopenttd-ba733c005dbe8edf23a3f1cb05dd892df5be11a9.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_cmd.c')
-rw-r--r--station_cmd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 8cecba027..9042ce6ed 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -642,7 +642,7 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
rect.min_y = MapSizeY();
rect.max_x = rect.max_y = 0;
// Don't update acceptance for a buoy
- if (st->had_vehicle_of_type & HVOT_BUOY)
+ if (IsBuoy(st))
return;
/* old accepted goods types */
@@ -1855,6 +1855,8 @@ int32 CmdBuildBuoy(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StationInitialize(st, ti.tile);
st->dock_tile = ti.tile;
st->facilities |= FACIL_DOCK;
+ /* Buoys are marked in the Station struct by this flag. Yes, it is this
+ * braindead.. */
st->had_vehicle_of_type |= HVOT_BUOY;
st->owner = OWNER_NONE;
@@ -1913,6 +1915,8 @@ static int32 RemoveBuoy(Station *st, uint32 flags)
if (flags & DC_EXEC) {
st->dock_tile = 0;
+ /* Buoys are marked in the Station struct by this flag. Yes, it is this
+ * braindead.. */
st->facilities &= ~FACIL_DOCK;
st->had_vehicle_of_type &= ~HVOT_BUOY;
@@ -2706,7 +2710,7 @@ uint MoveGoodsToStation(uint tile, int w, int h, int type, uint amount)
for(i=0; i!=8; i++) {
if (around[i] == INVALID_STATION) {
st = GetStation(st_index);
- if ((st->had_vehicle_of_type & HVOT_BUOY) == 0 &&
+ if (!IsBuoy(st) &&
( !st->town->exclusive_counter || (st->town->exclusivity == st->owner) ) && // check exclusive transport rights
st->goods[type].rating != 0 &&
(!_patches.selectgoods || st->goods[type].last_speed) && // if last_speed is 0, no vehicle has been there.