Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Item & dropItem(const std::string identifier)
- {
- ifstream fileIn(Files::items);
- // otworz plik, zabezpiecz sie przed bledami
- std::string str;
- while (fileIn >> str && str = "id:")
- {
- std::string name;
- int damage;
- // inne zmienne
- if (str == identifier)
- {
- fileIn >> name;
- fileIn >> damage;
- // odczytaj pozostale parametry, najlepiej zrob funkcje osobna i ja tu w jednej linii wywolasz
- return Item(name, damage, ...);
- }
- }
- // throw exception
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement