Merge branch '138-toggle-free-look-with-hotkey' into main/gingo-test
[ryzomcore.git] / ryzom / client / src / interface_v3 / group_career.cpp
blob56ac4e1d2e05193caca7664aecabe06d08e6fe9e
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
6 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 //
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as
10 // published by the Free Software Foundation, either version 3 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "stdpch.h"
25 #include "group_career.h"
26 #include "interface_manager.h"
27 #include "nel/gui/interface_element.h"
29 //#include "game_share/jobs.h"
30 #include "nel/misc/xml_auto_ptr.h"
32 using namespace std;
34 NLMISC_REGISTER_OBJECT(CViewBase, CGroupCareer, std::string, "career");
35 NLMISC_REGISTER_OBJECT(CViewBase, CGroupJob, std::string, "job");
37 // ***************************************************************************
38 bool CGroupCareer::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
40 if(!CGroupContainer::parse(cur, parentGroup))
41 return false;
43 CXMLAutoPtr ptr((const char*) xmlGetProp (cur, (xmlChar*)"career"));
45 uint careerIndex;
46 ROLES::ERole Career;
48 if (ptr)
50 NLMISC::fromString((const char*)ptr, careerIndex);
51 Career= (ROLES::ERole) careerIndex;
52 if(Career==ROLES::role_unknown)
54 nlinfo ("unknown career %s in %s", (const char*)ptr, _Id.c_str());
55 return false;
58 else
60 nlinfo ("no career in %s", _Id.c_str());
61 return false;
64 if (Career >= ROLES::NB_ROLES)
65 Career = ROLES::fighter;
67 string sTmp = ROLES::roleToUCString(Career);
68 for (uint32 i= 0; i < sTmp.size(); ++i)
69 if (sTmp[i] < 128)
70 if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') )
71 sTmp[i] = sTmp[i] - 'a' + 'A';
73 setTitle (sTmp);
75 return true;
78 // ***************************************************************************
79 bool CGroupJob::parse (xmlNodePtr /* cur */, CInterfaceGroup * /* parentGroup */)
81 return false;
83 // if(!CGroupContainer::parse(cur, parentGroup))
84 // return false;
86 // CXMLAutoPtr ptr = (char*) xmlGetProp (cur, (xmlChar*)"career");
88 // if (ptr == NULL)
89 // return false;
91 // uint careerIndex, jobIndex;
92 // ROLES::ERole Career;
93 // JOBS::TJob Job;
95 // if (ptr)
96 // {
97 // fromString((const char*)ptr, careerIndex);
98 // Career= (ROLES::ERole) careerIndex;
99 // if(Career==ROLES::role_unknown)
100 // {
101 // nlinfo ("unknown career %s in %s", (const char*)ptr, _Id.c_str());
102 // return false;
103 // }
104 // }
105 // else
106 // {
107 // nlinfo ("no career in %s", _Id.c_str());
108 // return false;
109 // }
111 // // get job
112 // ptr = xmlGetProp (cur, (xmlChar*)"job");
113 // if (ptr)
114 // {
115 // fromString((const char*)ptr, jobIndex);
116 // if(jobIndex==-1)
117 // Job= JOBS::All;
118 // else
119 // Job= JOBS::getJobForRace((ROLES::ERole)careerIndex, (EGSPD::CPeople::TPeople)jobIndex);
120 // if(Job==JOBS::Unknown)
121 // {
122 // nlinfo ("unknown job %s in %s", (const char*)ptr, _Id.c_str());
123 // return false;
124 // }
125 // }
126 // else
127 // {
128 // nlinfo ("no job in %s", _Id.c_str());
129 // return false;
130 // }
132 // string sTmp = JOBS::jobToUCString(Job);
133 // for (uint32 i= 0; i < sTmp.size(); ++i)
134 // if (sTmp[i] < 128)
135 // if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') )
136 // sTmp[i] = sTmp[i] - 'a' + 'A';
137 // seUCTitle (sTmp);
139 // return true;