(svn r11031) -Codechange: reduce the amount of duplication of bit counting functions. Based on patches by skidd13, SmatZ and Belugas.

This commit is contained in:
rubidium
2007-09-01 08:31:36 +00:00
parent 766d6d420e
commit 6f76bc2449
7 changed files with 30 additions and 46 deletions

View File

@@ -1083,7 +1083,7 @@ static void RoadZPosAffectSpeed(Vehicle *v, byte old_z)
static int PickRandomBit(uint bits)
{
uint i;
uint num = RandomRange(CountBitsSet(bits));
uint num = RandomRange(COUNTBITS(bits));
for (i = 0; !(bits & 1) || (int)--num >= 0; bits >>= 1, i++) {}
return i;