fix: missing pack.has_indices if content is not loaded

This commit is contained in:
MihailRis
2025-07-13 15:36:09 +03:00
parent aca9b49c77
commit b02b454573
3 changed files with 40 additions and 11 deletions
+13 -10
View File
@@ -3,6 +3,7 @@
#include <stdexcept>
#include <string>
#include <vector>
#include <optional>
#include "typedefs.hpp"
#include "content_fwd.hpp"
@@ -36,6 +37,16 @@ struct DependencyPack {
std::string id;
};
struct ContentPackStats {
size_t totalBlocks;
size_t totalItems;
size_t totalEntities;
inline bool hasSavingContent() const {
return totalBlocks + totalItems + totalEntities > 0;
}
};
struct ContentPack {
std::string id = "none";
std::string title = "untitled";
@@ -48,6 +59,8 @@ struct ContentPack {
io::path getContentFile() const;
std::optional<ContentPackStats> loadStats() const;
static inline const std::string PACKAGE_FILENAME = "package.json";
static inline const std::string CONTENT_FILENAME = "content.json";
static inline const io::path BLOCKS_FOLDER = "blocks";
@@ -87,16 +100,6 @@ struct ContentPack {
}
};
struct ContentPackStats {
size_t totalBlocks;
size_t totalItems;
size_t totalEntities;
inline bool hasSavingContent() const {
return totalBlocks + totalItems + totalEntities > 0;
}
};
struct WorldFuncsSet {
bool onblockplaced;
bool onblockreplaced;