mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
refactor: create paths namespace instead of global variables
This commit is contained in:
@@ -675,9 +675,9 @@ TAnimModel::export_as_text_( std::ostream &Output ) const {
|
||||
pModel ?
|
||||
pModel->NameGet() + ".t3d" : // rainsted requires model file names to include an extension
|
||||
"none" ) };
|
||||
if( modelfile.find( szModelPath ) == 0 ) {
|
||||
if( modelfile.find( paths::models ) == 0 ) {
|
||||
// don't include 'models/' in the path
|
||||
modelfile.erase( 0, std::string{ szModelPath }.size() );
|
||||
modelfile.erase( 0, std::string{ paths::models }.size() );
|
||||
}
|
||||
Output << modelfile << ' ';
|
||||
// texture
|
||||
@@ -685,9 +685,9 @@ TAnimModel::export_as_text_( std::ostream &Output ) const {
|
||||
m_materialdata.replacable_skins[ 1 ] != null_handle ?
|
||||
GfxRenderer->Material( m_materialdata.replacable_skins[ 1 ] )->GetName() :
|
||||
"none" ) };
|
||||
if( texturefile.find( szTexturePath ) == 0 ) {
|
||||
if( texturefile.find( paths::textures ) == 0 ) {
|
||||
// don't include 'textures/' in the path
|
||||
texturefile.erase( 0, std::string{ szTexturePath }.size() );
|
||||
texturefile.erase( 0, std::string{ paths::textures }.size() );
|
||||
}
|
||||
if( contains( texturefile, ' ' ) ) {
|
||||
Output << "\"" << texturefile << "\"" << ' ';
|
||||
|
||||
@@ -125,7 +125,7 @@ TModelsManager::find_in_databank( std::string const &Name ) {
|
||||
|
||||
std::vector<std::string> filenames {
|
||||
Name,
|
||||
szModelPath + Name };
|
||||
paths::models + Name };
|
||||
|
||||
for( auto const &filename : filenames ) {
|
||||
auto const lookup { m_modelsmap.find( filename ) };
|
||||
@@ -146,7 +146,7 @@ TModelsManager::find_on_disk( std::string const &Name ) {
|
||||
|
||||
auto lookup = (
|
||||
FileExists( Name + extension ) ? Name :
|
||||
FileExists( szModelPath + Name + extension ) ? szModelPath + Name :
|
||||
FileExists( paths::models + Name + extension ) ? paths::models + Name :
|
||||
"" );
|
||||
if( false == lookup.empty() ) {
|
||||
return lookup;
|
||||
|
||||
@@ -1467,7 +1467,7 @@ texture_manager::find_in_databank( std::string const &Texturename ) const {
|
||||
std::vector<std::string> const filenames {
|
||||
Global.asCurrentTexturePath + Texturename,
|
||||
Texturename,
|
||||
szTexturePath + Texturename };
|
||||
paths::textures + Texturename };
|
||||
|
||||
for( auto const &filename : filenames ) {
|
||||
auto const lookup { m_texturemappings.find( filename ) };
|
||||
@@ -1486,7 +1486,7 @@ texture_manager::find_on_disk( std::string const &Texturename ) {
|
||||
std::vector<std::string> const filenames {
|
||||
Global.asCurrentTexturePath + Texturename,
|
||||
Texturename,
|
||||
szTexturePath + Texturename };
|
||||
paths::textures + Texturename };
|
||||
|
||||
auto lookup =
|
||||
FileExists(
|
||||
|
||||
@@ -582,7 +582,7 @@ material_manager::find_in_databank( std::string const &Materialname ) const {
|
||||
std::vector<std::string> const filenames {
|
||||
Global.asCurrentTexturePath + Materialname,
|
||||
Materialname,
|
||||
szTexturePath + Materialname };
|
||||
paths::textures + Materialname };
|
||||
|
||||
for( auto const &filename : filenames ) {
|
||||
auto const lookup { m_materialmappings.find( filename ) };
|
||||
@@ -602,7 +602,7 @@ material_manager::find_on_disk( std::string const &Materialname ) {
|
||||
auto const materialname { ToLower( Materialname ) };
|
||||
return (
|
||||
FileExists(
|
||||
{ Global.asCurrentTexturePath + materialname, materialname, szTexturePath + materialname },
|
||||
{ Global.asCurrentTexturePath + materialname, materialname, paths::textures + materialname },
|
||||
{ ".mat" } ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user