From: ehofman Date: Sun, 7 Mar 2004 18:47:37 +0000 (+0000) Subject: Silently ignore texture files that are not present. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a34ac6a596593ffa5799f09bdbbf5c67aac7c2dc;p=simgear.git Silently ignore texture files that are not present. --- diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx index 5433a0f2..565b1f42 100644 --- a/simgear/scene/material/mat.cxx +++ b/simgear/scene/material/mat.cxx @@ -93,19 +93,23 @@ SGMaterial::read_properties( const string &fg_root, const SGPropertyNode * props for (int i = 0; i < textures.size(); i++) { string tname = textures[i]->getStringValue(); - if (tname == "") + if (tname == "") { tname = "unknown.rgb"; + } SGPath tpath( fg_root ); tpath.append("Textures.high"); tpath.append(tname); - if (!ulFileExists(tpath.c_str())) { + if ( !ulFileExists(tpath.c_str()) ) { tpath = SGPath( fg_root ); tpath.append("Textures"); tpath.append(tname); } - _internal_state st( NULL, tpath.str(), false ); - _status.push_back( st ); + + if ( ulFileExists(tpath.c_str()) ) { + _internal_state st( NULL, tpath.str(), false ); + _status.push_back( st ); + } } if (textures.size() == 0) { @@ -208,11 +212,12 @@ SGMaterial::get_state (int n) const return NULL; } - if ( _current_ptr >= _status.size()) + ssgSimpleState *st = (n >= 0) ? _status[n].state + : _status[_current_ptr].state; + ((SGMaterial *)this)->_current_ptr += 1; + if (_current_ptr >= _status.size()) ((SGMaterial *)this)->_current_ptr = 0; - ssgSimpleState *st = (n >= 0) ? _status[n].state : _status[_current_ptr].state; - ((SGMaterial *)this)->_current_ptr += 1; return st; }