diff options
author | rubidium <rubidium@openttd.org> | 2010-05-11 20:48:06 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-05-11 20:48:06 +0000 |
commit | be504a6ef0f26b78216699d6995ccc8dee02a5c1 (patch) | |
tree | 97bb83daf3620edf7a128da731e3e43d450d359d /src/pathfinder | |
parent | 26bf9a13deea2da71142a6259ede951e08e75d01 (diff) | |
download | openttd-be504a6ef0f26b78216699d6995ccc8dee02a5c1.tar.xz |
(svn r19788) -Codechange: make FOR_EACH_SET_BIT not change the value of the passed bit variable, i.e. allow expressions as parameter
Diffstat (limited to 'src/pathfinder')
-rw-r--r-- | src/pathfinder/follow_track.hpp | 3 | ||||
-rw-r--r-- | src/pathfinder/npf/npf.cpp | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp index 6fdebc3e6..33e861c41 100644 --- a/src/pathfinder/follow_track.hpp +++ b/src/pathfinder/follow_track.hpp @@ -160,9 +160,8 @@ struct CFollowTrackT /* Mask already reserved trackdirs. */ m_new_td_bits &= ~TrackBitsToTrackdirBits(reserved); /* Mask out all trackdirs that conflict with the reservation. */ - uint bits = (uint)TrackdirBitsToTrackBits(m_new_td_bits); int i; - FOR_EACH_SET_BIT(i, bits) { + FOR_EACH_SET_BIT(i, TrackdirBitsToTrackBits(m_new_td_bits)) { if (TracksOverlap(reserved | TrackToTrackBits((Track)i))) m_new_td_bits &= ~TrackToTrackdirBits((Track)i); } if (m_new_td_bits == TRACKDIR_BIT_NONE) { diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index b239d5c52..05ff2f4b0 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -921,9 +921,8 @@ static void NPFFollowTrack(AyStar *aystar, OpenListNode *current) TrackBits reserved = GetReservedTrackbits(dst_tile); trackdirbits &= ~TrackBitsToTrackdirBits(reserved); - uint bits = TrackdirBitsToTrackBits(trackdirbits); int i; - FOR_EACH_SET_BIT(i, bits) { + FOR_EACH_SET_BIT(i, TrackdirBitsToTrackBits(trackdirbits)) { if (TracksOverlap(reserved | TrackToTrackBits((Track)i))) trackdirbits &= ~TrackToTrackdirBits((Track)i); } } |