Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
///inventory.h
#ifndef INVENTORY_H
#define INVENTORY_H
#include "item.h"
#include "weapon.h"
#include "armor.h"
#include <exception>
#include <vector>
#include <memory>
///this class will hold items that I will later add to active slots
class Inventory
{
private:
int max_inventory_space;
int number_of_items;
int player_input;
public:
///At first I have tried this using normal pointers, but figuring out that
/// I am propably creating a memory leak, I switched to unique pointer, because later I will also need to move an Item
///I am also using array instead of vector, because with vector i got Critical error detected c0000374 and was not able to fix it
///The lastitem slot will be for swaping armor and weapon
std::unique_ptr<Item> Inventory_array[11];
Weapon weapon_slot;
Armor armor_slot;
Inventory();
void add_item(Item &item,int mode_of_operation);
void remove_item(int item_number);
void swap_item(int item_number,std::string item_type);
void display_inventory();
void inventory_menu();
~Inventory(){
for(int i = 0; i > number_of_items;i++)
{
Inventory_array[i].release();
Inventory_array[i] = 0;
}
};
};
#endif