Advertisement
Guest User

Untitled

a guest
May 25th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. void Import()
  2. {
  3. _armyDeque.clear();
  4. _cost = 0;
  5. std::string line;
  6. std::ifstream myFile(_nationality.getName() + ".txt");
  7. int counter = 0;
  8. if (myFile.is_open())
  9. {
  10. while (getline(myFile, line))
  11. {
  12. if (counter == 1){ // line = armyName
  13. _name = line;
  14. _costLimit = 9999;
  15. }
  16. if (line == RomanUnits::Legionnaire::LegionnaireName){
  17. getline(myFile, line);
  18. AddUnit(new RomanUnits::Legionnaire(), std::stoi(line));
  19. }
  20.  
  21. if (line == GaulUnits::Phalanx::PhalanxName){
  22. getline(myFile, line);
  23. AddUnit(new GaulUnits::Phalanx(), std::stoi(line));
  24. }
  25.  
  26. if if if if if if if ...
  27.  
  28. counter++;
  29. }
  30. myFile.close();
  31. }
  32. }
  33. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement