Skip to content

Commit dfd5f48

Browse files
Prevent opening hand result changes before duel start (#3117)
1 parent f5adfdd commit dfd5f48

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

gframe/single_duel.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,12 @@ void SingleDuel::StartDuel(DuelPlayer* dp) {
354354
duel_stage = DUEL_STAGE_FINGER;
355355
}
356356
void SingleDuel::HandResult(DuelPlayer* dp, unsigned char res) {
357-
if(res > 3)
357+
if(res == 0 || res > 3 || dp->state != CTOS_HAND_RESULT)
358358
return;
359-
if(dp->state != CTOS_HAND_RESULT)
359+
auto player = dp->type;
360+
if(hand_result[player])
360361
return;
361-
hand_result[dp->type] = res;
362+
hand_result[player] = res;
362363
if(hand_result[0] && hand_result[1]) {
363364
STOC_HandResult schr;
364365
schr.res1 = hand_result[0];

gframe/tag_duel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,12 @@ void TagDuel::StartDuel(DuelPlayer* dp) {
320320
duel_stage = DUEL_STAGE_FINGER;
321321
}
322322
void TagDuel::HandResult(DuelPlayer* dp, unsigned char res) {
323-
if(res > 3 || dp->state != CTOS_HAND_RESULT)
323+
if(res == 0 || res > 3 || dp->state != CTOS_HAND_RESULT)
324324
return;
325-
if(dp->type == 0)
326-
hand_result[0] = res;
327-
else
328-
hand_result[1] = res;
325+
auto player = (dp->type & 0x2) >> 1;
326+
if(hand_result[player])
327+
return;
328+
hand_result[player] = res;
329329
if(hand_result[0] && hand_result[1]) {
330330
STOC_HandResult schr;
331331
schr.res1 = hand_result[0];

0 commit comments

Comments
 (0)