Advertisement
Guest User

Untitled

a guest
Jan 8th, 2020
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1.         uint choices = 0;
  2.         /* Just follow track 1 tile and see if there is a track to follow. (try not to bang in coast or ship) */
  3.         while (tracks != TRACK_BIT_NONE) {
  4.             track = RemoveFirstTrack(&tracks);
  5.  
  6.             ti = TileIndexDiffCByDiagDir(TrackdirToExitdir(TrackEnterdirToTrackdir(track, diagdir)));
  7.             TileIndex tile_check = TileAddWrap(tile, ti.x, ti.y);
  8.             if (tile_check == INVALID_TILE) continue;
  9.  
  10.             if (HasVehicleOnPos(tile_check, &scc, FindShipOnTile)) continue;
  11.  
  12.             TrackBits bits = GetAvailShipTracks(tile_check, TrackdirToExitdir(TrackEnterdirToTrackdir(track, diagdir)));
  13.             if (!IsDiagonalTrack(track)) bits &= TRACK_BIT_CROSS;  // No 90 degree turns.
  14.  
  15.             if (bits != INVALID_TRACK_BIT && bits != TRACK_BIT_NONE) {
  16.                 choices++;
  17.                 if (choices < 2 || Chance16(1, 2)) {
  18.                     *track_old = track;
  19.                 }
  20.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement