2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
|
|
|
#include "cCreativeInventory.h"
|
|
|
|
#include "cPlayer.h"
|
|
|
|
#include "cClientHandle.h"
|
|
|
|
#include "cWindow.h"
|
|
|
|
#include "cItem.h"
|
|
|
|
#include "cRoot.h"
|
|
|
|
|
|
|
|
#include <json/json.h>
|
|
|
|
|
|
|
|
|
2012-08-18 05:56:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cCreativeInventory::cCreativeInventory(cPlayer * a_Owner)
|
2012-06-14 09:06:06 -04:00
|
|
|
: cInventory(a_Owner)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-08-18 05:56:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cCreativeInventory::~cCreativeInventory()
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2012-08-18 05:56:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cCreativeInventory::Clicked(
|
|
|
|
short a_SlotNum, bool a_IsRightClick, bool a_IsShiftPressed,
|
|
|
|
const cItem & a_HeldItem
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (a_SlotNum == -1)
|
2012-08-10 15:01:36 -04:00
|
|
|
{
|
|
|
|
// object thrown out
|
2012-08-18 05:56:28 -04:00
|
|
|
m_Owner->TossItem(false, a_HeldItem.m_ItemCount, a_HeldItem.m_ItemType, a_HeldItem.m_ItemDamage);
|
2012-08-10 15:01:36 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-08-18 05:56:28 -04:00
|
|
|
if ((a_SlotNum < c_HotOffset) || (a_SlotNum >= c_NumSlots))
|
2012-08-10 15:01:36 -04:00
|
|
|
{
|
2012-08-18 05:56:28 -04:00
|
|
|
LOG("%s: Invalid slot (%d) in cCreativeInventory::Clicked(). Ignoring...", m_Owner->GetName().c_str(), a_SlotNum);
|
2012-08-10 15:01:36 -04:00
|
|
|
return;
|
|
|
|
}
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2012-08-18 05:56:28 -04:00
|
|
|
m_Slots[a_SlotNum] = a_HeldItem;
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
2012-08-18 05:56:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|