From 2ab5eee78b495ec73049c8446a0ed37ab4ff0920 Mon Sep 17 00:00:00 2001 From: matthijs Date: Mon, 2 May 2005 22:13:20 +0000 Subject: (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. --- settings.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'settings.c') diff --git a/settings.c b/settings.c index 878b9ad81..2b6d52787 100644 --- a/settings.c +++ b/settings.c @@ -944,8 +944,8 @@ const SettingDesc patch_settings[] = { * penalty will further prevent this. * We give presignal exits (and combo's) a different (larger) penalty, because we really * don't want trains waiting in front of a presignal exit. */ - {"npf_rail_firstred_penalty", SDT_UINT32, (void*)(10 * NPF_TILE_LENGTH), &_patches.npf_rail_firstred_penalty, NULL}, - {"npf_rail_firstred_exit_penalty", SDT_UINT32, (void*)(100 * NPF_TILE_LENGTH), &_patches.npf_rail_firstred_exit_penalty, NULL}, + {"npf_rail_firstred_penalty", SDT_UINT32, (void*)(10 * NPF_TILE_LENGTH), &_patches.npf_rail_firstred_penalty, NULL}, + {"npf_rail_firstred_exit_penalty", SDT_UINT32, (void*)(100 * NPF_TILE_LENGTH), &_patches.npf_rail_firstred_exit_penalty, NULL}, /* This penalty is for when the last signal before the target is red. * This is useful for train stations, where there are multiple * platforms to choose from, which lie in different signal blocks. @@ -960,11 +960,19 @@ const SettingDesc patch_settings[] = { * a penalty of 1 tile for every station tile passed, the route will * be around it. */ - {"npf_rail_station_penalty", SDT_UINT32, (void*)(1 * NPF_TILE_LENGTH), &_patches.npf_rail_station_penalty, NULL}, - {"npf_rail_slope_penalty", SDT_UINT32, (void*)(1 * NPF_TILE_LENGTH), &_patches.npf_rail_slope_penalty, NULL}, - {"npf_rail_curve_penalty", SDT_UINT32, (void*)(1), &_patches.npf_rail_curve_penalty, NULL}, - - {NULL, 0, NULL, NULL, NULL} + {"npf_rail_station_penalty", SDT_UINT32, (void*)(1 * NPF_TILE_LENGTH), &_patches.npf_rail_station_penalty, NULL}, + {"npf_rail_slope_penalty", SDT_UINT32, (void*)(1 * NPF_TILE_LENGTH), &_patches.npf_rail_slope_penalty, NULL}, + /* This penalty is applied when a train makes a turn. Its value of 1 makes + * sure that it has a minimal impact on the pathfinding, only when two + * paths have equal length it will make a difference */ + {"npf_rail_curve_penalty", SDT_UINT32, (void*)(1), &_patches.npf_rail_curve_penalty, NULL}, + {"npf_buoy_penalty", SDT_UINT32, (void*)(2 * NPF_TILE_LENGTH), &_patches.npf_buoy_penalty, NULL}, + /* This penalty is applied when a ship makes a turn. It is bigger than the + * rail curve penalty, since ships (realisticly) have more trouble with + * making turns */ + {"npf_water_curve_penalty", SDT_UINT32, (void*)(NPF_TILE_LENGTH / 4), &_patches.npf_water_curve_penalty, NULL}, + + {NULL, 0, NULL, NULL, NULL} }; static const SettingDesc currency_settings[] = { -- cgit v1.2.3-54-g00ecf