#pragma once #include "CNProtocol.hpp" #include #include #include #include #include class Chunk { public: std::set players; std::set NPCs; }; enum { INSTANCE_OVERWORLD // default instance every player starts in //INSTANCE_IZ, // these aren't actually used //INSTANCE_UNIQUE }; namespace ChunkManager { void init(); void cleanup(); extern std::map, Chunk*> chunks; void addNPC(int posX, int posY, uint64_t instanceID, int32_t id); void addPlayer(int posX, int posY, uint64_t instanceID, CNSocket* sock); bool removePlayer(std::tuple chunkPos, CNSocket* sock); bool removeNPC(std::tuple chunkPos, int32_t id); bool checkChunk(std::tuple chunk); void destroyChunk(std::tuple chunkPos); std::tuple grabChunk(int posX, int posY, uint64_t instanceID); std::vector grabChunks(std::tuple chunkPos); std::vector getDeltaChunks(std::vector from, std::vector to); std::vector> getChunksInMap(uint64_t mapNum); bool inPopulatedChunks(int posX, int posY, uint64_t instanceID); void createInstance(uint64_t); void destroyInstance(uint64_t); }