EchoesOfFate
A game for our COMP315 Project
 
Loading...
Searching...
No Matches
Inventory Class Reference

#include <Inventory.h>

Public Member Functions

 Inventory (vector< Item > itms, string bgPngPath, int AmtSlots)
 
 Inventory ()
 
virtual ~Inventory ()
 
void push (Item item)
 
void pop (Item item, int Amt)
 
Item swap (Item item, int index)
 
void swap (int ind, int index)
 
vector< ItemgetItems ()
 

Constructor & Destructor Documentation

◆ Inventory() [1/2]

Inventory::Inventory ( vector< Item > itms,
string bgPngPath,
int AmtSlots )

ctor

◆ Inventory() [2/2]

Inventory::Inventory ( )

!dtor

◆ ~Inventory()

Inventory::~Inventory ( )
virtual

dtor

Member Function Documentation

◆ getItems()

vector< Item > Inventory::getItems ( )

◆ pop()

void Inventory::pop ( Item item,
int Amt )

pops items 1 by 1

remove slot if 0 items in item stack there

◆ push()

void Inventory::push ( Item item)

check how many of this item is in this stacked item, like 20 gold bars in a stack for eg

checks in our inventory at ith item, if we can add more gold bars to him, like if the max amt of gold bars that can be stacked is 30, then it checks if we can

add 1 of these items to inventory, add 1 gold bar

remove from stack of items, remove a bar

checks if theres even more like we asked for 200 gold or something

checks if theres space

adds the item as a new slot

empties out the stack of items

◆ swap() [1/2]

void Inventory::swap ( int ind,
int index )

swap 2 items in the inventory

◆ swap() [2/2]

Item Inventory::swap ( Item item,
int index )

swap an item with one of the items in our inventory, like 30 chucken(at index like 4 or something) for 20 gold bars


The documentation for this class was generated from the following files: