Fix wrong array indexing in undo action label (fixes #8135)

`Result` was not the correct variable to use to index the operation names array, instead it should be what is returned from the selection popup.
This commit is contained in:
Corantin H 2024-03-21 18:25:48 +01:00
parent 21d0d69bec
commit ad07be1492

View file

@ -708,8 +708,9 @@ CUi::EPopupMenuFunctionResult CLayerTiles::RenderProperties(CUIRect *pToolBox)
static int s_GameTilesButton = 0;
if(m_pEditor->DoButton_Editor(&s_GameTilesButton, "Game tiles", 0, &Button, 0, "Constructs game tiles from this layer"))
m_pEditor->PopupSelectGametileOpInvoke(m_pEditor->Ui()->MouseX(), m_pEditor->Ui()->MouseY());
int Result = m_pEditor->PopupSelectGameTileOpResult();
switch(Result)
int Selected = m_pEditor->PopupSelectGameTileOpResult();
int Result = -1;
switch(Selected)
{
case 4:
Result = TILE_THROUGH_CUT;
@ -804,7 +805,7 @@ CUi::EPopupMenuFunctionResult CLayerTiles::RenderProperties(CUIRect *pToolBox)
vpActions.push_back(std::make_shared<CEditorBrushDrawAction>(m_pEditor, m_pEditor->m_SelectedGroup));
char aDisplay[256];
str_format(aDisplay, sizeof(aDisplay), "Construct '%s' game tiles (x%d)", s_apGametileOpNames[Result], Changes);
str_format(aDisplay, sizeof(aDisplay), "Construct '%s' game tiles (x%d)", s_apGametileOpNames[Selected], Changes);
m_pEditor->m_EditorHistory.RecordAction(std::make_shared<CEditorActionBulk>(m_pEditor, vpActions, aDisplay, true));
}
else