Fix for FTP Razz crasher

When a player is listed as playing the hand and sits out between the listing and ante-up join_holecards returned only 2 cards causing Card.encodeRazzStartHand() to crash.

Make sure that join_holecards must return at least 3 cards for stud, and add an entry for this case in the lookup table
This commit is contained in:
Worros 2010-12-11 01:26:56 +08:00
parent 5a5ab451d1
commit caa2104fa9
2 changed files with 6 additions and 0 deletions

View File

@ -303,6 +303,7 @@ def encodeRazzStartHand(cards):
encodeRazzList = {
'(00)A':-13,'(00)2':-12,'(00)3':-11,'(00)4':-10,'(00)5':-9,'(00)6':-8,'(00)7':-7,'(00)8':-6,'(00)9':-5,'(00)T':-4,
'(00)J':-3,'(00)Q':-2,'(00)K':-1,
'(00)0':0,
'(32)A':1,'(3A)2':2,'(2A)3':3,'(42)A':4,'(4A)2':5,'(2A)4':6,'(43)A':7,'(4A)3':8,'(3A)4':9,
'(43)2':10,'(42)3':11,'(32)4':12,'(52)A':13,'(5A)2':14,'(2A)5':15,'(53)A':16,'(5A)3':17,'(3A)5':18,'(53)2':19,
'(52)3':20,'(32)5':21,'(54)A':22,'(5A)4':23,'(4A)5':24,'(54)2':25,'(52)4':26,'(42)5':27,'(54)3':28,'(53)4':29,

View File

@ -1580,6 +1580,11 @@ Add a complete on [street] by [player] to [amountTo]
else:
log.warning(_("join_holecards: # of holecards should be either < 4, 4 or 7 - 5 and 6 should be impossible for anyone who is not a hero"))
log.warning(_("join_holcards: holecards(%s): %s") %(player, holecards))
if holecards == [u'0x', u'0x']:
log.warning(_("join_holecards: Player '%s' appears not to have been dealt a card"))
# If a player is listed but not dealt a card in a cash game this can occur
# Noticed in FTP Razz hand. Return 3 empty cards in this case
holecards = [u'0x', u'0x', u'0x']
return holecards