]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/xonotic-map-compiler
map compiler: allow an option --no-fast that removes a -fast option (possibly includi...
[xonotic/xonotic.git] / misc / tools / xonotic-map-compiler
index 4f8c83871edcfbb6ee6eab9ca84d9384afcc289c..12be54ad7d0848cfcba200316255aa50073c0dd7 100755 (executable)
@@ -134,6 +134,16 @@ while(@ARGV)
        {
                $options->{order} = [split /\s*,\s*/, shift @ARGV];
        }
+       elsif($_ =~ /^--no(-.*)/)
+       {
+               if($curmode eq 'maps')
+               {
+                       $curmode = 'bsp';
+               }
+               my $flag = $1;
+               @{$options->{$curmode}} = grep { (($_ eq $flag) ... /^-/) !~ /^[0-9]+$/ } @{$options->{$curmode}};
+                       # so, e.g. --no-samplesize removes "-samplesize" and a following "3"
+       }
        elsif($_ =~ /^-(-.*)/)
        {
                if($curmode eq 'maps')
@@ -183,7 +193,7 @@ sub q3map2(@)
                or die "fork: $!";
        if($pid) # parent
        {
-               local $SIG{ALRM} = sub { kill $pid; };
+               local $SIG{ALRM} = sub { warn "SIGALRM caught\n"; kill TERM => $pid; };
                alarm $timeout
                        if $timeout;
                if(waitpid($pid, 0) != $pid)
@@ -191,7 +201,7 @@ sub q3map2(@)
                        die "waitpid: did not return our child process $pid: $!";
                }
                alarm 0;
-               return $? == 0;
+               return ($? == 0);
        }
        else # child
        {