games-board/rmahjong: revert deletion passing literal to int() in patch

The following or similar error still takes place
under certain conditions on score screen:

File "... /rmahjong/client/states.py", line 558, in get_results
    score = (int(self.message[wind + "_score"]))
ValueError: invalid literal for int() with base 10: '27100.0'

so restore part of patch to fix passing literal to int().

Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
This commit is contained in:
Sergey Torokhov
2020-10-28 00:32:44 +03:00
parent 93d0833bda
commit 549434473e

View File

@@ -1,3 +1,35 @@
diff --git a/client/client.py b/client/client.py
--- a/client/client.py
+++ b/client/client.py
@@ -138,10 +138,10 @@ class Mahjong:
def init_player_boxes(self, names, player_winds, score):
self.player_boxes = [
- PlayerBox((50, 700), names[0], player_winds[0], int(score[0]), direction_up, (0,-80)),
- PlayerBox((954, 50), names[1], player_winds[1], int(score[1]), direction_left, (-210, 0)),
- PlayerBox((700, 0), names[2], player_winds[2], int(score[2]), direction_up, (0,80)),
- PlayerBox((0, 50), names[3], player_winds[3], int(score[3]), direction_right, (80,0)) ]
+ PlayerBox((50, 700), names[0], player_winds[0], int(float(score[0])), direction_up, (0,-80)),
+ PlayerBox((954, 50), names[1], player_winds[1], int(float(score[1])), direction_left, (-210, 0)),
+ PlayerBox((700, 0), names[2], player_winds[2], int(float(score[2])), direction_up, (0,80)),
+ PlayerBox((0, 50), names[3], player_winds[3], int(float(score[3])), direction_right, (80,0)) ]
for widget in self.player_boxes:
self.gui.add_widget(widget)
diff --git a/client/states.py b/client/states.py
--- a/client/states.py
+++ b/client/states.py
@@ -555,8 +555,8 @@ class ScoreState(RoundPreparingState):
results = []
for wind in winds:
name = (self.mahjong.get_player_name(wind))
- score = (int(self.message[wind + "_score"]))
- payment = (int(self.message[wind + "_payment"]))
+ score = (int(float(self.message[wind + "_score"])))
+ payment = (int(float(self.message[wind + "_payment"])))
results.append((name, score, payment))
results.sort(key = lambda r: r[1], reverse = True)
return results
diff --git a/client/tilepainter.py b/client/tilepainter.py
--- a/client/tilepainter.py
+++ b/client/tilepainter.py