implement a round-robin scheme for random objects to make sure the same type of object is placed at the same spot all the time
This commit is contained in:
@@ -139,8 +139,9 @@ SGMatModel::get_random_model( SGPropertyNode *prop_root )
|
||||
{
|
||||
load_models( prop_root ); // comment this out if preloading models
|
||||
int nModels = _models.size();
|
||||
int index = int(sg_random() * nModels);
|
||||
if (index >= nModels)
|
||||
// int index = int(sg_random() * nModels);
|
||||
static int index = -1;
|
||||
if (++index >= nModels)
|
||||
index = 0;
|
||||
return _models[index].get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user