summaryrefslogtreecommitdiff
path: root/settings.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
commit2ab5eee78b495ec73049c8446a0ed37ab4ff0920 (patch)
treed0b9834259f5e0b0d954f2722cf9ab0ce5de1d99 /settings.c
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 'settings.c')
-rw-r--r--settings.c22
1 files changed, 15 insertions, 7 deletions
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[] = {