@@ -1602,16 +1602,15 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
16021602 pcard->is_selected = false ;
16031603 if (l & 0xf1 )
16041604 panelmode = true ;
1605- if ((l & LOCATION_HAND ) && hand_count[c] >= 10 ) {
1606- if (++select_count_in_hand[c] > 1 )
1605+ if ((l & LOCATION_HAND ) && hand_count[c] >= 10 ) {
1606+ select_count_in_hand[c]++;
1607+ if (select_count_in_hand[c] > 1 )
16071608 panelmode = true ;
16081609 }
16091610 }
16101611 std::sort (mainGame->dField .selectable_cards .begin (), mainGame->dField .selectable_cards .end (), ClientCard::client_card_sort);
1611- if (select_hint)
1612- myswprintf (textBuffer, L" %ls(%d-%d)" , dataManager.GetDesc (select_hint),
1613- mainGame->dField .select_min , mainGame->dField .select_max );
1614- else myswprintf (textBuffer, L" %ls(%d-%d)" , dataManager.GetSysString (560 ), mainGame->dField .select_min , mainGame->dField .select_max );
1612+ int hint = select_hint ? select_hint : 560 ;
1613+ myswprintf (textBuffer, L" %ls(%d-%d)" , dataManager.GetDesc (hint), mainGame->dField .select_min , mainGame->dField .select_max );
16151614 select_hint = 0 ;
16161615 if (panelmode) {
16171616 mainGame->gMutex .lock ();
@@ -1668,7 +1667,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
16681667 if (l & 0xf1 )
16691668 panelmode = true ;
16701669 if ((l & LOCATION_HAND ) && hand_count[c] >= 10 ) {
1671- if (++select_count_in_hand[c] > 1 )
1670+ select_count_in_hand[c]++;
1671+ if (select_count_in_hand[c] > 1 )
16721672 panelmode = true ;
16731673 }
16741674 }
@@ -1692,17 +1692,16 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
16921692 if (l & 0xf1 )
16931693 panelmode = true ;
16941694 if ((l & LOCATION_HAND ) && hand_count[c] >= 10 ) {
1695- if (++select_count_in_hand[c] > 1 )
1695+ select_count_in_hand[c]++;
1696+ if (select_count_in_hand[c] > 1 )
16961697 panelmode = true ;
16971698 }
16981699 }
16991700 std::sort (mainGame->dField .selectable_cards .begin (), mainGame->dField .selectable_cards .end (), ClientCard::client_card_sort);
17001701 if (select_hint)
17011702 select_unselect_hint = select_hint;
1702- if (select_unselect_hint)
1703- myswprintf (textBuffer, L" %ls(%d-%d)" , dataManager.GetDesc (select_unselect_hint),
1704- mainGame->dField .select_min , mainGame->dField .select_max );
1705- else myswprintf (textBuffer, L" %ls(%d-%d)" , dataManager.GetSysString (560 ), mainGame->dField .select_min , mainGame->dField .select_max );
1703+ int hint = select_unselect_hint ? select_unselect_hint : 560 ;
1704+ myswprintf (textBuffer, L" %ls(%d-%d)" , dataManager.GetDesc (hint), mainGame->dField .select_min , mainGame->dField .select_max );
17061705 select_hint = 0 ;
17071706 if (panelmode) {
17081707 mainGame->gMutex .lock ();
@@ -1851,10 +1850,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
18511850 else
18521851 myswprintf (textBuffer, dataManager.GetSysString (560 ));
18531852 } else {
1854- if (select_hint)
1855- myswprintf (textBuffer, L" %ls" , dataManager.GetDesc (select_hint));
1856- else
1857- myswprintf (textBuffer, dataManager.GetSysString (570 ));
1853+ int hint = select_hint ? select_hint : 570 ;
1854+ myswprintf (textBuffer, L" %ls" , dataManager.GetDesc (hint));
18581855 }
18591856 select_hint = 0 ;
18601857 mainGame->stHintMsg ->setText (textBuffer);
@@ -1978,10 +1975,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
19781975 pcard->is_selectable = true ;
19791976 }
19801977 mainGame->dField .CheckSelectTribute ();
1981- if (select_hint)
1982- myswprintf (textBuffer, L" %ls(%d-%d)" , dataManager.GetDesc (select_hint),
1983- mainGame->dField .select_min , mainGame->dField .select_max );
1984- else myswprintf (textBuffer, L" %ls(%d-%d)" , dataManager.GetSysString (531 ), mainGame->dField .select_min , mainGame->dField .select_max );
1978+ int hint = select_hint ? select_hint : 531 ;
1979+ myswprintf (textBuffer, L" %ls(%d-%d)" , dataManager.GetDesc (hint), mainGame->dField .select_min , mainGame->dField .select_max );
19851980 select_hint = 0 ;
19861981 mainGame->gMutex .lock ();
19871982 mainGame->stHintMsg ->setText (textBuffer);
@@ -3548,21 +3543,20 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
35483543 case MSG_TOSS_COIN : {
35493544 /* int player = */ mainGame->LocalPlayer (BufferIO::Read<uint8_t >(pbuf));
35503545 int count = BufferIO::Read<uint8_t >(pbuf);
3551- wchar_t * pwbuf = textBuffer ;
3552- BufferIO::CopyWStrRef ( dataManager.GetSysString (1623 ), pwbuf, 256 );
3546+ std::wstring result ;
3547+ result += dataManager.GetSysString (1623 );
35533548 for (int i = 0 ; i < count; ++i) {
3554- int res = BufferIO::Read<uint8_t >(pbuf);
3555- *pwbuf++ = L' [' ;
3556- BufferIO::CopyWStrRef ( dataManager.GetSysString (res ? 60 : 61 ), pwbuf, 256 );
3557- *pwbuf++ = L' ]' ;
3549+ uint8_t res = BufferIO::Read<uint8_t >(pbuf);
3550+ result + = L' [' ;
3551+ result += dataManager.GetSysString (res ? 60 : 61 );
3552+ result + = L' ]' ;
35583553 }
3559- *pwbuf = 0 ;
35603554 if (mainGame->dInfo .isReplay && mainGame->dInfo .isReplaySkiping )
35613555 return true ;
35623556 soundManager.PlaySoundEffect (SOUND_COIN );
35633557 mainGame->gMutex .lock ();
3564- mainGame->AddLog (textBuffer );
3565- mainGame->stACMessage ->setText (textBuffer );
3558+ mainGame->AddLog (result. c_str () );
3559+ mainGame->stACMessage ->setText (result. c_str () );
35663560 mainGame->PopupElement (mainGame->wACMessage , 20 );
35673561 mainGame->gMutex .unlock ();
35683562 mainGame->WaitFrameSignal (40 );
@@ -3571,21 +3565,20 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
35713565 case MSG_TOSS_DICE : {
35723566 /* int player = */ mainGame->LocalPlayer (BufferIO::Read<uint8_t >(pbuf));
35733567 int count = BufferIO::Read<uint8_t >(pbuf);
3574- wchar_t * pwbuf = textBuffer ;
3575- BufferIO::CopyWStrRef ( dataManager.GetSysString (1624 ), pwbuf, 256 );
3568+ std::wstring result ;
3569+ result += dataManager.GetSysString (1624 );
35763570 for (int i = 0 ; i < count; ++i) {
3577- int res = BufferIO::Read<uint8_t >(pbuf);
3578- *pwbuf++ = L' [' ;
3579- *pwbuf++ = L' 0' + res;
3580- *pwbuf++ = L' ]' ;
3571+ uint8_t res = BufferIO::Read<uint8_t >(pbuf);
3572+ result + = L' [' ;
3573+ result += ( L' 0' + res) ;
3574+ result + = L' ]' ;
35813575 }
3582- *pwbuf = 0 ;
35833576 if (mainGame->dInfo .isReplay && mainGame->dInfo .isReplaySkiping )
35843577 return true ;
35853578 soundManager.PlaySoundEffect (SOUND_DICE );
35863579 mainGame->gMutex .lock ();
3587- mainGame->AddLog (textBuffer );
3588- mainGame->stACMessage ->setText (textBuffer );
3580+ mainGame->AddLog (result. c_str () );
3581+ mainGame->stACMessage ->setText (result. c_str () );
35893582 mainGame->PopupElement (mainGame->wACMessage , 20 );
35903583 mainGame->gMutex .unlock ();
35913584 mainGame->WaitFrameSignal (40 );
@@ -3627,9 +3620,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
36273620 mainGame->chkRace [i]->setVisible (true );
36283621 else mainGame->chkRace [i]->setVisible (false );
36293622 }
3630- if (select_hint)
3631- myswprintf (textBuffer, L" %ls" , dataManager.GetDesc (select_hint));
3632- else myswprintf (textBuffer, dataManager.GetSysString (563 ));
3623+ int hint = select_hint ? select_hint : 563 ;
3624+ myswprintf (textBuffer, L" %ls" , dataManager.GetDesc (hint));
36333625 select_hint = 0 ;
36343626 mainGame->gMutex .lock ();
36353627 mainGame->wANRace ->setText (textBuffer);
@@ -3647,9 +3639,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
36473639 mainGame->chkAttribute [i]->setVisible (true );
36483640 else mainGame->chkAttribute [i]->setVisible (false );
36493641 }
3650- if (select_hint)
3651- myswprintf (textBuffer, L" %ls" , dataManager.GetDesc (select_hint));
3652- else myswprintf (textBuffer, dataManager.GetSysString (562 ));
3642+ int hint = select_hint ? select_hint : 562 ;
3643+ myswprintf (textBuffer, L" %ls" , dataManager.GetDesc (hint));
36533644 select_hint = 0 ;
36543645 mainGame->gMutex .lock ();
36553646 mainGame->wANAttribute ->setText (textBuffer);
@@ -3663,9 +3654,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
36633654 mainGame->dField .declare_opcodes .clear ();
36643655 for (int i = 0 ; i < count; ++i)
36653656 mainGame->dField .declare_opcodes .push_back (BufferIO::Read<uint32_t >(pbuf));
3666- if (select_hint)
3667- myswprintf (textBuffer, L" %ls" , dataManager.GetDesc (select_hint));
3668- else myswprintf (textBuffer, dataManager.GetSysString (564 ));
3657+ int hint = select_hint ? select_hint : 564 ;
3658+ myswprintf (textBuffer, L" %ls" , dataManager.GetDesc (hint));
36693659 select_hint = 0 ;
36703660 mainGame->gMutex .lock ();
36713661 mainGame->ebANCard ->setText (L" " );
@@ -3718,9 +3708,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, size_t len) {
37183708 pos.LowerRightCorner .Y = pos.UpperLeftCorner .Y + 95 ;
37193709 mainGame->wANNumber ->setRelativePosition (pos);
37203710 }
3721- if (select_hint)
3722- myswprintf (textBuffer, L" %ls" , dataManager.GetDesc (select_hint));
3723- else myswprintf (textBuffer, dataManager.GetSysString (565 ));
3711+ int hint = select_hint ? select_hint : 565 ;
3712+ myswprintf (textBuffer, L" %ls" , dataManager.GetDesc (hint));
37243713 select_hint = 0 ;
37253714 mainGame->wANNumber ->setText (textBuffer);
37263715 mainGame->PopupElement (mainGame->wANNumber );
0 commit comments