catch scenario objectives, fix bug in multiline handling

This commit is contained in:
Yann Dirson 2004-08-08 00:16:18 +00:00
parent 55bb09bb4c
commit 694eafb701

View File

@ -58,11 +58,11 @@ foreach my $wmlfile (@wmlfiles) {
our %suffix = ( our %suffix = (
'difficulty_descriptions' => '_difficulties', 'difficulty_descriptions' => '_difficulties',
'cannot_use_message' => '_cannot_use_message', 'cannot_use_message' => '_cannot_use_message',
'objectives' => '_objectives',
); );
# get ids from other wml files # get ids from other wml files
#our @wmlfiles = glob ("data/*.cfg data/scenarios/*/*.cfg"); @wmlfiles = glob ("data/*.cfg data/scenarios/*/*.cfg");
@wmlfiles = glob ("data/*.cfg");
foreach my $wmlfile (@wmlfiles) { foreach my $wmlfile (@wmlfiles) {
open (WML, $wmlfile) or die "cannot open $wmlfile"; open (WML, $wmlfile) or die "cannot open $wmlfile";
print STDERR " Processing $wmlfile\n"; print STDERR " Processing $wmlfile\n";
@ -74,7 +74,7 @@ foreach my $wmlfile (@wmlfiles) {
print STDERR "--> $id\n"; print STDERR "--> $id\n";
# } elsif (m,\[/.*\],) { # } elsif (m,\[/.*\],) {
# $id = undef; # $id = undef;
} elsif (m/(difficulty\_descriptions|cannot\_use\_message)\s*=\s*(?:_\s*)?\"(.*)\"\s*$/) { } elsif (m/(difficulty\_descriptions|cannot\_use\_message|objectives)\s*=\s*(?:_\s*)?\"(.*)\"\s*$/) {
# single-line # single-line
die "nested key" if defined $key; die "nested key" if defined $key;
@ -83,12 +83,12 @@ foreach my $wmlfile (@wmlfiles) {
} else { } else {
print STDERR "No id for $1 $2\n"; print STDERR "No id for $1 $2\n";
} }
} elsif (m/(difficulty\_descriptions|cannot\_use\_message)\s*=\s*(?:_\s*)?\"(.*)\s*$/) { } elsif (m/(difficulty\_descriptions|cannot\_use\_message|objectives)\s*=\s*(?:_\s*)?\"(.*)\s*$/) {
# start of multi-line # start of multi-line
die "nested key" if defined $key; die "nested key" if defined $key;
$strtype=1; $strtype=1;
$key = $1; $key = $id . $suffix{$1};
$value = $2 . "\n"; $value = $2 . "\n";
} elsif (m/(?:title|message|name|story)\s*=\s*(?:_\s*)\"(.*)\"\s*$/) { } elsif (m/(?:title|message|name|story)\s*=\s*(?:_\s*)\"(.*)\"\s*$/) {
# single-line # single-line