Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / tools / leveldesign / export / formFlora.cpp
blob4ed1ddd4b84ced305994631646af543b0c51041d
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/>.
17 #include "formFlora.h"
19 #include "nel/misc/common.h"
20 #include "nel/misc/debug.h"
22 #include "nel/georges/u_form_elm.h"
24 using namespace std;
25 using namespace NLMISC;
26 using namespace NLGEORGES;
28 // ---------------------------------------------------------------------------
29 void SFormFlora::build (UFormElm &item)
31 IncludePatats.clear ();
32 ExcludePatats.clear ();
33 PlantInstances.clear ();
35 // Read the Include_patats field
36 UFormElm *pElt;
37 if (item.getNodeByName (&pElt, "Include_patats") && pElt)
39 uint size;
40 nlverify (pElt->getArraySize (size));
41 for (uint i=0; i<size; i++)
43 string value;
44 pElt->getArrayValue (value, i);
45 IncludePatats.push_back (value);
49 // Read the Include_patats field
50 if (item.getNodeByName (&pElt, "Exclude_patats") && pElt)
52 uint size;
53 nlverify (pElt->getArraySize (size));
54 for (uint i=0; i<size; i++)
56 string value;
57 pElt->getArrayValue (value, i);
58 ExcludePatats.push_back (value);
62 // Read the Plants field
63 if (item.getNodeByName (&pElt, "Plants") && pElt)
65 uint size;
66 nlverify (pElt->getArraySize (size));
67 for (uint i=0; i<size; i++)
69 // Get the struct
70 UFormElm *pArrayElt;
71 if (pElt->getArrayNode (&pArrayElt, i) && pArrayElt)
73 SPlantInstance piTmp;
74 pArrayElt->getValueByName (piTmp.Name, "File name");
75 pArrayElt->getValueByName (piTmp.Density, "Density");
76 pArrayElt->getValueByName (piTmp.Falloff, "Falloff");
77 PlantInstances.push_back (piTmp);
82 item.getValueByName (JitterPos, "Jitter_Pos");
84 item.getValueByName (ScaleMin, "Scale_Min");
86 item.getValueByName (ScaleMax, "Scale_Max");
88 item.getValueByName (PutOnWater, "Put_On_Water");
90 item.getValueByName (WaterHeight, "Water_Height");
92 item.getValueByName (RandomSeed, "Random_Seed");