(svn r11383) -Codechange: fixed all the mess around KillFirstBit (tnx to Rubidium and skidd13)

This commit is contained in:
truelight
2007-11-04 23:06:39 +00:00
parent 69b1d97c03
commit 4b8aaa994c
10 changed files with 22 additions and 41 deletions

View File

@@ -192,8 +192,8 @@ public:
/** add multiple nodes - direct children of the given node */
FORCEINLINE void AddMultipleNodes(Node* parent, const TrackFollower &tf)
{
bool is_choice = (KillFirstBit2x64(tf.m_new_td_bits) != 0);
for (TrackdirBits rtds = tf.m_new_td_bits; rtds != TRACKDIR_BIT_NONE; rtds = (TrackdirBits)KillFirstBit2x64(rtds)) {
bool is_choice = (KillFirstBit(tf.m_new_td_bits) != TRACKDIR_BIT_NONE);
for (TrackdirBits rtds = tf.m_new_td_bits; rtds != TRACKDIR_BIT_NONE; rtds = KillFirstBit(rtds)) {
Trackdir td = (Trackdir)FindFirstBit2x64(rtds);
Node& n = Yapf().CreateNewNode();
n.Set(parent, tf.m_new_tile, td, is_choice);

View File

@@ -32,8 +32,8 @@ public:
/// Called when YAPF needs to place origin nodes into open list
void PfSetStartupNodes()
{
bool is_choice = (KillFirstBit2x64(m_orgTrackdirs) != 0);
for (TrackdirBits tdb = m_orgTrackdirs; tdb != TRACKDIR_BIT_NONE; tdb = (TrackdirBits)KillFirstBit2x64(tdb)) {
bool is_choice = (KillFirstBit(m_orgTrackdirs) != TRACKDIR_BIT_NONE);
for (TrackdirBits tdb = m_orgTrackdirs; tdb != TRACKDIR_BIT_NONE; tdb = KillFirstBit(tdb)) {
Trackdir td = (Trackdir)FindFirstBit2x64(tdb);
Node& n1 = Yapf().CreateNewNode();
n1.Set(NULL, m_orgTile, td, is_choice);

View File

@@ -387,7 +387,7 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
}
/* Check if the next tile is not a choice. */
if (KillFirstBit2x64(tf_local.m_new_td_bits) != 0) {
if (KillFirstBit(tf_local.m_new_td_bits) != TRACKDIR_BIT_NONE) {
/* More than one segment will follow. Close this one. */
end_segment_reason |= ESRB_CHOICE_FOLLOWS;
break;

View File

@@ -97,7 +97,7 @@ public:
if (!F.Follow(tile, trackdir)) break;
// if there are more trackdirs available & reachable, we are at the end of segment
if (KillFirstBit2x64(F.m_new_td_bits) != 0) break;
if (KillFirstBit(F.m_new_td_bits) != TRACKDIR_BIT_NONE) break;
Trackdir new_td = (Trackdir)FindFirstBit2x64(F.m_new_td_bits);