cBlockHandler: take player by ref
This commit is contained in:
@@ -31,14 +31,14 @@ public:
|
||||
}
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer & a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
) override
|
||||
{
|
||||
a_BlockType = m_BlockType;
|
||||
NIBBLETYPE Meta = static_cast<NIBBLETYPE>(a_Player->GetEquippedItem().m_ItemDamage);
|
||||
NIBBLETYPE Meta = static_cast<NIBBLETYPE>(a_Player.GetEquippedItem().m_ItemDamage);
|
||||
|
||||
// Set the correct metadata based on player equipped item (i.e. a_BlockMeta not initialised yet)
|
||||
switch (a_BlockFace)
|
||||
@@ -96,15 +96,15 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
|
||||
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
|
||||
{
|
||||
if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != static_cast<short>(m_BlockType)))
|
||||
if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player.GetEquippedItem().m_ItemType != static_cast<short>(m_BlockType)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Sends the slab back to the client. It's to refuse a doubleslab placement. */
|
||||
a_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *a_Player);
|
||||
a_Player.GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
|
||||
}
|
||||
|
||||
/** Converts the single-slab blocktype to its equivalent double-slab blocktype */
|
||||
|
||||
Reference in New Issue
Block a user