diff options
author | LaG1924 <lag1924@gmail.com> | 2021-06-29 11:41:00 +0200 |
---|---|---|
committer | LaG1924 <lag1924@gmail.com> | 2021-06-29 11:41:00 +0200 |
commit | af02db535683f26bea8f3f7428a570a361bcb423 (patch) | |
tree | b007661805ed3ca288fb86e42830a6e5112e1e79 /src/AssetManager.cpp | |
parent | Merge pull request #63 from LaG1924/ftr/cmake-minor-improvements (diff) | |
download | AltCraft-af02db535683f26bea8f3f7428a570a361bcb423.tar AltCraft-af02db535683f26bea8f3f7428a570a361bcb423.tar.gz AltCraft-af02db535683f26bea8f3f7428a570a361bcb423.tar.bz2 AltCraft-af02db535683f26bea8f3f7428a570a361bcb423.tar.lz AltCraft-af02db535683f26bea8f3f7428a570a361bcb423.tar.xz AltCraft-af02db535683f26bea8f3f7428a570a361bcb423.tar.zst AltCraft-af02db535683f26bea8f3f7428a570a361bcb423.zip |
Diffstat (limited to 'src/AssetManager.cpp')
-rw-r--r-- | src/AssetManager.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp index 63dc596..d5b8d68 100644 --- a/src/AssetManager.cpp +++ b/src/AssetManager.cpp @@ -21,7 +21,6 @@ namespace fs = std::filesystem; const fs::path pathToAssets = "./assets/"; const std::string pathToAssetsList = "./items.json"; -std::map<std::string, BlockId> assetIds; std::map<BlockId, std::string> blockIdToBlockName; std::unique_ptr<AssetTreeNode> assetTree; std::unique_ptr<TextureAtlas> atlas; @@ -29,7 +28,6 @@ std::map<BlockId, BlockFaces> blockIdToBlockFaces; BlockFaces errorFaces; -void LoadIds(); void LoadAssets(); void LoadTextures(); void LoadScripts(); @@ -62,7 +60,6 @@ void AssetManager::InitAssetManager() LoadTextures(); - LoadIds(); ParseBlockModels(); PluginSystem::Init(); @@ -79,19 +76,6 @@ void AssetManager::InitPostRml() { } } -void LoadIds() { - std::ifstream in(pathToAssetsList); - nlohmann::json index; - in >> index; - for (auto &it : index) { - unsigned short id = it["type"].get<int>(); - unsigned char state = it["meta"].get<int>(); - std::string blockName = it["text_type"].get<std::string>(); - assetIds[blockName] = BlockId{ id, state }; - } - LOG(INFO) << "Loaded " << assetIds.size() << " ids"; -} - void LoadAssets() { assetTree = std::make_unique<AssetTreeNode>(); assetTree->name = "/"; @@ -661,16 +645,6 @@ BlockFaces &AssetManager::GetBlockModelByBlockId(BlockId block) { return blockIdToBlockFaces.insert(std::make_pair(block, blockFaces)).first->second; } -std::string AssetManager::GetAssetNameByBlockId(BlockId block) { - for (auto& it : assetIds) { - BlockId value = it.second; - value.state = 0; - if (value == block) - return it.first; - } - return "#NF"; -} - Asset *AssetManager::GetAssetPtr(const std::string & assetName) { OPTICK_EVENT(); AssetTreeNode *node; |