update ContentType naming
This commit is contained in:
parent
7da8e133a5
commit
cae314bc36
@ -11,9 +11,8 @@ function generate_heightmap(x, y)
|
|||||||
|
|
||||||
local bmap = Heightmap(W, H)
|
local bmap = Heightmap(W, H)
|
||||||
bmap:noise({x+3, y+6}, 0.1, 1, 3)
|
bmap:noise({x+3, y+6}, 0.1, 1, 3)
|
||||||
|
|
||||||
local map = Heightmap(W, H)
|
local map = Heightmap(W, H)
|
||||||
|
|
||||||
|
|
||||||
map:noise({x, y}, 0.06, 5, 0.2, umap, vmap)
|
map:noise({x, y}, 0.06, 5, 0.2, umap, vmap)
|
||||||
map:noise({x, y}, 0.12, 6, 0.5, umap, vmap)
|
map:noise({x, y}, 0.12, 6, 0.5, umap, vmap)
|
||||||
map:mul(bmap)
|
map:mul(bmap)
|
||||||
|
|||||||
@ -24,15 +24,15 @@ namespace rigging {
|
|||||||
class SkeletonConfig;
|
class SkeletonConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const char* contenttype_name(contenttype type) {
|
constexpr const char* ContentType_name(ContentType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case contenttype::none:
|
case ContentType::NONE:
|
||||||
return "none";
|
return "none";
|
||||||
case contenttype::block:
|
case ContentType::BLOCK:
|
||||||
return "block";
|
return "block";
|
||||||
case contenttype::item:
|
case ContentType::ITEM:
|
||||||
return "item";
|
return "item";
|
||||||
case contenttype::entity:
|
case ContentType::ENTITY:
|
||||||
return "entity";
|
return "entity";
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
@ -40,13 +40,13 @@ constexpr const char* contenttype_name(contenttype type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class namereuse_error : public std::runtime_error {
|
class namereuse_error : public std::runtime_error {
|
||||||
contenttype type;
|
ContentType type;
|
||||||
public:
|
public:
|
||||||
namereuse_error(const std::string& msg, contenttype type)
|
namereuse_error(const std::string& msg, ContentType type)
|
||||||
: std::runtime_error(msg), type(type) {
|
: std::runtime_error(msg), type(type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline contenttype getType() const {
|
inline ContentType getType() const {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class ContentUnitBuilder {
|
class ContentUnitBuilder {
|
||||||
std::unordered_map<std::string, contenttype>& allNames;
|
std::unordered_map<std::string, ContentType>& allNames;
|
||||||
contenttype type;
|
ContentType type;
|
||||||
|
|
||||||
void checkIdentifier(const std::string& id) {
|
void checkIdentifier(const std::string& id) {
|
||||||
const auto& found = allNames.find(id);
|
const auto& found = allNames.find(id);
|
||||||
@ -28,7 +28,7 @@ public:
|
|||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
|
|
||||||
ContentUnitBuilder(
|
ContentUnitBuilder(
|
||||||
std::unordered_map<std::string, contenttype>& allNames, contenttype type
|
std::unordered_map<std::string, ContentType>& allNames, ContentType type
|
||||||
)
|
)
|
||||||
: allNames(allNames), type(type) {
|
: allNames(allNames), type(type) {
|
||||||
}
|
}
|
||||||
@ -54,11 +54,11 @@ class ContentBuilder {
|
|||||||
UptrsMap<std::string, BlockMaterial> blockMaterials;
|
UptrsMap<std::string, BlockMaterial> blockMaterials;
|
||||||
UptrsMap<std::string, rigging::SkeletonConfig> skeletons;
|
UptrsMap<std::string, rigging::SkeletonConfig> skeletons;
|
||||||
UptrsMap<std::string, ContentPackRuntime> packs;
|
UptrsMap<std::string, ContentPackRuntime> packs;
|
||||||
std::unordered_map<std::string, contenttype> allNames;
|
std::unordered_map<std::string, ContentType> allNames;
|
||||||
public:
|
public:
|
||||||
ContentUnitBuilder<Block> blocks {allNames, contenttype::block};
|
ContentUnitBuilder<Block> blocks {allNames, ContentType::BLOCK};
|
||||||
ContentUnitBuilder<ItemDef> items {allNames, contenttype::item};
|
ContentUnitBuilder<ItemDef> items {allNames, ContentType::ITEM};
|
||||||
ContentUnitBuilder<EntityDef> entities {allNames, contenttype::entity};
|
ContentUnitBuilder<EntityDef> entities {allNames, ContentType::ENTITY};
|
||||||
ResourceIndicesSet resourceIndices {};
|
ResourceIndicesSet resourceIndices {};
|
||||||
|
|
||||||
~ContentBuilder();
|
~ContentBuilder();
|
||||||
|
|||||||
@ -14,8 +14,8 @@
|
|||||||
ContentLUT::ContentLUT(
|
ContentLUT::ContentLUT(
|
||||||
const ContentIndices* indices, size_t blocksCount, size_t itemsCount
|
const ContentIndices* indices, size_t blocksCount, size_t itemsCount
|
||||||
)
|
)
|
||||||
: blocks(blocksCount, indices->blocks, BLOCK_VOID, contenttype::block),
|
: blocks(blocksCount, indices->blocks, BLOCK_VOID, ContentType::BLOCK),
|
||||||
items(itemsCount, indices->items, ITEM_VOID, contenttype::item) {
|
items(itemsCount, indices->items, ITEM_VOID, ContentType::ITEM) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
struct contententry {
|
struct contententry {
|
||||||
contenttype type;
|
ContentType type;
|
||||||
std::string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -26,13 +26,13 @@ class ContentUnitLUT {
|
|||||||
bool missingContent = false;
|
bool missingContent = false;
|
||||||
bool reorderContent = false;
|
bool reorderContent = false;
|
||||||
T missingValue;
|
T missingValue;
|
||||||
contenttype type;
|
ContentType type;
|
||||||
public:
|
public:
|
||||||
ContentUnitLUT(
|
ContentUnitLUT(
|
||||||
size_t count,
|
size_t count,
|
||||||
const ContentUnitIndices<U>& unitIndices,
|
const ContentUnitIndices<U>& unitIndices,
|
||||||
T missingValue,
|
T missingValue,
|
||||||
contenttype type
|
ContentType type
|
||||||
)
|
)
|
||||||
: missingValue(missingValue), type(type) {
|
: missingValue(missingValue), type(type) {
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
class Content;
|
class Content;
|
||||||
class ContentPackRuntime;
|
class ContentPackRuntime;
|
||||||
|
|
||||||
enum class contenttype { none, block, item, entity };
|
enum class ContentType { NONE, BLOCK, ITEM, ENTITY };
|
||||||
|
|
||||||
enum class ResourceType : size_t { CAMERA, LAST = CAMERA };
|
enum class ResourceType : size_t { CAMERA, LAST = CAMERA };
|
||||||
|
|
||||||
|
|||||||
@ -92,7 +92,7 @@ static void show_content_missing(
|
|||||||
auto root = create_map();
|
auto root = create_map();
|
||||||
auto& contentEntries = root->putList("content");
|
auto& contentEntries = root->putList("content");
|
||||||
for (auto& entry : lut->getMissingContent()) {
|
for (auto& entry : lut->getMissingContent()) {
|
||||||
std::string contentName = contenttype_name(entry.type);
|
std::string contentName = ContentType_name(entry.type);
|
||||||
auto& contentEntry = contentEntries.putMap();
|
auto& contentEntry = contentEntries.putMap();
|
||||||
contentEntry.put("type", contentName);
|
contentEntry.put("type", contentName);
|
||||||
contentEntry.put("name", entry.name);
|
contentEntry.put("name", entry.name);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user