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/>.
20 #include "world_sheet.h"
22 #include "nel/georges/u_form_elm.h"
24 using namespace NLGEORGES
;
26 //===============================================================================
27 CWorldSheet::CWorldSheet()
29 Type
= CEntitySheet::WORLD
;
32 //===============================================================================
33 void CWorldSheet::build(const NLGEORGES::UFormElm
&item
)
37 nlverify (item
.getNodeByName (&pElt
, "continents list"));
40 nlwarning("node 'continents list' not found in a .world");
44 nlverify (pElt
->getArraySize (size
));
45 ContLocs
.reserve(size
);
46 for (uint32 i
= 0; i
<size
; ++i
)
48 const UFormElm
*pEltOfList
;
51 if (pElt
->getArrayNode (&pEltOfList
, i
) && pEltOfList
)
54 clTmp
.build (pEltOfList
);
55 ContLocs
.push_back (clTmp
);
58 item
.getValueByName (Name
, "name");
62 nlverify (item
.getNodeByName (&pElt
, "maps list"));
65 nlwarning("node 'maps list' is not found in a .world");
69 nlverify (pElt
->getArraySize (size
));
71 for (uint32 i
= 0; i
< size
; ++i
)
73 const UFormElm
*pEltOfList
;
76 if (pElt
->getArrayNode (&pEltOfList
, i
) && pEltOfList
)
79 mapTmp
.build (pEltOfList
);
80 Maps
.push_back (mapTmp
);
86 //===============================================================================
87 void CWorldSheet::serial(NLMISC::IStream
&f
)
90 f
.serialCont(ContLocs
);
95 //-----------------------------------------------
98 SelectionName
= "unknown";
99 ContinentName
= "unknown";
100 MinX
= MinY
= MaxX
= MaxY
= 0.0;
103 //-----------------------------------------------
104 void SContLoc::build (const UFormElm
*pItem
)
106 pItem
->getValueByName (SelectionName
, "selection_name");
107 pItem
->getValueByName (ContinentName
, "continent_name");
108 pItem
->getValueByName (MinX
, "minx");
109 pItem
->getValueByName (MinY
, "miny");
110 pItem
->getValueByName (MaxX
, "maxx");
111 pItem
->getValueByName (MaxY
, "maxy");
114 //-----------------------------------------------
115 void SContLoc::serial(NLMISC::IStream
&f
)
117 f
.serial(SelectionName
);
118 f
.serial(ContinentName
);
119 f
.serial(MinX
, MinY
, MaxX
, MaxY
);
122 //-----------------------------------------------
125 MinX
= MinY
= MaxX
= MaxY
= 0.0;
128 //-----------------------------------------------
129 void SMap::build(const NLGEORGES::UFormElm
*pItem
)
131 pItem
->getValueByName (Name
, "name");
132 pItem
->getValueByName (ContinentName
, "contname");
133 pItem
->getValueByName (BitmapName
, "bitmap");
134 pItem
->getValueByName (MinX
, "xmin");
135 pItem
->getValueByName (MinY
, "ymin");
136 pItem
->getValueByName (MaxX
, "xmax");
137 pItem
->getValueByName (MaxY
, "ymax");
139 const UFormElm
*pElt
;
140 nlverify (pItem
->getNodeByName (&pElt
, "children"));
142 if (pElt
== NULL
) return;
143 nlverify (pElt
->getArraySize (size
));
144 Children
.reserve(size
);
145 for (uint32 i
= 0; i
< size
; ++i
)
147 const UFormElm
*pEltOfList
;
149 if (pElt
->getArrayNode (&pEltOfList
, i
) && pEltOfList
)
151 SMap::SChild childTmp
;
152 childTmp
.build (pEltOfList
);
153 Children
.push_back (childTmp
);
158 //-----------------------------------------------
159 void SMap::serial(NLMISC::IStream
&f
)
162 f
.serial(ContinentName
);
163 f
.serial(BitmapName
);
168 f
.serialCont(Children
);
171 //-----------------------------------------------
172 void SMap::SChild::build(const NLGEORGES::UFormElm
*pItem
)
174 pItem
->getValueByName (Name
, "name");
175 pItem
->getValueByName (ZoneName
, "click zone name");
178 //-----------------------------------------------
179 void SMap::SChild::serial(NLMISC::IStream
&f
)