World indices check

This commit is contained in:
MihailRis
2023-12-07 15:16:37 +03:00
parent 551b230b94
commit 636cb0c44c
12 changed files with 197 additions and 40 deletions
+33
View File
@@ -0,0 +1,33 @@
#ifndef CONTENT_CONTENT_INDEX_LUT_H_
#define CONTENT_CONTENT_INDEX_LUT_H_
#include "../typedefs.h"
#include <string>
#include <filesystem>
class Content;
/* Content indices lookup table or report
used to convert world with different indices
Building with indices.json */
class ContentIndexLUT {
blockid_t* blocks;
std::string* blockNames;
public:
ContentIndexLUT(size_t blocks, const Content* content);
~ContentIndexLUT();
inline blockid_t getBlockId(blockid_t index) {
return blocks[index];
}
inline void setBlock(blockid_t index, std::string name, blockid_t id) {
blocks[index] = id;
blockNames[index] = name;
}
static ContentIndexLUT* create(const std::filesystem::path& filename,
const Content* content);
};
#endif // CONTENT_CONTENT_INDEX_LUT_H_