MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Item_Multi_FindCvarByValue

Function Item_Multi_FindCvarByValue

code/ui/ui_shared.cpp:10751–10786  ·  view source on GitHub ↗

================= Item_Multi_FindCvarByValue ================= */

Source from the content-addressed store, hash-verified

10749=================
10750*/
10751int Item_Multi_FindCvarByValue(itemDef_t *item)
10752{
10753 char buff[1024];
10754 float value = 0;
10755 int i;
10756 multiDef_t *multiPtr = (multiDef_t*)item->typeData;
10757 if (multiPtr)
10758 {
10759 if (multiPtr->strDef)
10760 {
10761 DC->getCVarString(item->cvar, buff, sizeof(buff));
10762 }
10763 else
10764 {
10765 value = DC->getCVarValue(item->cvar);
10766 }
10767 for (i = 0; i < multiPtr->count; i++)
10768 {
10769 if (multiPtr->strDef)
10770 {
10771 if (Q_stricmp(buff, multiPtr->cvarStr[i]) == 0)
10772 {
10773 return i;
10774 }
10775 }
10776 else
10777 {
10778 if (multiPtr->cvarValue[i] == value)
10779 {
10780 return i;
10781 }
10782 }
10783 }
10784 }
10785 return 0;
10786}
10787
10788/*
10789=================

Callers 1

Item_Multi_HandleKeyFunction · 0.70

Calls 1

Q_stricmpFunction · 0.85

Tested by

no test coverage detected