MCPcopy Create free account
hub / github.com/crossuo/crossuo / OnTextInput

Method OnTextInput

src/Gumps/GumpOptions.cpp:3869–3961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3867}
3868
3869void CGumpOptions::OnTextInput(const TextEvent &ev)
3870{
3871 const auto ch = EvChar(ev);
3872 if (g_EntryPointer == &m_GameWindowWidth->m_Entry ||
3873 g_EntryPointer == &m_GameWindowHeight->m_Entry ||
3874 g_EntryPointer == &m_ContainerOffsetX->m_Entry ||
3875 g_EntryPointer == &m_ContainerOffsetY->m_Entry)
3876 {
3877 if (ch >= '0' && ch <= '9')
3878 {
3879 g_EntryPointer->Insert(ch);
3880 const int val = str_to_int(g_EntryPointer->GetTextA());
3881 if (val > 2000)
3882 {
3883 g_EntryPointer->Remove(true);
3884 }
3885 else
3886 {
3887 WantRedraw = true;
3888 }
3889 }
3890 }
3891 else if (g_EntryPointer != &m_MacroKey->m_Entry)
3892 {
3893 CMacroObject *obj = m_MacroObjectPointer;
3894 if (obj != nullptr)
3895 {
3896 CGUITextEntry *entry = nullptr;
3897 QFOR(item, m_MacroDataBox->m_Items, CBaseGUI *)
3898 {
3899 if (item->Type == GOT_TEXTENTRY &&
3900 g_EntryPointer == &((CGUITextEntry *)item)->m_Entry)
3901 {
3902 entry = (CGUITextEntry *)item;
3903 break;
3904 }
3905 }
3906
3907 if (entry != nullptr)
3908 {
3909 const int maxMacroDraw = 7;
3910 int macroCount = 0;
3911 while (obj != nullptr && macroCount < maxMacroDraw)
3912 {
3913 if (obj->HasSubMenu == 2 &&
3914 entry->Serial ==
3915 ID_GO_P5_ACTION_SELECTION + (macroCount * ID_GO_P5_MACRO_START))
3916 {
3917 break;
3918 }
3919
3920 macroCount++;
3921 obj = (CMacroObject *)obj->m_Next;
3922 }
3923 }
3924 }
3925
3926 if (obj != nullptr)

Callers

nothing calls this directly

Calls 5

str_to_intFunction · 0.85
QFORFunction · 0.70
InsertMethod · 0.45
GetTextAMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected