Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / client_sheets / flora_sheet.h
blob54965674225d1dda2f0344a4a06613bb58515c5e
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 #ifndef CL_FLORA_SHEET_H
20 #define CL_FLORA_SHEET_H
22 #include "plant_sheet.h"
24 /** Infos about a .plant contained in a .flora
27 class CPlantInfo
29 public:
30 std::string SheetName;
31 uint32 Weight;
32 uint64 CumulatedWeight; // for sorting by weights
33 public:
34 virtual void build(const NLGEORGES::UFormElm &item);
35 virtual void serial(NLMISC::IStream &f);
37 inline bool operator < (const CPlantInfo &lhs, const CPlantInfo &rhs)
39 return lhs.CumulatedWeight < rhs.CumulatedWeight;
43 /** Info about flora, read from a .flora sheet
46 class CFloraSheet : public CEntitySheet
48 public:
49 float MicroLifeThreshold; // 0 -> every tile has micro-life > 1 -> no tile has micro-life
50 public:
51 /// ctor
52 CFloraSheet();
53 /// Build the sheet from an external script.
54 virtual void build(const NLGEORGES::UFormElm &item);
55 /// Serialize plant sheet into binary data file.
56 virtual void serial(NLMISC::IStream &f);
57 // Get total weight of plant infos
58 uint64 getPlantInfoTotalWeight() const { return _TotalWeight; }
59 /** Get plant info from weighted index
61 * e.g : we have 3 .plant in the .flora:
62 * .plant a.plant, weighted 4
63 * .plant b.plant, weighted 2
64 * .plant c.plant, weighted 1
66 * getPlantInfoWeight(0) -> a.plant
67 * getPlantInfoWeight(1) -> a.plant
68 * getPlantInfoWeight(2) -> a.plant
69 * getPlantInfoWeight(3) -> a.plant (4 occurences)
70 * getPlantInfoWeight(4) -> b.plant
71 * getPlantInfoWeight(5) -> b.plant (2 occurences)
72 * getPlantInfoWeight(6) -> c.plant (1 occurences)
75 const CPlantInfo *getPlantInfoFromWeightedIndex(uint64 index) const;
76 // Plant info access
77 uint getNumPlantInfos() const { return (uint)_Plants.size(); }
78 const CPlantInfo &getPlantInfo(uint index) const { return _Plants[index]; }
79 private:
80 std::vector<CPlantInfo> _Plants;
81 uint64 _TotalWeight;
85 #endif