Peoplemon  0.1.0
Peoplemon 3 game source documentation
StorageSystem.hpp
Go to the documentation of this file.
1 #ifndef CORE_PLAYER_STORAGESYSTEM_HPP
2 #define CORE_PLAYER_STORAGESYSTEM_HPP
3 
6 
7 namespace core
8 {
9 namespace system
10 {
11 class Player;
12 }
13 
14 namespace player
15 {
23 public:
24  static constexpr int BoxCount = 14;
25  static constexpr int BoxWidth = 12;
26  static constexpr int BoxHeight = 10;
27 
32  StorageSystem();
33 
40  bool add(const pplmn::OwnedPeoplemon& ppl);
41 
50  void add(unsigned int box, const sf::Vector2i& pos, const pplmn::OwnedPeoplemon& ppl);
51 
58  void remove(unsigned int box, const sf::Vector2i& position);
59 
68  pplmn::StoredPeoplemon* move(pplmn::StoredPeoplemon& ppl, unsigned int newBox,
69  const sf::Vector2i& newPos);
70 
79  bool spaceFree(int box, int x, int y) const;
80 
88  pplmn::StoredPeoplemon* get(unsigned int box, const sf::Vector2i& pos);
89 
96  const std::vector<pplmn::StoredPeoplemon>& getBox(unsigned int box) const;
97 
98 private:
99  std::array<std::vector<pplmn::StoredPeoplemon>, BoxCount> boxes;
100 
101  friend class system::Player;
102 };
103 
104 } // namespace player
105 } // namespace core
106 
107 #endif
Core classes and functionality for both the editor and game.
Represents an instance of a peoplemon. Can be a wild peoplemon, trainer, or player peoplemon....
Represents a Peoplemon in storage.
Peoplemon storage system for extra peoplemon the player has.
static constexpr int BoxCount
pplmn::StoredPeoplemon * get(unsigned int box, const sf::Vector2i &pos)
Returns the peoplemon at the given position in the given box.
static constexpr int BoxHeight
static constexpr int BoxWidth
pplmn::StoredPeoplemon * move(pplmn::StoredPeoplemon &ppl, unsigned int newBox, const sf::Vector2i &newPos)
Moves the given stored peoplemon from its current location to the new location.
StorageSystem()
Construct a new Storage System.
void remove(unsigned int box, const sf::Vector2i &position)
Clears the peoplemon from the given position, if one is there.
const std::vector< pplmn::StoredPeoplemon > & getBox(unsigned int box) const
Returns the given box. Performs no bounds check.
bool add(const pplmn::OwnedPeoplemon &ppl)
Adds the given peoplemon to storage in a free slot.
bool spaceFree(int box, int x, int y) const
Returns whether or not the given storage space is free.
Primary system for managing the player and their data.
Definition: Player.hpp:35