works with yaml 2.6
This commit is contained in:
parent
3cea0cb7c6
commit
35fc76f0a6
|
@ -123,6 +123,8 @@ ENDIF(WIN32)
|
|||
ADD_EXECUTABLE(otclient ${SOURCES})
|
||||
|
||||
# target link libraries
|
||||
MESSAGE(
|
||||
${YAMLCPP_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(otclient
|
||||
${Boost_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -134,3 +134,4 @@ line decorations:
|
|||
bordered image:
|
||||
source: lightness/window.png
|
||||
top border: [2,254,252,2]
|
||||
|
||||
|
|
|
@ -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<std::string>(), "#" + element->getId())) {
|
||||
if(boost::ends_with(yamlRead<std::string>(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<std::string>(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<std::string>());
|
||||
button->setText(yamlRead<std::string>(node["text"]));
|
||||
|
||||
// set on click event
|
||||
if(yamlHasValue(node, "onClick")) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ inline void operator>>(const YAML::Node& node, TSize<T>& size)
|
|||
template<class T>
|
||||
inline T yamlRead(const YAML::Node& node)
|
||||
{
|
||||
return node.Read<T>();
|
||||
return node.to<T>();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
|
Loading…
Reference in New Issue