diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a7d6939..79bcbc45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,6 +123,8 @@ ENDIF(WIN32) ADD_EXECUTABLE(otclient ${SOURCES}) # target link libraries +MESSAGE( + ${YAMLCPP_LIBRARY}) TARGET_LINK_LIBRARIES(otclient ${Boost_LIBRARIES} ${OPENGL_LIBRARIES} diff --git a/cmake/FindYamlCpp.cmake b/cmake/FindYamlCpp.cmake index bfa24711..ab2f846c 100644 --- a/cmake/FindYamlCpp.cmake +++ b/cmake/FindYamlCpp.cmake @@ -7,7 +7,6 @@ FIND_PATH(YAMLCPP_INCLUDE_DIR yaml-cpp/yaml.h HINTS -$ENV{PHYSFSDIR} PATH_SUFFIXES include/yaml-cpp include PATHS ~/Library/Frameworks @@ -22,8 +21,6 @@ PATHS FIND_LIBRARY(YAMLCPP_LIBRARY NAMES yaml-cpp -HINTS -$ENV{PHYSFSDIR} PATH_SUFFIXES lib64 lib PATHS ~/Library/Frameworks diff --git a/data/skins/lightness.yml b/data/skins/lightness.yml index c85a33df..7b1a4f8a 100644 --- a/data/skins/lightness.yml +++ b/data/skins/lightness.yml @@ -1,6 +1,6 @@ default font: sans-11px-bold default font color: [51, 51, 51, 255] - + buttons: default: default size: [96, 22] @@ -134,3 +134,4 @@ line decorations: bordered image: source: lightness/window.png top border: [2,254,252,2] + diff --git a/src/framework/ui/uiloader.cpp b/src/framework/ui/uiloader.cpp index fc97c053..0a74bfb9 100644 --- a/src/framework/ui/uiloader.cpp +++ b/src/framework/ui/uiloader.cpp @@ -155,7 +155,7 @@ void UILoader::loadElements(const UIElementPtr& parent, const YAML::Node& node) foreach(const UIElementPtr& element, container->getChildren()) { for(auto it = node.begin(); it != node.end(); ++it) { // node found, load it - if(boost::ends_with(it.first().Read(), "#" + element->getId())) { + if(boost::ends_with(yamlRead(it.first()), "#" + element->getId())) { loadElements(element, it.second()); break; } @@ -169,8 +169,8 @@ void UILoader::loadElement(const UIElementPtr& element, const YAML::Node& node) // set element skin if(yamlHasValue(node, "skin")) { const YAML::Node& cnode = node["skin"]; - if(cnode.GetType() == YAML::CT_SCALAR) { - element->setSkin(g_uiSkins.getElementSkin(element->getElementType(), cnode)); + if(cnode.Type() == YAML::NodeType::Scalar) { + element->setSkin(g_uiSkins.getElementSkin(element->getElementType(), yamlRead(cnode))); } else { UIElementSkinPtr skin = UIElementSkinPtr(new UIElementSkin()); skin->load(cnode); @@ -268,7 +268,7 @@ void UILoader::loadElementAnchor(const UIElementPtr& anchoredElement, UI::Anchor void UILoader::loadButton(const UIButtonPtr& button, const YAML::Node& node) { - button->setText(node["text"].Read()); + button->setText(yamlRead(node["text"])); // set on click event if(yamlHasValue(node, "onClick")) { diff --git a/src/framework/ui/uiskins.cpp b/src/framework/ui/uiskins.cpp index d115489e..3dec15c7 100644 --- a/src/framework/ui/uiskins.cpp +++ b/src/framework/ui/uiskins.cpp @@ -66,7 +66,8 @@ void UISkins::load(const std::string& skinsFile) it.first() >> name; UIElementSkinPtr skin = UIElementSkinPtr(new UIButtonSkin(name)); - skin->load(it.second()); + if(it.second().Type() == YAML::NodeType::Map) + skin->load(it.second()); m_elementSkins.push_back(skin); } } @@ -78,7 +79,8 @@ void UISkins::load(const std::string& skinsFile) it.first() >> name; UIElementSkinPtr skin = UIElementSkinPtr(new UIElementSkin(name, UI::Panel)); - skin->load(it.second()); + if(it.second().Type() == YAML::NodeType::Map) + skin->load(it.second()); m_elementSkins.push_back(skin); } } @@ -90,7 +92,8 @@ void UISkins::load(const std::string& skinsFile) it.first() >> name; UIElementSkinPtr skin = UIElementSkinPtr(new UIWindowSkin(name)); - skin->load(it.second()); + if(it.second().Type() == YAML::NodeType::Map) + skin->load(it.second()); m_elementSkins.push_back(skin); } } @@ -102,7 +105,8 @@ void UISkins::load(const std::string& skinsFile) it.first() >> name; UIElementSkinPtr skin = UIElementSkinPtr(new UILabelSkin(name)); - skin->load(it.second()); + if(it.second().Type() == YAML::NodeType::Map) + skin->load(it.second()); m_elementSkins.push_back(skin); } } @@ -115,7 +119,8 @@ void UISkins::load(const std::string& skinsFile) it.first() >> name; UIElementSkinPtr skin = UIElementSkinPtr(new UITextEditSkin(name)); - skin->load(it.second()); + if(it.second().Type() == YAML::NodeType::Map) + skin->load(it.second()); m_elementSkins.push_back(skin); } } @@ -128,7 +133,8 @@ void UISkins::load(const std::string& skinsFile) it.first() >> name; UIElementSkinPtr skin = UIElementSkinPtr(new UIElementSkin(name, UI::LineDecoration)); - skin->load(it.second()); + if(it.second().Type() == YAML::NodeType::Map) + skin->load(it.second()); m_elementSkins.push_back(skin); } } diff --git a/src/framework/util/yaml.h b/src/framework/util/yaml.h index 77550c6c..98cf90c6 100644 --- a/src/framework/util/yaml.h +++ b/src/framework/util/yaml.h @@ -68,7 +68,7 @@ inline void operator>>(const YAML::Node& node, TSize& size) template inline T yamlRead(const YAML::Node& node) { - return node.Read(); + return node.to(); } template