yaml 2.6 bugs
This commit is contained in:
parent
7e982af21f
commit
159de5d511
|
@ -66,7 +66,6 @@ void UISkins::load(const std::string& skinsFile)
|
||||||
it.first() >> name;
|
it.first() >> name;
|
||||||
|
|
||||||
UIElementSkinPtr skin = UIElementSkinPtr(new UIButtonSkin(name));
|
UIElementSkinPtr skin = UIElementSkinPtr(new UIButtonSkin(name));
|
||||||
if(it.second().Type() == YAML::NodeType::Map)
|
|
||||||
skin->load(it.second());
|
skin->load(it.second());
|
||||||
m_elementSkins.push_back(skin);
|
m_elementSkins.push_back(skin);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +78,6 @@ void UISkins::load(const std::string& skinsFile)
|
||||||
it.first() >> name;
|
it.first() >> name;
|
||||||
|
|
||||||
UIElementSkinPtr skin = UIElementSkinPtr(new UIElementSkin(name, UI::Panel));
|
UIElementSkinPtr skin = UIElementSkinPtr(new UIElementSkin(name, UI::Panel));
|
||||||
if(it.second().Type() == YAML::NodeType::Map)
|
|
||||||
skin->load(it.second());
|
skin->load(it.second());
|
||||||
m_elementSkins.push_back(skin);
|
m_elementSkins.push_back(skin);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +90,6 @@ void UISkins::load(const std::string& skinsFile)
|
||||||
it.first() >> name;
|
it.first() >> name;
|
||||||
|
|
||||||
UIElementSkinPtr skin = UIElementSkinPtr(new UIWindowSkin(name));
|
UIElementSkinPtr skin = UIElementSkinPtr(new UIWindowSkin(name));
|
||||||
if(it.second().Type() == YAML::NodeType::Map)
|
|
||||||
skin->load(it.second());
|
skin->load(it.second());
|
||||||
m_elementSkins.push_back(skin);
|
m_elementSkins.push_back(skin);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +102,6 @@ void UISkins::load(const std::string& skinsFile)
|
||||||
it.first() >> name;
|
it.first() >> name;
|
||||||
|
|
||||||
UIElementSkinPtr skin = UIElementSkinPtr(new UILabelSkin(name));
|
UIElementSkinPtr skin = UIElementSkinPtr(new UILabelSkin(name));
|
||||||
if(it.second().Type() == YAML::NodeType::Map)
|
|
||||||
skin->load(it.second());
|
skin->load(it.second());
|
||||||
m_elementSkins.push_back(skin);
|
m_elementSkins.push_back(skin);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +115,6 @@ void UISkins::load(const std::string& skinsFile)
|
||||||
it.first() >> name;
|
it.first() >> name;
|
||||||
|
|
||||||
UIElementSkinPtr skin = UIElementSkinPtr(new UITextEditSkin(name));
|
UIElementSkinPtr skin = UIElementSkinPtr(new UITextEditSkin(name));
|
||||||
if(it.second().Type() == YAML::NodeType::Map)
|
|
||||||
skin->load(it.second());
|
skin->load(it.second());
|
||||||
m_elementSkins.push_back(skin);
|
m_elementSkins.push_back(skin);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +128,6 @@ void UISkins::load(const std::string& skinsFile)
|
||||||
it.first() >> name;
|
it.first() >> name;
|
||||||
|
|
||||||
UIElementSkinPtr skin = UIElementSkinPtr(new UIElementSkin(name, UI::LineDecoration));
|
UIElementSkinPtr skin = UIElementSkinPtr(new UIElementSkin(name, UI::LineDecoration));
|
||||||
if(it.second().Type() == YAML::NodeType::Map)
|
|
||||||
skin->load(it.second());
|
skin->load(it.second());
|
||||||
m_elementSkins.push_back(skin);
|
m_elementSkins.push_back(skin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ template<class T>
|
||||||
inline T yamlRead(const YAML::Node& node, const char *name)
|
inline T yamlRead(const YAML::Node& node, const char *name)
|
||||||
{
|
{
|
||||||
T value;
|
T value;
|
||||||
|
if(node.Type() == YAML::NodeType::Map)
|
||||||
node[name] >> value;
|
node[name] >> value;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -83,14 +84,14 @@ template<class T>
|
||||||
inline T yamlRead(const YAML::Node& node, const char *name, const T& defaultValue)
|
inline T yamlRead(const YAML::Node& node, const char *name, const T& defaultValue)
|
||||||
{
|
{
|
||||||
T value = defaultValue;
|
T value = defaultValue;
|
||||||
if(node.FindValue(name))
|
if(node.Type() == YAML::NodeType::Map && node.FindValue(name))
|
||||||
node[name] >> value;
|
node[name] >> value;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool yamlHasValue(const YAML::Node& node, const char *name)
|
inline bool yamlHasValue(const YAML::Node& node, const char *name)
|
||||||
{
|
{
|
||||||
return node.FindValue(name) != NULL;
|
return (node.Type() == YAML::NodeType::Map && node.FindValue(name) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string yamlErrorDesc(const YAML::Node& node, const std::string& error)
|
inline std::string yamlErrorDesc(const YAML::Node& node, const std::string& error)
|
||||||
|
@ -107,6 +108,7 @@ template<class A, class B>
|
||||||
inline std::map<A,B> yamlReadMap(const YAML::Node& node, const char *name)
|
inline std::map<A,B> yamlReadMap(const YAML::Node& node, const char *name)
|
||||||
{
|
{
|
||||||
std::map<A,B> map;
|
std::map<A,B> map;
|
||||||
|
if(node.Type() == YAML::NodeType::Map) {
|
||||||
if(const YAML::Node* mapNode = node.FindValue(name)) {
|
if(const YAML::Node* mapNode = node.FindValue(name)) {
|
||||||
for(auto it = mapNode->begin(); it != mapNode->end(); ++it) {
|
for(auto it = mapNode->begin(); it != mapNode->end(); ++it) {
|
||||||
A a;
|
A a;
|
||||||
|
@ -116,6 +118,7 @@ inline std::map<A,B> yamlReadMap(const YAML::Node& node, const char *name)
|
||||||
map[a] = b;
|
map[a] = b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ int main(int argc, const char *argv[])
|
||||||
g_engine.enableFpsCounter();
|
g_engine.enableFpsCounter();
|
||||||
|
|
||||||
// load ui skins
|
// load ui skins
|
||||||
g_uiSkins.load("skins/lightness.yml");
|
g_uiSkins.load("skins/tibiaskin.yml");
|
||||||
|
|
||||||
// load script modules
|
// load script modules
|
||||||
g_lua.loadAllModules();
|
g_lua.loadAllModules();
|
||||||
|
|
Loading…
Reference in New Issue