From: Zack Middleton Date: Tue, 23 Jul 2019 04:50:17 +0000 (-0500) Subject: q3map2: fix not displaying default args for some q3map2 stages X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=83bf40560747af61bb506d3631e0acbbf00fb34a;p=xonotic%2Fnetradiant.git q3map2: fix not displaying default args for some q3map2 stages Fix not displaying default arguments, and possibly segfaulting, when running q3map2 -bsp, -analyze, -convert, -exportents, -export, or -import. --- diff --git a/tools/quake3/q3map2/bsp.c b/tools/quake3/q3map2/bsp.c index 3ab6a2df..f926a8dd 100644 --- a/tools/quake3/q3map2/bsp.c +++ b/tools/quake3/q3map2/bsp.c @@ -709,6 +709,11 @@ int BSPMain( int argc, char **argv ){ portalFilePath[0] = 0; surfaceFilePath[0] = 0; + if ( argc >= 2 && !strcmp( argv[ 1 ], "-bsp" ) ) { + Sys_Printf( "-bsp argument unnecessary\n" ); + argv++; + argc--; + } /* note it */ Sys_Printf( "--- BSP ---\n" ); @@ -1010,9 +1015,6 @@ int BSPMain( int argc, char **argv ){ i++; Sys_Printf( "Use %s as surface file\n", surfaceFilePath ); } - else if ( !strcmp( argv[ i ], "-bsp" ) ) { - Sys_Printf( "-bsp argument unnecessary\n" ); - } else{ Sys_FPrintf( SYS_WRN, "WARNING: Unknown option \"%s\"\n", argv[ i ] ); } diff --git a/tools/quake3/q3map2/bsp_analyze.c b/tools/quake3/q3map2/bsp_analyze.c index e84439d3..08575f32 100644 --- a/tools/quake3/q3map2/bsp_analyze.c +++ b/tools/quake3/q3map2/bsp_analyze.c @@ -83,7 +83,7 @@ int AnalyzeBSPMain( int argc, char **argv ){ /* arg checking */ - if ( argc < 1 ) { + if ( argc < 2 ) { Sys_Printf( "Usage: q3map -analyze [-lumpswap] [-v] \n" ); return 0; } diff --git a/tools/quake3/q3map2/convert_bsp.c b/tools/quake3/q3map2/convert_bsp.c index 9db32609..87579d26 100644 --- a/tools/quake3/q3map2/convert_bsp.c +++ b/tools/quake3/q3map2/convert_bsp.c @@ -151,7 +151,7 @@ int ConvertBSPMain( int argc, char **argv ){ force_map = qfalse; /* arg checking */ - if ( argc < 1 ) { + if ( argc < 2 ) { Sys_Printf( "Usage: q3map -convert [-format ] [-shadersasbitmap|-lightmapsastexcoord|-deluxemapsastexcoord] [-readbsp|-readmap [-meta|-patchmeta]] [-v] \n" ); return 0; } diff --git a/tools/quake3/q3map2/exportents.c b/tools/quake3/q3map2/exportents.c index b1236608..50eed897 100644 --- a/tools/quake3/q3map2/exportents.c +++ b/tools/quake3/q3map2/exportents.c @@ -90,7 +90,7 @@ void ExportEntities( void ){ int ExportEntitiesMain( int argc, char **argv ){ /* arg checking */ - if ( argc < 1 ) { + if ( argc < 2 ) { Sys_Printf( "Usage: q3map -exportents [-v] \n" ); return 0; } @@ -109,4 +109,4 @@ int ExportEntitiesMain( int argc, char **argv ){ /* return to sender */ return 0; -} \ No newline at end of file +} diff --git a/tools/quake3/q3map2/lightmaps_ydnar.c b/tools/quake3/q3map2/lightmaps_ydnar.c index 1b28ca06..fc8dcced 100644 --- a/tools/quake3/q3map2/lightmaps_ydnar.c +++ b/tools/quake3/q3map2/lightmaps_ydnar.c @@ -153,7 +153,7 @@ void ExportLightmaps( void ){ int ExportLightmapsMain( int argc, char **argv ){ /* arg checking */ - if ( argc < 1 ) { + if ( argc < 2 ) { Sys_Printf( "Usage: q3map -export [-v] \n" ); return 0; } @@ -188,7 +188,7 @@ int ImportLightmapsMain( int argc, char **argv ){ /* arg checking */ - if ( argc < 1 ) { + if ( argc < 2 ) { Sys_Printf( "Usage: q3map -import [-v] \n" ); return 0; }