aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltoolplacer.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/lltoolplacer.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/linden/indra/newview/lltoolplacer.cpp b/linden/indra/newview/lltoolplacer.cpp
index dda21dd..297556e 100644
--- a/linden/indra/newview/lltoolplacer.cpp
+++ b/linden/indra/newview/lltoolplacer.cpp
@@ -156,6 +156,20 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj,
156} 156}
157 157
158 158
159static S32 getTreeGrassSpecies(std::map<std::string, S32> &table, const char *control, S32 max)
160{
161 const std::string &species = gSavedSettings.getString(control);
162 std::map<std::string, S32>::iterator it;
163 it = table.find(species);
164 if (it != table.end()) {
165 return it->second;
166 } else {
167 // if saved species not found, default to "Random"
168 return (rand() % max);
169 }
170}
171
172
159BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) 173BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
160{ 174{
161 LLVector3 ray_start_region; 175 LLVector3 ray_start_region;
@@ -200,13 +214,13 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
200 case LL_PCODE_LEGACY_GRASS: 214 case LL_PCODE_LEGACY_GRASS:
201 // Randomize size of grass patch 215 // Randomize size of grass patch
202 scale.setVec(10.f + ll_frand(20.f), 10.f + ll_frand(20.f), 1.f + ll_frand(2.f)); 216 scale.setVec(10.f + ll_frand(20.f), 10.f + ll_frand(20.f), 1.f + ll_frand(2.f));
203 state = rand() % LLVOGrass::sMaxGrassSpecies; 217 state = getTreeGrassSpecies(LLVOGrass::sSpeciesNames, "LastGrass", LLVOGrass::sMaxGrassSpecies);
204 break; 218 break;
205 219
206 220
207 case LL_PCODE_LEGACY_TREE: 221 case LL_PCODE_LEGACY_TREE:
208 case LL_PCODE_TREE_NEW: 222 case LL_PCODE_TREE_NEW:
209 state = rand() % LLVOTree::sMaxTreeSpecies; 223 state = getTreeGrassSpecies(LLVOTree::sSpeciesNames, "LastTree", LLVOTree::sMaxTreeSpecies);
210 break; 224 break;
211 225
212 case LL_PCODE_SPHERE: 226 case LL_PCODE_SPHERE: