Peoplemon storage system for extra peoplemon the player has.
More...
#include <StorageSystem.hpp>
|
| StorageSystem () |
| Construct a new Storage System. More...
|
|
bool | add (const pplmn::OwnedPeoplemon &ppl) |
| Adds the given peoplemon to storage in a free slot. More...
|
|
void | add (unsigned int box, const sf::Vector2i &pos, const pplmn::OwnedPeoplemon &ppl) |
| Adds the peoplemon to storage at the given position. Does not check if the position is available, the caller must ensure that it is free. More...
|
|
void | remove (unsigned int box, const sf::Vector2i &position) |
| Clears the peoplemon from the given position, if one is there. More...
|
|
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. More...
|
|
bool | spaceFree (int box, int x, int y) const |
| Returns whether or not the given storage space is free. More...
|
|
pplmn::StoredPeoplemon * | get (unsigned int box, const sf::Vector2i &pos) |
| Returns the peoplemon at the given position in the given box. More...
|
|
const std::vector< pplmn::StoredPeoplemon > & | getBox (unsigned int box) const |
| Returns the given box. Performs no bounds check. More...
|
|
Peoplemon storage system for extra peoplemon the player has.
Definition at line 22 of file StorageSystem.hpp.
◆ StorageSystem()
core::player::StorageSystem::StorageSystem |
( |
| ) |
|
◆ add() [1/2]
Adds the given peoplemon to storage in a free slot.
- Parameters
-
- Returns
- True if the peoplemon could be stored, false if full
Definition at line 11 of file StorageSystem.cpp.
◆ add() [2/2]
void core::player::StorageSystem::add |
( |
unsigned int |
box, |
|
|
const sf::Vector2i & |
pos, |
|
|
const pplmn::OwnedPeoplemon & |
ppl |
|
) |
| |
Adds the peoplemon to storage at the given position. Does not check if the position is available, the caller must ensure that it is free.
- Parameters
-
box | The box to add to [0, 13] |
pos | The position in the box |
ppl | The peoplemon to add |
Definition at line 26 of file StorageSystem.cpp.
◆ get()
Returns the peoplemon at the given position in the given box.
- Parameters
-
box | The box to search in |
pos | The position to check |
- Returns
- pplmn::StoredPeoplemon* The peoplemon or nullptr if the spot is empty
Definition at line 89 of file StorageSystem.cpp.
◆ getBox()
Returns the given box. Performs no bounds check.
- Parameters
-
- Returns
- const std::vector<pplmn::StoredPeoplemon>& The box at the given index
Definition at line 96 of file StorageSystem.cpp.
◆ move()
Moves the given stored peoplemon from its current location to the new location.
- Parameters
-
ppl | The peoplemon to move |
newBox | The box to place it in |
newPos | The new position to give it |
- Returns
- pplmn::StoredPeoplemon* The new address of the stored peoplemon
Definition at line 42 of file StorageSystem.cpp.
◆ remove()
void core::player::StorageSystem::remove |
( |
unsigned int |
box, |
|
|
const sf::Vector2i & |
position |
|
) |
| |
Clears the peoplemon from the given position, if one is there.
- Parameters
-
box | The box to remove from |
position | The position to remove from |
Definition at line 32 of file StorageSystem.cpp.
◆ spaceFree()
bool core::player::StorageSystem::spaceFree |
( |
int |
box, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| const |
Returns whether or not the given storage space is free.
- Parameters
-
box | The box number to check |
x | The x position |
y | The y position |
- Returns
- True if that slot is open, false otherwise
Definition at line 79 of file StorageSystem.cpp.
◆ system::Player
◆ BoxCount
constexpr int core::player::StorageSystem::BoxCount = 14 |
|
staticconstexpr |
◆ BoxHeight
constexpr int core::player::StorageSystem::BoxHeight = 10 |
|
staticconstexpr |
◆ BoxWidth
constexpr int core::player::StorageSystem::BoxWidth = 12 |
|
staticconstexpr |
The documentation for this class was generated from the following files: