|
VOX
A little voxel engine
|
#include <ServerWorld.hpp>


Classes | |
| struct | BlockUpdateData |
| struct | ChunkLoadUnloadData |
| struct | Ticket |
Public Types | |
| typedef std::unordered_multimap< uint64_t, Ticket > | TicketMultiMap |
Public Member Functions | |
| ServerWorld (Server &server) | |
| ~ServerWorld () | |
| ServerWorld (ServerWorld &other)=delete | |
| ServerWorld (ServerWorld &&other)=delete | |
| ServerWorld & | operator= (ServerWorld &other)=delete |
| ServerWorld & | operator= (ServerWorld &&other)=delete |
| void | update () |
| void | addBlockUpdate (const BlockUpdateData &data) |
| void | updateBlocks () |
| void | placeBlock (const glm::vec3 &position, BlockInfo::Type block) |
| void | setBlock (const glm::vec3 &position, BlockInfo::Type block) |
| void | setPlayerTicketLevel (const int &level) |
| int | getLoadDistance () const |
| const std::unordered_set< glm::ivec3 > & | getBlockUpdateChunks () const |
| Get the list of Chunks that need to get a block update tick. More... | |
| const std::unordered_set< glm::ivec3 > & | getEntityUpdateChunks () const |
| Get the list of Chunks that need to get an entity update tick. More... | |
| const TicketMultiMap & | getTickets () const |
| Get the list of Tickets ( May contains duplicates ) More... | |
| uint64_t | addTicket (const Ticket &ticket) |
| Add a ticket to the ticket manager. More... | |
| void | removeTicket (const uint64_t &ticket_id) |
| Remove a ticket from the ticket manager. More... | |
| uint64_t | changeTicket (const uint64_t &old_ticket_id, const Ticket &new_ticket) |
| Shortcut to remove a ticket and add a new one. More... | |
| void | handlePacket (std::shared_ptr< IPacket > packet) |
Public Member Functions inherited from World | |
| World (bool save=false) | |
| ~World () | |
| World (World &other)=delete | |
| World (World &&other)=delete | |
| World & | operator= (World &other)=delete |
| World & | operator= (World &&other)=delete |
| std::shared_ptr< Chunk > | getChunk (const glm::ivec3 &position) |
| Get the Chunk object. More... | |
| void | insertChunk (const glm::ivec3 &position, std::shared_ptr< Chunk > chunk) |
| void | unloadRegion (const glm::ivec2 region_pos) |
| Unloads all chunk inside a region, if save is enabled, will save the region in a region file. More... | |
| WorldGenerator & | getWorldGenerator () |
| Save & | getSave () |
Additional Inherited Members | |
Static Public Member Functions inherited from World | |
| static glm::vec3 | getBlockChunkPosition (const glm::vec3 &position) |
| will return the block position relative to the chunk More... | |
| static glm::vec3 | getChunkPosition (const glm::vec3 &position) |
| will return the chunk position containing the block More... | |
Protected Member Functions inherited from World | |
| TracyLockableN (std::mutex, m_players_mutex, "Players") | |
| TracyLockableN (std::mutex, m_mobs_mutex, "Mobs") | |
| TracyLockableN (std::mutex, m_chunks_mutex, "Chunks") | |
| std::shared_ptr< Chunk > | getChunkNoLock (const glm::ivec3 &position) |
| Get a chunk ptr without locking the chunks mutex. More... | |
| void | insertChunkNoLock (const glm::ivec3 &position, std::shared_ptr< Chunk > chunk) |
| std::unordered_set< glm::ivec3 > | updateSkyLight (const glm::ivec3 &block_position) |
| Update the sky light of the chunk containing the block. More... | |
| std::unordered_set< glm::ivec3 > | updateBlockLight (const glm::ivec3 &block_position) |
| Update the block light of the chunk containing the block. More... | |
Protected Attributes inherited from World | |
| std::unordered_map< uint64_t, std::shared_ptr< Player > > | m_players |
| std::unordered_map< uint64_t, std::shared_ptr< Mob > > | m_mobs |
| uint64_t | m_mob_id = 0 |
| std::unordered_map< glm::ivec3, std::shared_ptr< Chunk > > | m_chunks |
| ExecutorAccessor | m_executor |
| WorldGenerator | m_world_generator |
| std::unique_ptr< Save > | m_save |
| typedef std::unordered_multimap<uint64_t, Ticket> ServerWorld::TicketMultiMap |
| ServerWorld::ServerWorld | ( | Server & | server | ) |
| ServerWorld::~ServerWorld | ( | ) |
|
delete |
|
delete |
| void ServerWorld::addBlockUpdate | ( | const BlockUpdateData & | data | ) |
| uint64_t ServerWorld::addTicket | ( | const Ticket & | ticket | ) |
Add a ticket to the ticket manager.
The new ticket will be active on the next tick
You can keep track of the ticket for further deletion with the ticket id
| ticket |
| uint64_t ServerWorld::changeTicket | ( | const uint64_t & | old_ticket_id, |
| const Ticket & | new_ticket | ||
| ) |
Shortcut to remove a ticket and add a new one.
the new ticket will be active on the next tick
you can keep track of the ticket for further deletion with the ticket id
| old_ticket_id | |
| new_ticket |
| const std::unordered_set< glm::ivec3 > & ServerWorld::getBlockUpdateChunks | ( | ) | const |
Get the list of Chunks that need to get a block update tick.
| const std::unordered_set< glm::ivec3 > & ServerWorld::getEntityUpdateChunks | ( | ) | const |
Get the list of Chunks that need to get an entity update tick.
| int ServerWorld::getLoadDistance | ( | ) | const |
| const ServerWorld::TicketMultiMap & ServerWorld::getTickets | ( | ) | const |
Get the list of Tickets ( May contains duplicates )
| void ServerWorld::handlePacket | ( | std::shared_ptr< IPacket > | packet | ) |
|
delete |
|
delete |
| void ServerWorld::placeBlock | ( | const glm::vec3 & | position, |
| BlockInfo::Type | block | ||
| ) |
| void ServerWorld::removeTicket | ( | const uint64_t & | ticket_id | ) |
Remove a ticket from the ticket manager.
| ticket_id |
| void ServerWorld::setBlock | ( | const glm::vec3 & | position, |
| BlockInfo::Type | block | ||
| ) |
| void ServerWorld::setPlayerTicketLevel | ( | const int & | level | ) |
| void ServerWorld::update | ( | ) |
| void ServerWorld::updateBlocks | ( | ) |