99
1010#define Text2GBK (s ) (s ? (isUTF8 ? UTF8toGBK(s) :s) : " " )
1111AttrShape::AttrShape (const tinyxml2::XMLElement* node, bool isUTF8) {
12+ if (auto text{ node->Attribute (" alias" ) }) {
13+ alias = split (Text2GBK (text), " |" );
14+ }
1215 if (auto exp{ node->GetText () }) {
1316 string s{ Text2GBK (exp) };
1417 if (auto text{ node->Attribute (" text" ) }) {
@@ -124,10 +127,7 @@ int loadCardTemp(const std::filesystem::path& fpPath, dict_ci<CardTemp>& m) {
124127 if (auto tp_name{ root->Attribute (" name" ) }) {
125128 auto & tp{ m[Text2GBK (tp_name)] };
126129 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" ) {
131131 tp.vBasicList .clear ();
132132 for (auto kid = elem->FirstChildElement (); kid; kid = kid->NextSiblingElement ()) {
133133 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) {
136136 else if (tag == " init" ) {
137137 for (auto kid = elem->FirstChildElement (); kid; kid = kid->NextSiblingElement ()) {
138138 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+ }
140144 }
141145 }
142146 }
0 commit comments