Item copperLongsword("Longsword", "Copper",
"A longblade made of dull copper", 1, Weapon, 1, 0, 1, 1, 1, false);
enum ItemType {
Weapon,
Shield,
Consumable,
Necklance,
Ring,
Robe,
Shirt,
Pants,
Helmet,
Chestplate,
Pauldron,
Gauntlet,
Greaves,
Boots,
};
class Item
{
private:
std::string Name;
std::string material;
int dataBaseID;
int itemVal;
std::string itemDesc;
int maxItemCharges;
ItemType type;
int weaponDmg;
int healBase;
int armorRating;
int enchantVal;
int stack;
int maxStack;
bool stackable;
public:
Item();
Item(std::string Name, std::string material,
std::string ItemDesc, int DatabaseID, int ItemType,
int Attack, int Defense, int GoldValue, int Stack,
int MaxStack, bool Stackable);
std::string GetItem() {return Name;}
std::string GetItemDesc() {return itemDesc;}
int GetDatabaseID() {return dataBaseID;}
int GetItemType() {return type;}
int GetDmg() {return weaponDmg;}
int GetArmorRating() {return armorRating;}
int GetItemVal() {return itemVal;}
int GetStack() {return stack;}
int GetMaxStack() {return maxStack;}
bool GetStackable() {return stackable;}
};
std::vector<Item> inventory;
Above is the code relating to Items in my text-based adventure game. Everything seems to work but once I run it, it gives:
Functions.h:8:1: error: ‘Item’ does not name a type; did you mean ‘tm’?
8 | Item copperLongsword("Longsword", "Copper",
"A longblade made of dull copper", 1, Weapon, 1, 0, 1, 1, 1, false);
| ^~~~
| tm
Functions.h: In member function ‘void Character::levelUp()’:
Functions.h:266:33: error: ‘copperLongsword’ was not declared in this scope
266 | inventory.push_back(copperLongsword);
| ^~~~~~~~~~~~~~~
➜
I have no idea why this is not allowing me to create this item. Any help would be appreciated!
What I have tried:
Google, and various other sites.