]> git.mxchange.org Git - simgear.git/commitdiff
Display random objects independently of buildings
authorStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Sun, 1 May 2016 21:35:21 +0000 (22:35 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 13 Aug 2016 08:21:16 +0000 (10:21 +0200)
Fix bug reported by Thorsten RENK on the mailing list
that random objects were only being displayed if random
objects were also present for the tile.  Also fix crash
if none of the random object models were found.

simgear/scene/material/matmodel.cxx
simgear/scene/tgdb/SGTileDetailsCallback.hxx

index 41d004daf5a6eecf575b858a269f49ac9a477191..84dd923745dd815abad052be3ee5e7138e94f9a4 100644 (file)
@@ -130,6 +130,8 @@ SGMatModel::load_models( SGPropertyNode *prop_root )
         
       } else {
         SG_LOG(SG_INPUT, SG_ALERT, "Failed to load object " << _paths[i]);
+        // Ensure the vector contains something, otherwise get_random_model below fails
+        _models.push_back(new osg::Node());
       }
     }
   }
index 465be137004f9a0076c37c6ecf339c18fcb84134..1cd9139ba76ede71e1b225b852171590cbd4d4ef 100644 (file)
@@ -387,7 +387,7 @@ public:
             float cos_zero_density_angle = mat->get_cos_object_zero_density_slope_angle();
             float cos_max_density_angle  = mat->get_cos_object_max_density_slope_angle();
             
-            if (building_coverage == 0)
+            if ((building_coverage == 0) && (group_count ==0))
                 continue;
             
             SGBuildingBin* bin = NULL;