Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. Item & dropItem(const std::string identifier)
  2. {
  3.     ifstream fileIn(Files::items);
  4.     // otworz plik, zabezpiecz sie przed bledami
  5.    
  6.     std::string str;
  7.     while (fileIn >> str && str = "id:")
  8.     {
  9.         std::string name;
  10.         int damage;
  11.         // inne zmienne
  12.  
  13.         if (str == identifier)
  14.         {
  15.             fileIn >> name;
  16.             fileIn >> damage;
  17.             // odczytaj pozostale parametry, najlepiej zrob funkcje osobna i ja tu w jednej linii wywolasz
  18.            
  19.             return Item(name, damage, ...);
  20.         }
  21.     }
  22.  
  23.     // throw exception
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement