player.h 834 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef INCLUDEPLAYER_H
  2. #define INCLUDEPLAYER_H
  3. #include "units/unit.h"
  4. #include "racemanager.h"
  5. #include <QObject>
  6. #include <set>
  7. class Race;
  8. template<class Obj, class Identifier>
  9. class ObjectFactory;
  10. class Player {
  11. public:
  12. Player() {
  13. }
  14. void init(int id) {
  15. player_name_ = "Игрок " + QString::number(id);
  16. race_ = RaceManager::getInstance().getRace(
  17. RaceManager::getInstance().getAvailableRacesList()[0]
  18. );
  19. units_.clear();
  20. }
  21. QString getPlayerName() {
  22. return player_name_;
  23. }
  24. const std::set<Unit>& getUnits() {
  25. return units_;
  26. }
  27. Race* getRace() {
  28. return race_;
  29. }
  30. signals:
  31. public slots:
  32. private:
  33. QString player_name_;
  34. std::set<Unit> units_;
  35. Race* race_;
  36. };
  37. #endif // INCLUDEPLAYER_H