1
0
Fork 0

Fixed some signed vs. unsigned warnings.

This commit is contained in:
curt 2002-07-26 16:54:40 +00:00
parent 88758e60b4
commit 8c7fe4c328

View file

@ -110,7 +110,7 @@ FGNewMat::Object::Object (const SGPropertyNode * node, double range_m)
// Note all the model paths // Note all the model paths
vector <SGPropertyNode_ptr> path_nodes = node->getChildren("path"); vector <SGPropertyNode_ptr> path_nodes = node->getChildren("path");
for (int i = 0; i < path_nodes.size(); i++) for (unsigned int i = 0; i < path_nodes.size(); i++)
_paths.push_back(path_nodes[i]->getStringValue()); _paths.push_back(path_nodes[i]->getStringValue());
// Note the heading type // Note the heading type
@ -126,11 +126,14 @@ FGNewMat::Object::Object (const SGPropertyNode * node, double range_m)
SG_LOG(SG_INPUT, SG_ALERT, "Unknown heading type: " << hdg SG_LOG(SG_INPUT, SG_ALERT, "Unknown heading type: " << hdg
<< "; using 'fixed' instead."); << "; using 'fixed' instead.");
} }
// uncomment to preload models
// load_models();
} }
FGNewMat::Object::~Object () FGNewMat::Object::~Object ()
{ {
for (int i = 0; i < _models.size(); i++) { for (unsigned int i = 0; i < _models.size(); i++) {
if (_models[i] != 0) { if (_models[i] != 0) {
_models[i]->deRef(); _models[i]->deRef();
_models[i] = 0; _models[i] = 0;
@ -147,13 +150,16 @@ FGNewMat::Object::get_model_count () const
inline void inline void
FGNewMat::Object::load_models () const FGNewMat::Object::load_models () const
{ {
cout << "loading ground cover objects:" << endl;
// Load model only on demand // Load model only on demand
if (!_models_loaded) { if (!_models_loaded) {
for (int i = 0; i < _paths.size(); i++) { for (unsigned int i = 0; i < _paths.size(); i++) {
SGPath path = globals->get_fg_root(); SGPath path = globals->get_fg_root();
path.append(_paths[i]); path.append(_paths[i]);
ssgTexturePath((char *)path.dir().c_str()); ssgTexturePath((char *)path.dir().c_str());
ssgEntity * entity = load_object((char *)path.c_str()); ssgEntity * entity = load_object((char *)path.c_str());
cout << " " << path.str() << endl;
if (entity != 0) { if (entity != 0) {
float ranges[] = {0, _range_m}; float ranges[] = {0, _range_m};
ssgRangeSelector * lod = new ssgRangeSelector; ssgRangeSelector * lod = new ssgRangeSelector;
@ -178,14 +184,14 @@ FGNewMat::Object::load_models () const
ssgEntity * ssgEntity *
FGNewMat::Object::get_model (int index) const FGNewMat::Object::get_model (int index) const
{ {
load_models(); load_models(); // comment this out if preloading models
return _models[index]; return _models[index];
} }
ssgEntity * ssgEntity *
FGNewMat::Object::get_random_model () const FGNewMat::Object::get_random_model () const
{ {
load_models(); load_models(); // comment this out if preloading models
int nModels = _models.size(); int nModels = _models.size();
int index = int(sg_random() * nModels); int index = int(sg_random() * nModels);
if (index >= nModels) if (index >= nModels)
@ -228,7 +234,7 @@ FGNewMat::ObjectGroup::ObjectGroup (SGPropertyNode * node)
FGNewMat::ObjectGroup::~ObjectGroup () FGNewMat::ObjectGroup::~ObjectGroup ()
{ {
for (int i = 0; i < _objects.size(); i++) { for (unsigned int i = 0; i < _objects.size(); i++) {
delete _objects[i]; delete _objects[i];
_objects[i] = 0; _objects[i] = 0;
} }