aboutsummaryrefslogtreecommitdiff
path: root/messages.pl
diff options
context:
space:
mode:
Diffstat (limited to 'messages.pl')
-rw-r--r--messages.pl11
1 files changed, 9 insertions, 2 deletions
diff --git a/messages.pl b/messages.pl
index d225d17..fe94a35 100644
--- a/messages.pl
+++ b/messages.pl
@@ -8,7 +8,13 @@
open my $t, "<textdecomp.s" or die $!;
while(<$t>) {
next unless /^dict(\d\d):.*;\s*"([^"]*)"/;
- my $value = 'Z' . chr($1 + 96);
+ my $id = $1;
+ if($id < 27) {
+ $id = chr($id + 96);
+ } else {
+ $id = chr($id - 27 + 65);
+ }
+ my $value = 'Z' . $id;
my $key = quotemeta $2;
$dictionary{$key} = $value;
}
@@ -37,12 +43,13 @@ while(<DATA>) {
$total_in += (1 + length);
my $dict_used = 0;
- for my $dk (keys %dictionary) {
+ for my $dk (sort { length $b <=> length $a } keys %dictionary) {
if(s/$dk/$dictionary{$dk}/g) {
$dict_used = 1;
}
}
+ #warn "'$_'\n" if $label eq 'do_you_want';
open my $out, ">msg.out" or die $!;
print $out $_;
close $out;