Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
177 lines
4.5 KiB
C++
177 lines
4.5 KiB
C++
// DlgDefaultAttachmentProperty.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "worldcreator.h"
|
|
#include "DlgDefaultAttachmentProperty.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDlgDefaultAttachmentProperty dialog
|
|
|
|
|
|
CDlgDefaultAttachmentProperty::CDlgDefaultAttachmentProperty(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CDlgDefaultAttachmentProperty::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CDlgDefaultAttachmentProperty)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
|
|
m_rpGCMDS = NULL;
|
|
}
|
|
|
|
|
|
void CDlgDefaultAttachmentProperty::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDlgDefaultAttachmentProperty)
|
|
DDX_Control(pDX, IDC_COMBO_ATTACHMENTSLOT, m_ctrlAttachmentSlot);
|
|
DDX_Control(pDX, IDC_COMBO_ATTACHMENT, m_ctrlAttachmentList);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDlgDefaultAttachmentProperty, CDialog)
|
|
//{{AFX_MSG_MAP(CDlgDefaultAttachmentProperty)
|
|
ON_WM_CLOSE()
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDlgDefaultAttachmentProperty message handlers
|
|
|
|
|
|
void CDlgDefaultAttachmentProperty::SetupDialog( CZ3DGCMDS* pGCMDS, const char* szSlotName, const char* szAttachmentName )
|
|
{
|
|
m_rpGCMDS = pGCMDS;
|
|
m_strSlotName= szSlotName;
|
|
m_strAttachmentName = szAttachmentName;
|
|
|
|
m_tokAttachmentSelected = g_TokAttachmentName.GetTOK(szAttachmentName);
|
|
m_tokSlotSelected = g_TokSlotName.GetTOK(szSlotName);
|
|
}
|
|
|
|
void CDlgDefaultAttachmentProperty::SetupDialog( CZ3DGCMDS* pGCMDS, int nIdx )
|
|
{
|
|
m_rpGCMDS = pGCMDS;
|
|
if( NULL == m_rpGCMDS )
|
|
{
|
|
return;
|
|
}
|
|
|
|
std::vector<Z3DTOK_SLOT_ATTACHMENT>* pvec;
|
|
|
|
m_rpGCMDS->RetrieveDefaultAttachmentList(pvec);
|
|
|
|
if( NULL == pvec )
|
|
{
|
|
return;
|
|
}
|
|
|
|
if( nIdx < pvec->size() )
|
|
{
|
|
m_strSlotName = g_TokSlotName.GetString( (*pvec)[nIdx].tokSlot );
|
|
m_strAttachmentName = g_TokAttachmentName.GetString( (*pvec)[nIdx].tokAttachment );
|
|
m_tokSlotSelected = (*pvec)[nIdx].tokSlot;
|
|
m_tokAttachmentSelected = (*pvec)[nIdx].tokAttachment;
|
|
}
|
|
else
|
|
{
|
|
m_strSlotName = "";
|
|
m_strAttachmentName = "";
|
|
m_tokSlotSelected = NULL_TOK;
|
|
m_tokAttachmentSelected = NULL_TOK;
|
|
}
|
|
}
|
|
|
|
void CDlgDefaultAttachmentProperty::InitDlgCtrls()
|
|
{
|
|
if( NULL == m_rpGCMDS )
|
|
{
|
|
return;
|
|
}
|
|
|
|
std::vector<Z3DTOK>* pVecSlot;
|
|
m_rpGCMDS->RetrieveAttachmentSlot( pVecSlot );
|
|
|
|
m_ctrlAttachmentSlot.ResetContent();
|
|
for( int i = 0; i < pVecSlot->size(); ++i )
|
|
{
|
|
m_ctrlAttachmentSlot.InsertString( -1,
|
|
g_TokSlotName.GetString( (*pVecSlot)[i] ) );
|
|
}
|
|
m_ctrlAttachmentSlot.SetCurSel( m_ctrlAttachmentSlot.FindStringExact(-1, m_strSlotName) );
|
|
|
|
std::map<Z3DTOK, Z3DATTACHMENTINFO*>* pMapAttachmentList;
|
|
std::map<Z3DTOK, Z3DATTACHMENTINFO*>::iterator itAttachment;
|
|
m_rpGCMDS->RetrieveAttachmentList( pMapAttachmentList );
|
|
|
|
m_ctrlAttachmentList.ResetContent();
|
|
for( itAttachment = pMapAttachmentList->begin(); itAttachment != pMapAttachmentList->end(); ++itAttachment )
|
|
{
|
|
m_ctrlAttachmentList.InsertString( -1, g_TokAttachmentName.GetString(itAttachment->first) );
|
|
}
|
|
m_ctrlAttachmentList.SetCurSel( m_ctrlAttachmentList.FindStringExact(-1, m_strAttachmentName) );
|
|
}
|
|
|
|
BOOL CDlgDefaultAttachmentProperty::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
// TODO: Add extra initialization here
|
|
InitDlgCtrls();
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CDlgDefaultAttachmentProperty::OnClose()
|
|
{
|
|
// TODO: Add your message handler code here and/or call default
|
|
CString str;
|
|
|
|
m_ctrlAttachmentSlot.GetLBText( m_ctrlAttachmentSlot.GetCurSel() , str );
|
|
m_tokSlotSelected = g_TokSlotName.GetTOK( str );
|
|
|
|
m_ctrlAttachmentList.GetLBText( m_ctrlAttachmentList.GetCurSel(), str );
|
|
m_tokAttachmentSelected = g_TokAttachmentName.GetTOK( str );
|
|
|
|
CDialog::OnClose();
|
|
}
|
|
|
|
void CDlgDefaultAttachmentProperty::OnDestroy()
|
|
{
|
|
CDialog::OnDestroy();
|
|
|
|
// TODO: Add your message handler code here
|
|
CString str;
|
|
|
|
int nCurSel = m_ctrlAttachmentSlot.GetCurSel();
|
|
if( -1 == nCurSel )
|
|
{
|
|
m_tokSlotSelected = NULL_TOK;
|
|
}
|
|
else
|
|
{
|
|
m_ctrlAttachmentSlot.GetLBText( nCurSel, str );
|
|
m_tokSlotSelected = g_TokSlotName.GetTOK( str );
|
|
}
|
|
|
|
nCurSel = m_ctrlAttachmentList.GetCurSel();
|
|
if( -1 == nCurSel )
|
|
{
|
|
m_tokAttachmentSelected = NULL_TOK;
|
|
}
|
|
else
|
|
{
|
|
m_ctrlAttachmentList.GetLBText( nCurSel, str );
|
|
m_tokAttachmentSelected = g_TokAttachmentName.GetTOK( str );
|
|
}
|
|
}
|