Changeset - r23159:9c6c98e6c0cb
[Not reviewed]
master
0 1 0
Peter Nelson - 6 years ago 2018-05-28 07:37:43
peter1138@openttd.org
Change: When ship is lost, pick first available track instead of a random track.
1 file changed with 2 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/ship_cmd.cpp
Show inline comments
 
@@ -461,16 +461,14 @@ static Track ChooseShipTrack(Ship *v, Ti
 

	
 
	if (v->dest_tile == 0 || DistanceManhattan(tile, v->dest_tile) > SHIP_MAX_ORDER_DISTANCE + 5) {
 
		/* No destination or destination too far, don't invoke pathfinder. */
 
		track = TrackBitsToTrack(v->state);
 
		if (track != TRACK_X && track != TRACK_Y) track = TrackToOppositeTrack(track);
 
		if (!HasBit(tracks, track)) {
 
			/* Can't continue in same direction so pick a random available track. */
 
			do {
 
				track = (Track)RandomRange(TRACK_END);
 
			} while ((TrackToTrackBits(track) & tracks) == TRACK_BIT_NONE);
 
			/* Can't continue in same direction so pick first available track. */
 
			track = FindFirstTrack(tracks);
 
		}
 
		path_found = false;
 
	} else {
 
		switch (_settings_game.pf.pathfinder_for_ships) {
 
			case VPF_OPF: track = OPFShipChooseTrack(v, tile, enterdir, tracks, path_found); break;
 
			case VPF_NPF: track = NPFShipChooseTrack(v, tile, enterdir, tracks, path_found); break;
0 comments (0 inline, 0 general)