a class to save and load chunks from the disk
More...
#include <Save.hpp>
|
| | Save () |
| |
| | Save (const std::filesystem::path &path) |
| |
| | ~Save () |
| |
| void | trackChunk (std::shared_ptr< Chunk > chunk) |
| | add chunk to the list of chunks to save More...
|
| |
| void | saveRegion (const glm::ivec2 &position) |
| | Unloads the region and saves it to the disk. More...
|
| |
| std::shared_ptr< Chunk > | getChunk (const glm::ivec3 &position) |
| | Tries to load a chunk from the disk. More...
|
| |
|
| static constexpr int | REGION_SIZE = 32 |
| |
| static const std::filesystem::path | SAVE_DIR { "saves" } |
| |
| static const std::filesystem::path | DEFAULT_NAME { "myWorld" } |
| |
a class to save and load chunks from the disk
◆ Save() [1/2]
◆ Save() [2/2]
| Save::Save |
( |
const std::filesystem::path & |
path | ) |
|
◆ ~Save()
◆ getChunk()
| std::shared_ptr< Chunk > Save::getChunk |
( |
const glm::ivec3 & |
position | ) |
|
Tries to load a chunk from the disk.
- Parameters
-
| position | position of the chunk |
- Return values
-
| nullptr | if the chunk is not found |
| std::shared_ptr<Chunk> | if the chunk is found |
◆ saveRegion()
| void Save::saveRegion |
( |
const glm::ivec2 & |
position | ) |
|
Unloads the region and saves it to the disk.
- Warning
- You SHOULD NOT have any references left to the chunks in the region, you take the risk of losing any changes made to the chunks as they will be untracked.
- Parameters
-
◆ toRegionPos()
| glm::ivec2 Save::toRegionPos |
( |
glm::ivec3 |
chunkPos3D | ) |
|
|
static |
◆ trackChunk()
| void Save::trackChunk |
( |
std::shared_ptr< Chunk > |
chunk | ) |
|
add chunk to the list of chunks to save
- Note
- you dont have to call trackChunk for chunks that you got from getChunk
- Parameters
-
◆ DEFAULT_NAME
| const std::filesystem::path Save::DEFAULT_NAME { "myWorld" } |
|
static |
◆ REGION_SIZE
| constexpr int Save::REGION_SIZE = 32 |
|
staticconstexpr |
◆ SAVE_DIR
| const std::filesystem::path Save::SAVE_DIR { "saves" } |
|
static |
The documentation for this class was generated from the following files: