diff options
author | rubidium <rubidium@openttd.org> | 2009-12-13 10:48:44 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-13 10:48:44 +0000 |
commit | 472e5501fa99b9db5c1ebccadf929e56e59fefdd (patch) | |
tree | 168696f40e69790495f936179cfa332faea5c3f7 /src/pathfinder/npf | |
parent | 3cfcae07e2732a11005da79dc0a113b22d83951b (diff) | |
download | openttd-472e5501fa99b9db5c1ebccadf929e56e59fefdd.tar.xz |
(svn r18481) -Codechange: unify the curve pathfinder penalty defaults; 0.01 tile won't make a dent, 3 tiles might be a bit too much
-Feature-ish: make maximum pathfinder penalties for finding depots customisable, also increase it slightly to 20 tiles worth of penalties.
Diffstat (limited to 'src/pathfinder/npf')
-rw-r--r-- | src/pathfinder/npf/npf.cpp | 8 | ||||
-rw-r--r-- | src/pathfinder/npf/npf_func.h | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 1fe5fe07f..1e732a125 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -1127,7 +1127,7 @@ static void NPFFillWithOrderData(NPFFindStationOrTileData *fstd, const Vehicle * /*** Road vehicles ***/ -FindDepotData NPFRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_distance) +FindDepotData NPFRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_penalty) { Trackdir trackdir = v->GetVehicleTrackdir(); @@ -1140,7 +1140,7 @@ FindDepotData NPFRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_dista * number by this. It might not be completely what we want, but it will * work for now :-) We can possibly change this when the old pathfinder * is removed. */ - return FindDepotData(ftd.node.tile, ftd.best_path_dist / NPF_TILE_LENGTH); + return FindDepotData(ftd.node.tile, ftd.best_path_dist); } Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs) @@ -1187,7 +1187,7 @@ Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, /*** Trains ***/ -FindDepotData NPFTrainFindNearestDepot(const Train *v, int max_distance) +FindDepotData NPFTrainFindNearestDepot(const Train *v, int max_penalty) { const Train *last = v->Last(); Trackdir trackdir = v->GetVehicleTrackdir(); @@ -1202,7 +1202,7 @@ FindDepotData NPFTrainFindNearestDepot(const Train *v, int max_distance) * number by this. It might not be completely what we want, but it will * work for now :-) We can possibly change this when the old pathfinder * is removed. */ - return FindDepotData(ftd.node.tile, ftd.best_path_dist / NPF_TILE_LENGTH, NPFGetFlag(&ftd.node, NPF_FLAG_REVERSE)); + return FindDepotData(ftd.node.tile, ftd.best_path_dist, NPFGetFlag(&ftd.node, NPF_FLAG_REVERSE)); } bool NPFTrainFindNearestSafeTile(const Train *v, TileIndex tile, Trackdir trackdir, bool override_railtype) diff --git a/src/pathfinder/npf/npf_func.h b/src/pathfinder/npf/npf_func.h index 14c4d2c53..6684d9897 100644 --- a/src/pathfinder/npf/npf_func.h +++ b/src/pathfinder/npf/npf_func.h @@ -19,12 +19,12 @@ /** * Used when user sends road vehicle to the nearest depot or if road vehicle needs servicing using NPF. * @param v vehicle that needs to go to some depot - * @param max_distance max distance (number of track tiles) from the current vehicle position - * (used also as optimization - the pathfinder can stop path finding if max_distance + * @param max_penalty max distance (in pathfinder penalty) from the current vehicle position + * (used also as optimization - the pathfinder can stop path finding if max_penalty * was reached and no depot was seen) * @return the data about the depot */ -FindDepotData NPFRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_distance); +FindDepotData NPFRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_penalty); /** * Finds the best path for given road vehicle using NPF. @@ -49,12 +49,12 @@ Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, /** * Used when user sends train to the nearest depot or if train needs servicing using NPF * @param v train that needs to go to some depot - * @param max_distance max distance (number of track tiles) from the current train position - * (used also as optimization - the pathfinder can stop path finding if max_distance + * @param max_penalty max max_penalty (in pathfinder penalty) from the current train position + * (used also as optimization - the pathfinder can stop path finding if max_penalty * was reached and no depot was seen) * @return the data about the depot */ -FindDepotData NPFTrainFindNearestDepot(const Train *v, int max_distance); +FindDepotData NPFTrainFindNearestDepot(const Train *v, int max_penalty); /** * Try to extend the reserved path of a train to the nearest safe tile using NPF. |