Planet.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // Created by jovian on 17/08/17.
  3. //
  4. #ifndef SPACEEXPANSION_PLANET_H
  5. #define SPACEEXPANSION_PLANET_H
  6. #include <string>
  7. #include "../Graphics/Visual.h"
  8. #include "../Rules/PlanetStep.h"
  9. #include "StarShip.h"
  10. class Planet {
  11. // Methods
  12. public:
  13. Planet(const PlanetDef &def);
  14. virtual ~Planet();
  15. Visual *makeVisual();
  16. void applyRule(PlanetStep *rule);
  17. const PlanetDef &getDef() const;
  18. int getId() const;
  19. void landShip(StarShip *ship); // If a ship is arrived it can land on the planet
  20. bool readyShip(); // Return true if at least one ship is ready to go
  21. StarShip* launchShip(const Stock &avg); // Load and launch a ship into space
  22. bool need(Resource res, Stock average); // Return true if this lanet need res
  23. static std::string randomName();
  24. // Attributes
  25. private:
  26. PlanetDef m_def;
  27. int m_idPlanet;
  28. unsigned int m_imgId;
  29. float m_angle;
  30. std::vector<StarShip *> m_landedShips;
  31. // Static
  32. private:
  33. static int m_incr; // Useful for indexing
  34. };
  35. #endif //SPACEEXPANSION_PLANET_H