Fix editor prompt suggesting disabled last action

The editor prompt always has as a first entry the last action that ran.
But this entry should not show up if that action is currently disabled.
This commit is contained in:
ChillerDragon 2024-09-01 10:38:33 +08:00
parent 36f0bcc509
commit daad41fbd7
2 changed files with 4 additions and 4 deletions

View file

@ -101,7 +101,7 @@ void CPrompt::OnRender(CUIRect _)
{
m_PromptSelectedIndex = 0;
m_vpFilteredPromptList.clear();
if(m_ResetFilterResults && m_pLastAction)
if(m_ResetFilterResults && m_pLastAction && !m_pLastAction->Disabled())
{
m_vpFilteredPromptList.push_back(m_pLastAction);
}
@ -160,7 +160,7 @@ void CPrompt::OnRender(CUIRect _)
{
if(m_PromptSelectedIndex >= 0)
{
const CQuickAction *pBtn = m_vpFilteredPromptList[m_PromptSelectedIndex];
CQuickAction *pBtn = m_vpFilteredPromptList[m_PromptSelectedIndex];
SetInactive();
pBtn->Call();
m_pLastAction = pBtn;

View file

@ -10,10 +10,10 @@
class CPrompt : public CEditorComponent
{
bool m_ResetFilterResults = true;
const CQuickAction *m_pLastAction = nullptr;
CQuickAction *m_pLastAction = nullptr;
int m_PromptSelectedIndex = -1;
std::vector<const CQuickAction *> m_vpFilteredPromptList;
std::vector<CQuickAction *> m_vpFilteredPromptList;
std::vector<CQuickAction *> m_vQuickActions;
CLineInputBuffered<512> m_PromptInput;