From 3b54523e7a8e00ff6666d9f12fdfa6768f1b45af Mon Sep 17 00:00:00 2001 From: soL-KO Date: Wed, 3 Jun 2026 12:23:55 +0300 Subject: [PATCH] CountableItemEditDlg and caller windows's now work as expected --- src/Client/WarFare/CountableItemEditDlg.cpp | 23 ++++++++++++----- src/Client/WarFare/CountableItemEditDlg.h | 9 ++++++- src/Client/WarFare/UIPerTradeDlg.cpp | 13 ++++++++-- src/Client/WarFare/UITransactionDlg.cpp | 28 ++++++++++++++++++--- src/Client/WarFare/UIWareHouseDlg.cpp | 24 +++++++++++++++--- src/N3Base/N3UIEdit.cpp | 4 ++- 6 files changed, 85 insertions(+), 16 deletions(-) diff --git a/src/Client/WarFare/CountableItemEditDlg.cpp b/src/Client/WarFare/CountableItemEditDlg.cpp index 04c83b9e7..ba328fab3 100644 --- a/src/Client/WarFare/CountableItemEditDlg.cpp +++ b/src/Client/WarFare/CountableItemEditDlg.cpp @@ -1,10 +1,11 @@ -// CountableItemEditDlg.cpp: implementation of the CCountableItemEditDlg class. +// CountableItemEditDlg.cpp: implementation of the CCountableItemEditDlg class. // ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" #include "text_resources.h" #include "CountableItemEditDlg.h" +#include "N3UIWndBase.h" #include "GameProcedure.h" #include "GameProcMain.h" @@ -174,6 +175,20 @@ bool CCountableItemEditDlg::ReceiveMessage(CN3UIBase* pSender, uint32_t dwMsg) void CCountableItemEditDlg::Open(e_UIWND eUW, e_UIWND_DISTRICT eUD, bool bCountGold, bool bWareGold) { + m_eCallerWnd = eUW; + m_eCallerWndDistrict = eUD; + m_bWareGold = bWareGold; + + int iStackSize = -1; + if (!bCountGold && CN3UIWndBase::s_sSelectedIconInfo.pItemSelect != nullptr) + { + bool bToMeOrNotToMe = (eUW == UIWND_TRANSACTION && eUD == UIWND_DISTRICT_TRADE_NPC); // that is the question... + if (!bToMeOrNotToMe) + { + iStackSize = CN3UIWndBase::s_sSelectedIconInfo.pItemSelect->iCount; + } + } + std::string szMsg; if (bCountGold) szMsg = fmt::format_text_resource(IDS_EDIT_BOX_GOLD); @@ -189,7 +204,7 @@ void CCountableItemEditDlg::Open(e_UIWND eUW, e_UIWND_DISTRICT eUD, bool bCountG int iCX = 0, iCY = 0; m_bLocked = true; - SetQuantity(-1); + SetQuantity(iStackSize); SetVisible(true); @@ -198,10 +213,6 @@ void CCountableItemEditDlg::Open(e_UIWND eUW, e_UIWND_DISTRICT eUD, bool bCountG if (pEdit != nullptr) pEdit->SetFocus(); - m_eCallerWnd = eUW; - m_eCallerWndDistrict = eUD; - m_bWareGold = bWareGold; - switch (eUW) { case UIWND_TRANSACTION: diff --git a/src/Client/WarFare/CountableItemEditDlg.h b/src/Client/WarFare/CountableItemEditDlg.h index 25cf90404..72d38a074 100644 --- a/src/Client/WarFare/CountableItemEditDlg.h +++ b/src/Client/WarFare/CountableItemEditDlg.h @@ -1,4 +1,4 @@ -// CountableItemEditDlg.h: interface for the CCountableItemEditDlg class. +// CountableItemEditDlg.h: interface for the CCountableItemEditDlg class. // ////////////////////////////////////////////////////////////////////// @@ -41,6 +41,13 @@ class CCountableItemEditDlg : public CN3UIBase virtual void Open(e_UIWND eUW, e_UIWND_DISTRICT eUD, bool bCountGold, bool bWareGold = false); virtual void Close(); + void SetCallerInfo(e_UIWND eUW, e_UIWND_DISTRICT eUD, bool bWareGold = false) + { + m_eCallerWnd = eUW; + m_eCallerWndDistrict = eUD; + m_bWareGold = bWareGold; + } + bool IsLocked() { return m_bLocked; diff --git a/src/Client/WarFare/UIPerTradeDlg.cpp b/src/Client/WarFare/UIPerTradeDlg.cpp index 3c1648a55..ab9ca380f 100644 --- a/src/Client/WarFare/UIPerTradeDlg.cpp +++ b/src/Client/WarFare/UIPerTradeDlg.cpp @@ -1,4 +1,4 @@ -// UIPerTradeDlg.cpp: implementation of the CUIPerTradeDlg class. +// UIPerTradeDlg.cpp: implementation of the CUIPerTradeDlg class. // ////////////////////////////////////////////////////////////////////// @@ -664,7 +664,16 @@ bool CUIPerTradeDlg::ReceiveIconDrop(__IconItemSkill* spItem, POINT ptCur) // 활이나 물약등 아이템인 경우.. s_bWaitFromServer = false; - s_pCountableItemEdit->Open(UIWND_PER_TRADE, UIWND_DISTRICT_PER_TRADE_MY, false); + if (s_sSelectedIconInfo.pItemSelect != nullptr && s_sSelectedIconInfo.pItemSelect->iCount == 1) + { + s_pCountableItemEdit->SetCallerInfo(UIWND_PER_TRADE, UIWND_DISTRICT_PER_TRADE_MY, false); + s_pCountableItemEdit->SetQuantity(1); + ItemCountOK(); + } + else + { + s_pCountableItemEdit->Open(UIWND_PER_TRADE, UIWND_DISTRICT_PER_TRADE_MY, false); + } AllHighLightIconFree(); SetState(UI_STATE_COMMON_NONE); diff --git a/src/Client/WarFare/UITransactionDlg.cpp b/src/Client/WarFare/UITransactionDlg.cpp index 0a598cdad..55629e528 100644 --- a/src/Client/WarFare/UITransactionDlg.cpp +++ b/src/Client/WarFare/UITransactionDlg.cpp @@ -1,4 +1,4 @@ -// UITransactionDlg.cpp: implementation of the CUITransactionDlg class. +// UITransactionDlg.cpp: implementation of the CUITransactionDlg class. // ////////////////////////////////////////////////////////////////////// @@ -998,7 +998,18 @@ bool CUITransactionDlg::ReceiveIconDrop(__IconItemSkill* spItem, POINT ptCur) s_sRecoveryJobInfo.UIWndSourceEnd.iOrder = iDestInviOrder; s_bWaitFromServer = false; - s_pCountableItemEdit->Open(UIWND_TRANSACTION, s_sSelectedIconInfo.UIWndSelect.UIWndDistrict, false); + if (s_sSelectedIconInfo.pItemSelect != nullptr && s_sSelectedIconInfo.pItemSelect->iCount == 1 + && s_sSelectedIconInfo.UIWndSelect.UIWndDistrict != UIWND_DISTRICT_TRADE_NPC) + { + auto eDist = s_sSelectedIconInfo.UIWndSelect.UIWndDistrict; + s_pCountableItemEdit->SetCallerInfo(UIWND_TRANSACTION, eDist, false); + s_pCountableItemEdit->SetQuantity(1); + ItemCountOK(); + } + else + { + s_pCountableItemEdit->Open(UIWND_TRANSACTION, s_sSelectedIconInfo.UIWndSelect.UIWndDistrict, false); + } return false; } @@ -1112,7 +1123,18 @@ bool CUITransactionDlg::ReceiveIconDrop(__IconItemSkill* spItem, POINT ptCur) || s_sRecoveryJobInfo.pItemSource->pItemBasic->byContable == UIITEM_TYPE_COUNTABLE_SMALL) { // 활이나 물약등 아이템인 경우.. - s_pCountableItemEdit->Open(UIWND_TRANSACTION, s_sSelectedIconInfo.UIWndSelect.UIWndDistrict, false); + if (s_sSelectedIconInfo.pItemSelect != nullptr && s_sSelectedIconInfo.pItemSelect->iCount == 1 + && s_sSelectedIconInfo.UIWndSelect.UIWndDistrict != UIWND_DISTRICT_TRADE_NPC) + { + auto eDist = s_sSelectedIconInfo.UIWndSelect.UIWndDistrict; + s_pCountableItemEdit->SetCallerInfo(UIWND_TRANSACTION, eDist, false); + s_pCountableItemEdit->SetQuantity(1); + ItemCountOK(); + } + else + { + s_pCountableItemEdit->Open(UIWND_TRANSACTION, s_sSelectedIconInfo.UIWndSelect.UIWndDistrict, false); + } } else { diff --git a/src/Client/WarFare/UIWareHouseDlg.cpp b/src/Client/WarFare/UIWareHouseDlg.cpp index 9af378b1f..aa6af157f 100644 --- a/src/Client/WarFare/UIWareHouseDlg.cpp +++ b/src/Client/WarFare/UIWareHouseDlg.cpp @@ -1,4 +1,4 @@ -// UIWareHouseDlg.cpp: implementation of the UIWareHouseDlg class. +// UIWareHouseDlg.cpp: implementation of the UIWareHouseDlg class. // ////////////////////////////////////////////////////////////////////// @@ -764,7 +764,16 @@ bool CUIWareHouseDlg::ReceiveIconDrop(__IconItemSkill* spItem, POINT ptCur) s_sRecoveryJobInfo.UIWndSourceEnd.iOrder = iDestiOrder; s_bWaitFromServer = false; - s_pCountableItemEdit->Open(UIWND_WARE_HOUSE, s_sSelectedIconInfo.UIWndSelect.UIWndDistrict, false); + if (s_sSelectedIconInfo.pItemSelect != nullptr && s_sSelectedIconInfo.pItemSelect->iCount == 1) + { + s_pCountableItemEdit->SetCallerInfo(UIWND_WARE_HOUSE, s_sSelectedIconInfo.UIWndSelect.UIWndDistrict, false); + s_pCountableItemEdit->SetQuantity(1); + ItemCountOK(); + } + else + { + s_pCountableItemEdit->Open(UIWND_WARE_HOUSE, s_sSelectedIconInfo.UIWndSelect.UIWndDistrict, false); + } } else { @@ -942,7 +951,16 @@ bool CUIWareHouseDlg::ReceiveIconDrop(__IconItemSkill* spItem, POINT ptCur) s_bWaitFromServer = false; - s_pCountableItemEdit->Open(UIWND_WARE_HOUSE, s_sSelectedIconInfo.UIWndSelect.UIWndDistrict, false); + if (s_sSelectedIconInfo.pItemSelect != nullptr && s_sSelectedIconInfo.pItemSelect->iCount == 1) + { + s_pCountableItemEdit->SetCallerInfo(UIWND_WARE_HOUSE, s_sSelectedIconInfo.UIWndSelect.UIWndDistrict, false); + s_pCountableItemEdit->SetQuantity(1); + ItemCountOK(); + } + else + { + s_pCountableItemEdit->Open(UIWND_WARE_HOUSE, s_sSelectedIconInfo.UIWndSelect.UIWndDistrict, false); + } return false; } diff --git a/src/N3Base/N3UIEdit.cpp b/src/N3Base/N3UIEdit.cpp index 9eaaa5afb..559308662 100644 --- a/src/N3Base/N3UIEdit.cpp +++ b/src/N3Base/N3UIEdit.cpp @@ -1,4 +1,4 @@ -// N3UIEdit.cpp: implementation of the CN3UIEdit class. +// N3UIEdit.cpp: implementation of the CN3UIEdit class. // ////////////////////////////////////////////////////////////////////// @@ -293,6 +293,8 @@ bool CN3UIEdit::SetFocus() else ::SetWindowText(s_hWndEdit, ""); } + + ::SendMessage(s_hWndEdit, EM_SETSEL, 0, -1); } return true;