diff --git a/include/modulesystem.h b/include/modulesystem.h index c6f2a9ae..873c4663 100644 --- a/include/modulesystem.h +++ b/include/modulesystem.h @@ -130,10 +130,10 @@ class ModuleRef public: ModuleRef( const char* name ) : m_table( 0 ){ if ( !globalModuleServer().getError() ) { - m_module = globalModuleServer().findModule( typename Type::Name(), typename Type::Version(), name ); + m_module = globalModuleServer().findModule( Type::Name, Type::Version, name ); if ( m_module == 0 ) { globalModuleServer().setError( true ); - globalErrorStream() << "ModuleRef::initialise: type=" << makeQuoted( typename Type::Name() ) << " version=" << makeQuoted( typename Type::Version() ) << " name=" << makeQuoted( name ) << " - not found\n"; + globalErrorStream() << "ModuleRef::initialise: type=" << makeQuoted( Type::Name ) << " version=" << makeQuoted( Type::Version ) << " name=" << makeQuoted( name ) << " - not found\n"; } else { @@ -151,7 +151,7 @@ public: } Type* getTable(){ #if defined( _DEBUG ) - ASSERT_MESSAGE( m_table != 0, "ModuleRef::getTable: type=" << makeQuoted( typename Type::Name() ) << " version=" << makeQuoted( typename Type::Version() ) << " - module-reference used without being initialised" ); + ASSERT_MESSAGE( m_table != 0, "ModuleRef::getTable: type=" << makeQuoted( Type::Name ) << " version=" << makeQuoted( Type::Version ) << " - module-reference used without being initialised" ); #endif return m_table; } @@ -173,16 +173,16 @@ public: } void initialise( const char* name ){ - m_module = globalModuleServer().findModule( typename Type::Name(), typename Type::Version(), name ); + m_module = globalModuleServer().findModule( Type::Name, Type::Version, name ); if ( m_module == 0 ) { globalModuleServer().setError( true ); - globalErrorStream() << "SingletonModuleRef::initialise: type=" << makeQuoted( typename Type::Name() ) << " version=" << makeQuoted( typename Type::Version() ) << " name=" << makeQuoted( name ) << " - not found\n"; + globalErrorStream() << "SingletonModuleRef::initialise: type=" << makeQuoted( Type::Name ) << " version=" << makeQuoted( Type::Version ) << " name=" << makeQuoted( name ) << " - not found\n"; } } Type* getTable(){ #if defined( _DEBUG ) - ASSERT_MESSAGE( m_table != 0, "SingletonModuleRef::getTable: type=" << makeQuoted( typename Type::Name() ) << " version=" << makeQuoted( typename Type::Version() ) << " - module-reference used without being initialised" ); + ASSERT_MESSAGE( m_table != 0, "SingletonModuleRef::getTable: type=" << makeQuoted( Type::Name ) << " version=" << makeQuoted( Type::Version ) << " - module-reference used without being initialised" ); #endif return m_table; } diff --git a/libs/generic/constant.cpp b/libs/generic/constant.cpp index 9ddeb5bc..353548ca 100644 --- a/libs/generic/constant.cpp +++ b/libs/generic/constant.cpp @@ -33,8 +33,8 @@ public: INTEGER_CONSTANT( Version, 1 ); }; -int version = Bleh::Version(); -const char* name = Bleh::Name(); +int version = Bleh::Version; +const char* name = Bleh::Name; } #endif diff --git a/libs/generic/constant.h b/libs/generic/constant.h index 83817947..b0532b92 100644 --- a/libs/generic/constant.h +++ b/libs/generic/constant.h @@ -25,25 +25,7 @@ /// \file /// \brief Language extensions for constants that are guaranteed to be evaluated at compile-time. -/// \brief A compile-time-constant as a type. -template -struct ConstantWrapper -{ - typedef typename Type::Value Value; - operator Value() const - { - return Type::evaluate(); - } -}; -template -inline TextOutputStreamType& ostream_write( TextOutputStreamType& ostream, const ConstantWrapper& c ){ - return ostream_write( ostream, typename Type::Value( c ) ); -} - -#define TYPE_CONSTANT( name, value, type ) struct name ## _CONSTANT_ { typedef type Value; static Value evaluate() { return value; } }; typedef ConstantWrapper name -#define STRING_CONSTANT( name, value ) TYPE_CONSTANT ( name, value, const char* ) -#define INTEGER_CONSTANT( name, value ) TYPE_CONSTANT ( name, value, int ) - -STRING_CONSTANT( EmptyString, "" ); +#define STRING_CONSTANT( name, value ) static constexpr const char* name = value +#define INTEGER_CONSTANT( name, value ) static constexpr int name = value #endif diff --git a/libs/modulesystem/modulesmap.h b/libs/modulesystem/modulesmap.h index 1675bfbb..77197785 100644 --- a/libs/modulesystem/modulesmap.h +++ b/libs/modulesystem/modulesmap.h @@ -102,7 +102,7 @@ public: if ( !globalModuleServer().getError() ) { if ( string_equal( names, "*" ) ) { InsertModules visitor( m_modules ); - globalModuleServer().foreachModule( typename Type::Name(), typename Type::Version(), visitor ); + globalModuleServer().foreachModule( Type::Name, Type::Version, visitor ); } else { @@ -113,11 +113,11 @@ public: if ( string_empty( name ) ) { break; } - Module* module = globalModuleServer().findModule( typename Type::Name(), typename Type::Version(), name ); + Module* module = globalModuleServer().findModule( Type::Name, Type::Version, name ); if ( module == 0 ) { - globalErrorStream() << "ModulesRef::initialise: type=" << makeQuoted( typename Type::Name() ) << " version=" << makeQuoted( typename Type::Version() ) << " name=" << makeQuoted( name ) << " - not found\n"; + globalErrorStream() << "ModulesRef::initialise: type=" << makeQuoted( Type::Name ) << " version=" << makeQuoted( Type::Version ) << " name=" << makeQuoted( name ) << " - not found\n"; // do not fail on missing image or model plugin, they can be optional - if ( !string_equal( typename Type::Name(), "image" ) && !string_equal( typename Type::Name(), "model" ) ){ + if ( !string_equal( Type::Name, "image" ) && !string_equal( Type::Name, "model" ) ){ globalModuleServer().setError( true ); break; } diff --git a/libs/modulesystem/singletonmodule.h b/libs/modulesystem/singletonmodule.h index 75367608..bbefb0f6 100644 --- a/libs/modulesystem/singletonmodule.h +++ b/libs/modulesystem/singletonmodule.h @@ -33,7 +33,7 @@ class DefaultAPIConstructor { public: const char* getName(){ - return typename API::Name(); + return API::Name; } API* constructAPI( Dependencies& dependencies ){ @@ -49,7 +49,7 @@ class DependenciesAPIConstructor { public: const char* getName(){ - return typename API::Name(); + return API::Name; } API* constructAPI( Dependencies& dependencies ){ @@ -87,7 +87,7 @@ public: } void selfRegister(){ - globalModuleServer().registerModule( typename Type::Name(), typename Type::Version(), APIConstructor::getName(), *this ); + globalModuleServer().registerModule( Type::Name, Type::Version, APIConstructor::getName(), *this ); } Dependencies& getDependencies(){ @@ -101,16 +101,16 @@ public: } void capture(){ if ( ++m_refcount == 1 ) { - globalOutputStream() << "Module Initialising: '" << typename Type::Name() << "' '" << APIConstructor::getName() << "'\n"; + globalOutputStream() << "Module Initialising: '" << Type::Name << "' '" << APIConstructor::getName() << "'\n"; m_dependencies = new Dependencies(); m_dependencyCheck = !globalModuleServer().getError(); if ( m_dependencyCheck ) { m_api = APIConstructor::constructAPI( *m_dependencies ); - globalOutputStream() << "Module Ready: '" << typename Type::Name() << "' '" << APIConstructor::getName() << "'\n"; + globalOutputStream() << "Module Ready: '" << Type::Name << "' '" << APIConstructor::getName() << "'\n"; } else { - globalErrorStream() << "Module Dependencies Failed: '" << typename Type::Name() << "' '" << APIConstructor::getName() << "'\n"; + globalErrorStream() << "Module Dependencies Failed: '" << Type::Name << "' '" << APIConstructor::getName() << "'\n"; } m_cycleCheck = true; } diff --git a/libs/scenelib.h b/libs/scenelib.h index c2a1418e..1ad4d676 100644 --- a/libs/scenelib.h +++ b/libs/scenelib.h @@ -98,17 +98,16 @@ class NodeType : public StaticTypeSystemInitialiser { TypeId m_typeId; public: - typedef typename Type::Name Name; NodeType() : m_typeId( NODETYPEID_NONE ){ StaticTypeSystemInitialiser::instance().addInitialiser( InitialiseCaller( *this ) ); } void initialise(){ - m_typeId = GlobalSceneGraph().getNodeTypeId( Name() ); + m_typeId = GlobalSceneGraph().getNodeTypeId( Type::Name ); } typedef MemberCaller, &NodeType::initialise> InitialiseCaller; TypeId getTypeId(){ #if defined( _DEBUG ) - ASSERT_MESSAGE( m_typeId != NODETYPEID_NONE, "node-type " << makeQuoted( Name() ) << " used before being initialised" ); + ASSERT_MESSAGE( m_typeId != NODETYPEID_NONE, "node-type " << makeQuoted( Name ) << " used before being initialised" ); #endif return m_typeId; } @@ -433,17 +432,16 @@ class InstanceType : public StaticTypeSystemInitialiser { TypeId m_typeId; public: - typedef typename Type::Name Name; InstanceType() : m_typeId( INSTANCETYPEID_NONE ){ StaticTypeSystemInitialiser::instance().addInitialiser( InitialiseCaller( *this ) ); } void initialise(){ - m_typeId = GlobalSceneGraph().getInstanceTypeId( Name() ); + m_typeId = GlobalSceneGraph().getInstanceTypeId( Type::Name ); } typedef MemberCaller, &InstanceType::initialise> InitialiseCaller; TypeId getTypeId(){ #if defined( _DEBUG ) - ASSERT_MESSAGE( m_typeId != INSTANCETYPEID_NONE, "instance-type " << makeQuoted( Name() ) << " used before being initialised" ); + ASSERT_MESSAGE( m_typeId != INSTANCETYPEID_NONE, "instance-type " << makeQuoted( Type::Name ) << " used before being initialised" ); #endif return m_typeId; } diff --git a/plugins/mapq3/plugin.cpp b/plugins/mapq3/plugin.cpp index 693f3731..b86684db 100644 --- a/plugins/mapq3/plugin.cpp +++ b/plugins/mapq3/plugin.cpp @@ -76,8 +76,8 @@ public: INTEGER_CONSTANT( MapVersion, 2 ); MapDoom3API( MapDoom3Dependencies& dependencies ) : m_dependencies( dependencies ){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "doom3 maps", "*.map" ) ); - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "doom3 region", "*.reg" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "doom3 maps", "*.map" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "doom3 region", "*.reg" ) ); } MapFormat* getTable(){ return this; @@ -110,8 +110,8 @@ public: if ( !Tokeniser_getInteger( tokeniser, version ) ) { return; } - if ( version != MapVersion() ) { - globalErrorStream() << "Doom 3 map version " << MapVersion() << " supported, version is " << version << "\n"; + if ( version != MapVersion ) { + globalErrorStream() << "Doom 3 map version " << MapVersion << " supported, version is " << version << "\n"; return; } tokeniser.nextLine(); @@ -121,7 +121,7 @@ public: void writeGraph( scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream ) const { TokenWriter& writer = GlobalScripLibModule::getTable().m_pfnNewSimpleTokenWriter( outputStream ); writer.writeToken( "Version" ); - writer.writeInteger( MapVersion() ); + writer.writeInteger( MapVersion ); writer.nextLine(); Map_Write( root, traverse, writer, false ); writer.release(); @@ -147,8 +147,8 @@ public: INTEGER_CONSTANT( MapVersion, 3 ); MapQuake4API( MapDoom3Dependencies& dependencies ) : m_dependencies( dependencies ){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "quake4 maps", "*.map" ) ); - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "quake4 region", "*.reg" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "quake4 maps", "*.map" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "quake4 region", "*.reg" ) ); } MapFormat* getTable(){ return this; @@ -181,8 +181,8 @@ public: if ( !Tokeniser_getInteger( tokeniser, version ) ) { return; } - if ( version != MapVersion() ) { - globalErrorStream() << "Quake 4 map version " << MapVersion() << " supported, version is " << version << "\n"; + if ( version != MapVersion ) { + globalErrorStream() << "Quake 4 map version " << MapVersion << " supported, version is " << version << "\n"; return; } tokeniser.nextLine(); @@ -192,7 +192,7 @@ public: void writeGraph( scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream ) const { TokenWriter& writer = GlobalScripLibModule::getTable().m_pfnNewSimpleTokenWriter( outputStream ); writer.writeToken( "Version" ); - writer.writeInteger( MapVersion() ); + writer.writeInteger( MapVersion ); writer.nextLine(); Map_Write( root, traverse, writer, false ); writer.release(); @@ -234,9 +234,9 @@ public: STRING_CONSTANT( Name, "mapq3" ); MapQ3API(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "quake3 maps", "*.map", true, true, true ) ); - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "quake3 region", "*.reg", true, true, true ) ); - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "quake3 compiled maps", "*.bsp", false, true, false ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "quake3 maps", "*.map", true, true, true ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "quake3 region", "*.reg", true, true, true ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "quake3 compiled maps", "*.bsp", false, true, false ) ); } MapFormat* getTable(){ return this; @@ -316,8 +316,8 @@ public: STRING_CONSTANT( Name, "mapq1" ); MapQ1API(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "quake maps", "*.map" ) ); - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "quake region", "*.reg" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "quake maps", "*.map" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "quake region", "*.reg" ) ); } MapFormat* getTable(){ return this; @@ -392,8 +392,8 @@ public: STRING_CONSTANT( Name, "maphl" ); MapHalfLifeAPI(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "half-life maps", "*.map" ) ); - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "half-life region", "*.reg" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "half-life maps", "*.map" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "half-life region", "*.reg" ) ); } MapFormat* getTable(){ return this; @@ -436,8 +436,8 @@ public: STRING_CONSTANT( Name, "mapq2" ); MapQ2API(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "quake2 maps", "*.map" ) ); - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "quake2 region", "*.reg" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "quake2 maps", "*.map" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "quake2 region", "*.reg" ) ); } MapFormat* getTable(){ return this; @@ -639,8 +639,8 @@ public: STRING_CONSTANT( Name, "mapvmf" ); MapVMFAPI(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "vmf maps", "*.vmf" ) ); - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "vmf region", "*.reg" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "vmf maps", "*.vmf" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "vmf region", "*.reg" ) ); } MapFormat* getTable(){ return this; diff --git a/plugins/mapxml/plugin.cpp b/plugins/mapxml/plugin.cpp index 3bba36d0..7208cb18 100644 --- a/plugins/mapxml/plugin.cpp +++ b/plugins/mapxml/plugin.cpp @@ -68,7 +68,7 @@ public: STRING_CONSTANT( Name, "xmldoom3" ); MapXMLAPI(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "xml doom3 maps", "*.xmap" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "xml doom3 maps", "*.xmap" ) ); } MapFormat* getTable(){ return this; diff --git a/plugins/md3model/plugin.cpp b/plugins/md3model/plugin.cpp index ba74d5c9..770d1031 100644 --- a/plugins/md3model/plugin.cpp +++ b/plugins/md3model/plugin.cpp @@ -70,7 +70,7 @@ public: STRING_CONSTANT( Name, "md3" ); ModelMD3API(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "md3 models", "*.md3" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "md3 models", "*.md3" ) ); } ModelLoader* getTable(){ return &m_modelmd3; @@ -99,7 +99,7 @@ public: STRING_CONSTANT( Name, "md2" ); ModelMD2API(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "md2 models", "*.md2" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "md2 models", "*.md2" ) ); } ModelLoader* getTable(){ return &m_modelmd2; @@ -126,7 +126,7 @@ public: STRING_CONSTANT( Name, "mdl" ); ModelMDLAPI(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "mdl models", "*.mdl" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "mdl models", "*.mdl" ) ); } ModelLoader* getTable(){ return &m_modelmdl; @@ -153,7 +153,7 @@ public: STRING_CONSTANT( Name, "mdc" ); ModelMDCAPI(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "mdc models", "*.mdc" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "mdc models", "*.mdc" ) ); } ModelLoader* getTable(){ return &m_modelmdc; @@ -205,7 +205,7 @@ public: STRING_CONSTANT( Name, "md5mesh" ); ModelMD5API(){ - GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "md5 meshes", "*.md5mesh" ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, Name, filetype_t( "md5 meshes", "*.md5mesh" ) ); } ModelLoader* getTable(){ return &m_modelmd5; diff --git a/plugins/model/plugin.cpp b/plugins/model/plugin.cpp index d30935b1..ef8d13b2 100644 --- a/plugins/model/plugin.cpp +++ b/plugins/model/plugin.cpp @@ -124,7 +124,7 @@ public: m_modelLoader( module ){ StringOutputStream filter( 128 ); filter << "*." << extension; - GlobalFiletypesModule::getTable().addType( Type::Name(), extension, filetype_t( module->displayName, filter.c_str() ) ); + GlobalFiletypesModule::getTable().addType( Type::Name, extension, filetype_t( module->displayName, filter.c_str() ) ); } ModelLoader* getTable(){ return &m_modelLoader; diff --git a/radiant/entity.cpp b/radiant/entity.cpp index 8dd689bb..8e315f2d 100644 --- a/radiant/entity.cpp +++ b/radiant/entity.cpp @@ -604,7 +604,7 @@ const char* misc_model_dialog( GtkWidget* parent, const char* filepath ){ } } - const char *filename = file_dialog( parent, true, "Choose Model", buffer.c_str(), ModelLoader::Name() ); + const char *filename = file_dialog( parent, true, "Choose Model", buffer.c_str(), ModelLoader::Name ); if ( filename != 0 ) { // use VFS to get the correct relative path const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) ); diff --git a/radiant/map.cpp b/radiant/map.cpp index 27732782..7c762e12 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -352,7 +352,7 @@ bool Map_Unnamed( const Map& map ){ } inline const MapFormat& MapFormat_forFile( const char* filename ){ - const char* moduleName = findModuleName( GetFileTypeRegistry(), MapFormat::Name(), path_get_extension( filename ) ); + const char* moduleName = findModuleName( GetFileTypeRegistry(), MapFormat::Name, path_get_extension( filename ) ); MapFormat* format = Radiant_getMapModules().findModule( moduleName ); ASSERT_MESSAGE( format != 0, "map format not found for file " << makeQuoted( filename ) ); return *format; @@ -1974,17 +1974,17 @@ const char* getMapsPath(){ const char* map_open( const char* title ){ const char* path = Map_Unnamed( g_map )? getMapsPath() : g_map.m_name.c_str(); - return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), true, title, path, MapFormat::Name(), true, false, false ); + return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), true, title, path, MapFormat::Name, true, false, false ); } const char* map_import( const char* title ){ const char* path = Map_Unnamed( g_map )? getMapsPath() : g_map.m_name.c_str(); - return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), true, title, path, MapFormat::Name(), false, true, false ); + return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), true, title, path, MapFormat::Name, false, true, false ); } const char* map_save( const char* title ){ const char* path = Map_Unnamed( g_map )? getMapsPath() : g_map.m_name.c_str(); - return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), false, title, path, MapFormat::Name(), false, false, true ); + return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), false, title, path, MapFormat::Name, false, false, true ); } void OpenMap(){ diff --git a/radiant/modelwindow.cpp b/radiant/modelwindow.cpp index f7b797b1..3b1689ed 100644 --- a/radiant/modelwindow.cpp +++ b/radiant/modelwindow.cpp @@ -1231,7 +1231,7 @@ void ModelBrowser_constructTree(){ m_modelExtensions.emplace( moduleName ); } } typelist; - GlobalFiletypes().getTypeList( ModelLoader::Name(), &typelist, true, false, false ); + GlobalFiletypes().getTypeList( ModelLoader::Name, &typelist, true, false, false ); ModelFolders modelFolders( g_ModelBrowser.m_prefFoldersToLoad.c_str() ); diff --git a/radiant/referencecache.cpp b/radiant/referencecache.cpp index 18494100..72338039 100644 --- a/radiant/referencecache.cpp +++ b/radiant/referencecache.cpp @@ -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() ) ) { diff --git a/radiant/undo.cpp b/radiant/undo.cpp index dd8005bf..4ccfc713 100644 --- a/radiant/undo.cpp +++ b/radiant/undo.cpp @@ -254,8 +254,8 @@ public: m_undoables.erase( undoable ); } void setLevels( std::size_t levels ){ - if ( levels > static_cast( MAX_UNDO_LEVELS() ) ) { - levels = MAX_UNDO_LEVELS(); + if ( levels > static_cast( MAX_UNDO_LEVELS ) ) { + levels = MAX_UNDO_LEVELS; } while ( m_undo_stack.size() > levels )