(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 d26052c7df
commit 2ab5eee78b
9 changed files with 119 additions and 50 deletions

View File

@@ -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},
{"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}
{NULL, 0, NULL, NULL, NULL}
};
static const SettingDesc currency_settings[] = {