From 2afdd9021a2ee5277d5307e163dd7a5f0605d04c Mon Sep 17 00:00:00 2001 From: Shiar Date: Mon, 11 Feb 2008 21:15:15 +0100 Subject: [PATCH] graphplay: draw unit limit Fill area between current unit count and unit cap (same color as units line, but transparant). --- graphplay | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/graphplay b/graphplay index bbbbc28..33279b8 100755 --- a/graphplay +++ b/graphplay @@ -61,7 +61,7 @@ for my $input (@ARGV) { } } - for (0 .. 2) { + for (0 .. 3) { my $line = $lines[$_][$player]; my $start; my $lasty; @@ -80,6 +80,7 @@ for my $input (@ARGV) { $player++; } +$max[2] = $max[3]; my @norm = ((map {$area{fieldysize} / $_} @max), $area{fieldxsize} / $maxtime); my $xsteps = 25; @@ -107,6 +108,12 @@ for ([0 => "min", "Minerals"], [1 => "gas", "Gas"], [2 => "unit", "Units"]) { open my $output, '>', "$filename.svg"; $svg->process('timeline', { title => "$title timeline for /replay/20080201md4x4", + fill => $line == 2 && [ + map { "\n\tM " . join "\tL ", map sprintf("%s %s\n", + $area{fieldxmin} + $_->[0] * $norm[4], + $area{fieldymax} - $_->[1] * $norm[$line+1] + ), grep defined, @{$lines[$line][$_]}, reverse @{$lines[$line+1][$_]} } 0 .. $#{$lines[$line]} + ], paths => [ map { "\n\tM " . join "\tL ", map sprintf("%s %s\n", $area{fieldxmin} + $_->[0] * $norm[4], @@ -151,5 +158,14 @@ __DATA__ [% END %] +[% IF fill %] + +[% count = 0 %] +[% FOREACH path = fill %][% count = count + 1 %] + +[% END %] + +[% END %] + -- 2.30.0