From 23869255f8cd6687268ad8de1f4ca2a5236cba67 Mon Sep 17 00:00:00 2001 From: 6emmes <27066734+6emmes@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:15:04 +0200 Subject: [PATCH 1/2] Fix incorrect assert --- src/game/logic/object/object.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/game/logic/object/object.cpp b/src/game/logic/object/object.cpp index b16a2c101..9c92fa1c6 100644 --- a/src/game/logic/object/object.cpp +++ b/src/game/logic/object/object.cpp @@ -4203,10 +4203,11 @@ void Object::Do_Command_Button(const CommandButton *button, CommandSourceType ty const UpgradeTemplate *upgrade = button->Get_Upgrade_Template(); captainslog_dbgassert(upgrade != nullptr, "Undefined upgrade '%s' in player upgrade command", "UNKNOWN"); - if (upgrade == nullptr - || upgrade->Get_Type() == UPGRADE_TYPE_OBJECT + if (upgrade != nullptr + && upgrade->Get_Type() == UPGRADE_TYPE_OBJECT && (Has_Upgrade(upgrade) || !Affected_By_Upgrade(upgrade))) { - goto l1; + break; + } ProductionUpdateInterface *production = Get_Production_Update_Interface(); From 716f94a9edc27eb811f06ea7448f49cb5970bf28 Mon Sep 17 00:00:00 2001 From: 6emmes <27066734+6emmes@users.noreply.github.com> Date: Wed, 30 Oct 2024 22:08:45 +0100 Subject: [PATCH 2/2] Update object.cpp --- src/game/logic/object/object.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game/logic/object/object.cpp b/src/game/logic/object/object.cpp index 9c92fa1c6..53b1d6f95 100644 --- a/src/game/logic/object/object.cpp +++ b/src/game/logic/object/object.cpp @@ -4203,11 +4203,13 @@ void Object::Do_Command_Button(const CommandButton *button, CommandSourceType ty const UpgradeTemplate *upgrade = button->Get_Upgrade_Template(); captainslog_dbgassert(upgrade != nullptr, "Undefined upgrade '%s' in player upgrade command", "UNKNOWN"); - if (upgrade != nullptr - && upgrade->Get_Type() == UPGRADE_TYPE_OBJECT - && (Has_Upgrade(upgrade) || !Affected_By_Upgrade(upgrade))) { + if (upgrade == nullptr) { break; + } + if (upgrade->Get_Type() == UPGRADE_TYPE_OBJECT + && (Has_Upgrade(upgrade) || !Affected_By_Upgrade(upgrade))) { + break; } ProductionUpdateInterface *production = Get_Production_Update_Interface();