mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
fix: stabilize block item registration and display
Store item names as owned strings in ItemManager, set block type property for block items, validate item kind before placement, and handle items without textures gracefully in inventory UI.
This commit is contained in:
@@ -40,6 +40,7 @@ private:
|
||||
static inline IDMap m_id_map;
|
||||
static inline bool is_init = false;
|
||||
static inline CrossPlaneMap m_cross_plane_map;
|
||||
static void set_up_cross_plane_map();
|
||||
static void set_up_cross_plane_map(
|
||||
const std::vector<std::pair<bool, BlockType>>& types);
|
||||
};
|
||||
} // namespace Cubed
|
||||
@@ -25,7 +25,7 @@ private:
|
||||
using acc = ItemMap::accessor;
|
||||
using cacc = ItemMap::const_accessor;
|
||||
|
||||
using IDMap = tbb::concurrent_hash_map<std::string_view, ItemID>;
|
||||
using IDMap = tbb::concurrent_hash_map<std::string, ItemID>;
|
||||
using BlockToIDMap = tbb::concurrent_hash_map<BlockType, ItemID>;
|
||||
void add(const std::filesystem::path& path);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
|
||||
void load_block_status(unsigned status_id);
|
||||
void load_block_texture(unsigned block_id);
|
||||
void load_item_texture();
|
||||
void init_item_texture();
|
||||
void load_cross_plane_texture(unsigned id);
|
||||
const Texture* load_image_texture(const std::string& path);
|
||||
void load_pbr_texture(unsigned id);
|
||||
|
||||
Reference in New Issue
Block a user