From 5c6a48b2ff362a70416a6a00fda7d06e0f276f2d Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sat, 1 Jul 2023 02:43:29 +0100 Subject: i am in hell --- src/T2DLL/PeopleSearchDlg.cpp | 66 +++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 30 deletions(-) (limited to 'src/T2DLL/PeopleSearchDlg.cpp') 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); } } } -- cgit v1.2.3