diff --git a/tools/quake3/common/stringfixedsize.h b/tools/quake3/common/stringfixedsize.h index 7caf4bc8..22a885d9 100644 --- a/tools/quake3/common/stringfixedsize.h +++ b/tools/quake3/common/stringfixedsize.h @@ -37,8 +37,11 @@ public: StringFixedSize() { clear(); } - explicit StringFixedSize( const char* string ){ - operator()( string ); + template>>>>> + explicit StringFixedSize( Args&& ... args ){ + operator()( std::forward( args ) ... ); } std::size_t write( const char* buffer, std::size_t length ) override { if( m_length + length < SIZE ){ @@ -53,15 +56,14 @@ public: return length; } - StringFixedSize& operator=( const char* string ){ - return operator()( string ); + void operator=( const char* string ){ + operator()( string ); } template - StringFixedSize& operator()( Args&& ... args ){ + void operator()( Args&& ... args ){ clear(); ( *this << ... << std::forward( args ) ); - return *this; } operator const char*() const { diff --git a/tools/quake3/q3map2/bsp.cpp b/tools/quake3/q3map2/bsp.cpp index 284ea3e0..a1ef1ec8 100644 --- a/tools/quake3/q3map2/bsp.cpp +++ b/tools/quake3/q3map2/bsp.cpp @@ -104,7 +104,7 @@ static void ProcessAdvertisements() { bspAdvertisement_t& ad = bspAds.emplace_back(); ad.cellId = e.intForKey( "cellId" ); // copy and clear the rest of memory // check for overflow by String64 - const auto modelKey = String64()( e.valueForKey( "model" ) ); + const String64 modelKey( e.valueForKey( "model" ) ); strncpy( ad.model, modelKey, sizeof( ad.model ) ); const bspModel_t& adModel = bspModels[atoi( modelKey.c_str() + 1 )]; @@ -396,8 +396,7 @@ static void ProcessWorldModel( entity_t& e ){ /* ydnar: fog hull */ if ( e.read_keyvalue( value, "_foghull" ) ) { - const auto shader = String64()( "textures/", value ); - MakeFogHullSurfs( shader ); + MakeFogHullSurfs( String64( "textures/", value ) ); } /* ydnar: bug 645: do flares for lights */ diff --git a/tools/quake3/q3map2/bspfile_abstract.cpp b/tools/quake3/q3map2/bspfile_abstract.cpp index c82d56b6..b2c1beb7 100644 --- a/tools/quake3/q3map2/bspfile_abstract.cpp +++ b/tools/quake3/q3map2/bspfile_abstract.cpp @@ -100,7 +100,7 @@ static void SwapBSPFile(){ const shaderInfo_t *si = ShaderInfoForShader( shader.shader ); if ( !strEmptyOrNull( si->remapShader ) ) { // copy and clear the rest of memory // check for overflow by String64 - const auto remap = String64()( si->remapShader ); + const String64 remap( si->remapShader ); strncpy( shader.shader, remap, sizeof( shader.shader ) ); } } diff --git a/tools/quake3/q3map2/map.cpp b/tools/quake3/q3map2/map.cpp index 05af398e..485b0dd6 100644 --- a/tools/quake3/q3map2/map.cpp +++ b/tools/quake3/q3map2/map.cpp @@ -1002,7 +1002,7 @@ static void ParseRawBrush( bool onlyLights ){ /* read shader name */ GetToken( false ); - const auto shader = String64()( "textures/", token ); + const String64 shader( "textures/", token ); /* set default flags and values */ shaderInfo_t *si = onlyLights? &shaderInfo[ 0 ] @@ -1440,7 +1440,7 @@ static void LoadEntityIndexMap( entity_t& e ){ if ( space == NULL ) { space = offset + strlen( offset ); } - im->offsets[ i ] = atof( String64()( StringRange( offset, space ) ) ); + im->offsets[ i ] = atof( String64( StringRange( offset, space ) ) ); if ( space == NULL ) { break; } @@ -1576,7 +1576,7 @@ static bool ParseMapEntity( bool onlyLights, bool noCollapseGroups, int mapEntit const char *value; if( mapEnt.read_keyvalue( value, "_celshader" ) || entities[ 0 ].read_keyvalue( value, "_celshader" ) ){ - celShader = ShaderInfoForShader( String64()( "textures/", value ) ); + celShader = ShaderInfoForShader( String64( "textures/", value ) ); Sys_Printf( "Entity %d (%s) has cel shader %s\n", mapEnt.mapEntityNum, classname, celShader->shader.c_str() ); } else{ diff --git a/tools/quake3/q3map2/model.cpp b/tools/quake3/q3map2/model.cpp index 10b933df..a01292eb 100644 --- a/tools/quake3/q3map2/model.cpp +++ b/tools/quake3/q3map2/model.cpp @@ -1127,14 +1127,7 @@ void InsertModel( const char *name, const char *skin, int frame, const Matrix4& /* shader renaming for sof2 */ if ( renameModelShaders ) { - auto shaderName = String64()( PathExtensionless( picoShaderName ) ); - if ( spawnFlags & eRMG_BSP ) { - shaderName << "_RMG_BSP"; - } - else{ - shaderName << "_BSP"; - } - si = ShaderInfoForShader( shaderName ); + si = ShaderInfoForShader( String64( PathExtensionless( picoShaderName ), ( spawnFlags & eRMG_BSP )? "_RMG_BSP" : "_BSP" ) ); } else{ si = ShaderInfoForShader( picoShaderName ); @@ -1382,7 +1375,7 @@ void AddTriangleModels( entity_t& eparent ){ shaderInfo_t *celShader; if( const char *value; e.read_keyvalue( value, "_celshader" ) || entities[ 0 ].read_keyvalue( value, "_celshader" ) ){ - celShader = ShaderInfoForShader( String64()( "textures/", value ) ); + celShader = ShaderInfoForShader( String64( "textures/", value ) ); } else{ celShader = globalCelShader.empty() ? NULL : ShaderInfoForShader( globalCelShader ); diff --git a/tools/quake3/q3map2/patch.cpp b/tools/quake3/q3map2/patch.cpp index 36ac36e1..68490baa 100644 --- a/tools/quake3/q3map2/patch.cpp +++ b/tools/quake3/q3map2/patch.cpp @@ -206,7 +206,7 @@ void ParsePatch( bool onlyLights, entity_t& mapEnt, int mapPrimitiveNum ){ /* get shader name */ GetToken( true ); - const auto shader = String64()( "textures/", token ); + const String64 shader( "textures/", token ); Parse1DMatrix( 5, info ); m.width = info[0]; diff --git a/tools/quake3/q3map2/shaders.cpp b/tools/quake3/q3map2/shaders.cpp index ae342483..29560fad 100644 --- a/tools/quake3/q3map2/shaders.cpp +++ b/tools/quake3/q3map2/shaders.cpp @@ -759,7 +759,7 @@ shaderInfo_t *ShaderInfoForShader( const char *shaderName ){ } /* strip off extension */ - auto shader = String64()( PathExtensionless( shaderName ) ); + String64 shader( PathExtensionless( shaderName ) ); /* search for it */ deprecationDepth = 0; diff --git a/tools/quake3/q3map2/surface.cpp b/tools/quake3/q3map2/surface.cpp index 9bd410f5..977eb824 100644 --- a/tools/quake3/q3map2/surface.cpp +++ b/tools/quake3/q3map2/surface.cpp @@ -667,8 +667,8 @@ static shaderInfo_t *GetIndexedShader( const shaderInfo_t *parent, const indexMa /* get the shader */ shaderInfo_t *si = ShaderInfoForShader( ( minShaderIndex == maxShaderIndex )? - String64()( "textures/", im->shader.c_str(), '_', int(maxShaderIndex) ): - String64()( "textures/", im->shader.c_str(), '_', int(minShaderIndex), "to", int(maxShaderIndex) ) ); + String64( "textures/", im->shader, '_', int(maxShaderIndex) ): + String64( "textures/", im->shader, '_', int(minShaderIndex), "to", int(maxShaderIndex) ) ); /* inherit a few things from parent shader */ if ( parent->globalTexture ) { @@ -759,10 +759,10 @@ mapDrawSurface_t *DrawSurfaceForSide( const entity_t& e, const brush_t& b, const } /* ydnar: sky hack/fix for GL_CLAMP borders on ati cards */ - if ( skyFixHack && !strEmpty( si->skyParmsImageBase ) ) { + if ( skyFixHack && !si->skyParmsImageBase.empty() ) { //% Sys_FPrintf( SYS_VRB, "Enabling sky hack for shader %s using env %s\n", si->shader, si->skyParmsImageBase ); for( const auto suffix : { "_lf", "_rt", "_ft", "_bk", "_up", "_dn" } ) - DrawSurfaceForShader( String64()( si->skyParmsImageBase, suffix ) ); + DrawSurfaceForShader( String64( si->skyParmsImageBase, suffix ) ); } /* ydnar: gs mods */