summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorMike Hunsinger <mike.hunsinger@gmail.com>2014-01-24 04:11:10 +0100
committerMike Hunsinger <mike.hunsinger@gmail.com>2014-01-24 04:11:10 +0100
commit7c12247263502030fbf50fc6fda12bb8f67a269b (patch)
tree31c00f22652af0a777c7c88a3e75e57a8adecd5c /src/Entities/Player.cpp
parentFixed indentation and doxygen comments... For real this time. (diff)
downloadcuberite-7c12247263502030fbf50fc6fda12bb8f67a269b.tar
cuberite-7c12247263502030fbf50fc6fda12bb8f67a269b.tar.gz
cuberite-7c12247263502030fbf50fc6fda12bb8f67a269b.tar.bz2
cuberite-7c12247263502030fbf50fc6fda12bb8f67a269b.tar.lz
cuberite-7c12247263502030fbf50fc6fda12bb8f67a269b.tar.xz
cuberite-7c12247263502030fbf50fc6fda12bb8f67a269b.tar.zst
cuberite-7c12247263502030fbf50fc6fda12bb8f67a269b.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 54de4dee9..b2574c433 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1345,20 +1345,20 @@ AString cPlayer::GetColor(void) const
void cPlayer::TossEquippedItem(char a_Amount)
{
cItems Drops;
- cItem DroppedItem(GetInventory().GetEquippedItem());
- if (!DroppedItem.IsEmpty())
- {
- char NewAmount = a_Amount;
- if (NewAmount > GetInventory().GetEquippedItem().m_ItemCount)
- {
- NewAmount = GetInventory().GetEquippedItem().m_ItemCount; // Drop only what's there
- }
+ cItem DroppedItem(GetInventory().GetEquippedItem());
+ if (!DroppedItem.IsEmpty())
+ {
+ char NewAmount = a_Amount;
+ if (NewAmount > GetInventory().GetEquippedItem().m_ItemCount)
+ {
+ NewAmount = GetInventory().GetEquippedItem().m_ItemCount; // Drop only what's there
+ }
- GetInventory().GetHotbarGrid().ChangeSlotCount(GetInventory().GetEquippedSlotNum() /* Returns hotbar subslot, which HotbarGrid takes */, -a_Amount);
+ GetInventory().GetHotbarGrid().ChangeSlotCount(GetInventory().GetEquippedSlotNum() /* Returns hotbar subslot, which HotbarGrid takes */, -a_Amount);
- DroppedItem.m_ItemCount = NewAmount;
- Drops.push_back(DroppedItem);
- }
+ DroppedItem.m_ItemCount = NewAmount;
+ Drops.push_back(DroppedItem);
+ }
double vX = 0, vY = 0, vZ = 0;
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
@@ -1373,24 +1373,24 @@ void cPlayer::TossEquippedItem(char a_Amount)
void cPlayer::TossHeldItem(char a_Amount)
{
cItems Drops;
- cItem & Item = GetDraggingItem();
- if (!Item.IsEmpty())
- {
- char OriginalItemAmount = Item.m_ItemCount;
- Item.m_ItemCount = std::min(OriginalItemAmount, a_Amount);
- Drops.push_back(Item);
- if (OriginalItemAmount > a_Amount)
- {
- Item.m_ItemCount = OriginalItemAmount - a_Amount;
- }
- else
- {
- Item.Empty();
- }
- }
-
- double vX = 0, vY = 0, vZ = 0;
- EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
+ cItem & Item = GetDraggingItem();
+ if (!Item.IsEmpty())
+ {
+ char OriginalItemAmount = Item.m_ItemCount;
+ Item.m_ItemCount = std::min(OriginalItemAmount, a_Amount);
+ Drops.push_back(Item);
+ if (OriginalItemAmount > a_Amount)
+ {
+ Item.m_ItemCount = OriginalItemAmount - a_Amount;
+ }
+ else
+ {
+ Item.Empty();
+ }
+ }
+
+ double vX = 0, vY = 0, vZ = 0;
+ EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
vY = -vY * 2 + 1.f;
m_World->SpawnItemPickups(Drops, GetPosX(), GetEyeHeight(), GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player
}
@@ -1402,7 +1402,7 @@ void cPlayer::TossHeldItem(char a_Amount)
void cPlayer::TossPickup(const cItem & a_Item)
{
cItems Drops;
- Drops.push_back(a_Item);
+ Drops.push_back(a_Item);
double vX = 0, vY = 0, vZ = 0;
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);