- Fixed: InInventory didn't work quite right with multiple items.

This commit is contained in:
Braden Obrzut 2014-09-12 00:39:36 -04:00
parent 5e34b78451
commit 0223b7f460

View file

@ -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;