Lilypads: add missing boundary check
This commit is contained in:
parent
7027b2279f
commit
815f2aed82
@ -63,9 +63,15 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lilypad should be placed only if there is a water block below
|
const auto Below = PlacePos.addedY(-1);
|
||||||
|
if (Below.y < 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lilypad should be placed only if there is a water block below:
|
||||||
if (
|
if (
|
||||||
const auto BlockBelow = a_World->GetBlock(PlacePos.addedY(-1));
|
const auto BlockBelow = a_World->GetBlock(Below);
|
||||||
(BlockBelow != E_BLOCK_WATER) &&
|
(BlockBelow != E_BLOCK_WATER) &&
|
||||||
(BlockBelow != E_BLOCK_STATIONARY_WATER)
|
(BlockBelow != E_BLOCK_STATIONARY_WATER)
|
||||||
)
|
)
|
||||||
@ -78,6 +84,7 @@ public:
|
|||||||
{
|
{
|
||||||
a_Player->GetInventory().RemoveOneEquippedItem();
|
a_Player->GetInventory().RemoveOneEquippedItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user