]> git.localhorst.tv Git - blank.git/blobdiff - src/world/Player.hpp
try to cleanly destruct world
[blank.git] / src / world / Player.hpp
index 68aa352efcdcbfa202a3b30e4f1af73ebe08c165..c1a3e0b36a54a788a9c91211115dde565cc1d721 100644 (file)
@@ -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;
 
 };