1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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/>.
23 #include "stdpch.h" // First include for pre-compiled headers.
25 #include "mission_sheet.h"
27 #include "nel/georges/u_form_elm.h"
33 #define NB_STEPS_PER_MISSION 20
39 using namespace NLGEORGES
;
40 using namespace NLMISC
;
44 //-----------------------------------------------
46 // Build the sheet from an external script.
47 //-----------------------------------------------
48 void CMissionSheet::build(const NLGEORGES::UFormElm
&item
)
50 // Load the descriptors.
51 if(!item
.getValueByName(Name
, "Name"))
52 debug("key 'Name' not found.");
54 if(!item
.getValueByName(Description
, "Description"))
55 debug("key 'Description' not found.");
57 if(!item
.getValueByName(RewardDescription
, "RewardDescription"))
58 debug("key 'RewardDescription' not found.");
60 // load mission steps description
61 for (uint i
=1; i
< NB_STEPS_PER_MISSION
+ 1;i
++)
63 const UFormElm
* stepStruct
;
64 string varName
= string("step") + NLMISC::toString(i
);
65 item
.getNodeByName (&stepStruct
, varName
);
70 stepStruct
->getValueByName(stepDesc
,"Description");
71 if ( !stepDesc
.empty() )
72 StepsDescription
.push_back(stepDesc
);
79 //-----------------------------------------------
81 // Serialize character sheet into binary data file.
82 //-----------------------------------------------
83 void CMissionSheet::serial(NLMISC::IStream
&f
)
85 // Serialize class components.
87 f
.serial(Description
);
88 f
.serial(RewardDescription
);
89 f
.serialCont(StepsDescription
);