From 0223b7f4601e0018c8479394108ee0f86dae8244 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Fri, 12 Sep 2014 00:39:36 -0400 Subject: [PATCH] - Fixed: InInventory didn't work quite right with multiple items. --- src/g_shared/sbarinfo_commands.cpp | 43 ++++++------------------------ 1 file changed, 8 insertions(+), 35 deletions(-) diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index c9011e851..26dfa0d96 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -3383,43 +3383,16 @@ class CommandInInventory : public SBarInfoCommandFlowControl AInventory *invItem[2] = { statusBar->CPlayer->mo->FindInventory(item[0]), statusBar->CPlayer->mo->FindInventory(item[1]) }; if (invItem[0] != NULL && amount[0] > 0 && invItem[0]->Amount < amount[0]) invItem[0] = NULL; if (invItem[1] != NULL && amount[1] > 0 && invItem[1]->Amount < amount[1]) invItem[1] = NULL; - if(invItem[1] != NULL && conditionAnd) + + if (item[1]) { - if((invItem[0] != NULL && invItem[1] != NULL) && !negate) - { - SetTruth(true, block, statusBar); - return; - } - else if((invItem[0] == NULL || invItem[1] == NULL) && negate) - { - SetTruth(true, block, statusBar); - return; - } + if (conditionAnd) + SetTruth((invItem[0] && invItem[1]) != negate, block, statusBar); + else + SetTruth((invItem[0] || invItem[1]) != negate, block, statusBar); } - else if(invItem[1] != NULL && !conditionAnd) - { - if((invItem[0] != NULL || invItem[1] != NULL) && !negate) - { - SetTruth(true, block, statusBar); - return; - } - else if((invItem[0] == NULL && invItem[1] == NULL) && negate) - { - SetTruth(true, block, statusBar); - return; - } - } - else if((invItem[0] != NULL) && !negate) - { - SetTruth(true, block, statusBar); - return; - } - else if((invItem[0] == NULL) && negate) - { - SetTruth(true, block, statusBar); - return; - } - SetTruth(false, block, statusBar); + else + SetTruth((invItem[0] != NULL) != negate, block, statusBar); } protected: bool conditionAnd;