Skip to content

Commit 40690e5

Browse files
committed
Fixed issue #71. Thanks to @Doldol for pointing that out
1 parent 2d6fc3d commit 40690e5

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,15 @@ def pop(self, key, default=None):
189189
# =============================================================================
190190
# >> FUNCTIONS
191191
# =============================================================================
192-
def _validate_selection(player_info, command, valid_choices):
192+
def _validate_selection(command, index, valid_choices):
193193
"""Validate a selection command.
194194
195-
@param <player_infor>:
196-
A PlayerInfo instance.
197-
198195
@param <command>:
199196
A Command instance.
200197
198+
@param <index>:
199+
The player index that issued the command.
200+
201201
@param <valid_choices>:
202202
A list of integers that defines all valid choices
203203
"""
@@ -208,7 +208,7 @@ def _validate_selection(player_info, command, valid_choices):
208208
return (None, None)
209209

210210
if choice in valid_choices:
211-
return (index_from_playerinfo(player_info), choice)
211+
return (index, choice)
212212

213213
return (None, None)
214214

@@ -242,21 +242,21 @@ def _esc_refresh():
242242
# >> CLIENT COMMANDS
243243
# =============================================================================
244244
@ClientCommand('menuselect')
245-
def _menuselect_callback(player_info, command):
245+
def _menuselect_callback(command, index):
246246
"""Forward the selection to the proper user queue."""
247247
from menus.radio import VALID_CHOICES
248248

249-
index, choice = _validate_selection(player_info, command, VALID_CHOICES)
249+
index, choice = _validate_selection(command, index, VALID_CHOICES)
250250
if index is not None:
251251
_radio_queues[index]._select(choice)
252252

253253

254254
@ClientCommand(ESC_SELECTION_CMD)
255-
def _escselect_callback(player_info, command):
255+
def _escselect_callback(command, index):
256256
"""Forward the selection to the proper user queue."""
257257
from menus.esc import VALID_CHOICES
258258

259-
index, choice = _validate_selection(player_info, command, VALID_CHOICES)
259+
index, choice = _validate_selection(command, index, VALID_CHOICES)
260260
if index is not None:
261261
_esc_queues[index]._select(choice)
262262

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
else:
4242
BUTTON_BACK = 8
4343
BUTTON_NEXT = 9
44-
BUTTON_CLOSE = 0
44+
BUTTON_CLOSE = 10
4545
MAX_ITEM_COUNT = 7
46-
VALID_CHOICES = range(10)
46+
VALID_CHOICES = range(1, 11)
4747

4848

4949
# =============================================================================

0 commit comments

Comments
 (0)