]> git.mxchange.org Git - simgear.git/commitdiff
implement a round-robin scheme for random objects to make sure the same type of objec...
authorehofman <ehofman>
Mon, 1 Feb 2010 10:05:14 +0000 (10:05 +0000)
committerTim Moore <timoore33@gmail.com>
Sat, 6 Feb 2010 22:12:40 +0000 (23:12 +0100)
simgear/scene/material/matmodel.cxx

index bdad512eef0add5bf58e2d728169a8c15b20f7ef..c625d9b0af0e71be2bf17e479969a5d336ba2493 100644 (file)
@@ -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();
 }