9
9
10
10
#define Text2GBK (s ) (s ? (isUTF8 ? UTF8toGBK(s) :s) : " " )
11
11
AttrShape::AttrShape (const tinyxml2::XMLElement* node, bool isUTF8) {
12
+ if (auto text{ node->Attribute (" alias" ) }) {
13
+ alias = split (Text2GBK (text), " |" );
14
+ }
12
15
if (auto exp{ node->GetText () }) {
13
16
string s{ Text2GBK (exp) };
14
17
if (auto text{ node->Attribute (" text" ) }) {
@@ -124,10 +127,7 @@ int loadCardTemp(const std::filesystem::path& fpPath, dict_ci<CardTemp>& m) {
124
127
if (auto tp_name{ root->Attribute (" name" ) }) {
125
128
auto & tp{ m[Text2GBK (tp_name)] };
126
129
for (auto elem = root->FirstChildElement (); elem; elem = elem->NextSiblingElement ()) {
127
- if (string tag{ elem->Name ()}; tag == " alias" ) {
128
- if (auto text{ elem->GetText () })readini (Text2GBK (text), tp.replaceName );
129
- }
130
- else if (tag == " basic" ) {
130
+ if (string tag{ elem->Name ()}; tag == " basic" ) {
131
131
tp.vBasicList .clear ();
132
132
for (auto kid = elem->FirstChildElement (); kid; kid = kid->NextSiblingElement ()) {
133
133
if (auto text{ kid->GetText () })tp.vBasicList .push_back (getLines (Text2GBK (text)));
@@ -136,7 +136,11 @@ int loadCardTemp(const std::filesystem::path& fpPath, dict_ci<CardTemp>& m) {
136
136
else if (tag == " init" ) {
137
137
for (auto kid = elem->FirstChildElement (); kid; kid = kid->NextSiblingElement ()) {
138
138
if (auto name{ kid->Attribute (" name" ) }) {
139
- tp.AttrShapes [Text2GBK (name)] = { kid,isUTF8 };
139
+ string attr{ Text2GBK (name) };
140
+ auto & shape{ tp.AttrShapes [attr] = { kid,isUTF8 } };
141
+ if (!shape.alias .empty ())for (auto & key : shape.alias ) {
142
+ tp.replaceName [key] = attr;
143
+ }
140
144
}
141
145
}
142
146
}
0 commit comments