Skip to content

Commit

Permalink
Fix edge case when actively editing multiple CGameMenuItemZEdit items
Browse files Browse the repository at this point in the history
  • Loading branch information
tmyqlfpir authored and Hendricks266 committed Aug 3, 2023
1 parent 4f46c25 commit 011939d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source/blood/src/gamemenu.cpp
Expand Up @@ -1906,6 +1906,7 @@ void CGameMenuItemZEdit::Draw(void)
bool CGameMenuItemZEdit::Event(CGameMenuEvent &event)
{
static char buffer[256];
static CGameMenuItemZEdit *pGameMenuItemZEdit = NULL;
// Hack
if (event.at2 == sc_kpad_2 || event.at2 == sc_kpad_4 || event.at2 == sc_kpad_6 || event.at2 == sc_kpad_8)
event.at0 = kMenuEventKey;
Expand All @@ -1917,6 +1918,7 @@ bool CGameMenuItemZEdit::Event(CGameMenuEvent &event)
strncpy(at20, buffer, at24);
at20[at24-1] = 0;
at30 = 0;
pGameMenuItemZEdit = NULL;
return false;
}
return true;
Expand All @@ -1934,6 +1936,13 @@ bool CGameMenuItemZEdit::Event(CGameMenuEvent &event)
at30 = 0;
return false;
}
else // unselect previously edited item
{
if (!pGameMenuItemZEdit)
pGameMenuItemZEdit = this;
else if (pGameMenuItemZEdit != this)
pGameMenuItemZEdit->at30 = 0, pGameMenuItemZEdit = this;
}
strncpy(buffer, at20, at24);
buffer[at24-1] = 0;
at30 = 1;
Expand Down

0 comments on commit 011939d

Please sign in to comment.