X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FPlayer.hpp;h=c1a3e0b36a54a788a9c91211115dde565cc1d721;hb=1bc2f230105ad6e1ee8d999ddc079cd85d244bf9;hp=68aa352efcdcbfa202a3b30e4f1af73ebe08c165;hpb=13e676a6e49128ebc6c63b8dd08bef51d360e8e9;p=blank.git diff --git a/src/world/Player.hpp b/src/world/Player.hpp index 68aa352..c1a3e0b 100644 --- a/src/world/Player.hpp +++ b/src/world/Player.hpp @@ -1,18 +1,37 @@ #ifndef BLANK_WORLD_PLAYER_HPP_ #define BLANK_WORLD_PLAYER_HPP_ +#include "Entity.hpp" + + namespace blank { +class BlockLookup; class ChunkIndex; -class Entity; -struct Player { +class Player { + +public: + Player(Entity &e, ChunkIndex &i); + ~Player(); + + Entity &GetEntity() const noexcept { return entity; } + const std::string &Name() const noexcept { return entity.Name(); } + Ray Aim() const { return entity.Aim(entity.ChunkCoords()); } + + ChunkIndex &GetChunks() const noexcept { return chunks; } + + void SetInventorySlot(int i) noexcept { inv_slot = i; } + int GetInventorySlot() const noexcept { return inv_slot; } + + bool SuitableSpawn(BlockLookup &) const noexcept; - Entity *entity; - ChunkIndex *chunks; + void Update(int dt); - Player(Entity *e, ChunkIndex *i) - : entity(e), chunks(i) { } +private: + Entity &entity; + ChunkIndex &chunks; + int inv_slot; };