From: Mikko Rasa Date: Tue, 12 Feb 2013 12:33:56 +0000 (+0200) Subject: Improve train color selection to always choose saturated colors X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=527f6a4a97af0f5bbe6e1edbd31a6501e5aa774f;p=r2c2.git Improve train color selection to always choose saturated colors --- diff --git a/source/engineer/engineer.cpp b/source/engineer/engineer.cpp index ba92933..e1268c6 100644 --- a/source/engineer/engineer.cpp +++ b/source/engineer/engineer.cpp @@ -417,9 +417,10 @@ void Engineer::train_added(Train &train) for(unsigned i=0; i<10; ++i) { GL::Color color; - color.r = rand()*1.0/RAND_MAX; - color.g = rand()*1.0/RAND_MAX; - color.b = rand()*1.0/RAND_MAX; + unsigned h = rand()%3; + color.r = (h==0 ? 0.0 : rand()*1.0/RAND_MAX); + color.g = (h==1 ? 0.0 : rand()*1.0/RAND_MAX); + color.b = (h==2 ? 0.0 : rand()*1.0/RAND_MAX); color = color*(1/max(max(color.r, color.g), color.b)); float min_d_sq = 3; for(map::const_iterator j=train_colors.begin(); j!=train_colors.end(); ++j)