From 68797e51c66d44d9a3178b659c9f970d996796e1 Mon Sep 17 00:00:00 2001 From: ehofman Date: Mon, 1 Feb 2010 10:05:14 +0000 Subject: [PATCH] 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 --- simgear/scene/material/matmodel.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/simgear/scene/material/matmodel.cxx b/simgear/scene/material/matmodel.cxx index bdad512e..c625d9b0 100644 --- a/simgear/scene/material/matmodel.cxx +++ b/simgear/scene/material/matmodel.cxx @@ -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(); } -- 2.39.5