Bugfix Get Item At Index Returning Invaild Result
This commit is contained in:
parent
7ab8735ed1
commit
53ecbbb472
@ -107,7 +107,7 @@ bool UInventoryComponent::IsRoomAvailable(UBaseItem* Item, const int TopLeftInde
|
|||||||
TileToCheck.X = i;
|
TileToCheck.X = i;
|
||||||
TileToCheck.Y = j;
|
TileToCheck.Y = j;
|
||||||
if (!IsTileValid(TileToCheck)) return false;
|
if (!IsTileValid(TileToCheck)) return false;
|
||||||
const TTuple<UBaseItem*, bool> ItemAtIndex = GetItemAtIndex(TileToIndex(TileToCheck));
|
TTuple<UBaseItem*, bool> ItemAtIndex = GetItemAtIndex(TileToIndex(TileToCheck));
|
||||||
if (ItemAtIndex.Get<1>()) return false;
|
if (ItemAtIndex.Get<1>()) return false;
|
||||||
if (IsValid(ItemAtIndex.Get<0>())) return true;
|
if (IsValid(ItemAtIndex.Get<0>())) return true;
|
||||||
}
|
}
|
||||||
@ -126,6 +126,7 @@ FInventoryTile UInventoryComponent::IndexToTile(const int Index) const
|
|||||||
TTuple<UBaseItem*, bool> UInventoryComponent::GetItemAtIndex(const int Index)
|
TTuple<UBaseItem*, bool> UInventoryComponent::GetItemAtIndex(const int Index)
|
||||||
{
|
{
|
||||||
if (!InventoryItems.IsValidIndex(Index)) return MakeTuple(nullptr, false);
|
if (!InventoryItems.IsValidIndex(Index)) return MakeTuple(nullptr, false);
|
||||||
|
if (!IsValid(InventoryItems[Index])) return MakeTuple(nullptr, false);
|
||||||
return MakeTuple(InventoryItems[Index], true);
|
return MakeTuple(InventoryItems[Index], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user