Ticket #2622: gui_moddability.2.diff
File gui_moddability.2.diff, 23.2 KB (added by , 10 years ago) |
---|
-
binaries/data/mods/public/gui/session/diplomacy_window.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 3 <objects> 4 <object name="diplomacyDialogPanel" 5 size="50%-300 50%-200 50%+300 50%+150" 6 type="image" 7 hidden="true" 8 sprite="ModernDialog" 9 > 10 <object type="text" style="TitleText" size="50%-96 -16 50%+96 16"> 11 <translatableAttribute id="caption">Diplomacy</translatableAttribute> 12 </object> 13 14 <object name="diplomacyHeader" size="32 32 100%-32 64"> 15 <object name="diplomacyHeaderName" size="0 0 150 100%" type="text" style="chatPanel" ghost="true"> 16 <translatableAttribute id="caption">Name</translatableAttribute> 17 </object> 18 <object name="diplomacyHeaderCiv" size="150 0 250 100%" type="text" style="chatPanel" ghost="true"> 19 <translatableAttribute id="caption">Civilization</translatableAttribute> 20 </object> 21 <object name="diplomacyHeaderTeam" size="250 0 300 100%" type="text" style="chatPanel" ghost="true"> 22 <translatableAttribute id="caption">Team</translatableAttribute> 23 </object> 24 <object name="diplomacyHeaderTheirs" size="300 0 360 100%" type="text" style="chatPanel" ghost="true"> 25 <translatableAttribute id="caption">Theirs</translatableAttribute> 26 </object> 27 <object name="diplomacyHeaderAlly" size="100%-180 0 100%-160 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold"> 28 <translatableAttribute id="caption">A</translatableAttribute> 29 <translatableAttribute id="tooltip">Ally</translatableAttribute> 30 </object> 31 <object name="diplomacyHeaderNeutral" size="100%-160 0 100%-140 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold"> 32 <translatableAttribute id="caption">N</translatableAttribute> 33 <translatableAttribute id="tooltip">Neutral</translatableAttribute> 34 </object> 35 <object name="diplomacyHeaderEnemy" size="100%-140 0 100%-120 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold"> 36 <translatableAttribute id="caption">E</translatableAttribute> 37 <translatableAttribute id="tooltip">Enemy</translatableAttribute> 38 </object> 39 <object name="diplomacyHeaderTribute" size="100%-110 0 100% 100%" type="text" style="chatPanel"> 40 <translatableAttribute id="caption">Tribute</translatableAttribute> 41 </object> 42 </object> 43 <object size="32 64 100%-32 384"> 44 <repeat count="16"> 45 <object name="diplomacyPlayer[n]" size="0 0 100% 20" type="image" hidden="false"> 46 <object name="diplomacyPlayerName[n]" size="0 0 150 100%" type="text" style="chatPanel" ghost="true"/> 47 <object name="diplomacyPlayerCiv[n]" size="150 0 250 100%" type="text" style="chatPanel" ghost="true"/> 48 <object name="diplomacyPlayerTeam[n]" size="250 0 300 100%" type="text" style="chatPanel" ghost="true"/> 49 <object name="diplomacyPlayerTheirs[n]" size="300 0 360 100%" type="text" style="chatPanel" ghost="true"/> 50 51 <!-- Diplomatic stance - selection --> 52 <object name="diplomacyPlayerAlly[n]" size="100%-180 0 100%-160 100%" type="button" style="StoneButton" hidden="true"/> 53 <object name="diplomacyPlayerNeutral[n]" size="100%-160 0 100%-140 100%" type="button" style="StoneButton" hidden="true"/> 54 <object name="diplomacyPlayerEnemy[n]" size="100%-140 0 100%-120 100%" type="button" style="StoneButton" hidden="true"/> 55 56 <!-- Tribute --> 57 <object name="diplomacyPlayerTributeFood[n]" size="100%-110 0 100%-90 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true"> 58 <object name="diplomacyPlayerTributeFoodImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/food.png" ghost="true"/> 59 </object> 60 <object name="diplomacyPlayerTributeWood[n]" size="100%-90 0 100%-70 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true"> 61 <object name="diplomacyPlayerTributeWoodImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/wood.png" ghost="true"/> 62 </object> 63 <object name="diplomacyPlayerTributeStone[n]" size="100%-70 0 100%-50 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true"> 64 <object name="diplomacyPlayerTributeStoneImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/stone.png" ghost="true"/> 65 </object> 66 <object name="diplomacyPlayerTributeMetal[n]" size="100%-50 0 100%-30 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true"> 67 <object name="diplomacyPlayerTributeMetalImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/metal.png" ghost="true"/> 68 </object> 69 </object> 70 </repeat> 71 </object> 72 73 <object size="50%-64 100%-50 50%+64 100%-22" type="button" style="StoneButton"> 74 <translatableAttribute id="caption">Close</translatableAttribute> 75 <action on="Press">closeDiplomacy();</action> 76 </object> 77 </object> 78 </objects> -
binaries/data/mods/public/gui/session/session.xml
Property changes on: binaries/data/mods/public/gui/session/diplomacy_window.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/xml \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property
8 8 <script file="gui/common/music.js"/> 9 9 <script file="gui/common/timer.js"/> 10 10 <script file="gui/common/colorFades.js"/> 11 <script file="gui/session/session.js"/> 12 <script file="gui/session/selection.js"/> 11 <!-- load the placement script befor all other session scripts --> 13 12 <script file="gui/session/placement.js"/> 14 <script file="gui/session/input.js"/> 15 <script file="gui/session/menu.js"/> 16 <script file="gui/session/selection_details.js"/> 17 <script file="gui/session/unit_commands.js"/> 18 <script file="gui/session/messages.js"/> 19 <script file="gui/session/utility_functions.js"/> 13 <script directory="gui/session/"/> 20 14 21 15 <object name="sn" hotkey="session.gui.toggle"> 22 16 <action on="Tick"> … … 412 406 <!-- ================================ ================================ --> 413 407 <!-- Diplomacy Window --> 414 408 <!-- ================================ ================================ --> 415 <object name="diplomacyDialogPanel" 416 size="50%-300 50%-200 50%+300 50%+150" 417 type="image" 418 hidden="true" 419 sprite="ModernDialog" 420 > 421 <object type="text" style="TitleText" size="50%-96 -16 50%+96 16"> 422 <translatableAttribute id="caption">Diplomacy</translatableAttribute> 423 </object> 409 <object include="gui/session/diplomacy_window.xml" /> 424 410 425 <object name="diplomacyHeader" size="32 32 100%-32 64">426 <object name="diplomacyHeaderName" size="0 0 150 100%" type="text" style="chatPanel" ghost="true">427 <translatableAttribute id="caption">Name</translatableAttribute>428 </object>429 <object name="diplomacyHeaderCiv" size="150 0 250 100%" type="text" style="chatPanel" ghost="true">430 <translatableAttribute id="caption">Civilization</translatableAttribute>431 </object>432 <object name="diplomacyHeaderTeam" size="250 0 300 100%" type="text" style="chatPanel" ghost="true">433 <translatableAttribute id="caption">Team</translatableAttribute>434 </object>435 <object name="diplomacyHeaderTheirs" size="300 0 360 100%" type="text" style="chatPanel" ghost="true">436 <translatableAttribute id="caption">Theirs</translatableAttribute>437 </object>438 <object name="diplomacyHeaderAlly" size="100%-180 0 100%-160 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold">439 <translatableAttribute id="caption">A</translatableAttribute>440 <translatableAttribute id="tooltip">Ally</translatableAttribute>441 </object>442 <object name="diplomacyHeaderNeutral" size="100%-160 0 100%-140 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold">443 <translatableAttribute id="caption">N</translatableAttribute>444 <translatableAttribute id="tooltip">Neutral</translatableAttribute>445 </object>446 <object name="diplomacyHeaderEnemy" size="100%-140 0 100%-120 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold">447 <translatableAttribute id="caption">E</translatableAttribute>448 <translatableAttribute id="tooltip">Enemy</translatableAttribute>449 </object>450 <object name="diplomacyHeaderTribute" size="100%-110 0 100% 100%" type="text" style="chatPanel">451 <translatableAttribute id="caption">Tribute</translatableAttribute>452 </object>453 </object>454 455 <object size="32 64 100%-32 384">456 <repeat count="16">457 <object name="diplomacyPlayer[n]" size="0 0 100% 20" type="image" hidden="false">458 <object name="diplomacyPlayerName[n]" size="0 0 150 100%" type="text" style="chatPanel" ghost="true"/>459 <object name="diplomacyPlayerCiv[n]" size="150 0 250 100%" type="text" style="chatPanel" ghost="true"/>460 <object name="diplomacyPlayerTeam[n]" size="250 0 300 100%" type="text" style="chatPanel" ghost="true"/>461 <object name="diplomacyPlayerTheirs[n]" size="300 0 360 100%" type="text" style="chatPanel" ghost="true"/>462 463 <!-- Diplomatic stance - selection -->464 <object name="diplomacyPlayerAlly[n]" size="100%-180 0 100%-160 100%" type="button" style="StoneButton" hidden="true"/>465 <object name="diplomacyPlayerNeutral[n]" size="100%-160 0 100%-140 100%" type="button" style="StoneButton" hidden="true"/>466 <object name="diplomacyPlayerEnemy[n]" size="100%-140 0 100%-120 100%" type="button" style="StoneButton" hidden="true"/>467 468 <!-- Tribute -->469 <object name="diplomacyPlayerTributeFood[n]" size="100%-110 0 100%-90 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">470 <object name="diplomacyPlayerTributeFoodImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/food.png" ghost="true"/>471 </object>472 <object name="diplomacyPlayerTributeWood[n]" size="100%-90 0 100%-70 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">473 <object name="diplomacyPlayerTributeWoodImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/wood.png" ghost="true"/>474 </object>475 <object name="diplomacyPlayerTributeStone[n]" size="100%-70 0 100%-50 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">476 <object name="diplomacyPlayerTributeStoneImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/stone.png" ghost="true"/>477 </object>478 <object name="diplomacyPlayerTributeMetal[n]" size="100%-50 0 100%-30 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">479 <object name="diplomacyPlayerTributeMetalImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/metal.png" ghost="true"/>480 </object>481 </object>482 </repeat>483 </object>484 485 <object size="50%-64 100%-50 50%+64 100%-22" type="button" style="StoneButton">486 <translatableAttribute id="caption">Close</translatableAttribute>487 <action on="Press">closeDiplomacy();</action>488 </object>489 </object>490 491 411 <!-- ================================ ================================ --> 492 412 <!-- Trade Window --> 493 413 <!-- ================================ ================================ --> -
source/gui/CGUI.cpp
65 65 extern int g_yres; 66 66 67 67 const double SELECT_DBLCLICK_RATE = 0.5; 68 const u32 MAX_OBECT_DEPTH = 100; // Max number of nesting for GUI objects. Used to detect recursive inclusion 68 69 69 70 InReaction CGUI::HandleEvent(const SDL_Event_* ev) 70 71 { … … 930 931 931 932 // Check root element's (node) name so we know what kind of 932 933 // data we'll be expecting 933 CStr root_name 934 CStr root_name(XeroFile.GetElementString(node.GetNodeName())); 934 935 935 936 try 936 937 { … … 993 994 Xeromyces_ReadScript(child, pFile, Paths); 994 995 else 995 996 // Read in this whole object into the GUI 996 Xeromyces_ReadObject(child, pFile, m_BaseObject, subst, Paths );997 Xeromyces_ReadObject(child, pFile, m_BaseObject, subst, Paths, 0); 997 998 } 998 999 } 999 1000 … … 1036 1037 1037 1038 // Read in this whole object into the GUI 1038 1039 1039 CStr name 1040 CStr name(pFile->GetElementString(child.GetNodeName())); 1040 1041 1041 1042 if (name == "scrollbar") 1042 1043 { … … 1064 1065 } 1065 1066 } 1066 1067 1067 void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObject *pParent, const std::vector<std::pair<CStr, CStr> >& NameSubst, boost::unordered_set<VfsPath>& Paths )1068 void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObject *pParent, const std::vector<std::pair<CStr, CStr> >& NameSubst, boost::unordered_set<VfsPath>& Paths, u32 nesting_depth) 1068 1069 { 1070 if (nesting_depth > MAX_OBECT_DEPTH) 1071 { 1072 LOGERROR(L"Too many nested GUI objects. Probably caused by a recursive include attribute. Abort rendering any deeper."); 1073 return; 1074 } 1075 1069 1076 ENSURE(pParent); 1070 1077 int i; 1071 1078 … … 1110 1117 ATTR(file); 1111 1118 ATTR(id); 1112 1119 ATTR(context); 1120 ATTR(include); 1113 1121 1114 1122 // 1115 1123 // Read Style and set defaults … … 1118 1126 // 1119 1127 // Always load default (if it's available) first! 1120 1128 // 1121 CStr argStyle 1129 CStr argStyle(attributes.GetNamedItem(attr_style)); 1122 1130 1123 1131 if (m_Styles.count("default") == 1) 1124 1132 object->LoadStyle(*this, "default"); … … 1140 1148 1141 1149 bool NameSet = false; 1142 1150 bool ManuallySetZ = false; // if z has been manually set, this turn true 1151 bool ExternalChildren = false; 1143 1152 1153 CStrW inclusionPath; 1144 1154 CStr hotkeyTag; 1145 1155 1146 1156 // Now we can iterate all attributes and store … … 1159 1169 // Also the name needs some special attention 1160 1170 if (attr.Name == attr_name) 1161 1171 { 1162 CStr name 1172 CStr name(attr.Value); 1163 1173 1164 1174 // Apply the requested substitutions 1165 1175 for (size_t j = 0; j < NameSubst.size(); ++j) … … 1170 1180 continue; 1171 1181 } 1172 1182 1183 if (attr.Name == attr_include) 1184 { 1185 ExternalChildren = true; 1186 inclusionPath = attr.Value.FromUTF8(); 1187 continue; 1188 } 1189 1173 1190 // Wire up the hotkey tag, if it has one 1174 1191 if (attr.Name == attr_hotkey) 1175 1192 hotkeyTag = attr.Value; … … 1197 1214 if (! hotkeyTag.empty()) 1198 1215 m_HotkeyObjects[hotkeyTag].push_back(object); 1199 1216 1200 CStrW caption 1201 if (! 1217 CStrW caption(Element.GetText().FromUTF8()); 1218 if (!caption.empty()) 1202 1219 { 1203 1220 // Set the setting caption to this 1204 1221 object->SetSetting("caption", caption, true); … … 1211 1228 // Read Children 1212 1229 // 1213 1230 1214 // Iterate children1215 1231 XMBElementList children = Element.GetChildNodes(); 1232 CXeromyces XeroChildren; 1233 if (ExternalChildren) 1234 { 1235 if (children.Count > 0) 1236 LOGWARNING(L"GUI: Gui XML Object in has child nodes and an 'include' attribute (pointing to %ls). The child nodes will be ignored.", inclusionPath.c_str()); 1237 Paths.insert(inclusionPath); 1216 1238 1239 if (XeroChildren.Load(g_VFS, inclusionPath) == PSRETURN_OK) 1240 { 1241 XMBElement node = XeroChildren.GetRoot(); 1242 1243 CStr root_name(XeroChildren.GetElementString(node.GetNodeName())); 1244 1245 if (root_name == "objects") 1246 children = node.GetChildNodes(); 1247 else 1248 LOGERROR(L"GUI: Error reading included XML: %ls, root element must have the name 'objects'.", inclusionPath.c_str()); 1249 } 1250 else 1251 LOGERROR(L"GUI: Error reading included XML: %ls", inclusionPath.c_str()); 1252 1253 // set pFile to the new CXeromyces file, as it's only used to handle the children from now on 1254 pFile = &XeroChildren; 1255 } 1256 1257 // Iterate children 1217 1258 for (i=0; i<children.Count; ++i) 1218 1259 { 1219 1260 // Get node … … 1225 1266 if (element_name == elmt_object) 1226 1267 { 1227 1268 // Call this function on the child 1228 Xeromyces_ReadObject(child, pFile, object, NameSubst, Paths );1269 Xeromyces_ReadObject(child, pFile, object, NameSubst, Paths, nesting_depth + 1); 1229 1270 } 1230 1271 else if (element_name == elmt_action) 1231 1272 { … … 1232 1273 // Scripted <action> element 1233 1274 1234 1275 // Check for a 'file' parameter 1235 CStrW filename 1276 CStrW filename(child.GetAttributes().GetNamedItem(attr_file).FromUTF8()); 1236 1277 1237 1278 CStr code; 1238 1279 1239 1280 // If there is a file, open it and use it as the code 1240 if (! 1281 if (!filename.empty()) 1241 1282 { 1242 1283 Paths.insert(filename); 1243 1284 CVFSFile scriptfile; … … 1280 1321 } 1281 1322 else if (element_name == elmt_repeat) 1282 1323 { 1283 Xeromyces_ReadRepeat(child, pFile, object, Paths );1324 Xeromyces_ReadRepeat(child, pFile, object, Paths, nesting_depth); 1284 1325 } 1285 1326 else if (element_name == elmt_translatableAttribute) 1286 1327 { … … 1388 1429 } 1389 1430 } 1390 1431 1391 void CGUI::Xeromyces_ReadRepeat(XMBElement Element, CXeromyces* pFile, IGUIObject *pParent, boost::unordered_set<VfsPath>& Paths )1432 void CGUI::Xeromyces_ReadRepeat(XMBElement Element, CXeromyces* pFile, IGUIObject *pParent, boost::unordered_set<VfsPath>& Paths, u32 nesting_depth) 1392 1433 { 1393 1434 #define ELMT(x) int elmt_##x = pFile->GetElementID(#x) 1394 1435 #define ATTR(x) int attr_##x = pFile->GetAttributeID(#x) … … 1408 1449 { 1409 1450 if (child.GetNodeName() == elmt_object) 1410 1451 { 1411 Xeromyces_ReadObject(child, pFile, pParent, subst, Paths );1452 Xeromyces_ReadObject(child, pFile, pParent, subst, Paths, nesting_depth + 1); 1412 1453 } 1413 1454 } 1414 1455 } … … 1417 1458 void CGUI::Xeromyces_ReadScript(XMBElement Element, CXeromyces* pFile, boost::unordered_set<VfsPath>& Paths) 1418 1459 { 1419 1460 // Check for a 'file' parameter 1420 CStrW file 1461 CStrW file(Element.GetAttributes().GetNamedItem( pFile->GetAttributeID("file") ).FromUTF8()); 1421 1462 1422 1463 // If there is a file specified, open and execute it 1423 if (! 1464 if (!file.empty()) 1424 1465 { 1425 1466 Paths.insert(file); 1426 1467 try … … 1433 1474 } 1434 1475 } 1435 1476 1477 // If it has a directory attribute, read all JS files in that directory 1478 CStrW directory(Element.GetAttributes().GetNamedItem( pFile->GetAttributeID("directory") ).FromUTF8()); 1479 if (!directory.empty()) 1480 { 1481 VfsPaths pathnames; 1482 vfs::GetPathnames(g_VFS, directory, L"*.js", pathnames); 1483 for (VfsPaths::iterator it = pathnames.begin(); it != pathnames.end(); ++it) 1484 { 1485 // only load new files (so when the insert succeeds) 1486 if (Paths.insert(*it).second) 1487 { 1488 try 1489 { 1490 m_ScriptInterface->LoadGlobalScriptFile(*it); 1491 } 1492 catch (PSERROR_Scripting& e) 1493 { 1494 LOGERROR(L"GUI: Error executing script %ls: %hs", directory.c_str(), e.what()); 1495 } 1496 } 1497 } 1498 } 1499 1436 1500 // Execute inline scripts 1437 1501 try 1438 1502 { 1439 CStr code 1440 if (! 1503 CStr code(Element.GetText()); 1504 if (!code.empty()) 1441 1505 m_ScriptInterface->LoadGlobalScript(L"Some XML file", code.FromUTF8()); 1442 1506 } 1443 1507 catch (PSERROR_Scripting& e) … … 1478 1542 // Get node 1479 1543 XMBElement child = children.Item(i); 1480 1544 1481 CStr ElementName 1545 CStr ElementName(pFile->GetElementString(child.GetNodeName())); 1482 1546 1483 1547 if (ElementName == "image") 1484 1548 { … … 1506 1570 // different effects) 1507 1571 if (effects) 1508 1572 for (std::vector<SGUIImage*>::iterator it = Sprite->m_Images.begin(); it != Sprite->m_Images.end(); ++it) 1509 if (! 1573 if (!(*it)->m_Effects) 1510 1574 (*it)->m_Effects = new SGUIImageEffects(*effects); // do a copy just so it can be deleted correctly later 1511 1575 1512 1576 delete effects; … … 1539 1603 for (int i=0; i<attributes.Count; ++i) 1540 1604 { 1541 1605 XMBAttribute attr = attributes.Item(i); 1542 CStr attr_name 1543 CStrW attr_value 1606 CStr attr_name(pFile->GetAttributeString(attr.Name)); 1607 CStrW attr_value(attr.Value.FromUTF8()); 1544 1608 1545 1609 if (attr_name == "texture") 1546 1610 { … … 1649 1713 for (int i=0; i<children.Count; ++i) 1650 1714 { 1651 1715 XMBElement child = children.Item(i); 1652 CStr ElementName 1716 CStr ElementName(pFile->GetElementString(child.GetNodeName())); 1653 1717 if (ElementName == "effect") 1654 1718 { 1655 1719 if (Image->m_Effects) … … 1681 1745 for (int i=0; i<attributes.Count; ++i) 1682 1746 { 1683 1747 XMBAttribute attr = attributes.Item(i); 1684 CStr attr_name 1685 CStrW attr_value 1748 CStr attr_name(pFile->GetAttributeString(attr.Name)); 1749 CStrW attr_value(attr.Value.FromUTF8()); 1686 1750 1687 1751 if (attr_name == "add_color") 1688 1752 { … … 1717 1781 for (int i=0; i<attributes.Count; ++i) 1718 1782 { 1719 1783 XMBAttribute attr = attributes.Item(i); 1720 CStr attr_name 1784 CStr attr_name(pFile->GetAttributeString(attr.Name)); 1721 1785 1722 1786 // The "name" setting is actually the name of the style 1723 1787 // and not a new default … … 1756 1820 { 1757 1821 XMBAttribute attr = attributes.Item(i); 1758 1822 CStr attr_name = pFile->GetAttributeString(attr.Name); 1759 CStr attr_value 1823 CStr attr_value(attr.Value); 1760 1824 1761 1825 if (attr_value == "null") 1762 1826 continue; … … 1853 1917 for (int i=0; i<attributes.Count; ++i) 1854 1918 { 1855 1919 XMBAttribute attr = attributes.Item(i); 1856 CStr attr_name 1857 CStr attr_value 1920 CStr attr_name(pFile->GetAttributeString(attr.Name)); 1921 CStr attr_value(attr.Value); 1858 1922 1859 1923 if (attr_value == "null") 1860 1924 continue; … … 1901 1965 for (int i=0; i<attributes.Count; ++i) 1902 1966 { 1903 1967 XMBAttribute attr = attributes.Item(i); 1904 CStr attr_name 1905 CStr attr_value 1968 CStr attr_name(pFile->GetAttributeString(attr.Name)); 1969 CStr attr_value(attr.Value); 1906 1970 1907 1971 if (attr_name == "name") 1908 1972 { … … 1929 1993 CStr name = attributes.GetNamedItem(pFile->GetAttributeID("name")); 1930 1994 1931 1995 // Try parsing value 1932 CStr value 1933 if (! 1996 CStr value(Element.GetText()); 1997 if (!value.empty()) 1934 1998 { 1935 1999 // Try setting color to value 1936 2000 if (!color.ParseString(value)) -
source/gui/CGUI.h
444 444 * 445 445 * @see LoadXmlFile() 446 446 */ 447 void Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObject *pParent, const std::vector<std::pair<CStr, CStr> >& NameSubst, boost::unordered_set<VfsPath>& Paths );447 void Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObject *pParent, const std::vector<std::pair<CStr, CStr> >& NameSubst, boost::unordered_set<VfsPath>& Paths, u32 nesting_depth); 448 448 449 449 /** 450 450 * Reads in the element \<repeat\>, which repeats its child \<object\>s … … 451 451 * 'count' times, replacing the string "[n]" in its descendants' names 452 452 * with "[0]", "[1]", etc. 453 453 */ 454 void Xeromyces_ReadRepeat(XMBElement Element, CXeromyces* pFile, IGUIObject *pParent, boost::unordered_set<VfsPath>& Paths );454 void Xeromyces_ReadRepeat(XMBElement Element, CXeromyces* pFile, IGUIObject *pParent, boost::unordered_set<VfsPath>& Paths, u32 nesting_depth); 455 455 456 456 /** 457 457 * Reads in the element \<script\> (the XMBElement) and executes