summaryrefslogtreecommitdiffstats
path: root/source/cCreativeInventory.cpp
blob: e8b3a0d15e29547e640af0c480d3e01ab055e418 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

#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>





cCreativeInventory::cCreativeInventory(cPlayer * a_Owner)
	: cInventory(a_Owner)
{
	
}





cCreativeInventory::~cCreativeInventory()
{
}





void cCreativeInventory::Clicked(
	short a_SlotNum, bool a_IsRightClick, bool a_IsShiftPressed, 
	const cItem & a_HeldItem
)
{
	if (a_SlotNum == -1)
	{
		// object thrown out
		m_Owner->TossItem(false, a_HeldItem.m_ItemCount, a_HeldItem.m_ItemType, a_HeldItem.m_ItemDamage);
		return;
	}
	
	if ((a_SlotNum < c_HotOffset) || (a_SlotNum >= c_NumSlots))
	{
		LOG("%s: Invalid slot (%d) in cCreativeInventory::Clicked(). Ignoring...", m_Owner->GetName().c_str(), a_SlotNum);
		return;
	}

	m_Slots[a_SlotNum] = a_HeldItem;
}