[SimBot-commits] CVS: simbot/plugins weather.pl,1.115,1.116
Status: Abandoned
Brought to you by:
kstange
|
From: Pete P. <fou...@us...> - 2007-04-05 02:45:41
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16934/plugins Modified Files: weather.pl Log Message: Remember that bug I fixed last time? This time for sure! (-RAPL should parse properly) Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.115 retrieving revision 1.116 diff -u -d -p -r1.115 -r1.116 --- weather.pl 17 Mar 2007 02:09:03 -0000 1.115 +++ weather.pl 5 Apr 2007 02:45:33 -0000 1.116 @@ -1028,15 +1028,18 @@ sub parse_metar { } elsif($cur_block =~ m{^ # WX COND (-|\+|VC)? # Intensity - (MI|PR|BC|DR|BL|SH|TS|FR)? # Descriptor - (DZ|RA|SN|SG|IC|PL|GR|GS|UP)* # Precipitation - (BR|FG|FU|VA|DU|SA|HZ|PY)? # Obscuration - (PO|SQ|FC|SS)? # Other - $}x) { - my ($intensity, $descriptor, $precip, $obscuration, $other) - = ($1,$2,$3,$4,$5); - my @cond; + ((?:MI|PR|BC|DR|BL|SH|TS|FR)? # Descriptor + (?:DZ|RA|SN|SG|IC|PL|GR|GS|UP)* # Precipitation + (?:BR|FG|FU|VA|DU|SA|HZ|PY)? # Obscuration + (?:PO|SQ|FC|SS)? # Other + )$}x) { + my $intensity = $1; + my $other_blocks = $2; + #my ($intensity, $descriptor, $precip, $obscuration, $other) + # = ($1,$2,$3,$4,$5); + my @cond; + my $shower = 0; if(defined $intensity) { if($intensity =~ m/^-$/) { push(@cond, 'light'); @@ -1045,23 +1048,33 @@ sub parse_metar { } } - if(defined $descriptor && $descriptor !~ m/^SH$/) { - push(@cond, $cond_names{$descriptor}); - } + while($other_blocks =~ m/([A-Z]{2})/g) { + if($1 eq 'SH') { + $shower = 1; + } else { + push(@cond, $cond_names{$1}); + } + } + + if($shower) { push(@cond, $cond_names{'SH'}); } + + #if(defined $descriptor && $descriptor !~ m/^SH$/) { + # push(@cond, $cond_names{$descriptor}); + #} - if(defined $precip) { - push(@cond, $cond_names{$precip}); - } - if(defined $obscuration) { - push(@cond, $cond_names{$obscuration}); - } - if(defined $other) { - push(@cond, $cond_names{$other}); - } + #if(defined $precip) { + # push(@cond, $cond_names{$precip}); + #} + #if(defined $obscuration) { + # push(@cond, $cond_names{$obscuration}); + #} + #if(defined $other) { + # push(@cond, $cond_names{$other}); + #} - if(defined $descriptor && $descriptor =~ m/^SH$/) { - push(@cond, $cond_names{'SH'}); - } + #if(defined $descriptor && $descriptor =~ m/^SH$/) { + # push(@cond, $cond_names{'SH'}); + #} push(@sky_conds, join(' ', @cond)); |