Codechange: Increase readability of track functions and pathfinders.

This commit is contained in:
J0anJosep
2018-04-29 12:23:01 +02:00
committed by frosch
parent 85ebe20a76
commit 31ac11bddb
8 changed files with 28 additions and 26 deletions

View File

@@ -807,7 +807,7 @@ static TrackdirBits GetDriveableTrackdirBits(TileIndex dst_tile, Trackdir src_tr
{
TrackdirBits trackdirbits = TrackStatusToTrackdirBits(GetTileTrackStatus(dst_tile, type, subtype));
if (trackdirbits == 0 && type == TRANSPORT_ROAD && HasBit(subtype, ROADTYPE_TRAM)) {
if (trackdirbits == TRACKDIR_BIT_NONE && type == TRANSPORT_ROAD && HasBit(subtype, ROADTYPE_TRAM)) {
/* GetTileTrackStatus() returns 0 for single tram bits.
* As we cannot change it there (easily) without breaking something, change it here */
switch (GetSingleTramBit(dst_tile)) {
@@ -900,7 +900,7 @@ static void NPFFollowTrack(AyStar *aystar, OpenListNode *current)
trackdirbits = GetDriveableTrackdirBits(dst_tile, src_trackdir, type, subtype);
if (trackdirbits == 0) {
if (trackdirbits == TRACKDIR_BIT_NONE) {
/* We cannot enter the next tile. Road vehicles can reverse, others reach dead end */
if (type != TRANSPORT_ROAD || HasBit(subtype, ROADTYPE_TRAM)) return;
@@ -924,7 +924,7 @@ static void NPFFollowTrack(AyStar *aystar, OpenListNode *current)
/* Enumerate possible track */
uint i = 0;
while (trackdirbits != 0) {
while (trackdirbits != TRACKDIR_BIT_NONE) {
Trackdir dst_trackdir = RemoveFirstTrackdir(&trackdirbits);
DEBUG(npf, 5, "Expanded into trackdir: %d, remaining trackdirs: 0x%X", dst_trackdir, trackdirbits);