Mercurial > hg > batmud > maputils
changeset 2220:312b4ca781aa
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 24 Oct 2019 07:19:18 +0300 |
parents | 6ad44b2630d8 |
children | eecef8a1e851 |
files | old/mapref.pl |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/old/mapref.pl Mon Oct 21 03:44:06 2019 +0300 +++ b/old/mapref.pl Thu Oct 24 07:19:18 2019 +0300 @@ -49,12 +49,14 @@ open(INFILE, "<", $filename) or die("Could not open loc-file '$filename'.\n"); while (defined(my $line = <INFILE>)) { - chomp($line); - if ($line =~ /^(#|\s*$)/) + $line =~ s/\s+$//; + $line =~ s/^\s+//; + + if ($line =~ /^(#|$)/) { # Ignore empty lines and comments } - elsif ($line =~ /^\s*(\d+)\s*;\s*(\d+)\s*;\s*(\d\S*)\s*;\s*([^;]+);(.*)/) + elsif ($line =~ /^(\d+)\s*;\s*(\d+)\s*;\s*(\d\S*)\s*;\s*([^;]+);(.*)/) { my ($flags, $namestr, $rest) = ($3,$4,$5); my @names = split(/\s*\|\s*/, $namestr); @@ -82,12 +84,14 @@ while (defined(my $line = <INFILE>)) { $nline++; - chomp($line); + $line =~ s/\s+$//; + $line =~ s/^\s+//; + if ($line =~ /^(#|\s*$)/) { - print "$line\n"; + print $line."\n"; } - elsif ($line =~ /^\s*(\d+)\s*;\s*(\d+)\s*;\s*(\d\S*)\s*;([^;]+);(.*)/) + elsif ($line =~ /^(\d+)\s*;\s*(\d+)\s*;\s*(\d\S*)\s*;([^;]+);(.*)/) { my ($xc, $yc, $flags, $namestr, $rest) = ($1,$2,$3,$4,$5); if (substr($namestr, 0, 1) eq "\@")