Cuberite
A lightweight, fast and extensible game server for Minecraft
|
A cSlotArea with items layout that is private to each player and is temporary, such as a crafting grid or an enchantment table. More...
#include <SlotArea.h>
Public Member Functions | |
cSlotAreaTemporary (int a_NumSlots, cWindow &a_ParentWindow) | |
virtual const cItem * | GetSlot (int a_SlotNum, cPlayer &a_Player) const override |
Called to retrieve an item in the specified slot for the specified player. More... | |
virtual void | OnPlayerAdded (cPlayer &a_Player) override |
Called when a new player opens the same parent window. More... | |
virtual void | OnPlayerRemoved (cPlayer &a_Player) override |
Called when one of the players closes the parent window. More... | |
virtual void | SetSlot (int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override |
Called to set an item in the specified slot for the specified player. More... | |
void | TossItems (cPlayer &a_Player, int a_Begin, int a_End) |
Tosses the player's items in slots [a_Begin, a_End) (ie. More... | |
Public Member Functions inherited from cSlotArea | |
virtual void | Clicked (cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem) |
Called when a player clicks in the window. More... | |
virtual bool | CollectItemsToHand (cItem &a_Dragging, cPlayer &a_Player, bool a_CollectFullStacks) |
Called on DblClicking to collect all stackable items into hand. More... | |
cSlotArea (int a_NumSlots, cWindow &a_ParentWindow) | |
virtual void | DblClicked (cPlayer &a_Player, int a_SlotNum) |
Called from Clicked when the action is a caDblClick. More... | |
virtual void | DistributeStack (cItem &a_ItemStack, cPlayer &a_Player, bool a_ShouldApply, bool a_KeepEmptySlots, bool a_BackFill) |
Called to store as much of a_ItemStack in the area as possible. More... | |
virtual void | DropClicked (cPlayer &a_Player, int a_SlotNum, bool a_DropStack) |
Called from Clicked when the action is a drop click. More... | |
int | GetNumSlots (void) const |
virtual void | MiddleClicked (cPlayer &a_Player, int a_SlotNum) |
Called from Clicked when the action is a middleclick. More... | |
virtual void | NumberClicked (cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction) |
Called from Clicked when the action is a number click. More... | |
virtual void | ShiftClicked (cPlayer &a_Player, int a_SlotNum, const cItem &a_ClickedItem) |
Called from Clicked when the action is a shiftclick (left or right) More... | |
virtual | ~cSlotArea () |
Protected Types | |
using | cItemMap = std::map< UInt32, std::vector< cItem > > |
Protected Member Functions | |
cItem * | GetPlayerSlots (cPlayer &a_Player) |
Returns the pointer to the slot array for the player specified. More... | |
Protected Attributes | |
cItemMap | m_Items |
Protected Attributes inherited from cSlotArea | |
int | m_NumSlots |
cWindow & | m_ParentWindow |
Private Types | |
using | Super = cSlotArea |
A cSlotArea with items layout that is private to each player and is temporary, such as a crafting grid or an enchantment table.
This common ancestor stores the items in a per-player map. It also implements tossing items from the map.
Definition at line 226 of file SlotArea.h.
|
protected |
Definition at line 245 of file SlotArea.h.
|
private |
Definition at line 229 of file SlotArea.h.
cSlotAreaTemporary::cSlotAreaTemporary | ( | int | a_NumSlots, |
cWindow & | a_ParentWindow | ||
) |
Definition at line 2655 of file SlotArea.cpp.
Returns the pointer to the slot array for the player specified.
Definition at line 2763 of file SlotArea.cpp.
|
overridevirtual |
Called to retrieve an item in the specified slot for the specified player.
Must return a valid cItem.
Implements cSlotArea.
Definition at line 2664 of file SlotArea.cpp.
|
overridevirtual |
Called when a new player opens the same parent window.
The window already tracks the player. CS-locked.
Reimplemented from cSlotArea.
Reimplemented in cSlotAreaEnchanting.
Definition at line 2715 of file SlotArea.cpp.
|
overridevirtual |
Called when one of the players closes the parent window.
The window already doesn't track the player. CS-locked.
Reimplemented from cSlotArea.
Reimplemented in cSlotAreaEnchanting, cSlotAreaAnvil, and cSlotAreaCrafting.
Definition at line 2725 of file SlotArea.cpp.
|
overridevirtual |
Called to set an item in the specified slot for the specified player.
Implements cSlotArea.
Reimplemented in cSlotAreaEnchanting, and cSlotAreaCrafting.
Definition at line 2690 of file SlotArea.cpp.
void cSlotAreaTemporary::TossItems | ( | cPlayer & | a_Player, |
int | a_Begin, | ||
int | a_End | ||
) |
Tosses the player's items in slots [a_Begin, a_End) (ie.
incl. a_Begin, but excl. a_End)
Definition at line 2736 of file SlotArea.cpp.
|
protected |
Definition at line 247 of file SlotArea.h.