Dimension.h 1022 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <Array.h>
  3. #include <Trie.h>
  4. #include <Critical.h>
  5. #include "Chunk.h"
  6. #include "Entity.h"
  7. class World;
  8. class Dimension : public virtual Framework::ReferenceCounter
  9. {
  10. private:
  11. Framework::Trie<Chunk>* chunks;
  12. Framework::Array<Chunk*> chunkList;
  13. Framework::RCArray<Entity>* entities;
  14. Framework::Critical cs;
  15. void getAddrOf(Framework::Punkt cPos, char* addr) const;
  16. void getAddrOfWorld(Framework::Punkt wPos, char* addr) const;
  17. public:
  18. Dimension();
  19. ~Dimension();
  20. void api(char* message);
  21. Block* zBlock(Framework::Vec3<int> location);
  22. Block* getBlock(Framework::Vec3<int> location);
  23. void addEntity(Entity* entity);
  24. void setChunk(Chunk* chunk, Framework::Punkt center);
  25. bool hasChunck(int x, int y) const;
  26. Chunk* zChunk(Framework::Punkt wPos) const;
  27. void removeDistantChunks(Framework::Punkt wPos);
  28. void setBlock(Block* block);
  29. void removeBlock(Block* zBlock);
  30. Entity* zEntity(int id);
  31. Entity* getEntity(int id);
  32. void removeEntity(int id);
  33. };