Merge branch 'main' into blocks_meta

This commit is contained in:
MihailRis
2024-06-06 12:23:20 +03:00
88 changed files with 1476 additions and 802 deletions
+1 -1
View File
@@ -364,7 +364,7 @@ void WorldRegions::put(Chunk* chunk){
chunk->encode(), CHUNK_DATA_LEN, true);
// Writing lights cache
if (doWriteLights && chunk->isLighted()) {
if (doWriteLights && chunk->flags.lighted) {
put(chunk->x, chunk->z, REGION_LAYER_LIGHTS,
chunk->lightmap.encode(), LIGHTMAP_DATA_LEN, true);
}
+10 -3
View File
@@ -10,7 +10,7 @@
#include "WorldFiles.hpp"
const fs::path SCREENSHOTS_FOLDER {"screenshots"};
const fs::path CONTROLS_FILE {"controls.json"};
const fs::path CONTROLS_FILE {"controls.toml"};
const fs::path SETTINGS_FILE {"settings.toml"};
fs::path EnginePaths::getUserfiles() const {
@@ -60,6 +60,10 @@ fs::path EnginePaths::getControlsFile() {
return userfiles/fs::path(CONTROLS_FILE);
}
fs::path EnginePaths::getControlsFileOld() {
return userfiles/fs::path("controls.json");
}
fs::path EnginePaths::getSettingsFile() {
return userfiles/fs::path(SETTINGS_FILE);
}
@@ -135,7 +139,7 @@ static fs::path toCanonic(fs::path path) {
return path;
}
fs::path EnginePaths::resolve(std::string path) {
fs::path EnginePaths::resolve(std::string path, bool throwErr) {
size_t separator = path.find(':');
if (separator == std::string::npos) {
throw files_access_error("no entry point specified");
@@ -161,7 +165,10 @@ fs::path EnginePaths::resolve(std::string path) {
}
}
}
throw files_access_error("unknown entry point '"+prefix+"'");
if (throwErr) {
throw files_access_error("unknown entry point '"+prefix+"'");
}
return fs::path(filename);
}
ResPaths::ResPaths(fs::path mainRoot, std::vector<PathsRoot> roots)
+2 -1
View File
@@ -29,6 +29,7 @@ public:
fs::path getWorldFolder();
fs::path getWorldFolder(const std::string& name);
fs::path getControlsFile();
fs::path getControlsFileOld(); // TODO: remove in 0.22
fs::path getSettingsFile();
bool isWorldNameUsed(std::string name);
@@ -39,7 +40,7 @@ public:
std::vector<fs::path> scanForWorlds();
fs::path resolve(std::string path);
fs::path resolve(std::string path, bool throwErr=true);
};
struct PathsRoot {
+1 -1
View File
@@ -20,7 +20,7 @@ namespace files {
std::ifstream file;
size_t filelength;
public:
rafile(std::filesystem::path filename);
rafile(fs::path filename);
void seekg(std::streampos pos);
void read(char* buffer, std::streamsize size);