CLTGUITextItemCtrl* CMenuCharacter::InitWeaponNumCtrl(int index, DWORD dwCommandID, int x, int y, DBOOL enable) { char str[5]; HSTRING hString=m_pClientDE->CreateString("0"); // Create the new menu option CLTGUITextItemCtrl *pOption = new CLTGUITextItemCtrl; if(!pOption->Create(m_pClientDE, dwCommandID, hString, m_pMainMenus->GetSmallFont(), 1, DTRUE, DNULL)) { m_pClientDE->FreeString(hString); delete pOption; return DNULL; } m_pClientDE->FreeString(hString); for(int i = 1; i <= WEAP_LASTPLAYERWEAPON; i++) { itoa(g_WeaponDefaults[i - 1].m_dwStrengthReq, str, 10); hString=m_pClientDE->CreateString(str); pOption->AddString(hString); m_pClientDE->FreeString(hString); } pOption->SetColor(SETRGB(220,190,170), SETRGB(125,30,0)); pOption->SetSelIndex(index); pOption->SetPos(x, y); pOption->Enable(enable); return pOption; }
CLTGUITextItemCtrl* CMenuCharacter::InitNumberCtrl(int low, int high, int index, DWORD dwCommandID, int x, int y) { char str[5]; itoa(low, str, 10); HSTRING hString=m_pClientDE->CreateString(str); // Create the new menu option CLTGUITextItemCtrl *pOption = new CLTGUITextItemCtrl; if(!pOption->Create(m_pClientDE, dwCommandID, hString, m_pMainMenus->GetSmallFont(), 1, DTRUE, DNULL)) { m_pClientDE->FreeString(hString); delete pOption; return DNULL; } m_pClientDE->FreeString(hString); for(int i = low + 1; i <= high; i++) { itoa(i, str, 10); hString=m_pClientDE->CreateString(str); pOption->AddString(hString); m_pClientDE->FreeString(hString); } pOption->SetColor(SETRGB(220,190,170), SETRGB(125,30,0)); pOption->SetSelIndex(index); pOption->SetPos(x, y); return pOption; }