X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fimage.cpp;h=c81b3617ab7fe5527d9c8c45ac2fc6c83623db2b;hb=b8f0b2351d49fedbcc3a67dab5f9852a246b0b3d;hp=71f365a7662b00fcd165c10c97a14e2b146bbfc6;hpb=9dfae1c9b270ee369c6362903a9205b30751b95f;p=xonotic%2Fnetradiant.git diff --git a/radiant/image.cpp b/radiant/image.cpp index 71f365a7..c81b3617 100644 --- a/radiant/image.cpp +++ b/radiant/image.cpp @@ -32,37 +32,33 @@ typedef Modules<_QERPlugImageTable> ImageModules; - -ImageModules &Textures_getImageModules(); +ImageModules& Textures_getImageModules(); /// \brief Returns a new image for the first file matching \p name in one of the available texture formats, or 0 if no file is found. -Image *QERApp_LoadImage(void *environment, const char *name) -{ - Image *image = 0; - class LoadImageVisitor : public ImageModules::Visitor { - const char *m_name; - Image *&m_image; - public: - LoadImageVisitor(const char *name, Image *&image) - : m_name(name), m_image(image) - { - } - - void visit(const char *name, const _QERPlugImageTable &table) const - { - if (m_image == 0) { - StringOutputStream fullname(256); - fullname << m_name << '.' << name; - ArchiveFile *file = GlobalFileSystem().openFile(fullname.c_str()); - if (file != 0) { - m_image = table.loadImage(*file); - file->release(); - } - } - } - }; +Image* QERApp_LoadImage( void* environment, const char* name ){ + Image* image = 0; + class LoadImageVisitor : public ImageModules::Visitor + { + const char* m_name; + Image*& m_image; +public: + LoadImageVisitor( const char* name, Image*& image ) + : m_name( name ), m_image( image ){ + } + void visit( const char* name, const _QERPlugImageTable& table ) const { + if ( m_image == 0 ) { + StringOutputStream fullname( 256 ); + fullname << m_name << '.' << name; + ArchiveFile* file = GlobalFileSystem().openFile( fullname.c_str() ); + if ( file != 0 ) { + m_image = table.loadImage( *file ); + file->release(); + } + } + } + }; - Textures_getImageModules().foreachModule(LoadImageVisitor(name, image)); + Textures_getImageModules().foreachModule( LoadImageVisitor( name, image ) ); - return image; + return image; }