Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / client_sheets / skills_tree_sheet.cpp
blob65799bb200ba985c366449f34b24d30c47cadd3e
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "stdpch.h"
20 #include "skills_tree_sheet.h"
21 #include "nel/georges/u_form_elm.h"
22 #include "nel/misc/common.h"
24 using namespace std;
25 using namespace NLMISC;
26 using namespace NLGEORGES;
28 // ***************************************************************************
29 void CSkillsTreeSheet::build(const UFormElm &item)
31 const UFormElm *arraySkillElt = NULL;
32 if( item.getNodeByName( &arraySkillElt, "SkillData" ) )
34 if( arraySkillElt )
36 uint NbSkills;
37 nlverify( arraySkillElt->getArraySize( NbSkills ) );
39 //nlassert( NbSkills == SKILLS::NUM_SKILLS );
41 SkillsTree.resize( std::max(NbSkills, (uint) SKILLS::NUM_SKILLS));
43 for( uint i = 0; i < NbSkills; ++i )
45 const UFormElm* SkillElt = NULL;
46 if( ! ( arraySkillElt->getArrayNode( &SkillElt, i ) && SkillElt ) )
48 nlwarning("<CSkillsTreeSheet::build> can't get array node of SkillElt in sheet");
50 else
52 // Skill
53 string SkillName;
54 SkillElt->getValueByName( SkillName, "Skill" );
55 SKILLS::ESkills skill = SKILLS::toSkill( SkillName );
56 //nlassert( skill != SKILLS::unknown );
57 if (skill == SKILLS::unknown)
59 continue;
61 SkillsTree[ skill ].Skill = skill;
63 // Skill Code
64 if( ! SkillElt->getValueByName( SkillsTree[ skill ].SkillCode, "SkillCode" ) )
66 nlwarning("<CSkillsTreeSheet::build> can't get node SkillCode in sheet");
69 // Max skill value
70 if( ! SkillElt->getValueByName( SkillsTree[ skill ].MaxSkillValue, "MaxSkillValue" ) )
72 nlwarning("<CSkillsTreeSheet::build> can't get node MaxSkillValue in sheet");
75 // Type of stage
76 if( ! SkillElt->getValueByName( SkillsTree[ skill ].StageType, "Type of Stage" ) )
78 nlwarning("<CSkillsTreeSheet::build> can't get node 'Type of Stage' in sheet");
81 // ParentSkill
82 if( ! SkillElt->getValueByName( SkillName, "ParentSkill" ) )
84 nlwarning("<CSkillsTreeSheet::build> can't get node ParentSkills in sheet");
86 else
88 SkillsTree[ skill ].ParentSkill = SKILLS::toSkill( SkillName );
91 // ChildSkills
92 const UFormElm *arrayChildSkillElt = NULL;
93 if( SkillElt->getNodeByName( &arrayChildSkillElt, "ChildSkills" ) )
95 if( arrayChildSkillElt )
97 uint NbChildSkills;
98 nlverify( arrayChildSkillElt->getArraySize( NbChildSkills ) );
100 SkillsTree[ skill ].ChildSkills.resize( NbChildSkills );
102 for( uint j = 0; j < NbChildSkills; ++j )
104 string childSkillName;
105 arrayChildSkillElt->getArrayValue( childSkillName, j );
106 SKILLS::ESkills childSkill = SKILLS::toSkill( childSkillName );
107 //nlassert( childSkill != SKILLS::unknown );
108 SkillsTree[ skill ].ChildSkills[ j ] = childSkill;