From 15d94c254b3f539cae6e9074e3a34a0ecababfa9 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sat, 7 Aug 2010 15:39:43 +0200 Subject: [PATCH] Empty fleets aren't like normal fleets.. --- lib/NDWeb/Controller/Members.pm | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/NDWeb/Controller/Members.pm b/lib/NDWeb/Controller/Members.pm index 8c7f6cb..f3fdedb 100644 --- a/lib/NDWeb/Controller/Members.pm +++ b/lib/NDWeb/Controller/Members.pm @@ -561,30 +561,38 @@ sub parseconfirmations { (?.+?) \QTotal Ships in Fleet\E \s?\t (\d+) \s?\t (?\d+) \s?\t (?\d+) \s?\t (?\d+) \W+ Mission: \t (?\w*) \t (?\w*) \t (?\w*) \W+ - Target: \t (?\d+:\d+:\d+)? \t (?\d+:\d+:\d+)? \t (?\d+:\d+:\d+)? \W+ - \QLaunch Tick:\E \t (?\d*) \t (?\d*) \t (?\d*) \W+ - ETA: \t (?[^\t]*) \t (?[^\t]*) \t (?[^\t]*) + Target: \t (?((\d+:\d+:\d+)?\t)*) \W+ + \QLaunch Tick:\E \t (?(\d*\t)*) \W+ + ETA: \t? (?([^\t]+\t?)*) /sx){ my %match = %-; + my @etas = split /\t/, $+{etas}; + my @targets = split /\t/, $+{targets}; + my @lts = split /\t/, $+{lts}; for my $i (0..2){ my %mission = ( name => $match{name}->[$i], mission => $match{mission}->[$i], - target => $match{target}->[$i], amount => $match{amount}->[$i], - lt => $match{lt}->[$i], num => $i, ships => [] ); - given($match{eta}->[$i]){ - when(/(\d+) (\s+ \(\+\d+\))? \W+ + if ($mission{amount} == 0){ + push @missions,\%mission; + next; + } + + $mission{target} = shift @targets; + $mission{lt} = shift @lts; + given(shift @etas){ + when(/^(\d+) (\s+ \(\+\d+\))? \W+ Arrival:\ (\d+) \W+ \QReturn ETA: \E(Instant|\d+)/sx){ $mission{tick} = $3; $mission{eta} = $1 + $4; $mission{back} = $3 + $mission{eta} - 1; } - when(/(\d+) \W+ + when(/^(\d+) \W+ Arrival:\ (\d+)/sx){ $mission{tick} = $2; $mission{eta} = $1; -- 2.39.2