Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / client / src / client_sheets / world_sheet.cpp
blob1ae2f963f36167f2fac1b1507baa34ecf18c2fb7
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 "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)
35 const UFormElm *pElt;
36 uint size;
37 nlverify (item.getNodeByName (&pElt, "continents list"));
38 if(!pElt)
40 nlwarning("node 'continents list' not found in a .world");
42 else
44 nlverify (pElt->getArraySize (size));
45 ContLocs.reserve(size);
46 for (uint32 i = 0; i <size; ++i)
48 const UFormElm *pEltOfList;
50 // Get the continent
51 if (pElt->getArrayNode (&pEltOfList, i) && pEltOfList)
53 SContLoc clTmp;
54 clTmp.build (pEltOfList);
55 ContLocs.push_back (clTmp);
58 item.getValueByName (Name, "name");
61 // Maps loading
62 nlverify (item.getNodeByName (&pElt, "maps list"));
63 if(!pElt)
65 nlwarning("node 'maps list' is not found in a .world");
67 else
69 nlverify (pElt->getArraySize (size));
70 Maps.reserve(size);
71 for (uint32 i = 0; i < size; ++i)
73 const UFormElm *pEltOfList;
75 // Get the continent
76 if (pElt->getArrayNode (&pEltOfList, i) && pEltOfList)
78 SMap mapTmp;
79 mapTmp.build (pEltOfList);
80 Maps.push_back (mapTmp);
86 //===============================================================================
87 void CWorldSheet::serial(NLMISC::IStream &f)
89 f.serial(Name);
90 f.serialCont(ContLocs);
91 f.serialCont(Maps);
95 //-----------------------------------------------
96 SContLoc::SContLoc()
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 //-----------------------------------------------
123 SMap::SMap()
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");
138 // Read child
139 const UFormElm *pElt;
140 nlverify (pItem->getNodeByName (&pElt, "children"));
141 uint size;
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;
148 // Get the continent
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)
161 f.serial(Name);
162 f.serial(ContinentName);
163 f.serial(BitmapName);
164 f.serial(MinX);
165 f.serial(MinY);
166 f.serial(MaxX);
167 f.serial(MaxY);
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)
181 f.serial(Name);
182 f.serial(ZoneName);