Permalink
Cannot retrieve contributors at this time
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?
Ecotopia/Inventory.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
50 lines (39 sloc)
1.11 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <iomanip> | |
#include <vector> | |
#include <ostream> | |
#include <Windows.h> | |
#include <string> | |
#include <cctype> | |
using namespace std; | |
struct Item { | |
string name; //Item name. | |
int slot; //Head, Torso, Hands | |
int hp; | |
int attack; | |
int defense; | |
}; | |
std::ostream &operator<<(std::ostream &os, const Item& item) { | |
os << item.name; | |
return os; | |
} | |
int main() | |
{ | |
//Variables, Strings, etc. | |
int itemcounter = 0, counter = 0; | |
//"Empty" Item | |
Item Empty{ "<Empty>", 0, 0, 0 }; | |
vector<Item> Equipment = { 100, Empty }; //Current Equipment, 100 empty slots. | |
vector<Item> Inventory = { }; //Players Inventory. | |
string InventorySlots[] = { "Head" "Torso", "Hands" }; //Player parts where items can be equiped. | |
cout << "You check your manned maneuvering unit," << " you have:" << endl; | |
for (int i = 0; i < itemcounter; i++) | |
{ | |
cout << InventorySlots[i]; | |
if (Equipment[i].name == "Empty ") | |
{ | |
cout << " " << Equipment[i] << endl << endl; | |
} | |
} | |
} |