#include <tile_vegetable_desc.h>
Nevrax France
Definition at line 50 of file tile_vegetable_desc.h.
Public Member Functions | |
void | build (const std::vector< CVegetable > &vegetables) |
Build the CTileVegetableDesc. | |
void | clear () |
clear lists. | |
CTileVegetableDesc () | |
Constructor. | |
const std::vector< CVegetable > & | getVegetableList (uint distType) const |
get the vegetable list for a specific distanceType | |
uint | getVegetableSeed (uint distType) const |
get the vegetable seed for a specific distanceType | |
void | registerToManager (CVegetableManager *vegetableManager) |
register all Vegetables in this to the manager. | |
void | serial (NLMISC::IStream &f) |
serial. | |
Private Attributes | |
std::vector< CVegetable > | _VegetableList [NL3D_VEGETABLE_BLOCK_NUMDIST] |
uint32 | _VegetableSeed [NL3D_VEGETABLE_BLOCK_NUMDIST] |
|
Constructor.
Definition at line 43 of file tile_vegetable_desc.cpp.
00044 { 00045 } |
|
Build the CTileVegetableDesc.
Definition at line 57 of file tile_vegetable_desc.cpp. References _VegetableList, _VegetableSeed, clear(), min, NL3D_VEGETABLE_BLOCK_NUMDIST, and uint.
00058 { 00059 uint i; 00060 00061 // first clear(). 00062 clear(); 00063 00064 // Parse all landscape vegetables, and store them in appropriate distance Type. 00065 for(i=0;i<vegetables.size();i++) 00066 { 00067 uint distType= vegetables[i].DistType; 00068 distType= min(distType, (uint)(NL3D_VEGETABLE_BLOCK_NUMDIST-1)); 00069 _VegetableList[distType].push_back(vegetables[i]); 00070 } 00071 00072 // Compute Seed such that creation of one vegetable for a tile will never receive same seed. 00073 uint sumVeget= 0; 00074 for(i=0; i<NL3D_VEGETABLE_BLOCK_NUMDIST; i++) 00075 { 00076 _VegetableSeed[i]= sumVeget; 00077 // add number of vegetable for next seed. 00078 sumVeget+= _VegetableList[i].size(); 00079 } 00080 00081 } |
|
clear lists.
Definition at line 48 of file tile_vegetable_desc.cpp. References _VegetableList, NL3D_VEGETABLE_BLOCK_NUMDIST, and sint. Referenced by build().
00049 { 00050 for(sint i=0; i<NL3D_VEGETABLE_BLOCK_NUMDIST; i++) 00051 { 00052 _VegetableList[i].clear(); 00053 } 00054 } |
|
get the vegetable list for a specific distanceType
Definition at line 112 of file tile_vegetable_desc.cpp. References _VegetableList, NL3D_VEGETABLE_BLOCK_NUMDIST, nlassert, and uint. Referenced by NL3D::CPatch::generateTileVegetable().
00113 { 00114 nlassert(distType < NL3D_VEGETABLE_BLOCK_NUMDIST); 00115 00116 return _VegetableList[distType]; 00117 } |
|
get the vegetable seed for a specific distanceType
Definition at line 120 of file tile_vegetable_desc.cpp. References _VegetableSeed, NL3D_VEGETABLE_BLOCK_NUMDIST, nlassert, and uint. Referenced by NL3D::CPatch::generateTileVegetable().
00121 { 00122 nlassert(distType < NL3D_VEGETABLE_BLOCK_NUMDIST); 00123 00124 return _VegetableSeed[distType]; 00125 } |
|
register all Vegetables in this to the manager.
Definition at line 84 of file tile_vegetable_desc.cpp. References _VegetableList, NL3D_VEGETABLE_BLOCK_NUMDIST, and uint. Referenced by NL3D::CTileBank::initTileVegetableDescs().
00085 { 00086 // Pasre all distanceType. 00087 for(uint i=0; i<NL3D_VEGETABLE_BLOCK_NUMDIST; i++) 00088 { 00089 // Parse all vegetables of the list. 00090 for(uint j=0; j<_VegetableList[i].size(); j++) 00091 { 00092 // register the vegetable to the manager 00093 _VegetableList[i][j].registerToManager(vegetableManager); 00094 } 00095 } 00096 } |
|
serial.
Definition at line 99 of file tile_vegetable_desc.cpp. References _VegetableList, _VegetableSeed, NL3D_VEGETABLE_BLOCK_NUMDIST, nlassert, NLMISC::IStream::serial(), NLMISC::IStream::serialCont(), NLMISC::IStream::serialVersion(), and uint.
00100 { 00101 (void)f.serialVersion(0); 00102 00103 nlassert(NL3D_VEGETABLE_BLOCK_NUMDIST==5); 00104 for(uint i=0; i<NL3D_VEGETABLE_BLOCK_NUMDIST; i++) 00105 { 00106 f.serialCont(_VegetableList[i]); 00107 f.serial(_VegetableSeed[i]); 00108 } 00109 } |
|
List of vegetable to instanciate for a specific tile Grouped by distance Type. Definition at line 81 of file tile_vegetable_desc.h. Referenced by build(), clear(), getVegetableList(), registerToManager(), and serial(). |
|
Definition at line 83 of file tile_vegetable_desc.h. Referenced by build(), getVegetableSeed(), and serial(). |