QtCraft API C++ classes QML types Handbook

QcSlotList Struct

The slots of a screen as one list (inventory, crafting grid, an open machine or chest, armour), as the server moves items between them. More...

Header: #include <common/gameplay/QcSlotList.h>

Public Functions

bool moveBetween(int from, int to, int count, const QcContentRegistry &content)
int moveInto(int from, const QList<int> &targets, const QcContentRegistry &content)

Public Variables

QList<QcItemStack> stacks

Detailed Description

Member Function Documentation

bool QcSlotList::moveBetween(int from, int to, int count, const QcContentRegistry &content)

Moves up to count items (0 = the whole stack) from slot from to slot to: into an empty or matching slot (up to the stack limit of content), or swaps whole stacks otherwise. Returns false for invalid indices.

int QcSlotList::moveInto(int from, const QList<int> &targets, const QcContentRegistry &content)

Moves as much of the stack in from as fits into targets: first onto equal stacks (in the order of targets), then into the first empty ones, up to the stack limits of content. Returns the number of items moved.

Member Variable Documentation

QList<QcItemStack> QcSlotList::stacks

The slots.