summaryrefslogtreecommitdiffstats
path: root/source/Player.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-24 09:30:39 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-24 09:30:39 +0200
commitcf87169737fdeeee7d4b160688bbed7194e46147 (patch)
tree7daaeb9af8e3187cde6068c3cff5ff0ee64f0067 /source/Player.cpp
parentAdded ItemCategory::IsArmor() (diff)
downloadcuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar.gz
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar.bz2
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar.lz
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar.xz
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar.zst
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.zip
Diffstat (limited to 'source/Player.cpp')
-rw-r--r--source/Player.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/source/Player.cpp b/source/Player.cpp
index 0076b2cff..031b7a6c9 100644
--- a/source/Player.cpp
+++ b/source/Player.cpp
@@ -360,25 +360,18 @@ void cPlayer::KilledBy(cPawn * a_Killer)
m_bVisible = false; // So new clients don't see the player
// Puke out all the items
- const cItem * Items = m_Inventory.GetSlots();
cItems Pickups;
- for (unsigned int i = 1; i < m_Inventory.c_NumSlots; ++i)
- {
- if (!Items[i].IsEmpty())
- {
- Pickups.push_back(Items[i]);
- }
- }
+ m_Inventory.CopyToItems(Pickups);
m_Inventory.Clear();
m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10);
- SaveToDisk(); // Save it, yeah the world is a tough place !
+ SaveToDisk(); // Save it, yeah the world is a tough place !
}
-void cPlayer::Respawn()
+void cPlayer::Respawn(void)
{
m_Health = GetMaxHealth();
@@ -768,7 +761,7 @@ void cPlayer::TossItem(
)
{
cItems Drops;
- if (a_CreateType)
+ if (a_CreateType != 0)
{
// Just create item without touching the inventory (used in creative mode)
Drops.push_back(cItem(a_CreateType, a_Amount, a_CreateHealth));
@@ -800,8 +793,7 @@ void cPlayer::TossItem(
cItem DroppedItem(GetInventory().GetEquippedItem());
if (!DroppedItem.IsEmpty())
{
- DroppedItem.m_ItemCount = 1;
- if (GetInventory().RemoveItem(DroppedItem))
+ if (GetInventory().RemoveOneEquippedItem())
{
DroppedItem.m_ItemCount = 1; // RemoveItem decreases the count, so set it to 1 again
Drops.push_back(DroppedItem);