1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#include "StdAfx.h"
#include "DbgEquipInfo.h"
#include "T2DLL/LArray.h"
#include "T2DLL/T2CrossEquipArray.h"
#include "T2DLL/T2FloorInfo.h"
#include "T2DLL/T2Mover.h"
#include "T2DLL/T2Tenant.h"
#include "T2TowerDoc.h"
#include "T2TowerMainView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
DbgEquipInfo::DbgEquipInfo(CWnd *pParent)
: CDialog(IDD, pParent)
{
//{{AFX_DATA_INIT(DbgEquipInfo)
//}}AFX_DATA_INIT
}
/*virtual*/ void DbgEquipInfo::DoDataExchange(CDataExchange *pDX) {
CWnd::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DbgEquipInfo)
DDX_Control(pDX, IDC_DEBUG_INFO, mDebugInfoButton);
DDX_Control(pDX, IDC_DEBUG_INFO_LIST, mDebugInfoList);
DDX_Control(pDX, IDC_EQUIP_NAME, mEquipName);
DDX_Control(pDX, IDC_EQUIP_ID, mEquipID);
DDX_Control(pDX, IDC_CROSS_EQUIP_LIST, mCrossEquipList);
//}}AFX_DATA_MAP
}
void DbgEquipInfo::SetEquip(T2Equip *inEquip) {
mEquip = inEquip;
}
void DbgEquipInfo::SetDocument(T2TowerDoc *inDoc) {
mDocument = inDoc;
}
void DbgEquipInfo::SetTowerMainView(T2TowerMainView *inView) {
mTowerMainView = inView;
}
BEGIN_MESSAGE_MAP(DbgEquipInfo, CDialog)
//{{AFX_MSG_MAP(DbgEquipInfo)
ON_NOTIFY(NM_CLICK, IDC_CROSS_EQUIP_LIST, OnListClick)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*virtual*/ BOOL DbgEquipInfo::OnInitDialog() {
CDialog::OnInitDialog();
CString str;
mEquipName.SetWindowText(mEquip->GetEquipDef()->mStr48);
str.Format("%d", mEquip->mEquipID);
mEquipID.SetWindowText(str);
RECT rect;
mCrossEquipList.GetClientRect(&rect);
int width = rect.right;
mCrossEquipList.InsertColumn(0, "ID", LVCFMT_LEFT, width / 3);
mCrossEquipList.InsertColumn(1, "Type", LVCFMT_LEFT, (width * 2) / 3);
LArrayIterator iterator(*mEquip->mCEArray);
unsigned int id;
int index = 0;
while (iterator.Next(&id)) {
if (id >= 1000) {
str.Format("%d", id);
mCrossEquipList.InsertItem(index, str);
T2Tenant *tenant = mDocument->mFloorInfo->GetTenant(id);
if (tenant)
mCrossEquipList.SetItemText(index, 1, tenant->GetEquipDef()->mStr48);
else
mCrossEquipList.SetItemText(index, 1, "UNKNOWN");
} else if (id >= 1) {
str.Format("%d", id);
mCrossEquipList.InsertItem(index, str);
T2Mover *mover = mDocument->mFloorInfo->GetMover(id);
if (mover)
mCrossEquipList.SetItemText(index, 1, mover->GetEquipDef()->mStr48);
else
mCrossEquipList.SetItemText(index, 1, "UNKNOWN");
}
index++;
}
mEquip->GetEquipDef()->DebugInfo(mDebugInfoButton, mDebugInfoList, mEquip);
return true;
}
void DbgEquipInfo::OnListClick(NMHDR *inHdr, LRESULT *outResult) {
int item = mCrossEquipList.GetNextItem(-1, LVNI_SELECTED);
if (item != -1)
mTowerMainView->SendMessage(WM_COMMAND, MAKELONG(10000 + item, 0), 0);
*outResult = 0;
}
|