Skip to content

Commit 23fa4c5

Browse files
committed
Revert "Updated _slots_to_bin()"
This reverts commit eb3dbc0.
1 parent f51761b commit 23fa4c5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • addons/source-python/packages/source-python/menus

addons/source-python/packages/source-python/menus/radio.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,15 @@ def _slots_to_bin(slots):
9191
:param iterable slots: Slots that should be enabled.
9292
:raise ValueError: Raised if a slot is out of range.
9393
"""
94-
result = 0
94+
# Keys are enabled in that order: 0987654321
95+
buffer = list('0000000000')
9596
for slot in slots:
9697
if 0 <= slot <= 9:
97-
result |= 1 << slot
98+
buffer[~(slot - 1)] = '1'
9899
else:
99100
raise ValueError('Slot out of range: {}'.format(slot))
100101

101-
return result
102+
return int(''.join(buffer), 2)
102103

103104
def _select(self, player_index, choice_index):
104105
"""See :meth:`menus.base._BaseMenu._select`."""

0 commit comments

Comments
 (0)