mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-11 01:49:50 +00:00
(svn r18383) -Fix (r18375): triggering NOT_REACHED for some waypoints
This commit is contained in:
parent
4ec4fdff36
commit
66da3cbb20
@ -453,7 +453,9 @@ static int32 NPFFindStationOrTile(AyStar *as, OpenListNode *current)
|
||||
if (fstd->station_index == INVALID_STATION && tile == fstd->dest_coords) return AYSTAR_FOUND_END_NODE;
|
||||
|
||||
if (IsTileType(tile, MP_STATION) && GetStationIndex(tile) == fstd->station_index) {
|
||||
if (fstd->station_type == STATION_RAIL) return AYSTAR_FOUND_END_NODE;
|
||||
if (fstd->v->type == VEH_TRAIN) return AYSTAR_FOUND_END_NODE;
|
||||
|
||||
assert(fstd->v->type == VEH_ROAD);
|
||||
/* Only if it is a valid station *and* we can stop there */
|
||||
if (GetStationType(tile) == fstd->station_type && (fstd->not_articulated || IsDriveThroughStopTile(tile))) return AYSTAR_FOUND_END_NODE;
|
||||
}
|
||||
@ -1090,7 +1092,7 @@ void NPFFillWithOrderData(NPFFindStationOrTileData *fstd, const Vehicle *v, bool
|
||||
if (v->type != VEH_SHIP && (v->current_order.IsType(OT_GOTO_STATION) || v->current_order.IsType(OT_GOTO_WAYPOINT))) {
|
||||
assert(v->type == VEH_TRAIN || v->type == VEH_ROAD);
|
||||
fstd->station_index = v->current_order.GetDestination();
|
||||
fstd->station_type = (v->type == VEH_TRAIN) ? STATION_RAIL : (RoadVehicle::From(v)->IsBus() ? STATION_BUS : STATION_TRUCK);
|
||||
fstd->station_type = (v->type == VEH_TRAIN) ? (v->current_order.IsType(OT_GOTO_STATION) ? STATION_RAIL : STATION_WAYPOINT) : (RoadVehicle::From(v)->IsBus() ? STATION_BUS : STATION_TRUCK);
|
||||
fstd->not_articulated = v->type == VEH_ROAD && !RoadVehicle::From(v)->HasArticulatedPart();
|
||||
/* Let's take the closest tile of the station as our target for vehicles */
|
||||
fstd->dest_coords = CalcClosestStationTile(fstd->station_index, v->tile, fstd->station_type);
|
||||
|
@ -22,7 +22,6 @@
|
||||
* @param station The station to calculate the distance to
|
||||
* @param tile The tile from where to calculate the distance
|
||||
* @param station_type the station type to get the closest tile of
|
||||
* @note for simplification STATION_RAIL is also used for waypoints!
|
||||
* @return The closest station tile to the given tile.
|
||||
*/
|
||||
static inline TileIndex CalcClosestStationTile(StationID station, TileIndex tile, StationType station_type)
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
switch (v->current_order.GetType()) {
|
||||
case OT_GOTO_STATION:
|
||||
case OT_GOTO_WAYPOINT:
|
||||
m_destTile = CalcClosestStationTile(v->current_order.GetDestination(), v->tile, STATION_RAIL);
|
||||
m_destTile = CalcClosestStationTile(v->current_order.GetDestination(), v->tile, v->current_order.IsType(OT_GOTO_STATION) ? STATION_RAIL : STATION_WAYPOINT);
|
||||
m_dest_station_id = v->current_order.GetDestination();
|
||||
m_destTrackdirs = INVALID_TRACKDIR_BIT;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user