diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-01 02:43:29 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-01 02:43:29 +0100 |
commit | 5c6a48b2ff362a70416a6a00fda7d06e0f276f2d (patch) | |
tree | 62cf542c68d91aa6f7a4e3bfa9eddca4ab352970 /src/T2DLL/PeopleSearchDlg.cpp | |
parent | c0c336500955a23e344651e5412c9d9d441ef4ee (diff) | |
download | t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.tar.gz t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.zip |
i am in hell
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/PeopleSearchDlg.cpp | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/src/T2DLL/PeopleSearchDlg.cpp b/src/T2DLL/PeopleSearchDlg.cpp index 1e73ef2..d7f5277 100644 --- a/src/T2DLL/PeopleSearchDlg.cpp +++ b/src/T2DLL/PeopleSearchDlg.cpp @@ -10,6 +10,12 @@ #include "T2WorldDef.h" #include "UT2Utils.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + PeopleSearchDlg::PeopleSearchDlg() { mDeleteOnClose = true; } @@ -30,72 +36,72 @@ void PeopleSearchDlg::Create(T2TowerDoc *inDoc, HINSTANCE inInstance, CWnd *inPa } void PeopleSearchDlg::DoFind() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); - if (!theListBox) + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); + if (!listBox) return; - int curSel = theListBox->GetCurSel(); - if (curSel == -1) + int sel = listBox->GetCurSel(); + if (sel == -1) return; - T2Name *theName = (T2Name *) theListBox->GetItemDataPtr(curSel); + T2Name *theName = (T2Name *) listBox->GetItemDataPtr(sel); mDocument->towerDoc_vf238(theName); } void PeopleSearchDlg::DoDelete() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); - if (!theListBox) + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); + if (!listBox) return; - int curSel = theListBox->GetCurSel(); - if (curSel == -1) + int sel = listBox->GetCurSel(); + if (sel == -1) return; - T2Name *theName = (T2Name *) theListBox->GetItemDataPtr(curSel); + T2Name *theName = (T2Name *) listBox->GetItemDataPtr(sel); mDocument->mNameDB->RemoveName(theName); - theListBox->DeleteString(curSel); + listBox->DeleteString(sel); } /*virtual*/ void PeopleSearchDlg::OnT2Create() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); - if (!theListBox) + if (!listBox) return; HFONT theFont = GetFont(); if (theFont) - theListBox->SetFont(theFont); + listBox->SetFont(theFont); - theListBox->ResetContent(); + listBox->ResetContent(); - T2NameList *theNameDB = mDocument->mNameDB; + T2NameList *theNameList = mDocument->mNameDB; T2Name *theName; - LArrayIterator iterator(*theNameDB); + LArrayIterator iter(*theNameList); - while (iterator.Next(&theName)) { + while (iter.Next(&theName)) { int type = theName->GetType(); if (type == kPeopleNameType) { - CString nameStr; - unsigned int peopleID; - theName->GetName(nameStr, peopleID); + CString name; + unsigned int id; + theName->GetName(name, id); - T2People *thePeople = mDocument->mPeopleArrayList->FindPeople(peopleID); + T2People *thePeople = mDocument->mPeopleArrayList->FindPeople(id); if (thePeople) { - CString roomNumberStr; - CString str; + CString roomNum; + CString text; if (thePeople->GetWorkTenant() > 1) { T2Tenant *theTenant = mDocument->mFloorInfo->GetTenant(thePeople->GetWorkTenant()); if (theTenant) - UT2Utils::GetRoomNumberString(theTenant->GetRoomNumber(mDocument->mFloorInfo), roomNumberStr); + UT2Utils::GetRoomNumberString(theTenant->GetRoomNumber(mDocument->mFloorInfo), roomNum); } - roomNumberStr += " "; - str = roomNumberStr.Left(7); - str += nameStr; + roomNum += " "; + text = roomNum.Left(7); + text += name; - int theIndex = theListBox->AddString(str); - theListBox->SetItemDataPtr(theIndex, theName); + int ind = listBox->AddString(text); + listBox->SetItemDataPtr(ind, theName); } } } |