You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Поддержка ЗП формата для файлов описания текстур texture_desc. Они удобнее - можно кучу текстур описать в одном файле. Так же автозагрузка описаний по пути ui\\textures_descr\\*.xml
info.rect.x1 = xml.ReadAttribFlt(node, "texture", i, "x");
50
+
info.rect.x2 = xml.ReadAttribFlt(node, "texture", i, "width") + info.rect.x1;
51
+
info.rect.y1 = xml.ReadAttribFlt(node, "texture", i, "y");
52
+
info.rect.y2 = xml.ReadAttribFlt(node, "texture", i, "height") + info.rect.y1;
53
+
54
+
shared_str id = xml.ReadAttrib(node, "texture", i, "id");
55
+
56
+
/* avo: fix issue when values were not updated (silently skipped) when same key is encountered more than once. This is how std::map is designed.
57
+
/* Also used more efficient C++11 std::map::emplace method instead of outdated std::pair::make_pair */
58
+
/* XXX: avo: note that xxx.insert(mk_pair(v1,v2)) pattern is used extensively throughout solution so there is a good potential for other bug fixes/improvements */
59
+
if (m_textures.find(id) == m_textures.end())
60
+
m_textures.emplace(id, info);
61
+
else
62
+
m_textures[id] = info;
63
+
// m_textures.insert(mk_pair(id,info)); // original GSC insert call
64
+
/* avo: end */
65
+
}
66
+
67
+
xml.SetLocalRoot(root_node);
68
+
}
69
+
}
70
+
else
71
+
{
72
+
// ТЧ формат
73
+
shared_str file = xml.Read("file_name", 0, "");
74
+
75
+
int num = xml.GetNodesNum("", 0, "texture");
76
+
for (int i = 0; i < num; i++)
77
+
{
78
+
TEX_INFO info;
79
+
80
+
info.file = file;
81
+
82
+
info.rect.x1 = xml.ReadAttribFlt("texture", i, "x");
83
+
info.rect.x2 = xml.ReadAttribFlt("texture", i, "width") + info.rect.x1;
84
+
info.rect.y1 = xml.ReadAttribFlt("texture", i, "y");
85
+
info.rect.y2 = xml.ReadAttribFlt("texture", i, "height") + info.rect.y1;
86
+
87
+
shared_str id = xml.ReadAttrib("texture", i, "id");
88
+
89
+
/* avo: fix issue when values were not updated (silently skipped) when same key is encountered more than once. This is how std::map is designed.
90
+
/* Also used more efficient C++11 std::map::emplace method instead of outdated std::pair::make_pair */
91
+
/* XXX: avo: note that xxx.insert(mk_pair(v1,v2)) pattern is used extensively throughout solution so there is a good potential for other bug fixes/improvements */
92
+
if (m_textures.find(id) == m_textures.end())
93
+
m_textures.emplace(id, info);
94
+
else
95
+
m_textures[id] = info;
96
+
// m_textures.insert(mk_pair(id,info)); // original GSC insert call
0 commit comments