From caa2104fa94c0918dbb28c8e903c2781c1ef8d11 Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 11 Dec 2010 01:26:56 +0800 Subject: [PATCH] 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 --- pyfpdb/Card.py | 1 + pyfpdb/Hand.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/pyfpdb/Card.py b/pyfpdb/Card.py index b3ce09ff..8d426a0d 100755 --- a/pyfpdb/Card.py +++ b/pyfpdb/Card.py @@ -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, diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 8485ca9e..c2bea220 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -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