From e81d1f010a0b9cf25dabe9a9a035909821315797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 19 May 2022 10:02:02 +0200 Subject: [PATCH] Revert invalid PopupMenu breaking change from #61102 Fixes #61179. --- scene/gui/popup_menu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 1b52bf1ba..0831e3e08 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -686,7 +686,7 @@ void PopupMenu::_notification(int p_what) { #define ITEM_SETUP_WITH_ACCEL(p_label, p_id, p_accel) \ item.text = p_label; \ item.xl_text = tr(p_label); \ - item.id = p_id == -1 ? items.size() - 1 : p_id; \ + item.id = p_id == -1 ? items.size() : p_id; \ item.accel = p_accel; void PopupMenu::add_item(const String &p_label, int p_id, uint32_t p_accel) { @@ -759,7 +759,7 @@ void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int _ref_shortcut(p_shortcut); \ item.text = p_shortcut->get_name(); \ item.xl_text = tr(item.text); \ - item.id = p_id == -1 ? items.size() - 1 : p_id; \ + item.id = p_id == -1 ? items.size() : p_id; \ item.shortcut = p_shortcut; \ item.shortcut_is_global = p_global; @@ -822,7 +822,7 @@ void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu, Item item; item.text = p_label; item.xl_text = tr(p_label); - item.id = p_id == -1 ? items.size() - 1 : p_id; + item.id = p_id == -1 ? items.size() : p_id; item.submenu = p_submenu; items.push_back(item); update();