summaryrefslogtreecommitdiff
path: root/src/town_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/town_gui.cpp')
-rw-r--r--src/town_gui.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 452210e55..ccc723e41 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -121,8 +121,9 @@ uint GetMaskOfTownActions(int *nump, PlayerID pid, const Town *t)
static int GetNthSetBit(uint32 bits, int n)
{
if (n >= 0) {
- for (uint i = 0; bits != 0; bits >>= 1, i++) {
- if (bits & 1) n--;
+ uint i;
+ FOR_EACH_SET_BIT(i, bits) {
+ n--;
if (n < 0) return i;
}
}