From 2e2fcfcef662d21a74cc79cc313cc7051d653dd6 Mon Sep 17 00:00:00 2001 From: IceMage144 Date: Wed, 16 Aug 2017 17:37:19 -0300 Subject: [PATCH] Make json loader match resource container protocol Signed off by: @victordomiciano Signed off by: @kazuo256 Signed off by: @josealvim --- modules/ugdk-core/include/ugdk/action/json2spriteanimation.h | 2 +- modules/ugdk-core/src/action/json2spriteanimation.cc | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/ugdk-core/include/ugdk/action/json2spriteanimation.h b/modules/ugdk-core/include/ugdk/action/json2spriteanimation.h index 4c996996..cfe09421 100644 --- a/modules/ugdk-core/include/ugdk/action/json2spriteanimation.h +++ b/modules/ugdk-core/include/ugdk/action/json2spriteanimation.h @@ -16,7 +16,7 @@ namespace action { using SpriteAnimationTable = ::ugdk::structure::IndexableTable; -std::shared_ptr LoadSpriteAnimationTableFromFile(const std::string& filepath); +const SpriteAnimationTable* LoadSpriteAnimationTableFromFile(const std::string& filepath); } // namespace action } // namespace ugdk diff --git a/modules/ugdk-core/src/action/json2spriteanimation.cc b/modules/ugdk-core/src/action/json2spriteanimation.cc index 8f8efd06..6fa23e2f 100644 --- a/modules/ugdk-core/src/action/json2spriteanimation.cc +++ b/modules/ugdk-core/src/action/json2spriteanimation.cc @@ -71,7 +71,7 @@ namespace { }; } -std::shared_ptr LoadSpriteAnimationTableFromFile(const std::string& filepath) { +const SpriteAnimationTable* LoadSpriteAnimationTableFromFile(const std::string& filepath) { auto file = filesystem::manager().OpenFile(filepath); if (!file) return nullptr; @@ -81,7 +81,7 @@ std::shared_ptr LoadSpriteAnimationTableFromFile(con throw system::BaseException("Invalid json: %s\n", filepath.c_str()); auto json_node = libjson::parse(contents); - std::shared_ptr table(new SpriteAnimationTable(json_node.size())); + SpriteAnimationTable* table(new SpriteAnimationTable(json_node.size())); for (const auto& animation_json : json_node) { auto element = MakeUnique(); @@ -108,4 +108,3 @@ std::shared_ptr LoadSpriteAnimationTableFromFile(con } // namespace action } // namespace ugdk -