From: Rudolf Polzer Date: Sun, 4 Jul 2010 17:17:15 +0000 (+0200) Subject: fix arg parsing X-Git-Tag: xonotic-v0.5.0~252 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e778c332b0412e273081c2aeb43be5b07ff8e01f;p=xonotic%2Fnetradiant.git fix arg parsing --- diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index 74530f77..97c2759d 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -1,4 +1,4 @@ -/* ------------------------------------------------------------------------------- +/* -------------------------------------------------------------------------------; Copyright (C) 1999-2007 id Software, Inc. and contributors. For a list of contributors, see the accompanying CONTRIBUTORS file. @@ -1199,15 +1199,8 @@ int ScaleBSPMain( int argc, char **argv ) return 0; } - /* get scale */ - scale[2] = scale[1] = scale[0] = atof( argv[ argc - 2 ] ); - if(argc >= 4) - scale[1] = scale[0] = atof( argv[ argc - 3 ] ); - if(argc >= 5) - scale[0] = atof( argv[ argc - 4 ] ); - texscale = false; - for(i = 1; i < argc-1; ++i) + for(i = 1; i < argc-2; ++i) { if(!strcmp(argv[i], "-tex")) { @@ -1218,8 +1211,18 @@ int ScaleBSPMain( int argc, char **argv ) spawn_ref = atof(argv[i+1]); ++i; } + else + break; } + /* get scale */ + // if(argc-2 >= i) // always true + scale[2] = scale[1] = scale[0] = atof( argv[ argc - 2 ] ); + if(argc-3 >= i) + scale[1] = scale[0] = atof( argv[ argc - 3 ] ); + if(argc-4 >= i) + scale[0] = atof( argv[ argc - 4 ] ); + uniform = ((scale[0] == scale[1]) && (scale[1] == scale[2])); if( scale[0] == 0.0f || scale[1] == 0.0f || scale[2] == 0.0f )