diff options
author | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-01-01 05:55:17 +0100 |
---|---|---|
committer | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-01-01 05:55:17 +0100 |
commit | d7068b35a85f0c0248a5533240087747d02e1a17 (patch) | |
tree | 7d40a34bdda09c0fbccc9e8052043709cfd88d7b /source/cPlayer.cpp | |
parent | Chests, furnaces and dispensers face the correct way now. (diff) | |
download | cuberite-d7068b35a85f0c0248a5533240087747d02e1a17.tar cuberite-d7068b35a85f0c0248a5533240087747d02e1a17.tar.gz cuberite-d7068b35a85f0c0248a5533240087747d02e1a17.tar.bz2 cuberite-d7068b35a85f0c0248a5533240087747d02e1a17.tar.lz cuberite-d7068b35a85f0c0248a5533240087747d02e1a17.tar.xz cuberite-d7068b35a85f0c0248a5533240087747d02e1a17.tar.zst cuberite-d7068b35a85f0c0248a5533240087747d02e1a17.zip |
Diffstat (limited to 'source/cPlayer.cpp')
-rw-r--r-- | source/cPlayer.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp index baba0174a..12f3c5a30 100644 --- a/source/cPlayer.cpp +++ b/source/cPlayer.cpp @@ -1,6 +1,7 @@ #include "cPlayer.h"
#include "cServer.h"
-#include "cInventory.h"
+#include "cCreativeInventory.h"
+#include "cSurvivalInventory.h"
#include "cClientHandle.h"
#include "cWorld.h"
#include "cPickup.h"
@@ -82,7 +83,8 @@ cPlayer::cPlayer(cClientHandle* a_Client, const char* a_PlayerName) m_EntityType = E_PLAYER;
SetMaxHealth(20);
SetMaxFoodLevel(125);
- m_Inventory = new cInventory( this );
+ m_Inventory = new cSurvivalInventory( this );
+ m_CreativeInventory = new cCreativeInventory(this);
cTimer t1;
m_LastPlayerListTime = t1.GetNowTime();
@@ -118,6 +120,10 @@ cPlayer::~cPlayer(void) delete m_Inventory;
m_Inventory = 0;
}
+ if(m_CreativeInventory)
+ {
+ delete m_CreativeInventory;
+ }
delete m_pState;
GetWorld()->RemovePlayer( this ); // TODO - Remove from correct world? Or get rid of this?
}
@@ -398,10 +404,10 @@ void cPlayer::OpenWindow( cWindow* a_Window ) void cPlayer::CloseWindow(char a_WindowType)
{
if (a_WindowType == 0) { // Inventory
- if(GetInventory().GetWindow()->GetDraggingItem() && GetInventory().GetWindow()->GetDraggingItem()->m_ItemCount > 0)
+ if(m_Inventory->GetWindow()->GetDraggingItem() && m_Inventory->GetWindow()->GetDraggingItem()->m_ItemCount > 0)
{
LOG("Player holds item! Dropping it...");
- TossItem( true, GetInventory().GetWindow()->GetDraggingItem()->m_ItemCount );
+ TossItem( true, m_Inventory->GetWindow()->GetDraggingItem()->m_ItemCount );
}
//Drop whats in the crafting slots (1, 2, 3, 4)
@@ -458,6 +464,7 @@ void cPlayer::SetGameMode( int a_GameMode ) GameModePacket.m_Reason = 3; //GameModeChange
GameModePacket.m_GameMode = (char)a_GameMode; //GameModeChange
m_ClientHandle->Send ( GameModePacket );
+ GetInventory().SendWholeInventory(m_ClientHandle);
}
}
}
@@ -651,7 +658,7 @@ void cPlayer::TossItem( bool a_bDraggingItem, int a_Amount /* = 1 */ ) {
if( a_bDraggingItem )
{
- cItem* Item = GetInventory().GetWindow()->GetDraggingItem();
+ cItem* Item = GetSurvivalInventory().GetWindow()->GetDraggingItem();
if( Item->m_ItemID > 0 && Item->m_ItemCount >= a_Amount )
{
float vX = 0, vY = 0, vZ = 0;
|