sc: rename data files to append game release abbreviation
[sheet.git] / sc.plp
diff --git a/sc.plp b/sc.plp
index 4706bbfb15f51df2d63a929de5d382a9fc5ee99b..55dbd0941304f8a9f64b8069057df87596288059 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -1,9 +1,10 @@
 <(common.inc.plp)><:
 
-my $datafile = 'sc-units.inc.pl';
+my $scver = 'bw';
 if ($ENV{PATH_INFO} and $ENV{PATH_INFO} eq '/2') {
-       $datafile = 'sc2-units.inc.pl';
+       my $scver = 'hots';
 }
+my $datafile = "sc-units-$scver.inc.pl";
 
 Html({
        title => 'starcraft unit cheat sheet',
@@ -232,17 +233,15 @@ sub showval {
 
                print(
                        '<tr>',
-                       sprintf('<t%s class="cat">%s',
-                               $cat ne $_->{cat} ? ('h', $cat = $_->{cat}) : ('d', '&nbsp;')
-                       ),
-                       '<td>' . $_->{name},
+                       '<th class="cat">', $cat ne $_->{cat} && ($cat = $_->{cat}),
+                       '<td>', $_->{name},
                        showunitcols($_),
                );
 
                for my $subrow (@{ $_->{special} }) {
                        $subrow->{alt} or next;
                        print(
-                               '<tr class="alt"><td class="cat"><td>' . $subrow->{alt},
+                               '<tr class="alt"><td class="cat"><td>', $subrow->{alt},
                                showunitcols($subrow),
                        );
                }