MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / SetCurrentItem

Method SetCurrentItem

Descent3/newui_core.cpp:3040–3058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3038}
3039
3040bool newuiListBox::SetCurrentItem(const char *name) {
3041 int i, found = 0;
3042
3043 for (i = 0; i < m_NumItems; i++) {
3044 int res = (m_Flags & UILB_CASESENSITIVE) ? stricmp(m_ItemList[i], name) : strcmp(m_ItemList[i], name);
3045 if (res == 0) {
3046 SetCurrentIndex(m_Real2Virt[i]);
3047 found = 1;
3048 break;
3049 }
3050 }
3051
3052 if (!found) {
3053 mprintf(0, "newuiListBox::SelectItem item not found!\n");
3054 return false;
3055 }
3056
3057 return true;
3058}
3059
3060// set callbacks
3061void newuiListBox::SetSelectChangeCallback(void (*fn)(int)) { selectchange_fn = fn; }

Callers 1

MainMultiplayerMenuFunction · 0.80

Calls 1

SetCurrentIndexFunction · 0.85

Tested by

no test coverage detected