race.cpp 545 B

12345678910111213141516171819202122232425
  1. #include "race.h"
  2. #include "units/unit.h"
  3. #include <QFile>
  4. #include <QTextStream>
  5. #include <QString>
  6. Race::Race(QString race_name, QObject *parent) : QObject(parent)
  7. {
  8. QFile file(":/assets/units/" + race_name + "/units.txt");
  9. QTextStream in(&file);
  10. QString unit_name = in.readLine();
  11. //units_factory_.registerClass();
  12. while (!in.atEnd()) {
  13. available_units_list_.push_back(unit_name);
  14. race_name = in.readLine();
  15. }
  16. }
  17. Unit* createUnit(QString unit_name);
  18. std::vector<QString> getAvailableUnitsList();