simplify TYPE_CONSTANT code

This commit is contained in:
Garux
2021-03-25 21:59:31 +03:00
parent edabdd157e
commit 5008fa278f
15 changed files with 63 additions and 83 deletions

View File

@@ -165,7 +165,7 @@ NullModelLoader g_NullModelLoader;
/// \brief Returns the model loader for the model \p type or 0 if the model \p type has no loader module
ModelLoader* ModelLoader_forType( const char* type ){
const char* moduleName = findModuleName( &GlobalFiletypes(), ModelLoader::Name(), type );
const char* moduleName = findModuleName( &GlobalFiletypes(), ModelLoader::Name, type );
if ( string_not_empty( moduleName ) ) {
ModelLoader* table = ReferenceAPI_getModelModules().findModule( moduleName );
if ( table != 0 ) {
@@ -283,7 +283,7 @@ NodeSmartReference Model_load( ModelLoader* loader, const char* path, const char
}
else
{
const char* moduleName = findModuleName( &GlobalFiletypes(), MapFormat::Name(), type );
const char* moduleName = findModuleName( &GlobalFiletypes(), MapFormat::Name, type );
if ( string_not_empty( moduleName ) ) {
const MapFormat* format = ReferenceAPI_getMapModules().findModule( moduleName );
if ( format != 0 ) {
@@ -398,7 +398,7 @@ struct ModelResource : public Resource
}
bool save(){
if ( !mapSaved() ) {
const char* moduleName = findModuleName( GetFileTypeRegistry(), MapFormat::Name(), m_type.c_str() );
const char* moduleName = findModuleName( GetFileTypeRegistry(), MapFormat::Name, m_type.c_str() );
if ( string_not_empty( moduleName ) ) {
const MapFormat* format = ReferenceAPI_getMapModules().findModule( moduleName );
if ( format != 0 && MapResource_save( *format, m_model.get(), m_path.c_str(), m_name.c_str() ) ) {